aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Minor tweaks of new line number display variablesMartin Rudalics2017-07-121-18/+21
| | | | | | | | | | | * src/xdisp.c (Vdisplay_line_numbers): Tweak doc-string. (Vdisplay_line_number_width): Rename to Vdisplay_line_numbers_width. (maybe_produce_line_number): Comply with above rename. * lisp/cus-start.el (standard): * lisp/frame.el (top-level): * etc/NEWS: Comply with renaming of `display-line-number-width' to `display-line-numbers-width'.
* Avoid assertion violations in close_infile_unwindEli Zaretskii2017-07-121-1/+1
| | | | | * src/lread.c (close_infile_unwind): A temporary band-aid solution for bug#27642: allow 'infile' be NULL.
* ; * src/xdisp.c (syms_of_xdisp) <display-line-numbers>: Copyedits.Eli Zaretskii2017-07-111-5/+5
|
* Improve documentation of display-line-numbersEli Zaretskii2017-07-111-1/+6
| | | | | * src/xdisp.c (syms_of_xdisp) <display-line-numbers>: Improve the doc string. Suggested by Alex <agrambot@gmail.com>.
* Add an optional testfn parameter to assocNicolas Petton2017-07-1116-27/+33
| | | | | | | | | | | | | | | | | | | | | | | | * src/fns.c (assoc): New optional testfn parameter used for comparison when provided. * test/src/fns-tests.el (test-assoc-testfn): Add tests for the new 'testfn' parameter. * src/buffer.c: * src/coding.c: * src/dbusbind.c: * src/font.c: * src/fontset.c: * src/gfilenotify.c: * src/image.c: * src/keymap.c: * src/process.c: * src/w32fns.c: * src/w32font.c: * src/w32notify.c: * src/w32term.c: * src/xdisp.c: * src/xfont.c: Add a third argument to Fassoc calls. * etc/NEWS: * doc/lispref/lists.texi: Document the new 'testfn' parameter.
* Fix core dump in substitute-object-in-subtreePaul Eggert2017-07-095-136/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this fix, (substitute-object-in-subtree #0=(#0# 'a) 'a) would dump core, since the C code would recurse indefinitely through the infinite structure. This patch adds an argument to the function, and renames it to lread--substitute-object-in-subtree as the function is not general-purpose and should not be relied on by outside code. See Bug#23660. * src/intervals.c (traverse_intervals_noorder): ARG is now void *, not Lisp_Object, so that callers need not cons unnecessarily. All callers changed. Also, remove related #if-0 code that was “temporary” in the early 1990s and has not been compilable for some time. * src/lread.c (struct subst): New type, for substitution closure data. (seen_list): Remove this static var, as this info is now part of struct subst. All uses removed. (Flread__substitute_object_in_subtree): Rename from Fsubstitute_object_in_subtree, and give it a 3rd arg so that it doesn’t dump core when called from the top level with an already-cyclic structure. All callers changed. (SUBSTITUTE): Remove. All callers expanded and then simplified. (substitute_object_recurse): Take a single argument SUBST rather than a pair OBJECT and PLACEHOLDER, so that its address can be passed around as part of a closure; this avoids the need for an AUTO_CONS call. All callers changed. If the COMPLETED component is t, treat every subobject as potentially circular. (substitute_in_interval): Take a struct subst * rather than a Lisp_Object, for the closure data. All callers changed. * test/src/lread-tests.el (lread-lread--substitute-object-in-subtree): New test, to check that the core dump does not reoccur.
* Minor simplification of module_free_global_refPhilipp Stephani2017-07-101-8/+3
| | | | | * src/emacs-module.c (module_free_global_ref): Remove unused variable 'hashcode'. Inline variable 'value' that's only used once.
* Re-add a useful assertionPhilipp Stephani2017-07-101-1/+4
| | | | | | | | | * src/emacs-module.c (module_free_global_ref): Re-add assertion that the reference count is zero. This assertion was removed in commit 8afaa1321f8088bfb877fe4b6676e8517adb0bb7, but it's not included in the test performed by XFASTINT before, because the previous reference count could have been zero already in the case of a buggy implementation. This assertion might have detected Bug#27587.
* Fix bug in module_free_global_ref (Bug#27587)Valentin Gatien-Baron2017-07-101-1/+1
| | | | | | | * src/emacs-module.c (module_free_global_ref): Actually remove entry from hash table. Copyright-paperwork-exempt: yes
* Avoid crashes on MS-Windows starting 64-bit .NET executablesSaulius Menkevičius2017-07-091-29/+34
| | | | | | | * src/w32proc.c (w32_executable_type): Don't assume that the import directory in a DLL will always be non-NULL. (Bug#27527) Copyright-paperwork-exempt: yes
* Speed up display of line numbers for very large buffersEli Zaretskii2017-07-091-4/+16
| | | | | | * src/xdisp.c (maybe_produce_line_number): Speed up line counting using values cached by mode-line display of line numbers. (Bug#27622)
* ; * src/emacs-module.c (module_assert_thread): Simplify.Philipp Stephani2017-07-091-4/+6
|
* Define internal_border_parts for window systems only (Bug#27615)Alexander Kuleshov2017-07-091-0/+2
| | | | | * src/keyboard.c: (internal_border_parts): Define only when HAVE_WINDOW_SYSTEM is enabled. (Bug#27615)
* Module assertions: check for garbage collectionsPhilipp Stephani2017-07-081-2/+4
| | | | | | | | | | | | | | | | | | | | It's technically possible to write a user pointer finalizer that calls into Emacs module functions. This would be disastrous because it would allow arbitrary Lisp code to run during garbage collection. Therefore extend the module assertions to check for this case. * src/emacs-module.c (module_assert_thread): Also check whether a garbage collection is in progress. * test/data/emacs-module/mod-test.c (invalid_finalizer) (Fmod_test_invalid_finalizer): New test module functions. (emacs_module_init): Register new test function. * test/src/emacs-module-tests.el (module--test-assertion) (module--with-temp-directory): New helper macros. (module--test-assertions--load-non-live-object): Rename existing unit test, use helper macros. (module--test-assertions--call-emacs-from-gc): New unit test.
* Avoid compiler warnings in xdisp.c debugging codeAlexander Kuleshov2017-07-081-7/+7
| | | | | | * src/xdisp.c (dump_glyph, dump_glyph_row, Fdump_glyph_matrix): Use pD directives for ptrdiff_t values instead of pI, to avoid compilation warnings on 64-bit hosts. (Bug#27597)
* Support display of line numbers nativelyEli Zaretskii2017-07-086-28/+647
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This merges branch 'line-numbers'. * src/buffer.c (disable_line_numbers_overlay_at_eob): New function. * src/lisp.h (disable_line_numbers_overlay_at_eob): Add prototype. * src/dispextern.h (struct it): New members pt_lnum, lnum, lnum_bytepos, lnum_width, and lnum_pixel_width. * 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. * 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. If window-start is outside of the accessible portion, temporarily widen the buffer. * src/term.c (produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display. * src/xdisp.c (display_count_lines_logically) (display_count_lines_visually, maybe_produce_line_number) (should_produce_line_number, row_text_area_empty): New functions. (try_window_reusing_current_matrix): Don't use this method when display-line-numbers is in effect. (try_window_id, try_cursor_movement): Disable these optimizations when the line-number-current-line face is different from line-number face and for relative line numbers. (try_window_id, redisplay_window, try_cursor_movement): For visual line-number display, disable the same redisplay optimizations as for relative. (x_produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display. (hscroll_window_tree): Adjust hscroll calculations to line-number display. (DISP_INFINITY): Renamed from INFINITY to avoid clashes with math.h; all users changed. (set_cursor_from_row): Fix calculation of cursor X coordinate in R2L rows with display-produced glyphs at the beginning. (display_line): Use should_produce_line_number to determine whether a line number should be produced for each glyph row, and maybe_produce_line_number to produce line numbers. Don't display line numbers in the minibuffer and in tooltip frames. 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. (syms_of_xdisp) <display-line-numbers, display-line-numbers-widen> <display-line-number-width>: New buffer-local variables. <display-line-numbers-current-absolute>: New variable. * lisp/cus-start.el (standard): Provide customization forms for display-line-numbers and its sub-features. * lisp/faces.el (line-number, line-number-current-line): New faces. * lisp/frame.el: Add display-line-numbers, 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. * lisp/menu-bar.el (menu-bar-showhide-menu): Add menu-bar item to turn display-line-numbers on and off. (toggle-display-line-numbers): New function. * 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. * doc/emacs/basic.texi (Position Info): Add cross-reference to "Display Custom", for line-number display. * 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. * doc/lispref/display.texi (Size of Displayed Text): Document line-number-display-width. * etc/NEWS: Document display-line-numbers and its customizations.
| * Exclude blank columns from value of line-number-display-widthEli 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.