From 592b1cfee9f80413290dcd470effa7fa14036df3 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 4 Mar 2020 01:48:03 +0200 Subject: [PATCH 1/7] Improve documentation of next-error-highlight-no-select (bug#38778) * doc/emacs/building.texi (Compilation Mode): Mention next-error-highlight-no-select. * lisp/simple.el (next-error-highlight): Add reference to next-error-highlight-no-select. (next-error-highlight-no-select): Add reference to next-error-highlight. --- doc/emacs/building.texi | 5 ++++- lisp/simple.el | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 02f18865f39..e866eea4a29 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -214,6 +214,7 @@ Select a buffer to be used by next invocation of @code{next-error} and @kindex C-x ` @findex next-error @vindex next-error-highlight +@vindex next-error-highlight-no-select To visit errors sequentially, type @w{@kbd{C-x `}} (@code{next-error}), or equivalently @kbd{M-g M-n} or @kbd{M-g n}. This command can be invoked from any buffer, not just a Compilation @@ -258,7 +259,9 @@ to skip any messages. When Emacs visits the locus of an error message, it momentarily highlights the relevant source line. The duration of this highlight -is determined by the variable @code{next-error-highlight}. +is determined by the variable @code{next-error-highlight} for the locus +in the selected buffer, and @code{next-error-highlight-no-select} for +the locus in non-selected buffers. @vindex compilation-context-lines If the @file{*compilation*} buffer is shown in a window with a left diff --git a/lisp/simple.el b/lisp/simple.el index 0d8072bf5f0..cb04c982220 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -75,14 +75,16 @@ value of 1 means that nothing is amalgamated.") :version "22.1") (defcustom next-error-highlight 0.5 - "Highlighting of locations in selected source buffers. + "Highlighting of locations in the selected buffer. If a number, highlight the locus in `next-error' face for the given time in seconds, or until the next command is executed. If t, highlight the locus until the next command is executed, or until some other locus replaces it. If nil, don't highlight the locus in the source buffer. If `fringe-arrow', indicate the locus by the fringe arrow -indefinitely until some other locus replaces it." +indefinitely until some other locus replaces it. +See `next-error-highlight-no-select' to customize highlighting +of the locus in non-selected buffers." :type '(choice (number :tag "Highlight for specified time") (const :tag "Semipermanent highlighting" t) (const :tag "No highlighting" nil) @@ -91,12 +93,15 @@ indefinitely until some other locus replaces it." :version "22.1") (defcustom next-error-highlight-no-select 0.5 - "Highlighting of locations in `next-error-no-select'. + "Highlighting of locations in non-selected source buffers. +Usually non-selected buffers are displayed by `next-error-no-select'. If number, highlight the locus in `next-error' face for given time in seconds. If t, highlight the locus indefinitely until some other locus replaces it. If nil, don't highlight the locus in the source buffer. If `fringe-arrow', indicate the locus by the fringe arrow -indefinitely until some other locus replaces it." +indefinitely until some other locus replaces it. +See `next-error-highlight' to customize highlighting of the locus +in the selected buffer." :type '(choice (number :tag "Highlight for specified time") (const :tag "Semipermanent highlighting" t) (const :tag "No highlighting" nil) From 7cafbbe96434ef616abfef364d82f7250bffc1ed Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 27 Feb 2020 21:09:59 -0500 Subject: [PATCH 2/7] Fix describe-variable on values with circular syntax (Bug#39805) * lisp/help-fns.el (describe-variable): Set syntax tables before calling pp-buffer. --- lisp/help-fns.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 0e2ae6b3c3c..1be8e0ab082 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1000,6 +1000,8 @@ it is displayed along with the global value." (terpri) (let ((buf (current-buffer))) (with-temp-buffer + (lisp-mode-variables nil) + (set-syntax-table emacs-lisp-mode-syntax-table) (insert print-rep) (pp-buffer) (let ((pp-buffer (current-buffer))) From 60418a1ab21b86cb2d46470ae187e74a25d33212 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 27 Feb 2020 08:09:44 -0500 Subject: [PATCH 3/7] Explain how to unset mode bindings (Bug#39802) * doc/emacs/custom.texi (Init Rebinding): Explain that passing nil to define-key will unbind keys, and extend the example accordingly. --- doc/emacs/custom.texi | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index f39ce40931c..e7e879065ed 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1873,15 +1873,19 @@ You can use a vector for the simple cases too: Language and coding systems may cause problems with key bindings for non-@acronym{ASCII} characters. @xref{Init Non-ASCII}. +@findex define-key As described in @ref{Local Keymaps}, major modes and minor modes can define local keymaps. These keymaps are constructed when the mode is -used for the first time in a session. If you wish to change one of -these keymaps, you must use the @dfn{mode hook} (@pxref{Hooks}). +loaded for the first time in a session. The function @code{define-key} +can be used to make changes in a specific keymap. This function can +also unset keys, when passed @code{nil} as the binding. -@findex define-key - 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} in Texinfo mode: + 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 +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: @example (add-hook 'texinfo-mode-hook @@ -1890,6 +1894,7 @@ and @kbd{C-c p} in Texinfo mode: 'backward-paragraph) (define-key texinfo-mode-map "\C-cn" 'forward-paragraph))) + (define-key texinfo-mode-map "\C-c\C-xx" nil) @end example @node Modifier Keys From 40b217c2bfde6da6529499c9526a460fcdbeec8f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 4 Mar 2020 04:41:45 +0100 Subject: [PATCH 4/7] Bump checkdoc-version to match library header * lisp/emacs-lisp/checkdoc.el (checkdoc-version): Bump version. --- lisp/emacs-lisp/checkdoc.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index e15836ee7d8..fa5d1cff417 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el @@ -168,7 +168,7 @@ ;; not specifically docstring related. Would this even be useful? ;;; Code: -(defvar checkdoc-version "0.6.1" +(defvar checkdoc-version "0.6.2" "Release version of checkdoc you are currently running.") (require 'cl-lib) From db37dd2e84573ceb2fc037dab040b79880ca298c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Wed, 4 Mar 2020 14:46:46 +0100 Subject: [PATCH 5/7] Don't misinterpret doc string as initial value * lisp/loadhist.el (loadhist--restore-autoload): * lisp/progmodes/vhdl-mode.el (vhdl-font-lock-keywords-0): Prevent the doc string from being used as initial value. --- lisp/loadhist.el | 2 +- lisp/progmodes/vhdl-mode.el | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/loadhist.el b/lisp/loadhist.el index dabc8b9457a..a1ff2f6270d 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -173,7 +173,7 @@ documentation of `unload-feature' for details.") ;; we undefine it. ;; So we use this auxiliary variable to keep track of the last (t . SYMBOL) ;; that occurred. -(defvar loadhist--restore-autoload +(defvar loadhist--restore-autoload nil "If non-nil, this is a symbol for which we should restore a previous autoload if possible.") diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index b225a9b1d9a..de56f581ddb 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -13334,7 +13334,7 @@ File statistics: \"%s\"\n\ (defvar vhdl-font-lock-keywords nil "Regular expressions to highlight in VHDL Mode.") -(defvar vhdl-font-lock-keywords-0 +(defvar vhdl-font-lock-keywords-0 nil ;; set in `vhdl-font-lock-init' because dependent on user options "For consideration as a value of `vhdl-font-lock-keywords'. This does highlighting of template prompts and directives (pragmas).") From a1abf73c7642339c111646afed1d5d05ecada9c7 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 4 Mar 2020 19:50:38 +0000 Subject: [PATCH 6/7] Fix combine-change-calls-1 for when buffer-undo-list is t * lisp/subr.c (combine-change-calls-1): Bind before/after-change-functions to nil also when buffer-undo-list is t. --- lisp/subr.el | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index c1c4cad18d1..5b94343e499 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3959,19 +3959,18 @@ the function `undo--wrap-and-run-primitive-undo'." (let ((undo--combining-change-calls t)) (if (not inhibit-modification-hooks) (run-hook-with-args 'before-change-functions beg end)) - (if (eq buffer-undo-list t) - (setq result (funcall body)) - (let (;; (inhibit-modification-hooks t) - (before-change-functions - ;; Ugly Hack: if the body uses syntax-ppss/syntax-propertize - ;; (e.g. via a regexp-search or sexp-movement trigerring - ;; on-the-fly syntax-propertize), make sure that this gets - ;; properly refreshed after subsequent changes. - (if (memq #'syntax-ppss-flush-cache before-change-functions) - '(syntax-ppss-flush-cache))) - after-change-functions) - (setq result (funcall body))) - (let ((ap-elt + (let (;; (inhibit-modification-hooks t) + (before-change-functions + ;; Ugly Hack: if the body uses syntax-ppss/syntax-propertize + ;; (e.g. via a regexp-search or sexp-movement trigerring + ;; on-the-fly syntax-propertize), make sure that this gets + ;; properly refreshed after subsequent changes. + (if (memq #'syntax-ppss-flush-cache before-change-functions) + '(syntax-ppss-flush-cache))) + after-change-functions) + (setq result (funcall body))) + (when (not (eq buffer-undo-list t)) + (let ((ap-elt (list 'apply (- end end-marker) beg From a3c2d186eb514b505e61c2a89a1df886dbfcb06b Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 4 Mar 2020 21:17:04 +0000 Subject: [PATCH 7/7] CC Mode: Fix the handling of two adjacent after-change-functionses. The bug involved failing to set c-new-END correctly, which lead to an args-out-of-range error when after-change-functions was invoked twice without an intervening invocation of before-change-functions. * lisp/progmodes/cc-mode.el (c-after-change): Correct a coding error in the handling of c-just-done-before-change. --- lisp/progmodes/cc-mode.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 9f95a9ce48b..fd7750b0d82 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1992,17 +1992,16 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") ;; Note: c-just-done-before-change is nil, t, or 'whole-buffer. (unless (c-called-from-text-property-change-p) - (save-restriction - (widen) - (unless c-just-done-before-change - (c-before-change (point-min) (point-max))) - (unless (eq c-just-done-before-change t) + (unless (eq c-just-done-before-change t) + (save-restriction + (widen) + (when (null c-just-done-before-change) + (c-before-change (point-min) (point-max))) (setq beg (point-min) end (point-max) old-len (- end beg) c-new-BEG (point-min) - c-new-END (point-max))) - (setq c-just-done-before-change nil))) + c-new-END (point-max))))) ;; (c-new-BEG c-new-END) will be the region to fontify. It may become ;; larger than (beg end).