From 293720e930ac33e007d3402b677d6c482d0a3dbf Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 21 Dec 2017 17:18:40 +0000 Subject: [PATCH 01/15] Fix loss of documentation face in certain CC Mode doc comment situations * lisp/progmodes/cc-fonts.el (c-font-lock-doc-comments): Take into account the possibility of font-lock-comment-delimiter-face. Test rigorously for "/**" (etc.) being itself inside a literal, rather than just depending on the face of the previous character. --- lisp/progmodes/cc-fonts.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 7b99c2f54e5..83038e07ca6 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -2670,8 +2670,8 @@ need for `pike-font-lock-extra-types'.") ;; This function might do hidden buffer changes. (let (comment-beg region-beg) - (if (eq (get-text-property (point) 'face) - 'font-lock-comment-face) + (if (memq (get-text-property (point) 'face) + '(font-lock-comment-face font-lock-comment-delimiter-face)) ;; Handle the case when the fontified region starts inside a ;; comment. (let ((start (c-literal-start))) @@ -2691,8 +2691,15 @@ need for `pike-font-lock-extra-types'.") (or (not (c-got-face-at comment-beg c-literal-faces)) (and (/= comment-beg (point-min)) + ;; Cheap check which is unreliable (the previous + ;; character could be the end of a previous + ;; comment). (c-got-face-at (1- comment-beg) - c-literal-faces)))) + c-literal-faces) + ;; Expensive reliable check. + (save-excursion + (goto-char comment-beg) + (c-in-literal))))) (setq comment-beg nil)) (setq region-beg comment-beg)) From de7de9cc0cfcef1c7651887fd36fc2a346dadd6c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 21 Dec 2017 19:43:07 +0200 Subject: [PATCH 02/15] Prevent infloop in redisplay on TTY frames * src/xdisp.c (extend_face_to_end_of_line): Avoid infloop when filling up display margins with the default face's background. (Bug#29789) --- src/xdisp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xdisp.c b/src/xdisp.c index 7601e26a902..c3a46651da8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20280,6 +20280,7 @@ extend_face_to_end_of_line (struct it *it) /* term.c:produce_glyphs advances it->current_x only for TEXT_AREA. */ it->current_x += it->pixel_width; + ++it->glyph_row->used[LEFT_MARGIN_AREA]; } it->current_x = saved_x; @@ -20317,6 +20318,7 @@ extend_face_to_end_of_line (struct it *it) { PRODUCE_GLYPHS (it); it->current_x += it->pixel_width; + ++it->glyph_row->used[RIGHT_MARGIN_AREA]; } it->area = TEXT_AREA; From 88ddf53ef086ee2f2e0ea729bc4afbf34d88d82b Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 21 Dec 2017 17:49:14 +0000 Subject: [PATCH 03/15] Fontify a CPP construct correctly when a comment follows without spaces Do this by removing a broken optimization in the state cache which put category text properties on a character between the end of the CPP construct and the beginning of the comment. This can't work when there's no such character. * lisp/progmodes/cc-defs.el (c-cpp-delimiter, c-set-cpp-delimiters) (c-clear-cpp-delimiters, c-comment-out-cpps, c-with-cpps-commented-out) (c-with-all-but-one-cpps-commented-out): Remove. * lisp/progmodes/cc-engine.el (c-no-comment-end-of-macro): Return the comment start position rather than one character before it. (c-invalidate-state-cache, c-parse-state): Remove the invocations of c-with-all-but-one-cpps-commented-out and c-with-cpps-commented-out. * lisp/progmodes/cc-mode.el (c-neutralize-syntax-in-and-mark-CPP): Rename to c-neutralize-syntax-in-CPP and remove the bits which applied category properties. * lisp/progmodes/cc-langs.el (c-before-font-lock-functions): Incorporate the new name of the function c-neutralize-syntax-in-CPP. --- lisp/progmodes/cc-defs.el | 53 ------------------------------------- lisp/progmodes/cc-engine.el | 27 ++++++------------- lisp/progmodes/cc-langs.el | 4 +-- lisp/progmodes/cc-mode.el | 26 +++++------------- 4 files changed, 16 insertions(+), 94 deletions(-) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 973d97c2560..e837ce1973b 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -1414,59 +1414,6 @@ with value CHAR in the region [FROM to)." ;;;;;;;;;;;;;;; -(defconst c-cpp-delimiter '(14)) ; generic comment syntax -;; This is the value of the `category' text property placed on every # -;; which introduces a CPP construct and every EOL (or EOB, or character -;; preceding //, etc.) which terminates it. We can instantly "comment -;; out" all CPP constructs by giving `c-cpp-delimiter' a syntax-table -;; property '(14) (generic comment delimiter). -(defmacro c-set-cpp-delimiters (beg end) - ;; This macro does a hidden buffer change. - `(progn - (c-put-char-property ,beg 'category 'c-cpp-delimiter) - (if (< ,end (point-max)) - (c-put-char-property ,end 'category 'c-cpp-delimiter)))) -(defmacro c-clear-cpp-delimiters (beg end) - ;; This macro does a hidden buffer change. - `(progn - (c-clear-char-property ,beg 'category) - (if (< ,end (point-max)) - (c-clear-char-property ,end 'category)))) - -(defsubst c-comment-out-cpps () - ;; Render all preprocessor constructs syntactically commented out. - (put 'c-cpp-delimiter 'syntax-table c-cpp-delimiter)) -(defsubst c-uncomment-out-cpps () - ;; Restore the syntactic visibility of preprocessor constructs. - (put 'c-cpp-delimiter 'syntax-table nil)) - -(defmacro c-with-cpps-commented-out (&rest forms) - ;; Execute FORMS... whilst the syntactic effect of all characters in - ;; all CPP regions is suppressed. In particular, this is to suppress - ;; the syntactic significance of parens/braces/brackets to functions - ;; such as `scan-lists' and `parse-partial-sexp'. - `(unwind-protect - (c-save-buffer-state () - (c-comment-out-cpps) - ,@forms) - (c-save-buffer-state () - (c-uncomment-out-cpps)))) - -(defmacro c-with-all-but-one-cpps-commented-out (beg end &rest forms) - ;; Execute FORMS... whilst the syntactic effect of all characters in - ;; every CPP region APART FROM THE ONE BETWEEN BEG and END is - ;; suppressed. - `(unwind-protect - (c-save-buffer-state () - (save-restriction - (widen) - (c-clear-cpp-delimiters ,beg ,end)) - ,`(c-with-cpps-commented-out ,@forms)) - (c-save-buffer-state () - (save-restriction - (widen) - (c-set-cpp-delimiters ,beg ,end))))) - (defmacro c-self-bind-state-cache (&rest forms) ;; Bind the state cache to itself and execute the FORMS. Return the result ;; of the last FORM executed. It is assumed that no buffer changes will diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 12ec8f74fea..7b9baee6f76 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -238,8 +238,8 @@ ;; `c-macro-cache'. (defvar c-macro-cache-no-comment nil) (make-variable-buffer-local 'c-macro-cache-no-comment) -;; Either nil, or the last character of the macro currently represented by -;; `c-macro-cache' which isn't in a comment. */ +;; Either nil, or the position of a comment which is open at the end of the +;; macro represented by `c-macro-cache'. (defun c-invalidate-macro-cache (beg _end) ;; Called from a before-change function. If the change region is before or @@ -382,8 +382,9 @@ comment at the start of cc-engine.el for more info." (point))) (defun c-no-comment-end-of-macro () - ;; Go to the end of a CPP directive, or a pos just before which isn't in a - ;; comment. For this purpose, open strings are ignored. + ;; Go to the start of the comment which is open at the end of the current + ;; CPP directive, or to the end of that directive. For this purpose, open + ;; strings are ignored. ;; ;; This function must only be called from the beginning of a CPP construct. ;; @@ -401,7 +402,7 @@ comment at the start of cc-engine.el for more info." (setq s (parse-partial-sexp here there))) (when (and (nth 4 s) (not (eq (nth 7 s) 'syntax-table))) ; no pseudo comments. - (goto-char (1- (nth 8 s)))) + (goto-char (nth 8 s))) (setq c-macro-cache-no-comment (point))) (point))) @@ -3862,14 +3863,7 @@ comment at the start of cc-engine.el for more info." (if (eval-when-compile (memq 'category-properties c-emacs-features)) ;; Emacs (c-with-<->-as-parens-suppressed - (if (and c-state-old-cpp-beg - (< c-state-old-cpp-beg here)) - (c-with-all-but-one-cpps-commented-out - c-state-old-cpp-beg - c-state-old-cpp-end - (c-invalidate-state-cache-1 here)) - (c-with-cpps-commented-out - (c-invalidate-state-cache-1 here)))) + (c-invalidate-state-cache-1 here)) ;; XEmacs (c-invalidate-state-cache-1 here))) @@ -3902,12 +3896,7 @@ comment at the start of cc-engine.el for more info." (if (eval-when-compile (memq 'category-properties c-emacs-features)) ;; Emacs (c-with-<->-as-parens-suppressed - (if (and here-cpp-beg (> here-cpp-end here-cpp-beg)) - (c-with-all-but-one-cpps-commented-out - here-cpp-beg here-cpp-end - (c-parse-state-1)) - (c-with-cpps-commented-out - (c-parse-state-1)))) + (c-parse-state-1)) ;; XEmacs (c-parse-state-1)) (setq c-state-old-cpp-beg diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 169b61c3dd3..12a15873b1a 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -518,13 +518,13 @@ parameters \(point-min) and \(point-max).") (c objc) '(c-depropertize-new-text c-parse-quotes-after-change c-extend-font-lock-region-for-macros - c-neutralize-syntax-in-and-mark-CPP + c-neutralize-syntax-in-CPP c-change-expand-fl-region) c++ '(c-depropertize-new-text c-parse-quotes-after-change c-extend-font-lock-region-for-macros c-after-change-re-mark-raw-strings - c-neutralize-syntax-in-and-mark-CPP + c-neutralize-syntax-in-CPP c-restore-<>-properties c-change-expand-fl-region) java '(c-depropertize-new-text diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 22dea039cd1..4073a5a1b1a 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1016,15 +1016,10 @@ Note that the style variables are always made local to the buffer." t) (t nil))))))) -(defun c-neutralize-syntax-in-and-mark-CPP (_begg _endd _old-len) - ;; (i) "Neutralize" every preprocessor line wholly or partially in the - ;; changed region. "Restore" lines which were CPP lines before the change - ;; and are no longer so. - ;; - ;; (ii) Mark each CPP construct by placing a `category' property value - ;; `c-cpp-delimiter' at its start and end. The marked characters are the - ;; opening # and usually the terminating EOL, but sometimes the character - ;; before a comment delimiter. +(defun c-neutralize-syntax-in-CPP (_begg _endd _old-len) + ;; "Neutralize" every preprocessor line wholly or partially in the changed + ;; region. "Restore" lines which were CPP lines before the change and are + ;; no longer so. ;; ;; That is, set syntax-table properties on characters that would otherwise ;; interact syntactically with those outside the CPP line(s). @@ -1044,12 +1039,7 @@ Note that the style variables are always made local to the buffer." (c-save-buffer-state (limits) ;; Clear 'syntax-table properties "punctuation": ;; (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1)) - - ;; CPP "comment" markers: - (if (eval-when-compile (memq 'category-properties c-emacs-features));Emacs. - (c-clear-char-property-with-value - c-new-BEG c-new-END 'category 'c-cpp-delimiter)) - ;; FIXME!!! What about the "<" and ">" category properties? 2009-11-16 + ;; The above is now done in `c-depropertize-CPP'. ;; Add needed properties to each CPP construct in the region. (goto-char c-new-BEG) @@ -1076,11 +1066,7 @@ Note that the style variables are always made local to the buffer." (goto-char (match-beginning 1)) (setq mbeg (point)) (if (> (c-no-comment-end-of-macro) mbeg) - (progn - (c-neutralize-CPP-line mbeg (point)) ; "punctuation" properties - (if (eval-when-compile - (memq 'category-properties c-emacs-features)) ;Emacs. - (c-set-cpp-delimiters mbeg (point)))) ; "comment" markers + (c-neutralize-CPP-line mbeg (point)) ; "punctuation" properties (forward-line)) ; no infinite loop with, e.g., "#//" ))))) From ad2a47ce83c5c6fada96706a0e596ecc79d77696 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 21 Dec 2017 20:28:55 +0200 Subject: [PATCH 04/15] ; * src/xdisp.c (extend_face_to_end_of_line): Fix last change. --- src/xdisp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index c3a46651da8..538c3e6b87e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20274,13 +20274,14 @@ extend_face_to_end_of_line (struct it *it) it->area = LEFT_MARGIN_AREA; it->face_id = default_face->id; while (it->glyph_row->used[LEFT_MARGIN_AREA] - < WINDOW_LEFT_MARGIN_WIDTH (it->w)) + < WINDOW_LEFT_MARGIN_WIDTH (it->w) + && g < it->glyph_row->glyphs[TEXT_AREA]) { PRODUCE_GLYPHS (it); /* term.c:produce_glyphs advances it->current_x only for TEXT_AREA. */ it->current_x += it->pixel_width; - ++it->glyph_row->used[LEFT_MARGIN_AREA]; + g++; } it->current_x = saved_x; @@ -20314,11 +20315,12 @@ extend_face_to_end_of_line (struct it *it) it->area = RIGHT_MARGIN_AREA; it->face_id = default_face->id; while (it->glyph_row->used[RIGHT_MARGIN_AREA] - < WINDOW_RIGHT_MARGIN_WIDTH (it->w)) + < WINDOW_RIGHT_MARGIN_WIDTH (it->w) + && g < it->glyph_row->glyphs[LAST_AREA]) { PRODUCE_GLYPHS (it); it->current_x += it->pixel_width; - ++it->glyph_row->used[RIGHT_MARGIN_AREA]; + g++; } it->area = TEXT_AREA; From 798f07f1509ac973a379db921bd796e0df7f2982 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sun, 8 Oct 2017 17:25:31 +0200 Subject: [PATCH 05/15] Document that mode commands should be idempotent. * doc/lispref/modes.texi (Major Mode Conventions, Minor Mode Conventions): Document that the mode commands should be idempotent. --- doc/lispref/modes.texi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index bd94aeadf15..1a601baee86 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -313,6 +313,11 @@ The major mode command should set the variable @code{mode-name} to the Data}, for other possible forms). The name of the mode appears in the mode line. +@item +Calling the major mode command twice in direct succession should not +fail and should do the same thing as calling the command only once. +In other words, the major mode command should be idempotent. + @item @cindex functions in modes Since all global names are in the same name space, all the global @@ -1412,6 +1417,10 @@ a minor mode in a mode hook is a little uglier: @noindent However, this is not very commonly done. + Enabling or disabling a minor mode twice in direct succession should +not fail and should do the same thing as enabling or disabling it only +once. In other words, the minor mode command should be idempotent. + @item Add an element to @code{minor-mode-alist} for each minor mode (@pxref{Definition of minor-mode-alist}), if you want to indicate the From 164e84c9773d9738c80b49630c4e45d539b337ef Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Fri, 22 Dec 2017 09:20:41 +0100 Subject: [PATCH 06/15] Fix uses of 'nil' and 'non-nil' in manuals and a few more minor issues * doc/emacs/building.texi (Grep Searching): Fix doc of 'grep-save-buffers'. (Drag and Drop): Reorder paragraphs. Fix doc of 'mouse-drag-and-drop-region'. * doc/emacs/frames.texi (Word and Line Mouse): * doc/emacs/search.texi (Other Repeating Search): * doc/lispref/compile.texi (Compilation Functions): * doc/lispref/files.texi (Directory Names): * doc/lispref/functions.texi (Advising Named Functions): * doc/lispref/keymaps.texi (Controlling Active Maps): * doc/lispref/lists.texi (Association Lists): * doc/lispref/windows.texi (Quitting Windows): Fix uses of 'non-nil' and 'nil'. --- doc/emacs/building.texi | 9 +++++---- doc/emacs/frames.texi | 31 ++++++++++++++++--------------- doc/emacs/search.texi | 11 ++++++----- doc/lispref/compile.texi | 2 +- doc/lispref/files.texi | 3 ++- doc/lispref/functions.texi | 4 ++-- doc/lispref/keymaps.texi | 5 +++-- doc/lispref/lists.texi | 7 ++++--- doc/lispref/windows.texi | 4 ++-- 9 files changed, 41 insertions(+), 35 deletions(-) diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index e108a4e7c10..f342aef705e 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -394,10 +394,11 @@ match will be highlighted, instead of the entire source line. The @command{grep} commands will offer to save buffers before running. This is controlled by the @code{grep-save-buffers} variable. The possible values are either @code{nil} (don't save), @code{ask} -(ask before saving), a function which will be used as a predicate (and -is called with the file name as the parameter and should return -non-nil if the buffer is to be saved), and any other non-@code{nil} -value means that all buffers should be saved without asking. +(ask before saving), or a function which will be used as a predicate +(and is called with the file name as the parameter and should return +non-@code{nil} if the buffer is to be saved). Any other +non-@code{nil} value means that all buffers should be saved without +asking. @findex grep-find @findex find-grep diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index c94d690cf7f..58e70eefaf5 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -243,9 +243,9 @@ location of point. Double-clicking on the end of a parenthetical grouping or end string-delimiter keeps point at the end of the region by default, so the beginning of the region will not be visible if it is above the top of the window; setting the user option -@code{mouse-select-region-move-to-beginning} to non-nil changes this -to move point to the beginning of the region, scrolling the display -backward if necessary. +@code{mouse-select-region-move-to-beginning} to non-@code{nil} changes +this to move point to the beginning of the region, scrolling the +display backward if necessary. @item Double-Drag-mouse-1 Select the text you drag across, in the form of whole words. @@ -1094,18 +1094,6 @@ file on a Dired buffer moves or copies the file (according to the conventions of the application it came from) into the directory displayed in that buffer. -@vindex mouse-drag-and-drop-region - Emacs can also optionally drag the region of text by mouse into -another portion of this or another buffer. To enable that, customize -the variable @code{mouse-drag-and-drop-region} to a non-nil value. -Normally, the text is moved, i.e. cut and pasted, when the destination -is the same buffer as the origin; dropping the region on another -buffer copies the text instead. If the value of this variable names a -modifier key, such as @samp{shift} or @samp{control} or @samp{alt}, -then pressing that modifier key when dropping the text will copy it -instead of cutting it, even if you drop on the same buffer as the one -from which the text came. - @vindex dnd-open-file-other-window Dropping a file normally visits it in the window you drop it on. If you prefer to visit the file in a new window in such cases, customize @@ -1114,6 +1102,19 @@ the variable @code{dnd-open-file-other-window}. The XDND and Motif drag and drop protocols, and the old KDE 1.x protocol, are currently supported. +@vindex mouse-drag-and-drop-region + Emacs can also optionally drag the region with the mouse into +another portion of this or another buffer. To enable that, customize +the variable @code{mouse-drag-and-drop-region} to a non-@code{nil} +value. Normally, the text is moved, i.e. cut and pasted, when the +destination is the same buffer as the origin; dropping the region on +another buffer copies the text instead. If the value of this variable +names a modifier key, such as @samp{shift}, @samp{control} or +@samp{alt}, then pressing that modifier key when dropping the text +will copy it instead of cutting it, even if you drop on the same +buffer as the one from which the text came. + + @node Menu Bars @section Menu Bars @cindex Menu Bar mode diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 7b334733d67..c4853686ae0 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1746,12 +1746,13 @@ prompt, you can reuse search strings from previous incremental searches. The text that matched is highlighted using the @code{match} face. A numeric argument @var{n} specifies that @var{n} lines of context are to be displayed before and after each matching line. + The default number of context lines is specified by the variable -@code{list-matching-lines-default-context-lines}. -When @code{list-matching-lines-jump-to-current-line} is non-nil, -the current line is shown highlighted with face -@code{list-matching-lines-current-line-face} and the point is set -at the first match after such line. +@code{list-matching-lines-default-context-lines}. When +@code{list-matching-lines-jump-to-current-line} is non-@code{nil} the +current line is shown highlighted with face +@code{list-matching-lines-current-line-face} and the point is set at +the first match after such line. You can also run @kbd{M-s o} when an incremental search is active; this uses the current search string. diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 57ff06085d9..9123e93a5bf 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -94,7 +94,7 @@ the @code{byte-compile} function. You can compile a whole file with recorded in a buffer called @file{*Compile-Log*}, which uses Compilation mode. @xref{Compilation Mode,,,emacs, The GNU Emacs Manual}. However, if the variable @code{byte-compile-debug} is -non-nil, error message will be signaled as Lisp errors instead +non-@code{nil}, error messages will be signaled as Lisp errors instead (@pxref{Errors}). @cindex macro compilation diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 254eab03ea5..d249ce8783d 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2284,7 +2284,8 @@ because this is not portable. Always use @code{file-name-as-directory}. To avoid the issues mentioned above, or if the @var{dirname} value -might be nil (for example, from an element of @code{load-path}), use: +might be @code{nil} (for example, from an element of @code{load-path}), +use: @example (expand-file-name @var{relfile} @var{dirname}) diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 466a12f7a48..58eaf6b80ec 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1748,8 +1748,8 @@ code) obey the advice and other calls (from C code) do not. @defmac define-advice symbol (where lambda-list &optional name depth) &rest body This macro defines a piece of advice and adds it to the function named @var{symbol}. The advice is an anonymous function if @var{name} is -nil or a function named @code{symbol@@name}. See @code{advice-add} -for explanation of other arguments. +@code{nil} or a function named @code{symbol@@name}. See +@code{advice-add} for explanation of other arguments. @end defmac @defun advice-add symbol where function &optional props diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 73f5572e69d..71b054e063c 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -988,8 +988,9 @@ function is called with no arguments, prior to running each command, while @var{keymap} is active; it should return non-@code{nil} if @var{keymap} should stay active. -The optional argument @var{on-exit}, if non-nil, specifies a function -that is called, with no arguments, after @var{keymap} is deactivated. +The optional argument @var{on-exit}, if non-@code{nil}, specifies a +function that is called, with no arguments, after @var{keymap} is +deactivated. This function works by adding and removing @var{keymap} from the variable @code{overriding-terminal-local-map}, which takes precedence diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 0c993806824..230ea4b48eb 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1514,9 +1514,10 @@ of property lists and association lists. @defun assoc key alist &optional testfn This function returns the first association for @var{key} in @var{alist}, comparing @var{key} against the alist elements using -@var{testfn} if non-nil, or @code{equal} if nil (@pxref{Equality -Predicates}). It returns @code{nil} if no association in @var{alist} -has a @sc{car} equal to @var{key}. For example: +@var{testfn} if it is non-@code{nil} and @code{equal} otherwise +(@pxref{Equality Predicates}). It returns @code{nil} if no +association in @var{alist} has a @sc{car} equal to @var{key}. For +example: @smallexample (setq trees '((pine . cones) (oak . acorns) (maple . seeds))) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 08ed092c48c..07c8f27bc81 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -3059,7 +3059,7 @@ This function handles @var{window} and its buffer after quitting. The optional argument @var{window} must be a live window and defaults to the selected one. The function's behavior is determined by the four elements of the @code{quit-restore} window parameter (@pxref{Window -Parameters}), which is set to nil afterwards. +Parameters}), which is set to @code{nil} afterwards. The window is deleted entirely if: 1) the first element of the @code{quit-restore} parameter is one of 'window or 'frame, 2) the @@ -3126,7 +3126,7 @@ possible to set it manually, using the following code for displaying @end group @end example -Setting the window history to nil ensures that a future call to +Setting the window history to @code{nil} ensures that a future call to @code{quit-window} can delete the window altogether. @end defun From a0e3b06725a48379a2e341f90dd090f042ad8e18 Mon Sep 17 00:00:00 2001 From: Tak Kunihiro Date: Fri, 22 Dec 2017 09:39:07 +0100 Subject: [PATCH 07/15] Document 'mouse-drag-and-drop-region' options and mention them in NEWS * doc/emacs/frames.texi (Drag and Drop): * etc/NEWS (times): Document options for 'mouse-drag-and-drop-region' and mention them in NEWS. --- doc/emacs/frames.texi | 9 +++++++++ etc/NEWS | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 58e70eefaf5..5a052600ce4 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1114,6 +1114,15 @@ names a modifier key, such as @samp{shift}, @samp{control} or will copy it instead of cutting it, even if you drop on the same buffer as the one from which the text came. +In order to cut text even when source and destination buffers differ, +set the option +@code{mouse-drag-and-drop-region-cut-when-buffers-differ} to a +non-@code{nil} value. By default, on a graphic display the selected +text is shown in a tooltip and point moves together with the mouse +cursor during dragging. To suppress such behavior, set the options +@code{mouse-drag-and-drop-region-show-tooltip} and/or +@code{mouse-drag-and-drop-region-show-cursor} to @code{nil}. + @node Menu Bars @section Menu Bars diff --git a/etc/NEWS b/etc/NEWS index d751adde9b5..7ad852ec715 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -264,7 +264,11 @@ point to the beginning of the region. +++ ** The new user option 'mouse-drag-and-drop-region' allows to drag the -entire region of text to another place or another buffer. +entire region of text to another place or another buffer. Its +behavior is customizable via the new options +'mouse-drag-and-drop-region-cut-when-buffers-differ', +'mouse-drag-and-drop-region-show-tooltip' and +'mouse-drag-and-drop-region-show-cursor'. +++ ** The new user option 'confirm-kill-processes' allows the user to From d60faf32757ef007c7b5d07a8b248ee4a6f8f83e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 11:11:29 +0200 Subject: [PATCH 08/15] Improve detection of speller version in ispell.el * lisp/textmodes/ispell.el (ispell-check-version): Accept more general forms of version numbers for Aspell, Hunspell, and Enchant, to include various beta and prereleases. (Bug#29801) --- lisp/textmodes/ispell.el | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 6a169622f52..25f62e317c8 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -712,10 +712,10 @@ Otherwise returns the library directory name, if that is defined." (error "%s exited with %s %s" ispell-program-name (if (stringp status) "signal" "code") status)) - ;; Get relevant version strings. Only xx.yy.... format works well + ;; Get relevant version strings. (let (case-fold-search) (setq ispell-program-version - (and (search-forward-regexp "\\([0-9]+\\.[0-9\\.]+\\)" nil t) + (and (search-forward-regexp "\\([0-9]+\\.[0-9.]+\\)" nil t) (match-string 1))) ;; Make sure these variables are (re-)initialized to the default value @@ -725,19 +725,23 @@ Otherwise returns the library directory name, if that is defined." (goto-char (point-min)) (or (setq ispell-really-aspell - (and (search-forward-regexp - "(but really Aspell \\([0-9]+\\.[0-9\\.-]+\\)?)" nil t) - (match-string 1))) + (and + (search-forward-regexp + "(but really Aspell \\([0-9]+\\.[0-9.]+\\([-._+ ]?[a-zA-Z0-9]+\\)?\\)?)" + nil t) + (match-string 1))) (setq ispell-really-hunspell - (and (search-forward-regexp - "(but really Hunspell \\([0-9]+\\.[0-9\\.-]+\\)?)" - nil t) - (match-string 1))) + (and + (search-forward-regexp + "(but really Hunspell \\([0-9]+\\.[0-9.]+\\([-._+ ]?[a-zA-Z0-9]+\\)?\\)?)" + nil t) + (match-string 1))) (setq ispell-really-enchant - (and (search-forward-regexp - "(but really Enchant \\([0-9]+\\.[0-9\\.-]+\\)?)" - nil t) - (match-string 1))))) + (and + (search-forward-regexp + "(but really Enchant \\([0-9]+\\.[0-9.]+\\([-._+ ]?[a-zA-Z0-9]+\\)?\\)?)" + nil t) + (match-string 1))))) (let* ((aspell8-minver "0.60") (ispell-minver "3.1.12") From 90ca37feed236a2eb9d61e412dc3805aa8ad8933 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 11:19:56 +0200 Subject: [PATCH 09/15] Fix documentation of 'mouse-drag-and-drop-region' and friends * doc/emacs/frames.texi (Drag and Drop): Index 'mouse-drag-and-drop-region-cut-when-buffers-differ', 'mouse-drag-and-drop-region-show-tooltip', and 'mouse-drag-and-drop-region-show-cursor'. * etc/NEWS: Fix the format of the related entries. --- doc/emacs/frames.texi | 3 +++ etc/NEWS | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 5a052600ce4..0c994078327 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -1114,6 +1114,9 @@ names a modifier key, such as @samp{shift}, @samp{control} or will copy it instead of cutting it, even if you drop on the same buffer as the one from which the text came. +@vindex mouse-drag-and-drop-region-cut-when-buffers-differ +@vindex mouse-drag-and-drop-region-show-tooltip +@vindex mouse-drag-and-drop-region-show-cursor In order to cut text even when source and destination buffers differ, set the option @code{mouse-drag-and-drop-region-cut-when-buffers-differ} to a diff --git a/etc/NEWS b/etc/NEWS index 7ad852ec715..6e3001f5fa8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -256,18 +256,18 @@ whether the output buffer of an asynchronous command is shown immediately, or only when there is output. +++ -** The new user option 'mouse-select-region-move-to-beginning' -controls the position of point when double-clicking mouse-1 on the end -of a parenthetical grouping or string-delimiter: the default value nil -keeps point at the end of the region, setting it to non-nil moves -point to the beginning of the region. +** New user option 'mouse-select-region-move-to-beginning'. +This option controls the position of point when double-clicking +mouse-1 on the end of a parenthetical grouping or string-delimiter: +the default value nil keeps point at the end of the region, setting it +to non-nil moves point to the beginning of the region. +++ -** The new user option 'mouse-drag-and-drop-region' allows to drag the -entire region of text to another place or another buffer. Its -behavior is customizable via the new options +** New user option 'mouse-drag-and-drop-region'. +This option allows to drag the entire region of text to another place +or another buffer. Its behavior is customizable via the new options 'mouse-drag-and-drop-region-cut-when-buffers-differ', -'mouse-drag-and-drop-region-show-tooltip' and +'mouse-drag-and-drop-region-show-tooltip', and 'mouse-drag-and-drop-region-show-cursor'. +++ From 689526b714c3b4182110dc1ee59ff207b98d2fb6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 11:32:38 +0200 Subject: [PATCH 10/15] Fix interactive spec of 'semantic-ia-show-variants' * lisp/cedet/semantic/ia.el (semantic-ia-show-variants): Fix the interactive spec to match the function's expectations. (Bug#29770) --- lisp/cedet/semantic/ia.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el index 625c3ae9757..7ca29bd24b9 100644 --- a/lisp/cedet/semantic/ia.el +++ b/lisp/cedet/semantic/ia.el @@ -252,7 +252,7 @@ Completion options are calculated with `semantic-analyze-possible-completions'." ;;;###autoload (defun semantic-ia-show-variants (point) "Display a list of all variants for the symbol under POINT." - (interactive "P") + (interactive "d") (let* ((ctxt (semantic-analyze-current-context point)) (comp nil)) From 22b3075bb216c69ee7660151fda4eda70b9c3296 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 11:48:15 +0200 Subject: [PATCH 11/15] * etc/NEWS: Mention the removal of pinentry.el. (Bug#27445) --- etc/NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index 6e3001f5fa8..ccd819077ea 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1489,6 +1489,19 @@ passing '&optional' multiple times: Previously, Emacs would just ignore the extra keyword, or give incorrect results in certain cases. +--- +** The pinentry.el library has been removed. +That package (and the corresponding change in GnuPG and pinentry) +was intended to provide a way to input passphrase through Emacs with +GnuPG 2.0. However, the change to support that was only implemented +in GnuPG >= 2.1 and didn't get backported to GnuPG 2.0. And with +GnuPG 2.1 and later, pinentry.el is not needed at all. So the +library was useless, and we removed it. GnuPG 2.0 is no longer +supported by the upstream project. + +To adapt to the change, you may need to set 'epa-pinentry-mode' to the +symbol 'loopback'. + * Lisp Changes in Emacs 26.1 From 861d1100784ad2f4c7285a7afdc21e0ce216682c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 12:04:23 +0200 Subject: [PATCH 12/15] Improve documentation of records * doc/lispref/Makefile.in (srcs): Add the forgotten records.texi. * doc/lispref/records.texi (Records): Recommend that record type names use package-naming conventions. * etc/NEWS: Add the naming convention recommendation for record types. --- doc/lispref/Makefile.in | 1 + doc/lispref/records.texi | 9 ++++++++- etc/NEWS | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/lispref/Makefile.in b/doc/lispref/Makefile.in index 9fa5901a1ac..50d6d161ef6 100644 --- a/doc/lispref/Makefile.in +++ b/doc/lispref/Makefile.in @@ -118,6 +118,7 @@ srcs = \ $(srcdir)/package.texi \ $(srcdir)/positions.texi \ $(srcdir)/processes.texi \ + $(srcdir)/records.texi \ $(srcdir)/searching.texi \ $(srcdir)/sequences.texi \ $(srcdir)/streams.texi \ diff --git a/doc/lispref/records.texi b/doc/lispref/records.texi index 7cc36f14068..cae0f31f273 100644 --- a/doc/lispref/records.texi +++ b/doc/lispref/records.texi @@ -5,7 +5,7 @@ @c See the file elisp.texi for copying conditions. @node Records @chapter Records -@cindex record +@cindex records The purpose of records is to allow programmers to create objects with new types that are not built into Emacs. They are used as the @@ -28,6 +28,13 @@ type descriptor, the symbol naming its type will be returned; list specifying the contents. The first list element must be the record type. The following elements are the record slots. + To avoid conflicts with other type names, Lisp programs that define +new types of records should normally use the naming conventions of the +package where these record types are introduced for the names of the +types. Note that the names of the types which could possibly conflict +might not be known at the time the package defining a record type is +loaded; they could be loaded at some future point in time. + A record is considered a constant for evaluation: the result of evaluating it is the same record. This does not evaluate or even examine the slots. @xref{Self-Evaluating Forms}. diff --git a/etc/NEWS b/etc/NEWS index ccd819077ea..692c28a7210 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1584,6 +1584,10 @@ functions 'make-record', 'record', and 'recordp'. Records are now used internally to represent cl-defstruct and defclass instances, for example. +If your program defines new record types, you should use +package-naming conventions for naming those types. This is so any +potential conflicts with other types are avoided. + +++ ** 'save-some-buffers' now uses 'save-some-buffers-default-predicate' to decide which buffers to ask about, if the PRED argument is nil. From c3b6742b3fb7459af64eec4986837c4714636c51 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 12:18:12 +0200 Subject: [PATCH 13/15] Improve documentation of selecting windows * doc/lispref/windows.texi (Basic Windows, Selecting Windows): Clarify what selecting a window means for keyboard input, and that input focus may need to be considered when selecting windows on other frames. See http://lists.gnu.org/archive/html/emacs-devel/2017-12/msg00372.html for more details. --- doc/lispref/windows.texi | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 07c8f27bc81..d73b410f977 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -125,11 +125,13 @@ including for the case where @var{object} is a deleted window. as @dfn{selected within the frame}. For the selected frame, that window is called the @dfn{selected window}---the one in which most editing takes place, and in which the cursor for selected windows -appears (@pxref{Cursor Parameters}). The selected window's buffer is -usually also the current buffer, except when @code{set-buffer} has -been used (@pxref{Current Buffer}). As for non-selected frames, the -window selected within the frame becomes the selected window if the -frame is ever selected. @xref{Selecting Windows}. +appears (@pxref{Cursor Parameters}). Keyboard input that inserts or +deletes text is also normally directed to this window. The selected +window's buffer is usually also the current buffer, except when +@code{set-buffer} has been used (@pxref{Current Buffer}). As for +non-selected frames, the window selected within the frame becomes the +selected window if the frame is ever selected. @xref{Selecting +Windows}. @defun selected-window This function returns the selected window (which is always a live @@ -1726,7 +1728,7 @@ windows. @defun select-window window &optional norecord This function makes @var{window} the selected window and the window -selected within its frame (@pxref{Basic Windows}) and selects that +selected within its frame (@pxref{Basic Windows}), and selects that frame. It also makes @var{window}'s buffer (@pxref{Buffers and Windows}) current and sets that buffer's value of @code{point} to the value of @code{window-point} (@pxref{Window Point}) in @var{window}. @@ -1743,6 +1745,11 @@ next time. If @var{norecord} is non-@code{nil}, such updates are usually not performed. If, however, @var{norecord} equals the special symbol @code{mark-for-redisplay}, the additional actions mentioned above are omitted but @var{window} will be nevertheless updated. + +Note that sometimes selecting a window is not enough to show it, or +make its frame the top-most frame on display: you may also need to +raise the frame or make sure input focus is directed to that frame. +@xref{Input Focus}. @end defun @cindex select window hook From f7a62c2b488ceb8c56cba1f44aec73f8c1108816 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 12:25:09 +0200 Subject: [PATCH 14/15] Fix doc string of 'footnote-style-alist' * lisp/mail/footnote.el (footnote-style-alist): Remove a reference to non-existing files from doc string. (Bug#29759) --- lisp/mail/footnote.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el index 5e18d892d4a..68e5e474773 100644 --- a/lisp/mail/footnote.el +++ b/lisp/mail/footnote.el @@ -321,9 +321,7 @@ Use Unicode characters for footnoting." (unicode Footnote-unicode ,footnote-unicode-regexp)) "Styles of footnote tags available. By default only boring Arabic numbers, English letters and Roman Numerals -are available. -See footnote-han.el, footnote-greek.el and footnote-hebrew.el for more -exciting styles.") +are available.") (defcustom footnote-style 'numeric "Default style used for footnoting. From 34fcfc5c049bb99d68945bb24fb9d6a0789a33dd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Dec 2017 12:37:19 +0200 Subject: [PATCH 15/15] * lisp/emacs-lisp/inline.el (define-inline): Add a doc string. --- lisp/emacs-lisp/inline.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/emacs-lisp/inline.el b/lisp/emacs-lisp/inline.el index ff27158f836..b9f63c94474 100644 --- a/lisp/emacs-lisp/inline.el +++ b/lisp/emacs-lisp/inline.el @@ -124,6 +124,10 @@ After VARS is handled, BODY is evaluated in the new environment." ;;;###autoload (defmacro define-inline (name args &rest body) + "Define an inline function NAME with arguments ARGS and body in BODY. + +This is like `defmacro', but has several advantages. +See Info node `(elisp)Defining Functions' for more details." ;; FIXME: How can this work with CL arglists? (declare (indent defun) (debug defun) (doc-string 3)) (let ((doc (if (stringp (car-safe body)) (list (pop body))))