summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Exclude blank columns from value of line-number-display-widthscratch/line-numbersEli Zaretskii2017-07-071-3/+1
| | | | | | * src/indent.c (Fline_number_display_width): Don't add 2 to the number of columns we return, to make this consistent with display-line-number-width.
* Fix vertical-motion across the place where line-number width changesEli Zaretskii2017-07-071-22/+62
| | | | | | | | | | | | | | | | | | * src/indent.c (line_number_display_width): New function, refactored from line-number width calculations in vertical-motion. (Fvertical_motion): Call line_number_display_width when the width of line-number display is needed. (Fline_number_display_width): New defun. (syms_of_indent): Defsubr it. * doc/lispref/display.texi (Size of Displayed Text): Document line-number-display-width. * etc/NEWS: Mention line-number-display-width. * lisp/simple.el (last--line-number-width): New internal variable. (line-move-visual): Use it to adjust temporary-goal-column when line-number display changes its width.
* Implement line numbers that disregard narrowingEli Zaretskii2017-07-061-11/+38
| | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (display_count_lines_logically): New function, counts line numbers disregarding narrowing. Suggested by Andy Moreton <andrewjmoreton@gmail.com>. (maybe_produce_line_number): Call display_count_lines_logically instead of display_count_lines. Adapt BEGV, ZV, etc. to display-line-numbers-widen. (syms_of_xdisp) <display-line-numbers-widen>: New buffer-local variable. * lisp/cus-start.el (standard): Provide a customization form for display-line-numbers-widen. * lisp/frame.el: Add display-line-numbers-widen, display-line-numbers-current-absolute, and display-line-number-width to the list of variables that should trigger redisplay of the current buffer. * doc/emacs/display.texi (Display Custom): Document display-line-numbers-widen.
* Fix display of current line number in visual modeEli Zaretskii2017-07-041-1/+4
| | | | | | * src/xdisp.c (maybe_produce_line_number): Fix visual-mode display of current line when line-number-current-line face was customized. Reported by Filipe Silva <filipe.silva@gmail.com>.
* Avoid errors in vertical-motion when buffer is narrowedEli Zaretskii2017-07-031-0/+13
| | | | | | | * src/indent.c (Fvertical_motion): If need to start from window-start, and it is outside of the accessible portion, temporarily widen the buffer. This avoids errors in evil-mode. Reported by James Nguyen <james@jojojames.com>.
* Avoid off-by-one errors in column C-n/C-p calculationsEli Zaretskii2017-07-021-1/+18
| | | | | | * src/indent.c (Fvertical_motion): Help C-n/C-p estimate correctly the width used up by line numbers by looking near the window-start point.
* Improve display of tabs with line numbersEli Zaretskii2017-07-011-4/+5
| | | | | * src/xdisp.c (x_produce_glyphs): Improve calculation of next tab stop in hscrolled lines. Prevent aborts in compute_line_metrics.
* Avoid slow redisplay under 'visual' mode of line numbersEli Zaretskii2017-07-011-1/+8
| | | | | | * src/xdisp.c (display_count_lines_visually): Avoid very slow redisplay when this function is invoked very far from point. Reported by Alex <agrambot@gmail.com>.
* Fix relative-number display with non-nil display-line-number-widthEli Zaretskii2017-06-301-19/+16
| | | | | | | | * src/xdisp.c (maybe_produce_line_number): Don't treat a zero value of display-line-number-width as acceptable. Handle the case of 'relative' with display-line-number-width non-nil and smaller than the absolute line number requires. Reported by Alex <agrambot@gmail.com>.
* Add documentation for display-line-numbersEli Zaretskii2017-06-301-1/+6
| | | | | | | | | | | | | | | | | * doc/emacs/custom.texi (Init Rebinding): * doc/emacs/modes.texi (Minor Modes): Remove references to linum-mode. * doc/emacs/display.texi (Display Custom): Describe the line-number display. (Optional Mode Line): Fix the index entry to not conflict with that in "Display Custom". * doc/emacs/basic.texi (Position Info): Add cross-reference to "Display Custom", for line-number display. * src/xdisp.c (syms_of_xdisp): <display-line-numbers>: Mention display-line-numbers-disable in the doc string. * lisp/cus-start.el (standard): Fix lst change.
* Support displaying zero as the number of the current lineEli Zaretskii2017-06-301-5/+21
| | | | | | | | | | | | | * src/xdisp.c (syms_of_xdisp) <display-line-numbers-current-absolute>: New variable. <display-line-numbers>: Doc fix. (maybe_produce_line_number): Support nil value of display-line-numbers-current-absolute. * lisp/cus-start.el (standard): Add customization form for display-line-numbers-current-absolute. * etc/NEWS: Document recently introduced features.
* Speed up the visual-mode relative line numbersEli Zaretskii2017-06-301-25/+36
| | | | | | | | | | | | * src/xdisp.c (display_count_lines_visually): Introduce a shortcut: if a relative line number was already calculated for this iterator object, just increase it instead of the expensive call to move_it_to. Argument list changed to pass a pointer to the iterator object. (maybe_produce_line_number): Adjust for change in signature of display_count_lines_visually. Record the relative line number and the corresponding byte position in the iterator object also in the 'visual' mode.
* Fix hscrolling with line numbers on TTY framesEli Zaretskii2017-06-302-5/+14
| | | | | | | * src/xdisp.c (hscroll_window_tree): Correct the X offset calculations on TTY frames. * src/term.c (produce_glyphs): Use it->lnum_pixel_width instead of a kludge using it->lnum_width.
* Fix TAB display when the line-number face uses a smaller/larger fontEli Zaretskii2017-06-302-6/+8
| | | | | | | | * src/dispextern.h (struct it): New member lnum_pixel_width. * src/xdisp.c (maybe_produce_line_number): Compute the width of the line-number display in pixels. (x_produce_glyphs): Use it->lnum_pixel_width instead of a kludge that used it->lnum_width and made assumptions about pixel width.
* Minor fixesEli Zaretskii2017-06-291-4/+7
| | | | | | * src/xdisp.c (maybe_produce_line_number): Fix bug that caused line numbers to be displayed in empty lines beyond ZV. (x_produce_glyphs): Start fixing TAB display in truncated lines.
* Support default-text-propertiesEli Zaretskii2017-06-271-8/+10
| | | | | * src/xdisp.c (should_produce_line_number): Call get-char-property at ZV as well, to support default-text-properties.
* Initial support for visually-relative line numbersEli Zaretskii2017-06-261-34/+82
| | | | | | | | | | | | | | | | | | Works very slowly. * src/xdisp.c (display_count_lines_visually): New function. (maybe_produce_line_number): Support 'visual' mode of line-number display. * src/xdisp.c (maybe_produce_line_number): Update IT's metrics also when glyph_row is NULL. This is important for move_it_* functions. (syms_of_xdisp) <display-line-number-width>: Now buffer-local. (try_window_id, redisplay_window, try_cursor_movement): For 'visual' line-number display, disable the same redisplay optimizations as for 'relative'. * lisp/cus-start.el (standard): Add new value for the customization form of display-line-numbers.
* Update IT's metrics while simulating displayEli Zaretskii2017-06-261-0/+7
| | | | | | * src/xdisp.c (maybe_produce_line_number): Update IT's metrics also when glyph_row is NULL. This is important for move_it_* functions.
* Minor aesthetic fix of last change.Eli Zaretskii2017-06-251-1/+1
|
* Allow to disable display of line numbers beyond EOBEli Zaretskii2017-06-253-4/+37
| | | | | | | | | * src/buffer.c (disable_line_numbers_overlay_at_eob): New function. * src/lisp.h (disable_line_numbers_overlay_at_eob): Add prototype. * src/xdisp.c (should_produce_line_number): When at ZV, call disable_line_numbers_overlay_at_eob to determine whether line numbers should be displayed beyond ZV.
* Fix line number display for overlay/display strings with newlinesEli Zaretskii2017-06-251-3/+12
| | | | | | * src/xdisp.c (maybe_produce_line_number): Fix the condition for producing space glyphs instead of a line number to include the case of display strings and overlays.
* Move additional hscrolling code into a suitable 'if'Eli Zaretskii2017-06-241-17/+24
| | | | | | * src/xdisp.c (hscroll_window_tree): Make additional calculations regarding glyphs produced for line numbers conditional on line-number display.
* Partial fix of hscroll of truncated lines with line numbersEli Zaretskii2017-06-242-5/+31
| | | | | | | | | | | | * src/xdisp.c (x_produce_glyphs, hscroll_window_tree): Adjust hscroll calculations to line-number display. * src/term.c (produce_glyphs): Adjust tab stop to window's hscroll. These two changes fix horizontal scrolling when line numbers are displayed. But there's still a bug: the horizontal shift of lines that begin with a TAB is different from the rest. * src/xdisp.c (move_it_in_display_line_to): Call should_produce_line_number to determine whether a line number should be produced for this screen line.
* Allow Lisp program to disable line-number display for specific linesEli Zaretskii2017-06-241-19/+33
| | | | | | | | | | * etc/NEWS: Update the documentation. * src/xdisp.c (syms_of_xdisp) <display-line-numbers-disable>: New symbol. (should_produce_line_number): New function. (display_line): Use should_produce_line_number to determine whether a line number should be produced for each glyph row.
* Support a separate face for displaying the current line's numberEli Zaretskii2017-06-241-5/+24
| | | | | | | | | | | | * lisp/faces.el (line-number-current-line): New face. * src/xdisp.c (syms_of_xdisp) <line-number-current-line>: New symbol. (try_window_id, try_cursor_movement): Disable these optimizations when the line-number-current-line face is different from line-number face. (maybe_produce_line_number): Display the current line in the line-number-current-line face, if it's different from line-number.
* Change display of current line in relative modeEli Zaretskii2017-06-241-8/+8
| | | | | * src/xdisp.c (maybe_produce_line_number): In relative mode display the current line number as its absolute value, not as zero.
* Rename display-line-widthEli Zaretskii2017-06-241-4/+4
| | | | | | | * etc/NEWS: * src/xdisp.c (syms_of_xdisp, maybe_produce_line_number): * lisp/cus-start.el: Rename display-line-width to display-line-number-width.
* Fix tab stops when line numbers are displayedEli Zaretskii2017-06-242-0/+8
| | | | | | * src/xdisp.c (x_produce_glyphs): * src/term.c (produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display.
* Fix crashes on TTY frames due to negative lnum_width.Eli Zaretskii2017-06-241-0/+1
|
* Don't display line numbers in the minibuffer and in tooltip frames.Eli Zaretskii2017-06-241-5/+20
|
* Fix problems with line-number updates in Follow modeEli Zaretskii2017-06-241-4/+8
| | | | | | | | | | | * src/xdisp.c (redisplay_window): If forced window-start requires to move a window's point, and the window is under relative line-number display, force another round of redisplay to update the relative line numbers. This fixes follow-mode "redisplay" of its window group. * lisp/frame.el: Add display-line-numbers to the list of variables that should trigger redisplay of the current buffer.
* Fix display of line numbers with fonts larger than the defaultEli Zaretskii2017-06-241-9/+6
| | | | | | | * src/xdisp.c (maybe_produce_line_number): Update the metrics in IT, not in IT->glyph_row, since the latter gets overwritten in display_line. Fixes display of line numbers when the font used for them is larger than that of the default face.
* Fix background color beyond EOB and cursor displayEli Zaretskii2017-06-231-5/+16
| | | | | | | | | | | * src/xdisp.c: (maybe_produce_line_number): Use the default face for background of the blank glyphs in the line-number area which are drawn beyond EOB. (display_line): Reset the glyph row's displays_text_p flag only on empty lines that don't display line numbers. This fixes cursor display beyond EOB. Fix the bidi information in the glyphs produced for line numbers. Set the avoid_cursor_p flag of glyphs produced for line numbers.
* Fix display of indicate-empty-lines when line numbers are displayedEli Zaretskii2017-06-231-140/+158
| | | | | | | | | | | | * src/xdisp.c (row_text_area_empty): New function. (display_line): Call row_text_area_empty to verify that a glyph row's text area is devoid of any glyphs that came from a buffer or a string. This fixes a bug with empty-lines indication disappearing when line numbers or line-prefix are displayed. (display_line): Delete the argument FORCE; all callers changed. Remove the condition for actually producing the glyphs for the line number, as even if the number didn't change we need to produce empty space.
* Finish up native display of line numbersEli Zaretskii2017-06-172-29/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/xdisp.c (maybe_produce_line_number): Produce a blank before the number, for R2L rows. Increment 'g' in the loop even if glyph_row is NULL. Accept 2nd argument FORCE and produce the line-number glyphs if it is non-zero. (move_it_in_display_line_to): Account for the space taken by the line-number glyphs. Call maybe_produce_line_number with 2nd argument non-zero. (set_cursor_from_row): Fix calculation of cursor X coordinate in R2L rows with display-produced glyphs at the beginning. (syms_of_xdisp) <line-number>: New face symbol. <relative, display-line-width>: New symbols. (maybe_produce_line_number): Use the line-number face for displaying line numbers. Support relative line-number display. Support user-defined width for displaying line numbers. (try_cursor_movement, try_window_id): Disable these optimizations when displaying relative line numbers. * src/dispextern.h (struct it): New member 'pt_lnum'. * lisp/faces.el (line-number): New face. * lisp/cus-start.el (standard): Provide customization forms for display-line-numbers and display-line-width. * lisp/menu-bar.el (menu-bar-showhide-menu): Add menu-bar item to turn display-line-numbers on and off. * etc/NEWS: Document the new feature.
* Initial version of native display of line numbersEli Zaretskii2017-06-162-7/+187
| | | | | | | | | | | * src/xdisp.c (syms_of_xdisp) <display-line-numbers>: New buffer-local variable. Include <math.h>. (maybe_produce_line_number): New function. (DISP_INFINITY): Rename from INFINITY, since math.h defines INFINITY. (try_window_reusing_current_matrix): Don't use this method when display-line-numbers is in effect. * src/dispextern.h (struct it): New members 'lnum'.
* Pacify clang without munging C sourcePaul Eggert2017-06-151-2/+2
| | | | | | | | | | * configure.ac (WARN_CFLAGS): With Clang, use -Wno-tautological-compare regardless of --enable-gcc-warnings. (WERROR_CFLAGS): Simplify assignments, and guarantee it’s always set. * lib/strftime.c: Copy from gnulib, reverting Clang-specific change which I hope is no longer needed. * src/emacs.c (main): Revert rlim_t change, as rlim_t is signed on some older non-POSIX hosts.
* Don’t worry about __STDC_VERSION__ in emacs-modulePaul Eggert2017-06-151-5/+0
| | | | | | | * src/emacs-module.h: Remove __STDC_VERSION__ check. In the past we’ve found that some compilers do not define this symbol even when they work well enough. If necessary features like stdbool.h are missing the compiler will complain eventually anyway.
* Port cleanup check to Oracle Studio 12.5Paul Eggert2017-06-142-1/+8
| | | | | | * src/conf_post.h (__has_attribute_cleanup): Resurrect. * src/emacs-module.c: Verify __has_attribute (cleanup), but in an #if this time.
* Avoid compiler warning in image.c on MS-WindowsEli Zaretskii2017-06-141-0/+10
| | | | | | * src/image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: Avoid compilation warning under -Warray-bounds by temporarily disabling the -Warray-bounds option.
* Remove some tautological comparisons involving rlim_tPhilipp Stephani2017-06-141-2/+2
| | | | | | | | | | Clang on macOS warns about these with -Wtautological-compare. POSIX guarantees that rlim_t is unsigned (cf. http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/resource.h.html), so these resource limits can never be negative. * src/emacs.c (main): Remove tautological comparisons.
* Define --module-assertions only of modules are availablePhilipp Stephani2017-06-141-0/+6
| | | | | | | | Fixes Bug#27352. * src/emacs.c (usage_message, standard_args): Define --module-assertions only if Emacs has been compiled with module support.
* Port cleanup attribute to Oracle Studio 12.5Paul Eggert2017-06-132-4/+2
| | | | | | | | | | | * INSTALL (--with-modules): List cleanup attribute as prereq. * src/conf_post.h (__has_attribute_cleanup): Remove; no longer needed. * src/emacs-module.c (MODULE_SETJMP_1): Don’t attempt to verify (__has_attribute (cleanup)), as Oracle Studio 12.5 supports __has_attribute only inside preprocessor expressions. The C compiler should check the cleanup attribute in the next line anyway. (module_reset_handlerlist): Remove an unnecessary ‘const’ that causes Oracle Studio 12.5 to refuse to compile.
* Fix version checks for emacs-module.hPhilipp Stephani2017-06-131-4/+7
| | | | | We don't need C11 or C++11 because stdbool.h is in C99, and for C++ we don't need it at all.
* Small portability fix for emacs-module.h (bug#27346)Glenn Morris2017-06-121-2/+5
| | | | | * src/emacs-module.h (EMACS_ATTRIBUTE_NONNULL) [!__has_attribute]: Avoid 'error: missing binary operator before token "("'.
* Add no-focus-on-map to NS build (bug#25408)Alan Third2017-06-123-6/+33
| | | | | | | | | | | * src/nsfns.m (ns_frame_parm_handlers): Add x_set_no_focus_on_map. (x-create-frame): Check for no-focus-on-map. * src/nsterm.h (x_set_no_focus_on_map): New function. * src/nsterm.m (x_set_no_focus_on_map): New function. (ns_raise_frame): Add parameter for specifying whether to focus the frame. (ns_frame_raise_lower): (x_make_frame_visible): Handle new parameter for ns_raise_frame.
* _Noreturn not noreturnPaul Eggert2017-06-121-10/+14
| | | | | | | _Noreturn is more portable to non-C11 platforms. See: https://www.gnu.org/software/gnulib/manual/html_node/stdnoreturn_002eh.html * src/emacs-module.c: Use _Noreturn, not noreturn. No need to include <stdnoreturn.h>. Reindent to fit in 80 columns.
* Avoid compilation warnings with pre-C99 libcEli Zaretskii2017-06-121-4/+5
| | | | | | * src/emacs-module.c (module_free_global_ref) (module_assert_runtime, module_assert_env, value_to_lisp): Use 'pD' instead of C99 't' format descriptor.
* Flush all output streams before abortingPhilipp Stephani2017-06-121-1/+1
| | | | | | | | Maybe the stdout buffer still contains something interesting that should be flushed. * src/emacs-module.c (module_abort): Flush all output streams before aborting.
* Remove an assertion that doesn't test Emacs invariantsPhilipp Stephani2017-06-121-2/+0
| | | | | * src/emacs-module.c (module_copy_string_contents): Remove an assertion that doesn't test Emacs invariants.