From a76cafea0d55cc8df2a2c3556a628dac83762d9a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 May 2020 13:35:34 +0300 Subject: [PATCH 01/11] Fix handling of FROM = t and TO = t by 'window-text-pixel-size' * src/xdisp.c (Fwindow_text_pixel_size): Use byte position for accessing buffer text, not character positions. (Bug#41125) --- src/xdisp.c | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 19f4f326186..c15dd4770ae 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10442,7 +10442,7 @@ include the height of both, if present, in the return value. */) struct buffer *b; struct it it; struct buffer *old_b = NULL; - ptrdiff_t start, end, pos; + ptrdiff_t start, end, bpos; struct text_pos startp; void *itdata = NULL; int c, max_x = 0, max_y = 0, x = 0, y = 0; @@ -10457,32 +10457,56 @@ include the height of both, if present, in the return value. */) } if (NILP (from)) - start = BEGV; + { + start = BEGV; + bpos = BEGV_BYTE; + } else if (EQ (from, Qt)) { - start = pos = BEGV; - while ((pos++ < ZV) && (c = FETCH_CHAR (pos)) - && (c == ' ' || c == '\t' || c == '\n' || c == '\r')) - start = pos; - while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == '\t')) - start = pos; + start = BEGV; + bpos = BEGV_BYTE; + while (bpos < ZV_BYTE) + { + FETCH_CHAR_ADVANCE (c, start, bpos); + if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) + break; + } + while (bpos > BEGV_BYTE) + { + DEC_BOTH (start, bpos); + c = FETCH_CHAR (bpos); + if (!(c == ' ' || c == '\t')) + break; + } } else { CHECK_FIXNUM_COERCE_MARKER (from); start = min (max (XFIXNUM (from), BEGV), ZV); + bpos = CHAR_TO_BYTE (start); } + SET_TEXT_POS (startp, start, bpos); + if (NILP (to)) end = ZV; else if (EQ (to, Qt)) { - end = pos = ZV; - while ((pos-- > BEGV) && (c = FETCH_CHAR (pos)) - && (c == ' ' || c == '\t' || c == '\n' || c == '\r')) - end = pos; - while ((pos++ < ZV) && (c = FETCH_CHAR (pos)) && (c == ' ' || c == '\t')) - end = pos; + end = ZV; + bpos = ZV_BYTE; + while (bpos > BEGV_BYTE) + { + DEC_BOTH (end, bpos); + c = FETCH_CHAR (bpos); + if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r')) + break; + } + while (bpos < ZV_BYTE) + { + FETCH_CHAR_ADVANCE (c, end, bpos); + if (!(c == ' ' || c == '\t')) + break; + } } else { @@ -10499,7 +10523,6 @@ include the height of both, if present, in the return value. */) max_y = XFIXNUM (y_limit); itdata = bidi_shelve_cache (); - SET_TEXT_POS (startp, start, CHAR_TO_BYTE (start)); start_display (&it, w, startp); /* It makes no sense to measure dimensions of region of text that crosses the point where bidi reordering changes scan direction. From 0385771e2feab1d8e564bbda7edc7acb88aaf0a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Holby?= Date: Mon, 4 May 2020 22:02:57 +0200 Subject: [PATCH 02/11] Fix references to Speedbar in VHDL mode * lisp/progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Update references to Speedbar variables. (Bug#41084) Copyright-paperwork-exempt: yes --- lisp/progmodes/vhdl-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index de56f581ddb..39819131010 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -14730,7 +14730,7 @@ if required." (speedbar-add-mode-functions-list '("vhdl directory" (speedbar-item-info . vhdl-speedbar-item-info) - (speedbar-line-directory . speedbar-files-line-path))) + (speedbar-line-directory . speedbar-files-line-directory))) (speedbar-add-mode-functions-list '("vhdl project" (speedbar-item-info . vhdl-speedbar-item-info) From 7081c1d66fe99964c28794420f8cf4169fb8f818 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 May 2020 14:21:35 +0300 Subject: [PATCH 03/11] Fix typos in the Emacs user manual * doc/emacs/calendar.texi (Holidays): Fix usage of non-ASCII accents. * doc/emacs/custom.texi (Init Rebinding): Fix a cross-reference. * doc/emacs/dired.texi (Operating on Files): Make the cross-reference to "VC Delete/Rename" be to a different manual in the printed version. (Bug#41100) --- doc/emacs/calendar.texi | 4 ++-- doc/emacs/custom.texi | 2 +- doc/emacs/dired.texi | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi index 09111853958..8dc1a0b2df8 100644 --- a/doc/emacs/calendar.texi +++ b/doc/emacs/calendar.texi @@ -532,8 +532,8 @@ holidays centered around a different month, use @kbd{C-u M-x holidays}, which prompts for the month and year. The holidays known to Emacs include United States holidays and the -major Bahá'í, Chinese, Christian, Islamic, and Jewish holidays; also the -solstices and equinoxes. +major Bah@'{a}@t{'}@'{i}, Chinese, Christian, Islamic, and Jewish +holidays; also the solstices and equinoxes. @findex list-holidays The command @kbd{M-x holiday-list} displays the list of holidays for diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 406f0c96c1f..d034a78501b 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1882,7 +1882,7 @@ also unset keys, when passed @code{nil} as the binding. Since a mode's keymaps are not constructed until it has been loaded, you must delay running code which modifies them, e.g., by putting it -on a @dfn{mode hook} (@pxref{(Hooks)}). For example, Texinfo mode +on a @dfn{mode hook} (@pxref{Hooks}). For example, Texinfo mode runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook to add local bindings for @kbd{C-c n} and @kbd{C-c p}, and remove the one for @kbd{C-c C-x x} in Texinfo mode: diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index d5144141803..4ff1dc1bd94 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -723,7 +723,13 @@ with renamed files so that they refer to the new names. @vindex dired-vc-rename-file If the value of the variable @code{dired-vc-rename-file} is non-@code{nil}, files are renamed using the commands of the underlying VCS, via +@ifnottex @code{vc-rename-file} (@pxref{VC Delete/Rename}). +@end ifnottex +@iftex +@code{vc-rename-file} (@pxref{VC Delete/Rename,, Deleting and Renaming +Version-Controlled Files, emacs-xtra, Specialized Emacs Features}). +@end iftex @findex dired-do-hardlink @kindex H @r{(Dired)} From 2caf3e997e2a4013ffad10a047f24c98d02ab1d5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 May 2020 17:25:45 +0300 Subject: [PATCH 04/11] Improve documentation of Hi Lock mode * lisp/hi-lock.el (hi-lock-mode, hi-lock-face-buffer) (hi-lock-face-phrase-buffer, hi-lock-face-symbol-at-point): Clarify when 'hi-lock-mode' will use Font Lock and when it will use overlays. (Bug#41124) --- lisp/hi-lock.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index de258935e18..0f685464cdd 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -318,7 +318,10 @@ or add (global-hi-lock-mode 1) to your init file. In buffers where Font Lock mode is enabled, patterns are highlighted using font lock. In buffers where Font Lock mode is disabled, patterns are applied using overlays; in this case, the -highlighting will not be updated as you type. +highlighting will not be updated as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock. When Hi Lock mode is enabled, a \"Regexp Highlighting\" submenu is added to the \"Edit\" menu. The commands in the submenu, @@ -462,7 +465,10 @@ If SUBEXP is omitted or nil, the entire REGEXP is highlighted. Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, use overlays for highlighting. If overlays are used, the -highlighting will not update as you type." +highlighting will not update as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive (list (hi-lock-regexp-okay @@ -487,7 +493,10 @@ letters case-insensitive, before highlighting with `hi-lock-set-pattern'. Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, use overlays for highlighting. If overlays are used, the -highlighting will not update as you type." +highlighting will not update as you type. The Font Lock mode +is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive (list (hi-lock-regexp-okay @@ -508,7 +517,10 @@ unless you use a prefix argument. Uses `find-tag-default-as-symbol-regexp' to retrieve the symbol at point. This uses Font lock mode if it is enabled; otherwise it uses overlays, -in which case the highlighting will not update as you type." +in which case the highlighting will not update as you type. The Font +Lock mode is considered \"enabled\" in a buffer if its `major-mode' +causes `font-lock-specified-p' to return non-nil, which means +the major mode specifies support for Font Lock." (interactive) (let* ((regexp (hi-lock-regexp-okay (find-tag-default-as-symbol-regexp))) From 4a895c1b2601150357d6523bb5121fb07a89701e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 8 May 2020 20:27:39 +0300 Subject: [PATCH 05/11] Fix a typo in a comment * lisp/display-fill-column-indicator.el: Fix a typo in a comment. Suggested by david s . --- lisp/display-fill-column-indicator.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 25259aadf6b..1b92fa69d29 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -31,7 +31,7 @@ ;; NOTE: Customization variables for ;; `display-fill-column-indicator-column' and -;; `display-fill-column-indicator-char' itself are defined in +;; `display-fill-column-indicator-character' itself are defined in ;; cus-start.el. ;;; Code: From a1cbd05f3892fc86815f69bc50d8ab9175b7b082 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Fri, 8 May 2020 22:12:07 +0200 Subject: [PATCH 06/11] Improve documentation of 'with-suppressed-warnings'. * lisp/emacs-lisp/byte-run.el (with-suppressed-warnings): Refer to 'byte-compile-warnings' instead of 'byte-compile-warning-types', as only the former variable documents the available warning types. --- lisp/emacs-lisp/byte-run.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 6a49c60099d..70fe06085dc 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -513,11 +513,12 @@ wrong number of parameters, say (zot 1 2)) The warnings that can be suppressed are a subset of the warnings -in `byte-compile-warning-types'; see this variable for a fuller -explanation of the warning types. The types that can be -suppressed with this macro are `free-vars', `callargs', -`redefine', `obsolete', `interactive-only', `lexical', `mapcar', -`constants' and `suspicious'. +in `byte-compile-warning-types'; see the variable +`byte-compile-warnings' for a fuller explanation of the warning +types. The types that can be suppressed with this macro are +`free-vars', `callargs', `redefine', `obsolete', +`interactive-only', `lexical', `mapcar', `constants' and +`suspicious'. For the `mapcar' case, only the `mapcar' function can be used in the symbol list. For `suspicious', only `set-buffer' can be used." From 4c98aa7ea56a33740e3af1d1e32b0dc0ad400b85 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 May 2020 10:23:49 +0300 Subject: [PATCH 07/11] Minor clarifications in NEWS * etc/NEWS: Tell how to revert to previous behaviors regarding displaying messages when the minibuffer is active. (Bug#41087) --- etc/NEWS | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 42133b8bad8..bb275b70e6f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -881,21 +881,27 @@ list the contents of such directories when completing file names. ** Minibuffer +++ -*** A new user option, 'minibuffer-beginning-of-buffer-movement', has -been introduced to allow controlling how the 'M-<' command works in +*** New user option 'minibuffer-beginning-of-buffer-movement'. +This option allows control of how the 'M-<' command works in the minibuffer. If non-nil, point will move to the end of the prompt -(if point is after the end of the prompt). +(if point is after the end of the prompt). The default is nil, which +preserves the original behavior of 'M-<' moving to the beginning of +the prompt. +++ *** When the minibuffer is active, echo-area messages are displayed at the end of the minibuffer instead of hiding the minibuffer by the echo area display. The new user option 'minibuffer-message-clear-timeout' controls how messages displayed in this situation are removed from the -minibuffer. +minibuffer. To revert to previous behavior, where echo-area messages +temporarily overwrote the minibuffer contents until the user typed +something, set 'set-message-function' and 'clear-message-function' to +nil. --- *** Minibuffer now uses 'minibuffer-message' to display error messages -at the end of the active minibuffer. +at the end of the active minibuffer. To disable this, remove +'minibuffer-error-initialize' from 'minibuffer-setup-hook'. +++ *** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer. From 0bae57033f061271d66c76c158e73672c6a87f4d Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sat, 9 May 2020 09:38:27 +0200 Subject: [PATCH 08/11] Fix GTK's Tool Bar menu radio buttons * lisp/menu-bar.el (menu-bar-showhide-tool-bar-menu): Fix typo that makes the radio buttons pretend that the tool bar is always shown on the left side of the frame. --- lisp/menu-bar.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 8f825a19adc..cc12a17c794 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1085,10 +1085,10 @@ The selected font will be the default on both the existing and future frames." :visible (display-graphic-p) :button (:radio . (and tool-bar-mode - (frame-parameter + (eq (frame-parameter (menu-bar-frame-for-menubar) 'tool-bar-position) - 'left)))) + 'left))))) (bindings--define-key menu [showhide-tool-bar-right] '(menu-item "On the Right" From d5c184aa3e2a183144efa5f269e2c70d2681aa0a Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 9 May 2020 10:20:47 +0200 Subject: [PATCH 09/11] Refer to fill column indicator Info node in some places. * src/xdisp.c (syms_of_xdisp): Add reference to manual in documentation strings for variables related to fill column indicators. * lisp/display-fill-column-indicator.el (display-fill-column-indicator) (display-fill-column-indicator-mode): Add reference to manual. --- lisp/display-fill-column-indicator.el | 6 ++++-- src/xdisp.c | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index 1b92fa69d29..3f947bdc1c9 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -39,7 +39,8 @@ (defgroup display-fill-column-indicator nil "Display a fill column indicator in the buffer." :group 'convenience - :group 'display) + :group 'display + :link '(info-link "(emacs)Displaying Boundaries")) ;;;###autoload @@ -49,7 +50,8 @@ This uses `display-fill-column-indicator' internally. To change the position of the column displayed by default customize `display-fill-column-indicator-column'. You can change the -character for the indicator setting `display-fill-column-indicator-character'." +character for the indicator setting `display-fill-column-indicator-character'. +See Info node `Displaying Boundaries' for details." :lighter nil (if display-fill-column-indicator-mode (progn diff --git a/src/xdisp.c b/src/xdisp.c index c15dd4770ae..b0fbc9936fb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -34976,7 +34976,8 @@ It has no effect when set to 0, or when line numbers are not absolute. */); Fmake_variable_buffer_local (Qdisplay_line_numbers_offset); DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator, - doc: /* Non-nil means display the fill column indicator. */); + doc: /* Non-nil means display the fill column indicator. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator = false; DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); @@ -34985,7 +34986,8 @@ It has no effect when set to 0, or when line numbers are not absolute. */); doc: /* Column for indicator when `display-fill-column-indicator' is non-nil. The default value is t which means that the indicator will use the `fill-column' variable. If it is set to an integer the -indicator will be drawn in that column. */); +indicator will be drawn in that column. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator_column = Qt; DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); @@ -34993,7 +34995,8 @@ indicator will be drawn in that column. */); DEFVAR_LISP ("display-fill-column-indicator-character", Vdisplay_fill_column_indicator_character, doc: /* Character to draw the indicator when `display-fill-column-indicator' is non-nil. The default is U+2502 but a good alternative is (ascii 124) -if the font in fill-column-indicator face does not support Unicode characters. */); +if the font in fill-column-indicator face does not support Unicode characters. +See Info node `Displaying Boundaries' for details. */); Vdisplay_fill_column_indicator_character = Qnil; DEFSYM (Qdisplay_fill_column_indicator_character, "display-fill-column-indicator-character"); Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character); From c5e583977629f55ad438ef0b0c210a9eeb94ae6d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 May 2020 12:34:58 +0300 Subject: [PATCH 10/11] Fix customization of 'display-fill-column-indicator-character' * lisp/cus-start.el (display-fill-column-indicator-character): Fix the customization form. (Bug#41145) --- lisp/cus-start.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index dff4d9a6060..bd32c7c61d3 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -771,9 +771,16 @@ since it could result in memory overflow and make Emacs crash." :safe (lambda (value) (or (booleanp value) (integerp value)))) (display-fill-column-indicator-character display-fill-column-indicator - character + (choice + (character :tag "Use U+2502 to indicate fill column" + :value ?│) + (character :tag "Use | to indicate fill column" + :value ?|) + (const :tag "If possible, use U+2502 to indicate fill column, otherwise use |" + :value nil) + character) "27.1" - :safe characterp) + :safe (lambda (value) (or (characterp value) (booleanp value)))) ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c From be0d1cac83d14596406571f9cb668031ec5675ac Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 9 May 2020 14:33:05 +0200 Subject: [PATCH 11/11] Small fix for type of 'display-fill-column-indicator-character' * lisp/cus-start.el (standard): Don't mark t as safe file-local value for 'display-fill-column-indicator-character', as that value isn't allowed. --- lisp/cus-start.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index bd32c7c61d3..6632687da47 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -780,7 +780,7 @@ since it could result in memory overflow and make Emacs crash." :value nil) character) "27.1" - :safe (lambda (value) (or (characterp value) (booleanp value)))) + :safe (lambda (value) (or (characterp value) (null value)))) ;; xfaces.c (scalable-fonts-allowed display boolean "22.1") ;; xfns.c