commit 0a492e4dfa188f32fd04cdf95c9fa6324facae08 (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Tue Nov 12 23:31:12 2019 +0200 * lisp/tab-line.el (tab-line-tabs-buffer-list-function): New variable. (tab-line-tabs-buffer-list): New function. (tab-line-tabs-mode-buffers, tab-line-tabs-buffer-groups): Call tab-line-tabs-mode-buffers. (tab-line-tabs-buffer-groups): Add 'close' function that uses kill-buffer instead of bury-buffer that makes no sense here. (tab-line-format): Don't show the close button when a tab has no 'close' function or buffer. (tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab): Support tabs with 'buffer' properties. (tab-line-close-tab): Call 'close' function when defined. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index bf090374fa..6f5b40657a 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -281,13 +281,22 @@ with the same major mode as the current buffer." :group 'tab-line :version "27.1") +(defvar tab-line-tabs-buffer-list-function #'tab-line-tabs-buffer-list + "Function to return a global list of buffers. +Used only for `tab-line-tabs-mode-buffers' and `tab-line-tabs-buffer-groups'.") + +(defun tab-line-tabs-buffer-list () + (seq-filter (lambda (b) (and (buffer-live-p b) + (/= (aref (buffer-name b) 0) ?\s))) + (buffer-list))) + (defun tab-line-tabs-mode-buffers () "Return a list of buffers with the same major mode with current buffer." (let ((mode major-mode)) (seq-sort-by #'buffer-name #'string< (seq-filter (lambda (b) (with-current-buffer b (derived-mode-p mode))) - (buffer-list))))) + (funcall tab-line-tabs-buffer-list-function))))) (defvar tab-line-tabs-buffer-group-function nil "Function to put a buffer to the group. @@ -308,18 +317,17 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") (defun tab-line-tabs-buffer-group-name (&optional buffer) (if (functionp tab-line-tabs-buffer-group-function) (funcall tab-line-tabs-buffer-group-function buffer) - (unless (= (elt (buffer-name buffer) 0) ?\s) - (let ((mode (if buffer (with-current-buffer buffer - (format-mode-line mode-name)) - (format-mode-line mode-name)))) - (or (cdr (seq-find (lambda (group) - (string-match-p (car group) mode)) - tab-line-tabs-buffer-groups)) - mode))))) + (let ((mode (if buffer (with-current-buffer buffer + (format-mode-line mode-name)) + (format-mode-line mode-name)))) + (or (cdr (seq-find (lambda (group) + (string-match-p (car group) mode)) + tab-line-tabs-buffer-groups)) + mode)))) (defun tab-line-tabs-buffer-groups () (if (window-parameter nil 'tab-line-groups) - (let* ((buffers (buffer-list)) + (let* ((buffers (funcall tab-line-tabs-buffer-list-function)) (groups (seq-sort tab-line-tabs-buffer-groups-sort-function (delq nil (mapcar #'car (seq-group-by @@ -341,8 +349,8 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") tabs) (let* ((window-parameter (window-parameter nil 'tab-line-group)) - (group-name (tab-line-tabs-buffer-group-name)) - (group (prog1 (or window-parameter group-name) + (group-name (tab-line-tabs-buffer-group-name (current-buffer))) + (group (prog1 (or window-parameter group-name "All") (when (equal window-parameter group-name) (set-window-parameter nil 'tab-line-group nil)))) (group-tab `(tab @@ -358,8 +366,8 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") (equal (tab-line-tabs-buffer-group-name b) group)) (seq-uniq (append (list (current-buffer)) - (reverse (mapcar #'car (window-prev-buffers))) - (buffer-list))))) + (mapcar #'car (window-prev-buffers)) + (funcall tab-line-tabs-buffer-list-function))))) (sorted-buffers (if (functionp tab-line-tabs-buffer-group-sort-function) (seq-sort tab-line-tabs-buffer-group-sort-function buffers) @@ -368,7 +376,11 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") `(tab (name . ,(funcall tab-line-tab-name-function buffer)) (selected . ,(eq buffer (current-buffer))) - (buffer . ,buffer))) + (buffer . ,buffer) + (close . ,(lambda (&optional b) + ;; kill-buffer because bury-buffer + ;; won't remove the buffer from tab-line + (kill-buffer (or b buffer)))))) sorted-buffers))) (cons group-tab tabs)))) @@ -427,7 +439,8 @@ variable `tab-line-tabs-function'." separator (apply 'propertize (concat (propertize name 'keymap tab-line-tab-map) - (or (and tab-line-close-button-show + (or (and (or buffer-p (assq 'buffer tab) (assq 'close tab)) + tab-line-close-button-show (not (eq tab-line-close-button-show (if selected-p 'non-selected 'selected))) tab-line-close-button) "")) @@ -506,8 +519,9 @@ using the `previous-buffer' command." (tab-line-select-tab-buffer buffer (posn-window posnp)) (let ((select (cdr (assq 'select tab)))) (when (functionp select) - (funcall select) - (force-mode-line-update)))))) + (with-selected-window (posn-window posnp) + (funcall select) + (force-mode-line-update))))))) (defun tab-line-select-tab-buffer (buffer &optional window) (let* ((window-buffer (window-buffer window)) @@ -539,9 +553,17 @@ Its effect is the same as using the `previous-buffer' command (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (switch-to-prev-buffer window) (with-selected-window (or window (selected-window)) - (let ((buffer (cadr (memq (current-buffer) - (reverse (funcall tab-line-tabs-function)))))) - (when buffer (switch-to-buffer buffer))))))) + (let* ((tabs (funcall tab-line-tabs-function)) + (tab (nth (1- (seq-position + tabs (current-buffer) + (lambda (tab buffer) + (if (bufferp tab) + (eq buffer tab) + (eq buffer (cdr (assq 'buffer tab))))))) + tabs)) + (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))) + (when (bufferp buffer) + (switch-to-buffer buffer))))))) (defun tab-line-switch-to-next-tab (&optional mouse-event) "Switch to the next tab. @@ -552,16 +574,26 @@ Its effect is the same as using the `next-buffer' command (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (switch-to-next-buffer window) (with-selected-window (or window (selected-window)) - (let ((buffer (cadr (memq (current-buffer) - (funcall tab-line-tabs-function))))) - (when buffer (switch-to-buffer buffer))))))) + (let* ((tabs (funcall tab-line-tabs-function)) + (tab (nth (1+ (seq-position + tabs (current-buffer) + (lambda (tab buffer) + (if (bufferp tab) + (eq buffer tab) + (eq buffer (cdr (assq 'buffer tab))))))) + tabs)) + (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))) + (when (bufferp buffer) + (switch-to-buffer buffer))))))) (defcustom tab-line-close-tab-action 'bury-buffer "Defines what to do on closing the tab. If `bury-buffer', put the tab's buffer at the end of the list of all buffers that effectively hides the buffer's tab from the tab line. -If `kill-buffer', kills the tab's buffer." +If `kill-buffer', kills the tab's buffer. +This option is useful when `tab-line-tabs-function' has the value +`tab-line-tabs-window-buffers'." :type '(choice (const :tag "Bury buffer" bury-buffer) (const :tag "Kill buffer" kill-buffer)) :group 'tab-line @@ -575,10 +607,13 @@ from the tab line." (interactive (list last-nonmenu-event)) (let* ((posnp (and (listp mouse-event) (event-start mouse-event))) (window (and posnp (posn-window posnp))) - (buffer (or (get-pos-property 1 'tab (car (posn-string posnp))) - (current-buffer)))) + (tab (get-pos-property 1 'tab (car (posn-string posnp)))) + (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab)))) + (close-action (unless (bufferp tab) (cdr (assq 'close tab))))) (with-selected-window (or window (selected-window)) (cond + ((functionp close-action) + (funcall close-action)) ((eq tab-line-close-tab-action 'kill-buffer) (kill-buffer buffer)) ((eq tab-line-close-tab-action 'bury-buffer) commit d0351f4d2010e3e8f3ada04b045dede10f110d7f Author: Juri Linkov Date: Tue Nov 12 23:21:14 2019 +0200 * lisp/dired.el (dired-dwim-target): Add new choices (bug#35385) * lisp/dired.el (dired-dwim-target): Add choices dired-dwim-target-next and dired-dwim-target-recent. * lisp/dired-aux.el (dired-dwim-target-next) (dired-dwim-target-recent): New functions. (dired-dwim-target-directories): Call either of them. * doc/emacs/dired.texi (Operating on Files): Mention new preferences in dired-dwim-target. diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index c32255a86d..8fab508dea 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -654,10 +654,12 @@ commands, use the same conventions to decide which files to work on. Commands which ask for a destination directory, such as those which copy and rename files or create links for them, try to guess the default target directory for the operation. Normally, they suggest the Dired -buffer's default directory, but if the variable @code{dired-dwim-target} -is non-@code{nil}, and if there is another Dired buffer displayed in one -of the most recently used windows, that other buffer's directory is -suggested instead. +buffer's default directory, but if the option @code{dired-dwim-target} +is non-@code{nil}, and if there is another Dired buffer displayed in +some window, that other buffer's directory is suggested instead. +You can customize @code{dired-dwim-target} to prefer either the next +window with a Dired buffer, or the most recently used window with +a Dired buffer. Here are the file-manipulating Dired commands that operate on files. diff --git a/etc/NEWS b/etc/NEWS index 4134f7bb5f..ff33449329 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -852,8 +852,8 @@ pipes, block devices and character devices. directories in the destination. +++ -*** The non-nil value of 'dired-dwim-target' uses one of the most recently -visited windows with a Dired buffer instead of the next window. +*** 'dired-dwim-target' can be customized to prefer either the next window, +or one of the most recently visited windows with a Dired buffer. *** When the new user option 'dired-vc-rename-file' is non-nil, Dired performs file renaming using underlying version control system. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 184b507e1d..9f34b2afe9 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1993,6 +1993,22 @@ Optional arg HOW-TO determines how to treat the target. (format prompt (dired-mark-prompt arg files)) dir default)) (defun dired-dwim-target-directories () + (cond ((functionp dired-dwim-target) + (funcall dired-dwim-target)) + (dired-dwim-target + (dired-dwim-target-next)))) + +(defun dired-dwim-target-next () + ;; Return directories from all next visible windows with dired-mode buffers. + (mapcan (lambda (w) + (with-current-buffer (window-buffer w) + (when (eq major-mode 'dired-mode) + (list (dired-current-directory))))) + (delq (selected-window) (window-list-1 + (next-window nil 'nomini 'visible) + 'nomini 'visible)))) + +(defun dired-dwim-target-recent () ;; Return directories from all visible windows with dired-mode buffers ;; ordered by most-recently-used. (mapcar #'cdr (sort (mapcan (lambda (w) diff --git a/lisp/dired.el b/lisp/dired.el index 9d0b13e227..009018fafe 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -185,12 +185,22 @@ If a character, new links are unconditionally marked with that character." (defcustom dired-dwim-target nil "If non-nil, Dired tries to guess a default target directory. -This means: if there is a Dired buffer displayed in one of the most -recently selected windows, use its current directory, instead of this -Dired buffer's current directory. +This means: if there is a Dired buffer displayed in some window, +use its current directory, instead of this Dired buffer's +current directory. + +You can customize it to prefer either the next window with a Dired buffer, +or the most recently used window with a Dired buffer. The target is used in the prompt for file copy, rename etc." - :type 'boolean + :type '(choice + (const :tag "No guess" nil) + (function-item :tag "Prefer next windows" + dired-dwim-target-next) + (function-item :tag "Prefer most recently used windows" + dired-dwim-target-recent) + (function :tag "Your function") + (other :tag "Try to guess" t)) :group 'dired) (defcustom dired-copy-preserve-time t commit 4cccf7659a4767274b383e5fc820e27391988cc7 Author: Paul Eggert Date: Tue Nov 12 11:29:00 2019 -0800 Conditionally omit edition numbers, dates in doc This redoes the 2019-11-02T00:24:02!eggert@cs.ucla.edu patch, updated after consultation with John Sullivan. Omit printed edition numbers in online manuals while keeping them in printed manuals. In online manuals the edition numbers seem to cause more confusion than they cure; e.g., https://shop.fsf.org/books/gnu-emacs-manual-18th-edition-v-261 currently advertises "18th edition" even as it points to https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf which says "Seventeenth Edition". It is simpler and less confusing to stick to one version number like "27.0" in online manuals. For printed manuals people can run, e.g., "texi2any -D 'EDITION Nineteenth'" when generating the 19th printed edition of the Emacs manual. * doc/emacs/emacs.texi (EDITION): * doc/lispintro/emacs-lisp-intro.texi (edition-number, update-date): * doc/lispref/elisp.texi (VERSION, DATE): Remove definitions. Instead, let the person printing the book specify these values, with the default being the online version which does not have printed edition numbers. * doc/lispintro/emacs-lisp-intro.texi (titlepage-edition-number): New flag, for the edition number as it appears on the title page. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index a7967ecaee..d23e682cc8 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -3,28 +3,21 @@ @setfilename ../../info/emacs.info @settitle GNU Emacs Manual @include docstyle.texi - -@c The edition number appears in more than one place in this file -@c I don't really know what it means... -@c For example, it has said "Sixteenth" since sometime in the Emacs 22 -@c series, all through 23, and into 24. So it is not very useful IMO, -@c and offers nothing that EMACSVER does not. I guess it relates -@c mainly to the published book sold by the FSF. Hence no longer -@c bother including it except iftex. Really, I think it should not be -@c here at all (since anyone can make a pdf version), but should just -@c be something added by the FSF during the publishing process. -@c Also, the lispref uses a float (3.0), whereas this uses an ordinal, -@c so the format is not even consistent. -@set EDITION Seventeenth @include emacsver.texi +@c When printing, define EDITION to be the printed edition number, in +@c the preferred style for ordinal edition numbers. E.g., run the +@c shell command "texi2any -D 'EDITION Nineteenth'" for the 19th +@c printed edition where the edition number is spelled out in English. +@c This relates mainly to the published book sold by the FSF. + @copying -@iftex +@ifset EDITION This is the @value{EDITION} edition of the @cite{GNU Emacs Manual},@* -@end iftex -@ifnottex +@end ifset +@ifclear EDITION This is the @cite{GNU Emacs Manual}, -@end ifnottex +@end ifclear updated for Emacs version @value{EMACSVER}. Copyright @copyright{} 1985--1987, 1993--2019 Free Software Foundation, Inc. @@ -82,7 +75,12 @@ developing GNU and promoting software freedom.'' @sp 6 @center @titlefont{GNU Emacs Manual} @sp 4 +@ifset EDITION @center @value{EDITION} Edition, Updated for Emacs Version @value{EMACSVER}. +@end ifset +@ifclear EDITION +@center Updated for Emacs Version @value{EMACSVER} +@end ifclear @sp 5 @center Richard Stallman et al. @page diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 489ba8d6ef..710e64f457 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -63,10 +63,6 @@ \global\hbadness=6666 % don't worry about not-too-underfull boxes @end tex -@c These refer to the printed book sold by the FSF. -@set edition-number 3.10 -@set update-date 28 October 2009 - @c For next or subsequent edition: @c create function using with-output-to-temp-buffer @c create a major mode, with keymaps @@ -102,16 +98,24 @@ * Emacs Lisp Intro: (eintr). A simple introduction to Emacs Lisp programming. @end direntry +@c When printing, define edition-number to be the printed edition +@c number, titlepage-edition-number to be the spelled out edition +@c number suitable for the title page, and update-date to be the date, +@c in the preferred style for these. E.g., run the shell command: +@c texi2any -D 'edition-number 3.11' \ +@c -D 'titlepage-edition-number Revised Third Edtion' \ +@c -D 'update-date 31 March 2020' +@c This relates mainly to the published book sold by the FSF. + @copying This is @cite{An Introduction to Programming in Emacs Lisp}, for people who are not programmers. @sp 1 -@iftex +@ifset edition-number Edition @value{edition-number}, @value{update-date} -@end iftex -@ifnottex +@end ifset +@sp 1 Distributed with Emacs version @value{EMACSVER}. -@end ifnottex @sp 1 Copyright @copyright{} 1990--1995, 1997, 2001--2019 Free Software Foundation, Inc. @@ -173,7 +177,9 @@ supports it in developing GNU and promoting software freedom.'' @sp 2 @center @titlefont{Programming in Emacs Lisp} @sp 2 -@center Revised Third Edition +@ifset titlepage-edition-number +@center @value{titlepage-edition-number} +@end ifset @sp 4 @center by Robert J. Chassell diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index d667c51d78..72ad8a751d 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -52,12 +52,7 @@ @end ifset @end tex - -@c Version of the manual and of Emacs. -@c (See comments for EDITION in emacs.texi) -@set VERSION 3.1 @include emacsver.texi -@set DATE October 2014 @c in general, keep the following line commented out, unless doing a @c copy of this manual that will be published. The manual should go @@ -90,13 +85,18 @@ @c We use the "type index" to index new functions and variables. @c @syncodeindex tp fn +@c When printing, define VERSION to be the printed edition number and +@c DATE to be the printed edition's date. E.g., run the shell command +@c "texi2any -D 'VERSION 3.2' -D 'DATE 31 March 2020'". This relates +@c mainly to the published book sold by the FSF. + @copying -@iftex +@ifset VERSION This is edition @value{VERSION} of the @cite{GNU Emacs Lisp Reference Manual},@* -@end iftex -@ifnottex +@end ifset +@ifclear VERSION This is the @cite{GNU Emacs Lisp Reference Manual} -@end ifnottex +@end ifclear corresponding to Emacs version @value{EMACSVER}. Copyright @copyright{} 1990--1996, 1998--2019 Free Software Foundation, Inc. @@ -127,7 +127,9 @@ developing GNU and promoting software freedom.'' @subtitle @value{voltitle} @end ifset @subtitle For Emacs Version @value{EMACSVER} +@ifset VERSION @subtitle Revision @value{VERSION}, @value{DATE} +@end ifset @author by Bil Lewis, Dan LaLiberte, Richard Stallman, @author the GNU Manual Group, et al. commit 1e5392a4ae710486f77afb5898c552b5b0e85061 Author: Martin Rudalics Date: Tue Nov 12 16:44:30 2019 +0100 Make sure buffer is live before retrieving underline properties (Bug#38038) * src/window.h (WINDOW_BUFFER_LOCAL_VALUE): New macro. * src/nsterm.m (ns_draw_text_decoration): * src/w32term.c (w32_draw_glyph_string): * src/xterm.c (x_draw_glyph_string): Make sure buffer is live before retrieving underline properties from it (Bug#38038). diff --git a/src/nsterm.m b/src/nsterm.m index 9d5082b71d..e1d745e332 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3435,19 +3435,22 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. unsigned long descent = s->y + s->height - s->ybase; unsigned long minimum_offset; BOOL underline_at_descent_line, use_underline_position_properties; - Lisp_Object val = buffer_local_value (Qunderline_minimum_offset, - s->w->contents); - if (FIXNUMP (val)) - minimum_offset = XFIXNAT (val); - else - minimum_offset = 1; - val = buffer_local_value (Qx_underline_at_descent_line, - s->w->contents); - underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound)); - val = buffer_local_value (Qx_use_underline_position_properties, - s->w->contents); - use_underline_position_properties = - !(NILP (val) || EQ (val, Qunbound)); + Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE + (Qunderline_minimum_offset, s->w)); + + if (FIXNUMP (val)) + minimum_offset = XFIXNAT (val); + else + minimum_offset = 1; + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_underline_at_descent_line, s->w)); + underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound)); + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_use_underline_position_properties, s->w)); + use_underline_position_properties + = !(NILP (val) || EQ (val, Qunbound)); /* Use underline thickness of font, defaulting to 1. */ thickness = (font && font->underline_thickness > 0) diff --git a/src/w32term.c b/src/w32term.c index 9da0845836..d0537c67e9 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2512,20 +2512,21 @@ w32_draw_glyph_string (struct glyph_string *s) unsigned long minimum_offset; BOOL underline_at_descent_line; BOOL use_underline_position_properties; - Lisp_Object val - = buffer_local_value (Qunderline_minimum_offset, - s->w->contents); + Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE + (Qunderline_minimum_offset, s->w)); + if (FIXNUMP (val)) minimum_offset = max (0, XFIXNUM (val)); else minimum_offset = 1; - val = buffer_local_value (Qx_underline_at_descent_line, - s->w->contents); + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_underline_at_descent_line, s->w)); underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound)); - val - = buffer_local_value (Qx_use_underline_position_properties, - s->w->contents); + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_use_underline_position_properties, s->w)); use_underline_position_properties = !(NILP (val) || EQ (val, Qunbound)); diff --git a/src/window.h b/src/window.h index 71946a5695..5b9a3140c8 100644 --- a/src/window.h +++ b/src/window.h @@ -608,6 +608,13 @@ wset_next_buffers (struct window *w, Lisp_Object val) ? (W)->contents \ : Qnil) +/* Local value of variable V in window W's buffer. Nil if W has no + buffer. */ +#define WINDOW_BUFFER_LOCAL_VALUE(V, W) \ + (BUFFERP ((W)->contents) \ + ? buffer_local_value(V, (W)->contents) \ + : Qnil) + /* Return the canonical column width of the frame of window W. */ #define WINDOW_FRAME_COLUMN_WIDTH(W) \ (FRAME_COLUMN_WIDTH (WINDOW_XFRAME ((W)))) diff --git a/src/xterm.c b/src/xterm.c index 44fbd27b11..f7005804f0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3847,20 +3847,21 @@ x_draw_glyph_string (struct glyph_string *s) unsigned long minimum_offset; bool underline_at_descent_line; bool use_underline_position_properties; - Lisp_Object val - = buffer_local_value (Qunderline_minimum_offset, - s->w->contents); + Lisp_Object val = (WINDOW_BUFFER_LOCAL_VALUE + (Qunderline_minimum_offset, s->w)); + if (FIXNUMP (val)) minimum_offset = max (0, XFIXNUM (val)); else minimum_offset = 1; - val = buffer_local_value (Qx_underline_at_descent_line, - s->w->contents); + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_underline_at_descent_line, s->w)); underline_at_descent_line = !(NILP (val) || EQ (val, Qunbound)); - val - = buffer_local_value (Qx_use_underline_position_properties, - s->w->contents); + + val = (WINDOW_BUFFER_LOCAL_VALUE + (Qx_use_underline_position_properties, s->w)); use_underline_position_properties = !(NILP (val) || EQ (val, Qunbound)); commit 6eaf62df205569f234160e7035dd7116af57810e Author: Stefan Monnier Date: Tue Nov 12 08:39:18 2019 -0500 * lisp/emacs-lisp/easymenu.el (easy-menu-make-symbol): Fix last change diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index 292d50b91a..15b8bef428 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -475,7 +475,7 @@ When non-nil, NOEXP indicates that CALLBACK cannot be an expression ;; `functionp' is probably not needed. (functionp callback) noexp) callback - (lambda () (interactive) callback))) + (eval `(lambda () (interactive) ,callback) t))) command)) ;;;###autoload commit 555f5f78f8f3de71431774fdabbabbcec7242727 Author: Paul Eggert Date: Mon Nov 11 22:54:06 2019 -0800 Fix a few more minor quoting problems. diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el index 1ddb87ae86..559f65c29b 100644 --- a/lisp/erc/erc-stamp.el +++ b/lisp/erc/erc-stamp.el @@ -357,7 +357,7 @@ Return the empty string if FORMAT is nil." ts) "")) -;; This function is used to munge `buffer-invisibility-spec to an +;; This function is used to munge `buffer-invisibility-spec' to an ;; appropriate value. Currently, it only handles timestamps, thus its ;; location. If you add other features which affect invisibility, ;; please modify this function and move it to a more appropriate diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index d0a38e17c8..6e527a5a7a 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el @@ -1459,7 +1459,7 @@ group." (while (and allservers (not found)) (setq mairixserver (gnus-server-to-method (car (pop allservers)))) ;; First we look if SERVER is the backend of current nnmairix server - (setq found (and (eq (cadr (assoc `nnmairix-backend mairixserver)) + (setq found (and (eq (cadr (assoc 'nnmairix-backend mairixserver)) (car server)) (string= (cadr (assoc 'nnmairix-backend-server mairixserver)) (nth 1 server)))) diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el index 4d24e694a1..d4eac2a2e0 100644 --- a/lisp/obsolete/vip.el +++ b/lisp/obsolete/vip.el @@ -2250,7 +2250,7 @@ a token has type \(command, address, end-mark\) and value." (forward-char 1) (cond ((looking-at "'") (setq ex-token nil)) ((looking-at "[a-z]") (setq ex-token (following-char))) - (t (error "%s" "Marks are ' and a-z" ?'))) + (t (error "%s" "Marks are ' and a-z"))) (forward-char 1)) ((looking-at "\n") (setq ex-token-type "end-mark") diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index f412dbcd54..5a3386f227 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1252,7 +1252,7 @@ FMTS is a list of format specs for transforming the file name. (unless file (setq file '("*unknown*"))) (let* ((file-struct (compilation-get-file-structure file fmts)) ;; Get first already existing marker (if any has one, all have one). - ;; Do this first, as the compilation-assq`s may create new nodes. + ;; Do this first, as the compilation-assq's may create new nodes. (marker-line ; a line structure (cadr (compilation--file-struct->loc-tree file-struct))) (marker diff --git a/lisp/simple.el b/lisp/simple.el index 47d4adb0fd..872fb13237 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -9065,7 +9065,7 @@ contains the list of implementations currently supported for this command." (unless (string-equal val "") (when (null ,varimp-sym) (message - "Use C-u M-x %s RET`to select another implementation" + "Use `C-u M-x %s RET' to select another implementation" ,command-name) (sit-for 3)) (customize-save-variable ',varimp-sym diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el index 67ecd3ced8..56737571c4 100644 --- a/lisp/textmodes/remember.el +++ b/lisp/textmodes/remember.el @@ -148,7 +148,7 @@ ;; out, in the long run? Perhaps its because the time we save ;; electronically in one way, we're losing electronically in another; ;; the tool should never dominate one's focus. As the mystic -;; Faridu'd-Din `Attar wrote: "Be occupied as little as possible with +;; Farīd ud-Dīn ʿAṭṭār wrote: "Be occupied as little as possible with ;; things of the outer world but much with things of the inner world; ;; then right action will overcome inaction." ;; commit c5fd4d373ed6d80b744951afe13e50070bff41cf Author: Lars Ingebrigtsen Date: Tue Nov 12 03:40:06 2019 +0100 Rename font-log-refontify * lisp/font-lock.el (font-lock-debug-fontify): Rename to make it clearer what the function is for. * doc/lispref/modes.texi (Font Lock Basics): Ditto. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index b7e574740a..7283930507 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2738,11 +2738,11 @@ This function should make sure the region between @var{beg} and accessible portion. Calls the function specified by @code{font-lock-ensure-function}. -@item font-lock-refontify +@item font-lock-debug-fontify This is a convenience command meant to be used when developing font locking for a mode, and should not be called from Lisp code. It recomputes all the relevant variables and then calls -@code{font-lock-ensure} on the entire buffer. +@code{font-lock-fontify-region} on the entire buffer. @end ftable There are several variables that control how Font Lock mode highlights diff --git a/lisp/font-lock.el b/lisp/font-lock.el index f254211aa2..01c19e6e87 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1100,8 +1100,8 @@ accessible portion of the current buffer." "Function to make sure a region has been fontified. Called with two arguments BEG and END.") -(defun font-lock-refontify () - "Reinitialise the font-lock machinery and re-fontify the buffer. +(defun font-lock-debug-fontify () + "Reinitialise the font-lock machinery and (re-)fontify the buffer. This functions is a convenience functions when developing font locking for a mode, and is not meant to be called from lisp functions." (interactive) commit 96828581d9efdcff4ac0c11d0f638d99d3a191bf Author: Stefan Monnier Date: Mon Nov 11 17:14:30 2019 -0500 * lisp/startup.el (command-line): Fix last change in package--activated diff --git a/lisp/startup.el b/lisp/startup.el index 5fd76d9284..efd1ae9a4f 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1013,8 +1013,6 @@ the `--debug-init' option to view a complete error backtrace." (when debug-on-error-should-be-set (setq debug-on-error debug-on-error-from-init-file)))) -(defvar package--activated) - (defun command-line () "A subroutine of `normal-top-level'. Amongst another things, it parses the command-line arguments." @@ -1235,7 +1233,7 @@ please check its value") ;; If any package directory exists, initialize the package system. (and user-init-file package-enable-at-startup - (not package--activated) + (not (bound-and-true-p package--activated)) (catch 'package-dir-found (let (dirs) (if (boundp 'package-directory-list) commit 6b4a97c1c78f39ce890d100acceceb652d14e20d Author: Paul Eggert Date: Mon Nov 11 10:30:13 2019 -0800 Fix some quoting glitches in doc strings diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el index 355f72cd15..a757a8bf91 100644 --- a/lisp/calendar/cal-dst.el +++ b/lisp/calendar/cal-dst.el @@ -61,11 +61,11 @@ list and for correcting times of day in the solar and lunar calculations. For example, if daylight saving time is mandated to start on October 1, you would set `calendar-daylight-savings-starts' to - '(10 1 year) + (10 1 year) If it starts on the first Sunday in April, you would set it to - '(calendar-nth-named-day 1 0 4 year) + (calendar-nth-named-day 1 0 4 year) If the locale never uses daylight saving time, set this to nil." :type 'sexp diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index f46c07407d..e93ee2118e 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -71,7 +71,7 @@ (defcustom cal-tex-which-days '(0 1 2 3 4 5 6) "The days of the week that are displayed on the portrait monthly calendar. Sunday is 0, Monday is 1, and so on. The default is to print from Sunday to -Saturday. For example, use '(1 3 5) to only print Monday, Wednesday, Friday." +Saturday. For example, (1 3 5) prints only Monday, Wednesday, Friday." :type '(repeat integer) :group 'calendar-tex) @@ -109,7 +109,7 @@ date in the weekly calendars, and in the top center of daily calendars. The default is ordinal day number of the year and the number of days remaining. As an example, setting this to - '(calendar-hebrew-date-string date) + (calendar-hebrew-date-string date) will put the Hebrew date at the bottom of each day." :type 'sexp diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el index 19a4ef9851..6987e4e143 100644 --- a/lisp/cedet/cedet-cscope.el +++ b/lisp/cedet/cedet-cscope.el @@ -39,12 +39,12 @@ (defun cedet-cscope-search (searchtext texttype type scope) "Perform a search with CScope, return the created buffer. SEARCHTEXT is text to find. -TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, -'tagregexp, or 'tagcompletions. +TEXTTYPE is the type of text, such as `regexp', `string', `tagname', +`tagregexp', or `tagcompletions'. TYPE is the type of search, meaning that SEARCHTEXT is compared to filename, tagname (tags table), references (uses of a tag) , or symbol (uses of something not in the tag table.) -SCOPE is the scope of the search, such as 'project or 'subdirs." +SCOPE is the scope of the search, such as `project' or `subdir'." ;; CScope is an interactive program. It uses number flags ;; in order to perform command line searches. Useful for this ;; tool are: diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el index e3cd7a852a..bc058f3d4e 100644 --- a/lisp/cedet/cedet-global.el +++ b/lisp/cedet/cedet-global.el @@ -44,12 +44,12 @@ GTAGS is used to create the tags table queried by the `global' command." (defun cedet-gnu-global-search (searchtext texttype type scope) "Perform a search with GNU Global, return the created buffer. SEARCHTEXT is text to find. -TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, -'tagregexp, or 'tagcompletions. +TEXTTYPE is the type of text, such as `regexp', `string', `tagname', +`tagregexp', or `tagcompletions'. TYPE is the type of search, meaning that SEARCHTEXT is compared to filename, tagname (tags table), references (uses of a tag) , or symbol (uses of something not in the tag table.) -SCOPE is the scope of the search, such as 'project or 'subdirs." +SCOPE is the scope of the search, such as `project' or `subdirs'." (let ((flgs (cond ((eq type 'file) "-a") (t "-xa"))) diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el index f2fbe19362..57f522bf5b 100644 --- a/lisp/cedet/cedet-idutils.el +++ b/lisp/cedet/cedet-idutils.el @@ -52,12 +52,12 @@ (defun cedet-idutils-search (searchtext texttype type scope) "Perform a search with ID Utils, return the created buffer. SEARCHTEXT is text to find. -TEXTTYPE is the type of text, such as 'regexp, 'string, 'tagname, -'tagregexp, or 'tagcompletions. +TEXTTYPE is the type of text, such as `regexp', `string', `tagname', +`tagregexp', or `tagcompletions'. TYPE is the type of search, meaning that SEARCHTEXT is compared to filename, tagname (tags table), references (uses of a tag) , or symbol (uses of something not in the tag table.) -SCOPE is the scope of the search, such as 'project or 'subdirs. +SCOPE is the scope of the search, such as `project' or `subdirs'. Note: Scope is not yet supported." (if (eq type 'file) ;; Calls for file stuff is very simple. diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el index a6a0af100f..cc67d9f8bb 100644 --- a/lisp/cedet/ede/files.el +++ b/lisp/cedet/ede/files.el @@ -425,7 +425,7 @@ FILENAME should be just a filename which occurs in a directory controlled by this project. Optional argument FORCE forces the default filename to be provided even if it doesn't exist. -If FORCE equals 'newfile, then the cache is ignored and a new file in THIS +If FORCE equals `newfile', then the cache is ignored and a new file in THIS is returned." (require 'ede/locate) (let* ((loc (ede-get-locator-object this)) diff --git a/lisp/cedet/ede/srecode.el b/lisp/cedet/ede/srecode.el index 2d3636006f..dee52cab8f 100644 --- a/lisp/cedet/ede/srecode.el +++ b/lisp/cedet/ede/srecode.el @@ -75,7 +75,7 @@ updated in FORMS." TEMPLATE should specify a context by using a string format of: context:templatename Add DICTIONARY-ENTRIES into the dictionary before insertion. -Note: Just like `srecode-insert', but templates found in 'ede app." +Note: Just like `srecode-insert', but templates found in `ede' app." (require 'srecode/insert) (ede-srecode-insert-with-dictionary template diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el index 6851ad556a..d3cbe610a7 100644 --- a/lisp/cedet/semantic/analyze.el +++ b/lisp/cedet/semantic/analyze.el @@ -356,7 +356,7 @@ This function knows of flags: (defun semantic-analyze-find-tag (name &optional tagclass scope) "Return the first tag found with NAME or nil if not found. Optional argument TAGCLASS specifies the class of tag to return, -such as 'function or 'variable. +such as `function' or `variable'. Optional argument SCOPE specifies a scope object which has additional tags which are in SCOPE and do not need prefixing to find. diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el index 54ef2ee759..2f6eba467b 100644 --- a/lisp/cedet/semantic/ctxt.el +++ b/lisp/cedet/semantic/ctxt.el @@ -55,7 +55,7 @@ Used for identifying arguments to functions.") Return non-nil if there are no more context levels. Overloaded functions using `up-context' take no parameters. BOUNDS-TYPE is a symbol representing a tag class to restrict -movement to. If this is nil, 'function is used. +movement to. If this is nil, `function' is used. This will find the smallest tag of that class (function, variable, type, etc) and make sure non-nil is returned if you cannot go up past the bounds of that tag." diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el index 18c749b098..9a81d18b7d 100644 --- a/lisp/cedet/semantic/db-find.el +++ b/lisp/cedet/semantic/db-find.el @@ -434,7 +434,7 @@ Default action as described in `semanticdb-find-translate-path'." "All include tags scanned, plus action taken on the tag. Each entry is an alist: (ACTION . TAG) -where ACTION is one of 'scanned, 'duplicate, 'lost +where ACTION is one of `scanned', `duplicate', `lost' and TAG is a clone of the include tag that was found.") (make-variable-buffer-local 'semanticdb-find-scanned-include-tags) diff --git a/lisp/cedet/semantic/db-typecache.el b/lisp/cedet/semantic/db-typecache.el index 7e0f52fe0b..a6d9b3c797 100644 --- a/lisp/cedet/semantic/db-typecache.el +++ b/lisp/cedet/semantic/db-typecache.el @@ -412,7 +412,7 @@ found tag to be loaded." (defun semanticdb-typecache-find-by-name-helper (name table) "Find the tag with NAME in TABLE, which is from a typecache. If more than one tag has NAME in TABLE, we will prefer the tag that -is of class 'type." +is of class `type'." (let* ((names (semantic-find-tags-by-name name table)) (nmerge (semanticdb-typecache-merge-streams names nil)) (types (semantic-find-tags-by-class 'type nmerge))) diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el index 2a25bb5db1..9319e02c41 100644 --- a/lisp/cedet/semantic/edit.el +++ b/lisp/cedet/semantic/edit.el @@ -464,7 +464,7 @@ See `semantic-edits-change-leaf-tag' for details on parents." (defun semantic-parse-changes-failed (&rest args) "Signal that Semantic failed to parse changes. That is, display a message by passing all ARGS to `format-message', then throw -a 'semantic-parse-changes-failed exception with value t." +a `semantic-parse-changes-failed' exception with value t." (when semantic-edits-verbose-flag (message "Semantic parse changes failed: %S" (apply #'format-message args))) @@ -516,7 +516,7 @@ the semantic cache to see what needs to be changed." (defun semantic-edits-incremental-parser-1 () "Incrementally reparse the current buffer. Return the list of tags that changed. -If the incremental parse fails, throw a 'semantic-parse-changes-failed +If the incremental parse fails, throw a `semantic-parse-changes-failed' exception with value t, that can be caught to schedule a full reparse. This function is for internal use by `semantic-edits-incremental-parser'." (let* ((changed-tags nil) diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el index ec38a37295..8b01b25d99 100644 --- a/lisp/cedet/semantic/find.el +++ b/lisp/cedet/semantic/find.el @@ -307,7 +307,7 @@ attempting to do completions." (defmacro semantic-find-tags-by-class (class &optional table) "Find all tags of class CLASS in TABLE. CLASS is a symbol representing the class of the token, such as -'variable, of 'function.. +`variable' or `function'. TABLE is a tag table. See `semantic-something-to-tag-table'." `(semantic--find-tags-by-macro (eq ,class (semantic-tag-class (car tags))) @@ -316,7 +316,7 @@ TABLE is a tag table. See `semantic-something-to-tag-table'." (defmacro semantic-filter-tags-by-class (class &optional table) "Find all tags of class not in the list CLASS in TABLE. CLASS is a list of symbols representing the class of the token, -such as 'variable, of 'function.. +such as `variable' or `function'. TABLE is a tag table. See `semantic-something-to-tag-table'." `(semantic--find-tags-by-macro (not (memq (semantic-tag-class (car tags)) ,class)) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 53b5ea61f2..785a05816b 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1738,7 +1738,7 @@ Otherwise return nil." (define-mode-local-override semantic-tag-boundary-p semantic-grammar-mode (tag) "Return non-nil for tags that should have a boundary drawn. -Only tags of type 'nonterminal will be so marked." +Only tags of type `nonterminal' will be so marked." (let ((c (semantic-tag-class tag))) (eq c 'nonterminal))) diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index b103c3ce15..f81ad74cf9 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -281,7 +281,7 @@ Optional argument COLOR indicates that color should be mixed in." Java have documentation set in a comment preceding TAG's definition. Attempt to strip out comment syntactic sugar, unless optional argument NOSNARF is non-nil. -If NOSNARF is 'lex, then return the semantic lex token." +If NOSNARF is `lex', then return the semantic lex token." (when (or tag (setq tag (semantic-current-tag))) (with-current-buffer (semantic-tag-buffer tag) (save-excursion diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index a81b23ca75..2de579b5b3 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -698,7 +698,7 @@ and what valid VAL values are." (defun semantic-lex-spp-symbol-merge (txt) "Merge the tokens listed in TXT. -TXT might contain further 'spp-symbol-merge, which will +TXT might contain further `spp-symbol-merge', which will be merged recursively." ;; We need to merge the tokens in the 'text segment together, ;; and produce a single symbol from it. @@ -1272,7 +1272,7 @@ VALFORM are forms that return the name of the thing being included, and the type of include. The return value should be of the form: (NAME . TYPE) where NAME is the name of the include, and TYPE is the type of the include, -where a valid symbol is 'system, or nil." +where a valid symbol is `system', or nil." (let ((start (make-symbol "start")) (end (make-symbol "end")) (val (make-symbol "val")) diff --git a/lisp/cedet/semantic/mru-bookmark.el b/lisp/cedet/semantic/mru-bookmark.el index 13cfc586fd..461097ecb7 100644 --- a/lisp/cedet/semantic/mru-bookmark.el +++ b/lisp/cedet/semantic/mru-bookmark.el @@ -77,7 +77,7 @@ Set this when the tag gets unlinked from the buffer it belongs to.") :initform t :documentation "The reason this tag is interesting. -Nice values are 'edit, 'read, 'jump, and 'mark. +Nice values include the following: edit - created because the tag text was edited. read - created because point lingered in tag text. jump - jumped to another tag from this tag. diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el index 3b38e8a61c..5dc49d6cb3 100644 --- a/lisp/cedet/semantic/scope.el +++ b/lisp/cedet/semantic/scope.el @@ -461,8 +461,8 @@ implicit \"object\"." (define-overloadable-function semantic-analyze-scope-calculate-access (type scope) "Calculate the access class for TYPE as defined by the current SCOPE. Access is related to the :parents in SCOPE. If type is a member of SCOPE -then access would be 'private. If TYPE is inherited by a member of SCOPE, -the access would be 'protected. Otherwise, access is 'public") +then access would be `private'. If TYPE is inherited by a member of SCOPE, +the access would be `protected'. Otherwise, access is `public'.") (defun semantic-analyze-scope-calculate-access-default (type scope) "Calculate the access class for TYPE as defined by the current SCOPE." @@ -545,7 +545,8 @@ tag is not something you can complete from within TYPE." "Return all parts of TYPE, a tag representing a TYPE declaration. SCOPE is the scope object. NOINHERIT turns off searching of inherited tags. -PROTECTION specifies the type of access requested, such as 'public or 'private." +PROTECTION specifies the type of access requested, +such as `public' or `private'." (if (not type) nil (let* ((access (semantic-analyze-scope-calculate-access type scope)) @@ -593,8 +594,8 @@ whose tags can be searched when needed, OR it may be a scope object. ACCESS is the level of access we filter on child supplied tags. For languages with protection on specific methods or slots, it should strip out those not accessible by methods of TYPE. -An ACCESS of 'public means not in a method of a subclass of type. -A value of 'private means we can access private parts of the originating +An ACCESS of `public' means not in a method of a subclass of type. +A value of `private' means we can access private parts of the originating type." (let ((ret nil)) (semantic-analyze-scoped-inherited-tag-map diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el index 85acd50712..f7404fc017 100644 --- a/lisp/cedet/semantic/symref.el +++ b/lisp/cedet/semantic/symref.el @@ -78,7 +78,7 @@ ;;; Code: (defcustom semantic-symref-tool 'detect "The active symbol reference tool name. -The tool symbol can be 'detect, or a symbol that is the name of +The tool symbol can be `detect', or a symbol that is the name of a tool that can be used for symbol referencing." :type 'symbol :group 'semantic) @@ -309,9 +309,9 @@ Can be 'project, 'target, or 'file.") :type symbol :documentation "The kind of search results desired. -Can be 'line, 'file, or 'tag. -The type of result can be converted from 'line to 'file, or 'line to 'tag, -but not from 'file to 'line or 'tag.") +Can be `line', `file', or `tag'. +The type of result can be converted from `line' to `file', or `line' to `tag', +but not from `file' to `line' or `tag'.") ) "Baseclass for all symbol references tools. A symbol reference tool supplies functionality to identify the locations of diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el index ad072a4096..04a6b4e99f 100644 --- a/lisp/cedet/semantic/tag-ls.el +++ b/lisp/cedet/semantic/tag-ls.el @@ -199,7 +199,7 @@ Other languages qualify names within a Namespace (such as C++) which result in a different package like structure. Languages which do not override this function will just search the -stream for a tag of class 'package, and return that." +stream for a tag of class `package', and return that." (let ((stream (semantic-something-to-tag-table (or stream-or-buffer tag)))) (:override-with-args (tag stream)))) diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 7d663f3e3a..e5b5823dad 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -300,8 +300,8 @@ can handle the @menu environment.") texinfo-mode (&optional point) "Determine the class of tags that can be used at POINT. For texinfo, there two possibilities returned. -1) 'function - for a call to a texinfo function -2) 'word - indicates an english word. +1) `function' - for a call to a texinfo function +2) `word' - indicates an English word. It would be nice to know function arguments too, but not today." (let ((sym (semantic-ctxt-current-symbol))) (if (and sym (= (aref (car sym) 0) ?@)) diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index 787e30c342..ace05e9f4b 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -2641,7 +2641,7 @@ Decide what to do for each type of token if seen as the lookahead token in specified state. The value returned is used as the default action for the state. In addition, ACTROW is filled with what to do for each kind of token, index by symbol number, with nil meaning do -the default action. The value 'error, means this situation is an +the default action. The value `error', means this situation is an error. The parser recognizes this value specially. This is where conflicts are resolved. The loop over lookahead rules diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 4c93c0dc4f..e17dc68e1f 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el @@ -88,8 +88,8 @@ is to return a symbol based on type modifiers." (define-mode-local-override semantic-analyze-scope-calculate-access js-mode (type scope) "Calculate the access class for TYPE as defined by the current SCOPE. Access is related to the :parents in SCOPE. If type is a member of SCOPE -then access would be 'private. If TYPE is inherited by a member of SCOPE, -the access would be 'protected. Otherwise, access is 'public." +then access would be `private'. If TYPE is inherited by a member of SCOPE, +the access would be `protected'. Otherwise, access is `public'." nil) (define-mode-local-override semantic-ctxt-current-symbol js-mode (&optional point) diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el index a0205177ca..de6f21be09 100644 --- a/lisp/cedet/srecode/dictionary.el +++ b/lisp/cedet/srecode/dictionary.el @@ -560,7 +560,7 @@ where ENTRY_N = (NAME ENTRY_N_1 ENTRY_N_2 ...) | TAG -where TAG is a semantic tag of class 'variable. The (NAME ... ) +where TAG is a semantic tag of class `variable'. The (NAME ... ) form creates a child dictionary which is stored under the name NAME. The TAG form creates a value entry or section dictionary entry whose name is the name of the tag. diff --git a/lisp/cedet/srecode/document.el b/lisp/cedet/srecode/document.el index ad15b3ef6f..21acc61fef 100644 --- a/lisp/cedet/srecode/document.el +++ b/lisp/cedet/srecode/document.el @@ -385,7 +385,7 @@ It is assumed that the comment occurs just in front of FCN-IN." (when (or (not fcn-in) (not (semantic-tag-of-class-p fcn-in 'function))) - (error "No tag of class 'function to insert comment for")) + (error "No tag of class `function' to insert comment for")) (if (not (eq (current-buffer) (semantic-tag-buffer fcn-in))) (error "Only insert comments for tags in the current buffer")) @@ -496,7 +496,7 @@ It is assumed that the comment occurs just after VAR-IN." (when (or (not var-in) (not (semantic-tag-of-class-p var-in 'variable))) - (error "No tag of class 'variable to insert comment for")) + (error "No tag of class `variable' to insert comment for")) (if (not (eq (current-buffer) (semantic-tag-buffer var-in))) (error "Only insert comments for tags in the current buffer")) diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el index 4e25e1f5ca..455977bbe0 100644 --- a/lisp/cedet/srecode/insert.el +++ b/lisp/cedet/srecode/insert.el @@ -373,8 +373,8 @@ Can't be blank, or it might be used by regular variable insertion.") :initarg :where :documentation "This should be `begin' or `end', indicating where to insert a CR. -When `begin', insert a CR if not at 'bol'. -When `end', insert a CR if not at 'eol'.") +When `begin', insert a CR if not at `bol'. +When `end', insert a CR if not at `eol'.") ;; @TODO - Add slot and control for the number of blank ;; lines before and after point. ) diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el index 344b908da3..5195016e22 100644 --- a/lisp/cedet/srecode/semantic.el +++ b/lisp/cedet/srecode/semantic.el @@ -210,7 +210,7 @@ variable default values, and other things." ;;; :tagtype ARGUMENT HANDLING ;; ;; When a :tagtype argument is required, identify the current tag, of -;; cf class 'type. Apply those parameters to the dictionary. +;; class 'type'. Apply those parameters to the dictionary. (defun srecode-semantic-handle-:tagtype (dict) "Add macros into the dictionary DICT based on a tag of class type at point. @@ -218,7 +218,7 @@ Assumes the cursor is in a tag of class type. If not, throw an error." (let ((typetag (or srecode-semantic-selected-tag (semantic-current-tag-of-class 'type)))) (when (not typetag) - (error "Cursor is not in a TAG of class 'type")) + (error "Cursor is not in a TAG of class `type'")) (srecode-semantic-apply-tag-to-dict typetag dict))) @@ -285,8 +285,8 @@ CTXT is the pre-calculated context." "Insert TAG into a buffer using srecode templates at point. Optional STYLE-OPTION is a list of minor configuration of styles, -such as the symbol 'prototype for prototype functions, or -'system for system includes, and 'doxygen, for a doxygen style +such as the symbol `prototype' for prototype functions, or +`system' for system includes, and `doxygen', for a doxygen style comment. Optional third argument POINT-INSERT-FCN is a hook that is run after diff --git a/lisp/dired.el b/lisp/dired.el index 35d883a011..9d0b13e227 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -107,7 +107,7 @@ Note that `ls-lisp' does not support as many options as GNU ls, though. For more details, see Info node `(emacs)ls in Lisp'." :group 'dired :type '(choice (const :tag - "Use --dired only if 'ls' supports it" unspecified) + "Use --dired only if `ls' supports it" unspecified) (const :tag "Do not use --dired" nil) (other :tag "Always use --dired" t))) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 15a1dc3b9b..e5f0e89a36 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1021,7 +1021,7 @@ If PAGE is nil, convert the whole document." (defun doc-view-pdfdraw-program-subcommand () "Return the mutool subcommand replacing mudraw. -Recent MuPDF distributions replaced 'mudraw' with 'mutool draw'." +Recent MuPDF distributions replaced `mudraw' with `mutool draw'." (when (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program) '("draw"))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6b75ecf783..26207e03c4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2622,7 +2622,7 @@ Helper function for `describe-package'." (defun package-install-button-action (button) "Run `package-install' on the package BUTTON points to. -Used for the 'action property of buttons in the buffer created by +Used for the `action' property of buttons in the buffer created by `describe-package'." (let ((pkg-desc (button-get button 'package-desc))) (when (y-or-n-p (format-message "Install package `%s'? " @@ -2633,7 +2633,7 @@ Used for the 'action property of buttons in the buffer created by (defun package-delete-button-action (button) "Run `package-delete' on the package BUTTON points to. -Used for the 'action property of buttons in the buffer created by +Used for the `action' property of buttons in the buffer created by `describe-package'." (let ((pkg-desc (button-get button 'package-desc))) (when (y-or-n-p (format-message "Delete package `%s'? " @@ -2645,7 +2645,7 @@ Used for the 'action property of buttons in the buffer created by (defun package-keyword-button-action (button) "Show filtered \"*Packages*\" buffer for BUTTON. The buffer is filtered by the `package-keyword' property of BUTTON. -Used for the 'action property of buttons in the buffer created by +Used for the `action' property of buttons in the buffer created by `describe-package'." (let ((pkg-keyword (button-get button 'package-keyword))) (package-show-package-list t (list pkg-keyword)))) diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el index 83a738fd07..608f89902d 100644 --- a/lisp/erc/erc-autoaway.el +++ b/lisp/erc/erc-autoaway.el @@ -37,7 +37,7 @@ yourself back when you type something." (defvar erc-autoaway-idletimer nil "The Emacs idletimer. -This is only used when `erc-autoaway-idle-method' is set to 'emacs.") +This is only used when `erc-autoaway-idle-method' is set to `emacs'.") (defvar erc-autoaway-last-sent-time (erc-current-time) "The last time the user sent something.") @@ -50,7 +50,7 @@ user's away status.") (defun erc-autoaway-reestablish-idletimer () "Reestablish the Emacs idletimer. -If `erc-autoaway-idle-method' is 'emacs, you must call this +If `erc-autoaway-idle-method' is `emacs', you must call this function each time you change `erc-autoaway-idle-seconds'." (interactive) (when erc-autoaway-idletimer @@ -70,7 +70,7 @@ If none is found, return nil." "Add autoaway reset function to `post-command-hook' if at least one ERC process is alive. -This is used when `erc-autoaway-idle-method' is 'user." +This is used when `erc-autoaway-idle-method' is `user'." (when (or server (erc-autoaway-some-server-buffer)) (add-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) @@ -78,7 +78,7 @@ This is used when `erc-autoaway-idle-method' is 'user." "Remove the autoaway reset function from `post-command-hook' if no ERC process is alive. -This is used when `erc-autoaway-idle-method' is 'user." +This is used when `erc-autoaway-idle-method' is `user'." (unless (erc-autoaway-some-server-buffer) (remove-hook 'post-command-hook 'erc-autoaway-reset-idle-user))) @@ -140,9 +140,9 @@ Related variables: `erc-public-away-p' and `erc-away-nickname'." (defcustom erc-autoaway-idle-method 'user "The method used to determine how long you have been idle. -If 'user, the time of the last command sent to Emacs is used. -If 'emacs, the idle time in Emacs is used. -If 'irc, the time of the last IRC command is used. +If `user', the time of the last command sent to Emacs is used. +If `emacs', the idle time in Emacs is used. +If `irc', the time of the last IRC command is used. The time itself is specified by `erc-autoaway-idle-seconds'. diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el index b8eef7f618..fcf73507ac 100644 --- a/lisp/erc/erc-services.el +++ b/lisp/erc/erc-services.el @@ -289,7 +289,7 @@ NICK is nickserv's nickname. Use nick@server where necessary/possible. KEYWORD is the keyword to use in the reply message to identify yourself. USE-CURRENT indicates whether the current nickname must be used when identifying. -ANSWER is the command to use for the answer. The default is 'privmsg. +ANSWER is the command to use for the answer. The default is `privmsg'. SUCCESS-REGEXP is a regular expression matching the message nickserv sends when you've successfully identified. The last two elements are optional." diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el index 16973074be..1697a63368 100644 --- a/lisp/gnus/gnus-diary.el +++ b/lisp/gnus/gnus-diary.el @@ -64,7 +64,7 @@ Please refer to `format-time-string' for information on possible values." "Function called to format a diary delay string. It is passed two arguments. The first one is non-nil if the delay is in the past. The second one is of the form ((NUM . UNIT) ...) where NUM is -an integer and UNIT is one of 'year 'month 'week 'day 'hour or 'minute. +an integer and UNIT is one of `year' `month' `week' `day' `hour' or `minute'. It should return strings like \"In 2 months, 3 weeks\", \"3 hours, 1 minute ago\" and so on. diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 10793455a5..17f1086195 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -637,7 +637,7 @@ If ARG is 1, prompt for group name to post to. This function prepares a news even when using mail groups. This is useful for posting messages to mail groups without actually sending them over the -network. The corresponding back end must have a 'request-post method." +network. The corresponding back end must have a `request-post' method." (interactive "P") ;; We can't `let' gnus-newsgroup-name here, since that leads ;; to local variables leaking. @@ -714,7 +714,7 @@ If ARG, don't do that. If ARG is 1, prompt for group name to post to. This function prepares a news even when using mail groups. This is useful for posting messages to mail groups without actually sending them over the -network. The corresponding back end must have a 'request-post method." +network. The corresponding back end must have a `request-post' method." (interactive "P") ;; We can't `let' gnus-newsgroup-name here, since that leads ;; to local variables leaking. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 16e578cc74..e6fb382c2f 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -145,7 +145,7 @@ recipients." '("delayed$" "drafts$" "queue$" "INBOX$" "^nnmairix:" "archive") "List of groups that gnus-registry-split-fancy-with-parent won't return. The group names are matched, they don't have to be fully -qualified. This parameter tells the Gnus registry 'never split a +qualified. This parameter tells the Gnus registry `never split a message into a group that matches one of these, regardless of references.' @@ -211,7 +211,7 @@ groups." (defcustom gnus-registry-extra-entries-precious '(mark) "What extra keys are precious, meaning entries with them won't get pruned. -By default, 'mark is included, so articles with marks are +By default, `mark' is included, so articles with marks are considered precious. Before you save the Gnus registry, it's pruned. Any entries with diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index 72fcc64155..b66489aae9 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -826,7 +826,7 @@ HEADER is the header being scored. MATCH is the string we are looking for. TYPE is the match type: substring, regexp, exact, fuzzy. SCORE is the score to add. -DATE is the expire date, or nil for no expire, or 'now for immediate expire. +DATE is the expire date, or nil for no expire, or `now' for immediate expire. If optional argument `PROMPT' is non-nil, allow user to edit match. If optional argument `SILENT' is nil, show effect of score entry. If optional argument `EXTRA' is non-nil, it's a non-standard overview header." diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index f21bc7584e..b8859528d0 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -9127,7 +9127,7 @@ a non-numeric prefix arg will use nnir to search the entire server; without a prefix arg only the current group is searched. If the variable `gnus-refer-thread-use-nnir' is non-nil the prefix arg has the reverse meaning. If no -backend-specific 'request-thread function is available fetch +backend-specific `request-thread' function is available fetch LIMIT (the numerical prefix) old headers. If LIMIT is non-numeric or nil fetch the number specified by the `gnus-refer-thread-limit' variable." diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index f79d8f1707..a340804064 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -124,13 +124,13 @@ Hortense, would you be so kind as to remind me of my appointments 3 days before the date, thank you very much. Anda, hmmm... by the way, are you doing anything special tonight ?\". -The units of measure are 'minute 'hour 'day 'week 'month and 'year (no, -not 'century, sorry). +The units of measure are `minute' `hour' `day' `week' `month' and `year' (no, +not `century', sorry). NOTE: the units of measure actually express dates, not durations: if you -use 'week, messages will pop up on Sundays at 00:00 (or Mondays if +use `week', messages will pop up on Sundays at 00:00 (or Mondays if `nndiary-week-starts-on-monday' is non-nil) and *not* 7 days before the -appointment, if you use 'month, messages will pop up on the first day of +appointment, if you use `month', messages will pop up on the first day of each months, at 00:00 and so on. If you really want to specify a duration (like 24 hours exactly), you can diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 856ac75cd6..800ec3b959 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -1134,7 +1134,7 @@ If LIMIT, first try to limit the search to the N last articles." (nnimap-command "UID EXPUNGE %s" (nnimap-article-ranges articles)) (nnheader-message - 3 (concat "nnimap-expunge set to 'immediately, but " + 3 (concat "nnimap-expunge set to `immediately', but " "server doesn't support UIDPLUS")) nil)) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 7cb2d1615a..b8a6639719 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -317,7 +317,7 @@ If nil this will use `gnus-summary-line-format'." (defcustom nnir-retrieve-headers-override-function nil "If non-nil, a function that accepts an article list and group and populates the `nntp-server-buffer' with the retrieved -headers. Must return either 'nov or 'headers indicating the +headers. Must return either `nov' or `headers' indicating the retrieved header format. If this variable is nil, or if the provided function returns nil for diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index 6c5502ac3d..d0a38e17c8 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el @@ -301,7 +301,7 @@ The default chooses the largest window in the current frame." (defcustom nnmairix-propagate-marks-upon-close t "Flag if marks should be propagated upon closing a group. -The default of this variable is t. If set to 'ask, the +The default of this variable is t. If set to `ask', the user will be asked if the flags should be propagated when the group is closed. If set to nil, the user will have to manually call `nnmairix-propagate-marks'." @@ -1400,7 +1400,7 @@ nnmairix with nnml backends." "Replace folder names in Xref header and correct article numbers. Do this for all ARTICLES on BACKENDGROUP. Replace using MAIRIXGROUP. NUMC contains values for article number correction. -TYPE is either 'nov or 'headers." +TYPE is either `nov' or `headers'." (nnheader-message 7 "nnmairix: Rewriting headers...") (cond ((eq type 'nov) @@ -1449,7 +1449,7 @@ TYPE is either 'nov or 'headers." (defun nnmairix-backend-to-server (server) "Return nnmairix server most probably responsible for back end SERVER. User will be asked if this cannot be determined. Result is saved in -parameter 'indexed-servers of corresponding default search +parameter `indexed-servers' of corresponding default search group." (let ((allservers (nnmairix-get-nnmairix-servers)) mairixserver found defaultgroup) @@ -1459,7 +1459,7 @@ group." (while (and allservers (not found)) (setq mairixserver (gnus-server-to-method (car (pop allservers)))) ;; First we look if SERVER is the backend of current nnmairix server - (setq found (and (eq (cadr (assoc 'nnmairix-backend mairixserver)) + (setq found (and (eq (cadr (assoc `nnmairix-backend mairixserver)) (car server)) (string= (cadr (assoc 'nnmairix-backend-server mairixserver)) (nth 1 server)))) diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index c701e314fc..83df2f6198 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el @@ -831,8 +831,8 @@ backend is STATISTICAL." (defun spam-backend-list (&optional type) "Return a list of all the backend symbols, constrained by TYPE. -When TYPE is 'non-mover, only non-mover backends are returned. -When TYPE is 'mover, only mover backends are returned." +When TYPE is `non-mover', only non-mover backends are returned. +When TYPE is `mover', only mover backends are returned." (let (list) (dolist (backend spam-backends) (when (or @@ -882,8 +882,8 @@ that the message is definitely a spam." (defun spam-backend-function (backend classification type) "Get the BACKEND function for CLASSIFICATION and TYPE. -TYPE is 'registration or 'unregistration. -CLASSIFICATION is 'ham or 'spam." +TYPE is `registration' or `unregistration'. +CLASSIFICATION is `ham' or `spam'." (if (and (spam-classification-valid-p classification) (spam-backend-function-type-valid-p type)) @@ -1520,7 +1520,7 @@ In the case of mover backends, checks the setting of (defun spam-fetch-field-fast (article field &optional prepared-data-header) "Fetch a FIELD for ARTICLE with the internal `gnus-data-find' function. When PREPARED-DATA-HEADER is given, don't look in the Gnus data. -When FIELD is 'number, ARTICLE can be any number (since we want +When FIELD is `number', ARTICLE can be any number (since we want to find it out)." (when (numberp article) (let* ((data-header (or prepared-data-header diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 44c7e74839..13223de6e7 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -1321,8 +1321,8 @@ matches against '/a/b/c.d'." (define-ibuffer-filter basename "Limit current view to buffers with file basename matching QUALIFIER. -For example, for a buffer associated with file '/a/b/c.d', this -matches against 'c.d'." +For example, for a buffer associated with file `/a/b/c.d', this +matches against `c.d'." (:description "file basename" :reader (read-from-minibuffer "Filter by file name, without directory part (regex): ")) @@ -1335,7 +1335,7 @@ matches against 'c.d'." The separator character (typically `.') is not part of the pattern. For example, for a buffer associated with file -'/a/b/c.d', this matches against 'd'." +`/a/b/c.d', this matches against `d'." (:description "filename extension" :reader (read-from-minibuffer "Filter by filename extension without separator (regex): ")) @@ -1596,7 +1596,7 @@ to move by. The default is `ibuffer-marked-char'." "Hide all of the currently marked lines." (interactive) (if (= (ibuffer-count-marked-lines) 0) - (message "No buffers marked; use 'm' to mark a buffer") + (message "No buffers marked; use `m' to mark a buffer") (let ((count (ibuffer-map-marked-lines #'(lambda (_buf _mark) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c81b05efec..e223e4a436 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -651,24 +651,24 @@ directory, like `default-directory'." (define-key-after map [menu-bar view filter filter-by-filename] '(menu-item "Add filter by full filename..." ibuffer-filter-by-filename :help - (concat "For a buffer associated with file '/a/b/c.d', " - "list buffer if a given pattern matches '/a/b/c.d'"))) + (concat "For a buffer associated with file `/a/b/c.d', " + "list buffer if a given pattern matches `/a/b/c.d'"))) (define-key-after map [menu-bar view filter filter-by-basename] '(menu-item "Add filter by file basename..." ibuffer-filter-by-basename - :help (concat "For a buffer associated with file '/a/b/c.d', " - "list buffer if a given pattern matches 'c.d'"))) + :help (concat "For a buffer associated with file `/a/b/c.d', " + "list buffer if a given pattern matches `c.d'"))) (define-key-after map [menu-bar view filter filter-by-file-extension] '(menu-item "Add filter by file name extension..." ibuffer-filter-by-file-extension - :help (concat "For a buffer associated with file '/a/b/c.d', " - "list buffer if a given pattern matches 'd'"))) + :help (concat "For a buffer associated with file `/a/b/c.d', " + "list buffer if a given pattern matches `d'"))) (define-key-after map [menu-bar view filter filter-by-directory] '(menu-item "Add filter by filename's directory..." ibuffer-filter-by-directory :help - (concat "For a buffer associated with file '/a/b/c.d', " - "list buffer if a given pattern matches '/a/b'"))) + (concat "For a buffer associated with file `/a/b/c.d', " + "list buffer if a given pattern matches `/a/b'"))) (define-key-after map [menu-bar view filter filter-by-size-lt] '(menu-item "Add filter by size less than..." ibuffer-filter-by-size-lt)) (define-key-after map [menu-bar view filter filter-by-size-gt] @@ -1377,7 +1377,7 @@ Otherwise, toggle lock status." "Unmark all buffers with mark MARK." (interactive "cRemove marks (RET means all):") (if (= (ibuffer-count-marked-lines t) 0) - (message "No buffers marked; use 'm' to mark a buffer") + (message "No buffers marked; use `m' to mark a buffer") (let ((fn (lambda (_buf mk) (unless (eq mk ?\s) (ibuffer-set-mark-1 ?\s)) t))) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 85bc924794..ca3ed58e20 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -666,7 +666,7 @@ according to the Thumbnail Managing Standard." (defun image-dired-thumb-size (dimension) "Return thumb size depending on `image-dired-thumbnail-storage'. -DIMENSION should be either the symbol 'width or 'height." +DIMENSION should be either the symbol `width' or `height'." (cond ((eq 'standard image-dired-thumbnail-storage) 128) ((eq 'standard-large image-dired-thumbnail-storage) 256) diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el index 0b69839575..12457302ea 100644 --- a/lisp/mh-e/mh-identity.el +++ b/lisp/mh-e/mh-identity.el @@ -282,9 +282,9 @@ If VALUE is nil, use `mh-extract-from-attribution-verb'." (defun mh-identity-handler-default (field action top &optional value) "Process header FIELD. -The ACTION is one of 'remove or 'add. If TOP is non-nil, add the +The ACTION is one of `remove' or `add'. If TOP is non-nil, add the field and its VALUE at the top of the header, else add it at the -bottom of the header. If action is 'add, the VALUE is added." +bottom of the header. If action is `add', the VALUE is added." (let ((field-colon (if (string-match "^.*:$" field) field (concat field ":")))) diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el index 46762f12fd..a27247af5b 100644 --- a/lisp/mh-e/mh-letter.el +++ b/lisp/mh-e/mh-letter.el @@ -952,7 +952,7 @@ callable from a mouse button." (defun mh-insert-prefix-string (mh-ins-string) "Insert prefix string before each line in buffer. The inserted letter is cited using `sc-cite-original' if -`mh-yank-behavior' is one of 'supercite or 'autosupercite. +`mh-yank-behavior' is one of `supercite' or `autosupercite'. Otherwise, simply insert MH-INS-STRING before each line." (goto-char (point-min)) (cond ((or (eq mh-yank-behavior 'supercite) diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el index 596f00961b..97f1fddcd0 100644 --- a/lisp/mh-e/mh-search.el +++ b/lisp/mh-e/mh-search.el @@ -1329,7 +1329,7 @@ is used to search." "Read the next result. Parse it and return the message folder, message index and the match. If no other matches left then return nil. If the current -record is invalid return 'error." +record is invalid return `error'." (prog1 (cl-block nil (when (eobp) diff --git a/lisp/mwheel.el b/lisp/mwheel.el index e3648d9882..c9ece2dfca 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -151,7 +151,7 @@ face height." :version "26.1") (defcustom mouse-wheel-flip-direction nil - "Swap direction of 'wheel-right and 'wheel-left." + "Swap direction of `wheel-right' and `wheel-left'." :group 'mouse :type 'boolean :version "26.1") diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 4050c83eb0..1571c76189 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -62,12 +62,12 @@ "Whether to use client certificates for network connections. When non-nil, `open-network-stream' will automatically look for -matching client certificates (via 'auth-source') for a +matching client certificates (via `auth-source') for a destination server, if it is called without a :client-certificate keyword. Set to nil to disable this lookup globally. To disable on a -per-connection basis, specify ':client-certificate nil' when +per-connection basis, specify `:client-certificate nil' when calling `open-network-stream'." :group 'network :type 'boolean diff --git a/lisp/obsolete/lucid.el b/lisp/obsolete/lucid.el index d1b702ed55..b4995609f1 100644 --- a/lisp/obsolete/lucid.el +++ b/lisp/obsolete/lucid.el @@ -60,7 +60,7 @@ bottom of the buffer stack." (defun device-class (&optional device) "Return the class (color behavior) of DEVICE. -This will be one of 'color, 'grayscale, or 'mono. +This will be one of `color', `grayscale', or `mono'. This function exists for compatibility with XEmacs." (cond ((display-color-p device) 'color) diff --git a/lisp/obsolete/mantemp.el b/lisp/obsolete/mantemp.el index ad638422c2..af4a27bb7e 100644 --- a/lisp/obsolete/mantemp.el +++ b/lisp/obsolete/mantemp.el @@ -148,7 +148,7 @@ the lines." ;; subsequently remove 'class' for functions so we don't need to ;; both scan for classes and functions. (goto-char (point-min)) - (message "Inserting 'template class' for classes") + (message "Inserting `template class' for classes") (while (re-search-forward "^.+" nil t) (progn (beginning-of-line) @@ -156,7 +156,7 @@ the lines." (insert "template ") (insert "template class ")))) (goto-char (point-min)) - (message "Inserting 'template' for functions") + (message "Inserting `template' for functions") (while (re-search-forward "^template class [a-zA-Z :&*<>~=,0-9+!]*(" nil t nil) (progn diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el index 9943fb2548..4d24e694a1 100644 --- a/lisp/obsolete/vip.el +++ b/lisp/obsolete/vip.el @@ -2250,7 +2250,7 @@ a token has type \(command, address, end-mark\) and value." (forward-char 1) (cond ((looking-at "'") (setq ex-token nil)) ((looking-at "[a-z]") (setq ex-token (following-char))) - (t (error "Marks are ' and a-z"))) + (t (error "%s" "Marks are ' and a-z" ?'))) (forward-char 1)) ((looking-at "\n") (setq ex-token-type "end-mark") diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el index 9b152f29f4..8712619ecc 100644 --- a/lisp/org/ob-lua.el +++ b/lisp/org/ob-lua.el @@ -56,7 +56,7 @@ (defcustom org-babel-lua-mode 'lua-mode "Preferred lua mode for use in running lua interactively. -This will typically be 'lua-mode." +This will typically be `lua-mode'." :group 'org-babel :version "26.1" :package-version '(Org . "8.3") @@ -70,7 +70,7 @@ This will typically be 'lua-mode." :type 'string) (defcustom org-babel-lua-None-to 'hline - "Replace 'None' in lua tables with this before returning." + "Replace `None' in lua tables with this before returning." :group 'org-babel :version "26.1" :package-version '(Org . "8.3") @@ -285,8 +285,8 @@ fd:close()") (defun org-babel-lua-evaluate-external-process (body &optional result-type result-params preamble) "Evaluate BODY in external lua process. -If RESULT-TYPE equals 'output then return standard output as a -string. If RESULT-TYPE equals 'value then return the value of the +If RESULT-TYPE equals `output' then return standard output as a +string. If RESULT-TYPE equals `value' then return the value of the last statement in BODY, as elisp." (let ((raw (pcase result-type @@ -317,8 +317,8 @@ last statement in BODY, as elisp." (defun org-babel-lua-evaluate-session (session body &optional result-type result-params) "Pass BODY to the Lua process in SESSION. -If RESULT-TYPE equals 'output then return standard output as a -string. If RESULT-TYPE equals 'value then return the value of the +If RESULT-TYPE equals `output' then return standard output as a +string. If RESULT-TYPE equals `value' then return the value of the last statement in BODY, as elisp." (let* ((send-wait (lambda () (comint-send-input nil t) (sleep-for 0 5))) (dump-last-value diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 66c3d965e0..6870b780fa 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -3920,7 +3920,7 @@ dimming them." the header at `org-hd-marker' is blocked according to `org-entry-blocked-p', then if `org-agenda-dim-blocked-tasks' is 'invisible and the header is not blocked by checkboxes, set the -text property `org-todo-blocked' to 'invisible, otherwise set it +text property `org-todo-blocked' to `invisible', otherwise set it to t." (when (get-text-property 0 'todo-state entry) (let ((entry-marker (get-text-property 0 'org-hd-marker entry)) diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index e617317a06..1ec835a47e 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el @@ -385,7 +385,7 @@ variable is non-nil, Org passes their value to \\label unchanged. You are responsible for ensuring that the value is a valid LaTeX \\label key, and that no other \\label commands with the same key appear elsewhere in your document. (Keys may contain letters, -numbers, and the following punctuation: '_' '.' '-' ':'.) There +numbers, and the following punctuation: `_' `.' `-' `:'.) There are no such limitations on CUSTOM_ID and NAME when this variable is nil. diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 0cbff579d2..cbffbf4711 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -307,7 +307,7 @@ somewhat intentional." file CC-PART.el in the current directory to be loaded at compile time, (ii) generate code to load the file at load time. -CC-PART will normally be a quoted name such as 'cc-fix. +CC-PART will normally be a quoted name such as \\='cc-fix. CONDITION should not be quoted." (if (eval condition) (progn @@ -321,7 +321,7 @@ file CC-PART.el in the current directory to be loaded at compile time, (ii) generate an `eval-after-load' form to load CC-PART.el after the loading of FILE. -CC-PART will normally be a quoted name such as 'cc-fix. FILE +CC-PART will normally be a quoted name such as \\='cc-fix. FILE should be a string. CONDITION should not be quoted." (if (eval condition) (progn diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index cceb58c290..15b23bb2e6 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -5059,10 +5059,10 @@ that region is taken as syntactically significant text. NOERROR, in addition to the values nil, t, and used in `re-search-forward' can also take the values -'before-literal and 'after-literal. In these cases, when BOUND +`before-literal' and `after-literal'. In these cases, when BOUND is also given and is inside a literal, and a search fails, point will be left, respectively before or after the literal. Be aware -that with 'after-literal, if a string or comment is unclosed at +that with `after-literal', if a string or comment is unclosed at the end of the buffer, point may be left there, even though it is inside a literal there. diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el index 3367454c1c..8d6092b501 100644 --- a/lisp/progmodes/idlw-shell.el +++ b/lisp/progmodes/idlw-shell.el @@ -197,7 +197,7 @@ So by default setting a breakpoint will be on C-c C-d C-b." (defcustom idlwave-shell-automatic-electric-debug 'breakpoint "Enter the electric-debug minor mode automatically. This occurs at a breakpoint or any other halt. The mode is exited -upon return to the main level. Can be set to 'breakpoint to enter +upon return to the main level. Can be set to `breakpoint' to enter electric debug mode only when breakpoints are tripped." :group 'idlwave-shell-general-setup :type '(choice @@ -281,8 +281,8 @@ is non-nil." (defcustom idlwave-shell-show-commands '(run misc breakpoint) "A list of command types to show output from in the shell. -Possibilities are 'run, 'debug, 'breakpoint, and 'misc. Unselected -types are not displayed in the shell. The type 'everything causes all +Possibilities are `run', `debug', `breakpoint', and `misc'. Unselected +types are not displayed in the shell. The type `everything' causes all the copious shell traffic to be displayed." :group 'idlwave-shell-command-setup :type '(choice @@ -571,7 +571,7 @@ before use by the shell.") (defun idlwave-shell-temp-file (type) "Return a temp file, creating it if necessary. -TYPE is either 'pro' or 'rinfo', and `idlwave-shell-temp-pro-file' or +TYPE is either `pro' or `rinfo', and `idlwave-shell-temp-pro-file' or `idlwave-shell-temp-rinfo-save-file' is set (respectively)." (cond ((eq type 'rinfo) @@ -1195,7 +1195,7 @@ See also the variable `idlwave-shell-prompt-pattern'. (defun idlwave-shell-hide-p (type &optional list) "Whether to hide this type of command. -Return either nil or 'hide." +Return either nil or `hide'." (let ((list (or list idlwave-shell-show-commands))) (if (listp list) (if (not (memq type list)) 'hide)))) @@ -1222,13 +1222,13 @@ If optional second argument PCMD is non-nil it will be placed on `idlwave-shell-post-command-hook' when CMD is executed. If the optional third argument HIDE is non-nil, then hide output from -CMD, unless it is the symbol 'mostly, in which case only output +CMD, unless it is the symbol `mostly', in which case only output beginning with \"%\" is hidden, and all other output (i.e., the results of a PRINT command), is shown. This helps with, e.g., stepping through code with output. If optional fourth argument PREEMPT is non-nil CMD is put at front of -`idlwave-shell-pending-commands'. If PREEMPT is 'wait, wait for all +`idlwave-shell-pending-commands'. If PREEMPT is `wait', wait for all output to complete and the next prompt to arrive before returning \(useful if you need an answer now). IDL is considered ready if the prompt is present and if `idlwave-shell-ready' is non-nil. @@ -1639,8 +1639,8 @@ IDL has stopped. The types of messages we are interested in are execution halted, stepped, breakpoint, interrupted at and trace messages. For breakpoint messages process any attached count or command parameters. Update the stop line if a message is found. -The variable `idlwave-shell-current-state' is set to 'error, 'halt, -or 'breakpoint, which describes the status, or nil for none of +The variable `idlwave-shell-current-state' is set to `error', `halt', +or `breakpoint', which describes the status, or nil for none of the above." (let (trace) (cond @@ -2282,8 +2282,8 @@ is used. Does nothing if the resulting frame is nil." FRAME is a list of file name, line number, and subroutine name. If FRAME is nil then remove overlay. If COL is set, move point to that column in the line. If DEBUG is non-nil, enable the electric debug -mode. If it is 'disable, do not enable no matter what the setting of -`idlwave-shell-automatic-electric-debug'. If it is 'force, enable no +mode. If it is `disable', do not enable no matter what the setting of +`idlwave-shell-automatic-electric-debug'. If it is `force', enable no matter what the settings of that variable." (if (not frame) ;; remove stop-line overlay from old position @@ -2560,7 +2560,7 @@ stopped at a breakpoint." (defun idlwave-shell-toggle-enable-current-bp (&optional bp force no-update) "Disable or enable current breakpoint or a breakpoint passed in BP. -If FORCE is 'disable or 'enable, for that condition instead of +If FORCE is `disable' or `enable', for that condition instead of toggling. If NO-UPDATE is non-nil, don't update the breakpoint list after toggling." (interactive) @@ -3114,7 +3114,7 @@ versions of IDL." (defun idlwave-shell-help-statement (help expr) "Construct a help statement for printing expression EXPR. -HELP can be non-nil for `help,', nil for 'print,' or any string into which +HELP can be non-nil for `help,', nil for `print,' or any string into which to insert expression in place of the marker ___, e.g.: print, size(___,/DIMENSIONS)" (cond @@ -3287,9 +3287,9 @@ Queries IDL using the string in `idlwave-shell-bp-query'." "Get a value for a breakpoint. BP has the form of elements in `idlwave-shell-bp-alist'. Optional second arg ITEM is the particular value to retrieve. -ITEM can be 'file, 'line, 'index, 'module, 'count, 'cmd, -'condition, 'disabled, 'type, or 'data. 'data returns a list -of 'count, 'cmd and 'condition. Defaults to 'index." +ITEM can be `file', `line', `index', `module', `count', `cmd', +`condition', `disabled', `type', or `data'. `data' returns a list +of `count', `cmd' and `condition'. Defaults to `index'." (cond ;; Frame ((eq item 'line) (nth 1 (car bp))) @@ -3636,7 +3636,7 @@ Existing overlays are recycled, in order to minimize consumption." "Make a new overlay for highlighting breakpoints. This stuff is strongly dependent upon the version of Emacs. If TYPE -is passed, make an overlay of that type ('bp or 'bp-cond, currently +is passed, make an overlay of that type (`bp' or `bp-cond', currently only for glyphs)." (let ((ov (make-overlay 1 1)) (use-glyph (and (memq idlwave-shell-mark-breakpoints '(t glyph)) diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el index a759709b5c..8dcd625adc 100644 --- a/lisp/progmodes/mixal-mode.el +++ b/lisp/progmodes/mixal-mode.el @@ -330,7 +330,7 @@ part of the subfield. The default field for STJ is (0:2)." 2) (STZ storing "store zero" 33 field - "Store in cell Nr. M '+ 0'. + "Store in cell Nr. M `+ 0'. The modification of the operation code represents the subfield of the memory cell that is to be overwritten with zeros." 2) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index c7807f3944..5627a21573 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -110,7 +110,7 @@ is not a part of a detectable project either, return a (setq dir (read-directory-name "Choose the project directory: " dir nil t) pr (project--find-in-directory dir)) (unless pr - (message "Using '%s' as a transient project root" dir) + (message "Using `%s' as a transient project root" dir) (setq pr (cons 'transient dir))))) pr)) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e672645c73..37e0ccf719 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3747,7 +3747,7 @@ Used to extract the current line and module being inspected. Must match lines with real filename, like > /path/to/file.py(42)()->None -and lines in which filename starts with '<', e.g. +and lines in which filename starts with `<', e.g. > (1)()->None In the first case /path/to/file.py file will be visited and overlay icon @@ -3762,21 +3762,21 @@ Line number is expected in the second parenthesized expression." :safe 'stringp) (defcustom python-pdbtrack-continue-command '("c" "cont" "continue") - "Pdb 'continue' command aliases. -After one of this commands is sent to pdb, pdbtracking session is + "Pdb `continue' command aliases. +After one of these commands is sent to pdb, the pdbtracking session is considered over. -This command is remembered by pdbtracking. If next command sent to pdb -is empty string, it considered 'continue' command if previous command -was 'continue'. This behavior slightly differentiate 'continue' command -from 'exit' commands listed in `python-pdbtrack-exit-command'. +This command is remembered by pdbtracking. If the next command sent to pdb +is the empty string, it is treated as `continue' if the previous command +was `continue'. This behavior slightly differentiates the `continue' command +from the `exit' command listed in `python-pdbtrack-exit-command'. See `python-pdbtrack-activate' for pdbtracking session overview." :type 'list :version "27.1") (defcustom python-pdbtrack-exit-command '("q" "quit" "exit") - "Pdb 'exit' command aliases. + "Pdb `exit' command aliases. After one of this commands is sent to pdb, pdbtracking session is considered over. @@ -3801,7 +3801,7 @@ Never set this variable directly, use "List of buffers to be deleted after tracking finishes.") (defvar python-pdbtrack-prev-command-continue nil - "Is t if previous pdb command was 'continue'.") + "Is t if previous pdb command was `continue'.") (defun python-pdbtrack-set-tracked-buffer (file-name) "Set the buffer for FILE-NAME as the tracked buffer. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 69acc7a394..b9d9347b5b 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1807,9 +1807,9 @@ If the result is do-end block, it will always be multiline." (defun ruby-find-library-file (&optional feature-name) "Visit a library file denoted by FEATURE-NAME. FEATURE-NAME is a relative file name, file extension is optional. -This commands delegates to 'gem which', which searches both +This commands delegates to `gem which', which searches both installed gems and the standard library. When called -interactively, defaults to the feature name in the 'require' +interactively, defaults to the feature name in the `require' statement around point." (interactive) (unless feature-name diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el index 9fc6d54faf..a894e8e3f7 100644 --- a/lisp/progmodes/simula.el +++ b/lisp/progmodes/simula.el @@ -1122,7 +1122,7 @@ If COUNT is negative, move backward instead." ((eq (following-char) ?\;) (if (zerop parlevel) (throw 'simula-out nil) - (error "Parenthesis mismatch or misplaced ';'"))) + (error "Parenthesis mismatch or misplaced `;'"))) ((eq (following-char) ?\() (if (zerop parlevel) (throw 'simula-out (1+ (current-column))) diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 16ddcdebc9..dc5bf203a2 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -8737,13 +8737,13 @@ project is defined." ((/= (preceding-char) ?-) ; standard dash (minus) (self-insert-command count)) (t (self-insert-command count) - (message "Enter '-' for horiz. line, 'CR' for commenting-out code, else enter comment") + (message "Enter `-' for horiz. line, RET for commenting-out code, else enter comment") (let ((next-input (read-char))) (if (= next-input ?-) ; triple dash (progn (vhdl-comment-display-line) (message - "Enter '-' for display comment, else continue coding") + "Enter `-' for display comment, else continue coding") (let ((next-input (read-char))) (if (= next-input ?-) ; four dashes (vhdl-comment-display t) diff --git a/lisp/so-long.el b/lisp/so-long.el index 43602b4831..b5eb124215 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1342,7 +1342,7 @@ This is the `so-long-revert-function' for `so-long-mode'." (defun so-long-mode-downgrade (&optional mode) "The default value for `so-long-file-local-mode-function'. -A buffer-local 'downgrade' from `so-long-mode' to `so-long-minor-mode'. +A buffer-local \"downgrade\" from `so-long-mode' to `so-long-minor-mode'. When `so-long-function' is set to `so-long-mode', then we change it to to `turn-on-so-long-minor-mode' instead -- retaining the file-local major @@ -1373,13 +1373,13 @@ This is a `so-long-file-local-mode-function' option." ;; See also "Files with a file-local 'mode'" in the Commentary. "Handle the header-comments processing in `set-auto-mode'. -`set-auto-mode' has some special-case code to handle the 'mode' pseudo-variable +`set-auto-mode' has some special-case code to handle the `mode' pseudo-variable when set in the header comment. This runs outside of `hack-local-variables' and cannot be conveniently intercepted, so we are forced to replicate it here. This special-case code will ultimately be removed from Emacs, as it exists to deal with a deprecated feature; but until then we need to replicate it in order -to inhibit our own behaviour in the presence of a header comment 'mode' +to inhibit our own behavior in the presence of a header comment `mode' declaration. If a file-local mode is detected in the header comment, then we call the @@ -1496,7 +1496,7 @@ major mode is a member (or derivative of a member) of `so-long-target-modes'. This advice is needed and enabled only for Emacs versions < 26.1. -If the local 'mode' pseudo-variable is used, `set-auto-mode-0' will call it +If the local `mode' pseudo-variable is used, `set-auto-mode-0' will call it firstly, and subsequently `hack-one-local-variable' may call it again. Usually `hack-one-local-variable' tries to avoid processing that second call, diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index be2e192e5a..dd1eeb4530 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -2472,7 +2472,7 @@ SPC: Accept word this time. (help-2 (concat "[l]ook a word up in alternate dictionary; " "e[x/X]it; [q]uit session")) (help-3 (concat "[u]ncapitalized insert into dict. " - "Type 'x C-h f ispell-help' for more help"))) + "Type `x C-h f ispell-help' for more help"))) (save-window-excursion (if ispell-help-in-bufferp (let ((buffer (get-buffer-create "*Ispell Help*"))) @@ -3603,7 +3603,7 @@ If APPEND is non-n il, append the info to previous buffer if exists." "Continue a halted spelling session beginning with the current word." (interactive) (if (not (marker-position ispell-region-end)) - (message "No session to continue. Use 'X' command when checking!") + (message "No session to continue. Use `X' command when checking!") (if (not (equal (marker-buffer ispell-region-end) (current-buffer))) (message "Must continue ispell from buffer %s" (buffer-name (marker-buffer ispell-region-end))) diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 41ffb4cd4a..df567b0fc4 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el @@ -37,8 +37,8 @@ "Find the exact file referenced by `fname'. This tries the common compression extensions, because things like ange-ftp and efs are not quite smart enough to realize when a server -can do automatic decompression for them, and won't find 'foo' if -'foo.gz' exists, even though the FTP server would happily serve it up +can do automatic decompression for them, and won't find `foo' if +`foo.gz' exists, even though the FTP server would happily serve it up to them." (let ((scratch nil) (compressed-extensions '("" ".gz" ".z" ".Z" ".bz2" ".xz")) diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 52a765482e..a481defe29 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -1274,21 +1274,21 @@ which see." (cond ((eq ediff-window-setup-function #'ediff-setup-windows-multiframe) (setq ediff-multiframe nil) (setq window-setup-func #'ediff-setup-windows-plain) - (message "ediff is now in 'plain' mode")) + (message "ediff is now in `plain' mode")) ((eq ediff-window-setup-function #'ediff-setup-windows-plain) (if (and (ediff-buffer-live-p ediff-control-buffer) (window-live-p ediff-control-window)) (set-window-dedicated-p ediff-control-window nil)) (setq ediff-multiframe t) (setq window-setup-func #'ediff-setup-windows-multiframe) - (message "ediff is now in 'multiframe' mode")) + (message "ediff is now in `multiframe' mode")) (t (if (and (ediff-buffer-live-p ediff-control-buffer) (window-live-p ediff-control-window)) (set-window-dedicated-p ediff-control-window nil)) (setq ediff-multiframe t) (setq window-setup-func #'ediff-setup-windows-multiframe)) - (message "ediff is now in 'multiframe' mode")) + (message "ediff is now in `multiframe' mode")) ;; change default (setq-default ediff-window-setup-function window-setup-func) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 89f1fcce37..4c75eb79f1 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -433,7 +433,7 @@ default if it is available." Return value is a cons (STATUS . WARNING), where WARNING is a string or nil, and STATUS is one of the symbols: `added', `ignored', `kindchanged', `modified', `removed', `renamed', `unknown', -which directly correspond to `bzr status' output, or 'unchanged +which directly correspond to `bzr status' output, or `unchanged' for files whose copy in the working tree is identical to the one in the branch repository (or whose status not be determined)." ;; Doc used to also say the following, but AFAICS, it has never been true. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 3960f725cf..2046a9dcec 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -282,8 +282,8 @@ toggle display of the entire list." "Convert CODE-LIST to a VC status. Each element of CODE-LIST comes from the first two characters of -a line returned by 'git status --porcelain' and should be passed -in the order given by 'git status'." +a line returned by `git status --porcelain' and should be passed +in the order given by `git status'." ;; It is necessary to allow CODE-LIST to be a list because sometimes git ;; status returns multiple lines, e.g. for a file that is removed from ;; the index but is present in the HEAD and working tree. diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index 32e0b3e125..94ab938a22 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el @@ -3512,7 +3512,7 @@ To use this type, you must define :match or :match-alternatives." The `lazy' widget will, when instantiated, contain a single inferior widget, of the widget type specified by the :type parameter. The value of the `lazy' widget is the same as the value of the inferior -widget. When deriving a new widget from the 'lazy' widget, the :type +widget. When deriving a new widget from the `lazy' widget, the :type parameter is allowed to refer to the widget currently being defined, thus allowing recursive data structures to be described. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index d73c6a7842..eca1e3bc7f 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -240,8 +240,8 @@ form.") (should (equal kill-emacs-args '(nil))))) (ert-deftest files-tests-read-file-in-~ () - "Test file prompting in directory named '~'. -If we are in a directory named '~', the default value should not + "Test file prompting in directory named `~'. +If we are in a directory named `~', the default value should not be $HOME." (cl-letf (((symbol-function 'completing-read) (lambda (_prompt _coll &optional _pred _req init _hist def _) diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index ba5bfe0145..3a2212ef77 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -145,7 +145,7 @@ literals (Bug#20852)." "expected!"))))) (ert-deftest lread-tests--funny-quote-symbols () - "Check that 'smart quotes' or similar trigger errors in symbol names." + "Check that `smart quotes' or similar trigger errors in symbol names." (dolist (quote-char '(#x2018 ;; LEFT SINGLE QUOTATION MARK #x2019 ;; RIGHT SINGLE QUOTATION MARK commit 269796288a43520a1dcc481337af472d086faaa4 Author: Paul Eggert Date: Mon Nov 11 10:29:56 2019 -0800 Fix quoting glitch in formatting Gnus messages * lisp/gnus/gnus-util.el (defmacro, gnus-message): Use ‘format-message’, not ‘format’, to be compatible with ‘message’. diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 3cf364fff8..8e390473aa 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -468,7 +468,8 @@ displayed in the echo area." (gnus-add-timestamp-to-message (if (or (and (null ,format-string) (null ,args)) (progn - (setq str (apply 'format ,format-string ,args)) + (setq str (apply #'format-message ,format-string + ,args)) (zerop (length str)))) (prog1 (and ,format-string str) @@ -506,7 +507,7 @@ inside loops." ;; We have to do this format thingy here even if the result isn't ;; shown - the return value has to be the same as the return value ;; from `message'. - (apply 'format args))) + (apply #'format-message args))) (defun gnus-final-warning () (when (and (consp gnus-action-message-log) commit 72729014fcad377cbcdb2c5a59eb8b37ecf2a020 Author: Paul Eggert Date: Mon Nov 11 10:29:09 2019 -0800 Fix glitch in generating cxterm doc strings * lisp/international/titdic-cnv.el (tit-process-header): In generated doc strings, escape \, ", ', and ` properly. Currently only ' appears but we might as well future-proof this. diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 8615d95331..34bd1cfbd8 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -283,7 +283,14 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲, (pos (point))) (cond ((= ch ?C) ; COMMENT (cond ((looking-at "COMMENT") - (let ((pos (match-end 0))) + (let ((pos (match-end 0)) + (to (progn (end-of-line) (point)))) + (goto-char pos) + (while (re-search-forward "[\\\"]" to t) + (replace-match "\\\\\\&")) + (goto-char pos) + (while (re-search-forward "['`]" to t) + (replace-match "\\\\\\\\=\\&")) (end-of-line) (setq tit-comments (cons (buffer-substring-no-properties pos (point)) commit 292f73fc729cb12350814a4ba361253c33b4f59d Author: Wilson Snyder Date: Mon Nov 11 11:47:54 2019 -0500 Verilog-Mode collected updates. * lisp/progmodes/verilog-mode.el (verilog-read-decls): Fix to skip over base64-encoded protected data while reading AUTO declarations. Reported by Berend Ozceri. (verilog-auto-inst-port, verilog-auto-inst-vector): Support 'unsigned' in `verilog-auto-inst-vector'. Reported by Jeff Riley. (verilog-read-decls): Fix to ignore `line in AUTOINST, git bug18. Reported by Berend Ozceri. (verilog-library-extensions): Support .va /.vah/.sva/.svah file extensions to load verilog-mode for Verilog-AMS. Reported by Shareef Jalloq. (verilog-read-sub-decls-expr): Fix AUTOOUTPUT etc misparsing Verilog casts, bug1526. Reported by Udi Finkelstein. diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 5bfa5f837a..85657b385d 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -9,7 +9,7 @@ ;; Keywords: languages ;; The "Version" is the date followed by the decimal rendition of the Git ;; commit hex. -;; Version: 2019.09.23.004801067 +;; Version: 2019.11.11.038630457 ;; Yoni Rabkin contacted the maintainer of this ;; file on 19/3/2008, and the maintainer agreed that when a bug is @@ -80,7 +80,7 @@ ;; .emacs, or in your site's site-load.el ;; (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) -;; (add-to-list 'auto-mode-alist '("\\.[ds]?vh?\\'" . verilog-mode)) +;; (add-to-list 'auto-mode-alist '("\\.[ds]?va?h?\\'" . verilog-mode)) ;; Be sure to examine at the help for verilog-auto, and the other ;; verilog-auto-* functions for some major coding time savers. @@ -124,7 +124,7 @@ ;; ;; This variable will always hold the version number of the mode -(defconst verilog-mode-version "2019-09-23-049422b-vpo-GNU" +(defconst verilog-mode-version "2019-11-11-24d7439-vpo-GNU" "Version of this Verilog mode.") (defconst verilog-mode-release-emacs t "If non-nil, this version of Verilog mode was released with Emacs itself.") @@ -334,6 +334,15 @@ wherever possible, since it is slow." (t (defalias 'verilog-restore-buffer-modified-p 'set-buffer-modified-p)))) +(eval-and-compile + (cond + ((fboundp 'quit-window) + (defalias 'verilog-quit-window 'quit-window)) + (t + (defun verilog-quit-window (kill-ignored window) + "Quit WINDOW and bury its buffer. KILL-IGNORED is ignored." + (delete-window window))))) + (eval-and-compile ;; Both xemacs and emacs (condition-case nil @@ -1037,7 +1046,7 @@ See also `verilog-library-flags', `verilog-library-directories'." :type '(repeat directory)) (put 'verilog-library-files 'safe-local-variable 'listp) -(defcustom verilog-library-extensions '(".v" ".sv") +(defcustom verilog-library-extensions '(".v" ".va" ".sv") "List of extensions to use when looking for files for /*AUTOINST*/. See also `verilog-library-flags', `verilog-library-directories'." :type '(repeat string) @@ -1246,14 +1255,17 @@ See also `verilog-auto-arg-sort'." (put 'verilog-auto-inst-sort 'safe-local-variable 'verilog-booleanp) (defcustom verilog-auto-inst-vector t - "Non-nil means when creating default ports with AUTOINST, use bus subscripts. + "True means when creating default ports with AUTOINST, use bus subscripts. If nil, skip the subscript when it matches the entire bus as declared in the module (AUTOWIRE signals always are subscripted, you must manually declare the wire to have the subscripts removed.) Setting this to nil may -speed up some simulators, but is less general and harder to read, so avoid." +speed up some simulators, but is less general and harder to read, so avoid. +If `unsigned', use vectors for unsigned types (like using true, +otherwise no vectors if sizes match (like using nil)." :group 'verilog-mode-auto - :type 'boolean) -(put 'verilog-auto-inst-vector 'safe-local-variable 'verilog-booleanp) + :type '(choice (const nil) (const t) (const unsigned))) +(put 'verilog-auto-inst-vector 'safe-local-variable + '(lambda (x) (memq x '(nil t unsigned)))) (defcustom verilog-auto-inst-template-numbers nil "If true, when creating templated ports with AUTOINST, add a comment. @@ -7598,7 +7610,8 @@ and `verilog-separator-keywords'.)" (display-completion-list allcomp)) ;; Wait for a key press. Then delete *Completion* window (momentary-string-display "" (point)) - (quit-window nil (get-buffer-window "*Completions*"))))))) + (verilog-quit-window nil (get-buffer-window "*Completions*")) + ))))) (defun verilog-show-completions () "Show all possible completions at current point." @@ -7610,8 +7623,7 @@ and `verilog-separator-keywords'.)" (display-completion-list (nth 2 (verilog-completion-at-point)))) ;; Wait for a key press. Then delete *Completion* window (momentary-string-display "" (point)) - (quit-window nil (get-buffer-window "*Completions*"))) - + (verilog-quit-window nil (get-buffer-window "*Completions*"))) (defun verilog-get-default-symbol () "Return symbol around current point as a string." @@ -8477,6 +8489,10 @@ Return an array of [outputs inouts inputs wire reg assign const]." (setq enum (match-string-no-properties 2))) (or (search-forward "*/") (error "%s: Unmatched /* */, at char %d" (verilog-point-text) (point)))) + ;; Skip over protected sections with Base64-encoded data + ((looking-at "^\\s *`pragma\\s +protect\\s +begin_protected") + (or (re-search-forward "^\\s *`pragma\\s +protect\\s +end_protected" nil t) + (forward-line))) ((looking-at "(\\*") ;; To advance past either "(*)" or "(* ... *)" don't forward past first * (forward-char 1) @@ -8620,6 +8636,9 @@ Return an array of [outputs inouts inputs wire reg assign const]." ;; Ifdef? Ignore name of define ((member keywd '("`ifdef" "`ifndef" "`elsif")) (setq rvalue t)) + ;; Line directive? Skip over the rest of the line + ((equal keywd "`line") + (forward-line)) ;; Type? ((unless ptype (verilog-typedef-name-p keywd)) @@ -8852,6 +8871,12 @@ Return an array of [outputs inouts inputs wire reg assign const]." (let (sig vec multidim mem) ;; Remove leading reduction operators, etc (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" nil nil expr)) + ;; Remove casting types + (setq expr (verilog-string-replace-matches + "^\\s-*[a-zA-Z_][a-zA-Z_0-9]*\\s-*'" "" nil nil expr)) + ;; Remove simple single set of parens (perhaps from cast, or perhaps not) + (setq expr (verilog-string-replace-matches + "^\\s-*(\\([^)]*\\))\\s-*$" "\\1" nil nil expr)) ;;(message "vrsde-ptop: `%s'" expr) (cond ; Find \signal. Final space is part of escaped signal name ((string-match "^\\s-*\\(\\\\[^ \t\n\f]+\\s-\\)" expr) @@ -8981,14 +9006,16 @@ This only works on instantiations created with /*AUTOINST*/ converted by \\[verilog-auto-inst]. Otherwise, it would have to read in the whole component library to determine connectivity of the design. -One work around for this problem is to manually create // Inputs and // -Outputs comments above subcell signals, for example: +One work around for this problem is to manually create // Inputs +and // Outputs comments above subcell signals, then have an empty +AUTOINST, for example: submod SubModuleName ( // Outputs .out (out), // Inputs - .in (in));" + .in (in) + /*AUTOINST*/);" (save-excursion (let ((end-mod-point (verilog-get-end-of-defun)) st-point end-inst-point par-values @@ -11355,7 +11382,9 @@ If PAR-VALUES replace final strings with these parameter values." (vl-memory (verilog-sig-memory port-st)) (vl-mbits (if (verilog-sig-multidim port-st) (verilog-sig-multidim-string port-st) "")) - (vl-bits (if (or verilog-auto-inst-vector + (vl-bits (if (or (eq verilog-auto-inst-vector t) + (and (eq verilog-auto-inst-vector `unsigned) + (not (verilog-sig-signed port-st))) (not (assoc port (verilog-decls-get-signals moddecls))) (not (equal (verilog-sig-bits port-st) (verilog-sig-bits commit d0a3c94996d6b1928b845c6b98ac9618e9bf77f5 Author: Stefan Kangas Date: Mon Nov 11 16:05:21 2019 +0100 Add several configuration files to auto-mode-alist * lisp/files.el (auto-mode-alist): Use conf-mode for .asoundrc, .mairixrc, .mbsyncr, .msmtprc, .nvidia-settings-rc, .offlineimaprc, .reportbugrc, .rtorrent.rc, .screenrc, .mpdconf, .notmuch-config. Use conf-windows-mode for .redshift.conf. (Bug#38065) diff --git a/lisp/files.el b/lisp/files.el index 24b882ede2..053583b4cb 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2819,6 +2819,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\)\\'" . archive-mo ("\\.properties\\(?:\\.[a-zA-Z0-9._-]+\\)?\\'" . conf-javaprop-mode) ("\\.toml\\'" . conf-toml-mode) ("\\.desktop\\'" . conf-desktop-mode) + ("/\\.redshift.conf\\'" . conf-windows-mode) ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode) ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode) ;; ChangeLog.old etc. Other change-log-mode entries are above; @@ -2827,8 +2828,8 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\)\\'" . archive-mo ;; either user's dot-files or under /etc or some such ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode) ;; alas not all ~/.*rc files are like this - ("/\\.\\(?:enigma\\|gltron\\|gtk\\|hxplayer\\|net\\|neverball\\|qt/.+\\|realplayer\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode) - ("/\\.\\(?:gdbtkinit\\|grip\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode) + ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode) + ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode) ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode) ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode) ("/X11.+locale/.+/Compose\\'" . conf-colon-mode) commit b6942c0c37a504e00c717c8c74bfa9dcd208c931 Author: Paul Eggert Date: Sun Nov 10 15:01:06 2019 -0800 Document Lisp floats a bit better * doc/lispref/numbers.texi (Float Basics): * doc/misc/cl.texi (Implementation Parameters): * lisp/emacs-lisp/cl-lib.el (cl-most-positive-float) (cl-least-positive-float) (cl-least-positive-normalized-float, cl-float-epsilon) (cl-float-negative-epsilon): Document IEEE floating point better. Don’t suggest that Emacs might use some floating-point format other than IEEE format, as Emacs currently assumes IEEE in several places and there seems little point in removing those assumptions. diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index 0c71387a8a..939ad5c85a 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -218,8 +218,12 @@ considered to be valid as a character. @xref{Character Codes}. Floating-point numbers are useful for representing numbers that are not integral. The range of floating-point numbers is the same as the range of the C data type @code{double} on the machine -you are using. On all computers currently supported by Emacs, this is -double-precision @acronym{IEEE} floating point. +you are using. On all computers supported by Emacs, this is +@acronym{IEEE} binary64 floating point format, which is standardized by +@url{https://standards.ieee.org/standard/754-2019.html,,IEEE Std 754-2019} +and is discussed further in David Goldberg's paper +``@url{https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html, +What Every Computer Scientist Should Know About Floating-Point Arithmetic}''. The read syntax for floating-point numbers requires either a decimal point, an exponent, or both. Optional signs (@samp{+} or @samp{-}) diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 246f86bfd1..cfdbc7c41b 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -3113,48 +3113,42 @@ function that must be called before the parameters can be used. @defun cl-float-limits This function makes sure that the Common Lisp floating-point parameters like @code{cl-most-positive-float} have been initialized. Until it is -called, these parameters will be @code{nil}. -@c If this version of Emacs does not support floats, the parameters will -@c remain @code{nil}. +called, these parameters have unspecified values. If the parameters have already been initialized, the function returns immediately. - -The algorithm makes assumptions that will be valid for almost all -machines, but will fail if the machine's arithmetic is extremely -unusual, e.g., decimal. @end defun Since true Common Lisp supports up to four different kinds of floating-point numbers, it has families of constants like @code{most-positive-single-float}, @code{most-positive-double-float}, -@code{most-positive-long-float}, and so on. Emacs has only one -kind of floating-point number, so this package just uses single constants. +@code{most-positive-long-float}, and so on. This package uses just +one set of constants because Emacs has only one kind of +floating-point number, namely the IEEE binary64 floating-point format. +@xref{Float Basics,,,elisp,GNU Emacs Lisp Reference Manual}. @defvar cl-most-positive-float -This constant equals the largest value a Lisp float can hold. -For those systems whose arithmetic supports infinities, this is -the largest @emph{finite} value. For IEEE machines, the value -is approximately @code{1.79e+308}. +This constant equals the largest finite value a Lisp float can hold. +For IEEE binary64 format, this equals @code{(- (expt 2 1024) (- 2 +971))}, which equals @code{1.7976931348623157e+308}. @end defvar @defvar cl-most-negative-float -This constant equals the most negative value a Lisp float can hold. -(It is assumed to be equal to @code{(- cl-most-positive-float)}.) +This constant equals the most negative finite value a Lisp float can hold. +For IEEE binary64 format, this equals @code{(- cl-most-positive-float)}. @end defvar -@defvar cl-least-positive-float -This constant equals the smallest Lisp float value greater than zero. -For IEEE machines, it is about @code{4.94e-324} if denormals are -supported or @code{2.22e-308} if not. +@defvar cl-least-positive-normalized-float +This constant equals the smallest positive Lisp float that is +@dfn{normalized}, i.e., that has full precision. +For IEEE binary64 format, this equals @code{(expt 2 -1022)}, +which equals @code{2.2250738585072014e-308}. @end defvar -@defvar cl-least-positive-normalized-float -This constant equals the smallest @emph{normalized} Lisp float greater -than zero, i.e., the smallest value for which IEEE denormalization -will not result in a loss of precision. For IEEE machines, this -value is about @code{2.22e-308}. For machines that do not support -the concept of denormalization and gradual underflow, this constant -will always equal @code{cl-least-positive-float}. +@defvar cl-least-positive-float +This constant equals the smallest Lisp float value greater than zero. +For IEEE binary64 format, this equals @code{5e-324} (which equals +@code{(expt 2 -1074)}) if subnormal numbers are supported, and +@code{cl-least-positive-normalized-float} otherwise. @end defvar @defvar cl-least-negative-float @@ -3169,14 +3163,14 @@ This constant is the negative counterpart of @defvar cl-float-epsilon This constant is the smallest positive Lisp float that can be added to 1.0 to produce a distinct value. Adding a smaller number to 1.0 -will yield 1.0 again due to roundoff. For IEEE machines, epsilon -is about @code{2.22e-16}. +will yield 1.0 again due to roundoff. For IEEE binary64 format, this +equals @code{(expt 2 -52)}, which equals @code{2.220446049250313e-16}. @end defvar @defvar cl-float-negative-epsilon This is the smallest positive value that can be subtracted from -1.0 to produce a distinct value. For IEEE machines, it is about -@code{1.11e-16}. +1.0 to produce a distinct value. For IEEE binary64 format, this +equals @code{(expt 2 -53)}, which equals @code{1.1102230246251565e-16}. @end defvar @node Sequences diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index ff09691817..7d0df27e14 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -299,7 +299,7 @@ If true return the decimal value of digit CHAR in RADIX." (defconst cl-most-positive-float nil "The largest value that a Lisp float can hold. If your system supports infinities, this is the largest finite value. -For IEEE machines, this is approximately 1.79e+308. +For Emacs, this equals 1.7976931348623157e+308. Call `cl-float-limits' to set this.") (defconst cl-most-negative-float nil @@ -309,8 +309,8 @@ Call `cl-float-limits' to set this.") (defconst cl-least-positive-float nil "The smallest value greater than zero that a Lisp float can hold. -For IEEE machines, it is about 4.94e-324 if denormals are supported, -or 2.22e-308 if they are not. +For Emacs, this equals 5e-324 if subnormal numbers are supported, +`cl-least-positive-normalized-float' if they are not. Call `cl-float-limits' to set this.") (defconst cl-least-negative-float nil @@ -320,10 +320,8 @@ Call `cl-float-limits' to set this.") (defconst cl-least-positive-normalized-float nil "The smallest normalized Lisp float greater than zero. -This is the smallest value for which IEEE denormalization does not lose -precision. For IEEE machines, this value is about 2.22e-308. -For machines that do not support the concept of denormalization -and gradual underflow, this constant equals `cl-least-positive-float'. +This is the smallest value that has full precision. +For Emacs, this equals 2.2250738585072014e-308. Call `cl-float-limits' to set this.") (defconst cl-least-negative-normalized-float nil @@ -334,12 +332,12 @@ Call `cl-float-limits' to set this.") (defconst cl-float-epsilon nil "The smallest positive float that adds to 1.0 to give a distinct value. Adding a number less than this to 1.0 returns 1.0 due to roundoff. -For IEEE machines, epsilon is about 2.22e-16. +For Emacs, this equals 2.220446049250313e-16. Call `cl-float-limits' to set this.") (defconst cl-float-negative-epsilon nil "The smallest positive float that subtracts from 1.0 to give a distinct value. -For IEEE machines, it is about 1.11e-16. +For Emacs, this equals 1.1102230246251565e-16. Call `cl-float-limits' to set this.") commit 6ad5eb97940b07bf8d28f8517608351b3af1221c Author: Juri Linkov Date: Sun Nov 10 23:30:41 2019 +0200 * lisp/tab-bar.el: Better handling of closed-tabs in tab-bar-list. * lisp/tab-bar.el (tab-bar-list-delete-from-list): Add closed tab to tab-bar-closed-tabs. (tab-bar-list-select): Don't add the closed intermediate tab to tab-bar-closed-tabs. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index e00839572c..95835862ff 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1210,6 +1210,10 @@ Then move up one line. Prefix arg means move that many lines." (defun tab-bar-list-delete-from-list (tab) "Delete the window configuration from both lists." + (push `((frame . ,(selected-frame)) + (index . ,(tab-bar--tab-index tab)) + (tab . ,tab)) + tab-bar-closed-tabs) (set-frame-parameter nil 'tabs (delq tab (funcall tab-bar-tabs-function)))) (defun tab-bar-list-execute () @@ -1238,8 +1242,10 @@ in the selected frame." (interactive) (let* ((to-tab (tab-bar-list-current-tab t))) (kill-buffer (current-buffer)) - ;; Delete the current window configuration - (tab-bar-close-tab nil (1+ (tab-bar--tab-index to-tab))))) + ;; Delete the current window configuration of tab list + ;; without storing it in the undo list of closed tabs + (let (tab-bar-closed-tabs) + (tab-bar-close-tab nil (1+ (tab-bar--tab-index to-tab)))))) (defun tab-bar-list-mouse-select (event) "Select the window configuration whose line you click on." commit 7e151f5bcfe431c31528743705e6ab56cf8dc220 Author: Juri Linkov Date: Sun Nov 10 23:21:46 2019 +0200 * lisp/autorevert.el: Use 'minibuffer-message' to not obscure the prompt. * lisp/autorevert.el (auto-revert-handler): Use 'minibuffer-message' instead of 'message'. Call it from the original window's buffer that in case of the minibuffer should be current, so minibuffer-message could add a message to it. (Bug#34614) * lisp/emacs-lisp/ert-x.el (ert--make-message-advice): Add nil to the list of values to not use for format-message, because minibuffer-message calls 'message' with nil argument, and tests fail. diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 9275513c8d..079750a3f6 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -815,7 +815,8 @@ This is an internal function used by Auto-Revert Mode." (when revert (when (and auto-revert-verbose (not (eq revert 'fast))) - (message "Reverting buffer `%s'." (buffer-name))) + (with-current-buffer (window-buffer (old-selected-window)) + (minibuffer-message "Reverting buffer `%s'." (buffer-name)))) ;; If point (or a window point) is at the end of the buffer, we ;; want to keep it at the end after reverting. This allows one ;; to tail a file. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index ee561d5b95..d09d3ae11e 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -321,7 +321,7 @@ code under test from the behavior of the *Messages* buffer." COLLECTOR will be called with the message before it is passed to the real `message'." (lambda (func &rest args) - (if (or (null args) (equal (car args) "")) + (if (or (null args) (member (car args) '("" nil))) (apply func args) (let ((msg (apply #'format-message args))) (funcall collector (concat msg "\n")) commit 0154e41b184a0b9938fafd9eca15399b4d5e477f Author: Stefan Kangas Date: Sun Nov 10 22:15:31 2019 +0100 Make dired-get-subdir-min obsolete * lisp/dired.el (dired-get-subdir-min): Redefine as obsolete function alias for 'cdr'. (Bug#11571) (dired-get-subdir, dired-get-subdir-max, dired-clear-alist) (dired-next-subdir, dired-current-directory): * lisp/dired-aux.el (dired-rename-subdir-2) (dired-alist-sort, dired-insert-subdir-del) (dired-insert-subdir-doupdate, dired-goto-subdir) (dired-hide-subdir, dired-hide-all): Use 'cdr' instead of the above obsolete function. (dired-subdir-alist): Doc fix. Co-authored-by: Drew Adams diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 722d036e3f..184b507e1d 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1728,7 +1728,7 @@ rename them using `vc-rename-file'." (let ((regexp (regexp-quote (directory-file-name dir))) (newtext (directory-file-name to)) buffer-read-only) - (goto-char (dired-get-subdir-min elt)) + (goto-char (cdr elt)) ;; Update subdir headerline in buffer (if (not (looking-at dired-subdir-regexp)) (error "%s not found where expected - dired-subdir-alist broken?" @@ -2491,8 +2491,8 @@ This function takes some pains to conform to `ls -lR' output." (setq dired-subdir-alist (sort dired-subdir-alist (lambda (elt1 elt2) - (> (dired-get-subdir-min elt1) - (dired-get-subdir-min elt2)))))) + (> (cdr elt1) + (cdr elt2)))))) (defun dired-kill-tree (dirname &optional remember-marks kill-root) "Kill all proper subdirs of DIRNAME, excluding DIRNAME itself. @@ -2535,7 +2535,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." (defun dired-insert-subdir-del (element) ;; Erase an already present subdir (given by ELEMENT) from buffer. ;; Move to that buffer position. Return a mark-alist. - (let ((begin-marker (dired-get-subdir-min element))) + (let ((begin-marker (cdr element))) (goto-char begin-marker) ;; Are at beginning of subdir (and inside it!). Now determine its end: (goto-char (dired-subdir-max)) @@ -2566,7 +2566,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." ;; BEG-END is the subdir-region (as list of begin and end). (if elt ; subdir was already present ;; update its position (should actually be unchanged) - (set-marker (dired-get-subdir-min elt) (point-marker)) + (set-marker (cdr elt) (point-marker)) (dired-alist-add dirname (point-marker))) ;; The hook may depend on the subdir-alist containing the just ;; inserted subdir, so run it after dired-alist-add: @@ -2680,7 +2680,7 @@ The next char is \\n." (setq dir (file-name-as-directory dir)) (let ((elt (assoc dir dired-subdir-alist))) (and elt - (goto-char (dired-get-subdir-min elt)) + (goto-char (cdr elt)) ;; dired-subdir-hidden-p and dired-add-entry depend on point being ;; at \n after this function succeeds. (progn (end-of-line) @@ -2778,7 +2778,7 @@ Use \\[dired-hide-all] to (un)hide all directories." (end-pos (1- (dired-get-subdir-max elt))) buffer-read-only) ;; keep header line visible, hide rest - (goto-char (dired-get-subdir-min elt)) + (goto-char (cdr elt)) (end-of-line) (if hidden-p (dired--unhide (point) end-pos) @@ -2797,14 +2797,14 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory." ;; hide (let ((pos (point-max))) ; pos of end of last directory (dolist (subdir dired-subdir-alist) - (let ((start (dired-get-subdir-min subdir)) ; pos of prev dir + (let ((start (cdr subdir)) ; pos of prev dir (end (save-excursion (goto-char pos) ; current dir ;; we're somewhere on current dir's line (forward-line -1) (point)))) (dired--hide start end)) - (setq pos (dired-get-subdir-min subdir))))))) ; prev dir gets current dir + (setq pos (cdr subdir))))))) ; prev dir gets current dir ;;;###end dired-ins.el diff --git a/lisp/dired.el b/lisp/dired.el index 05789a3516..35d883a011 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -354,10 +354,14 @@ The directory name must be absolute, but need not be fully expanded.") ;; The subdirectory names in the next two lists are expanded. (defvar dired-subdir-alist nil - "Association list of subdirectories and their buffer positions. -Each subdirectory has an element: (DIRNAME . STARTMARKER). + "Alist of listed directories and their buffer positions. +Alist elements have the form (DIRNAME . STARTMARKER), where +DIRNAME is the absolute name of the directory and STARTMARKER is +a marker at the beginning of DIRNAME. + The order of elements is the reverse of the order in the buffer. -In simple cases, this list contains one element.") +If no subdirectories are listed then the alist contains only one +element, for the listed directory.") (defvar-local dired-switches-alist nil "Keeps track of which switches to use for inserted subdirectories. @@ -2857,21 +2861,20 @@ You can then feed the file name(s) to other commands with \\[yank]." (let ((cur-dir (dired-current-directory))) (beginning-of-line) ; alist stores b-o-l positions (and (zerop (- (point) - (dired-get-subdir-min (assoc cur-dir + (cdr (assoc cur-dir dired-subdir-alist)))) cur-dir)))) -;; can't use macro, must be redefinable for other alist format in dired-nstd. -(defalias 'dired-get-subdir-min 'cdr) +(define-obsolete-function-alias 'dired-get-subdir-min 'cdr "27.1") (defun dired-get-subdir-max (elt) (save-excursion - (goto-char (dired-get-subdir-min elt)) + (goto-char (cdr elt)) (dired-subdir-max))) (defun dired-clear-alist () (while dired-subdir-alist - (set-marker (dired-get-subdir-min (car dired-subdir-alist)) nil) + (set-marker (cdr (car dired-subdir-alist)) nil) (setq dired-subdir-alist (cdr dired-subdir-alist)))) (defun dired-subdir-index (dir) @@ -2895,7 +2898,7 @@ You can then feed the file name(s) to other commands with \\[yank]." ;; nth with negative arg does not return nil but the first element (setq index (- (dired-subdir-index this-dir) arg)) (setq pos (if (>= index 0) - (dired-get-subdir-min (nth index dired-subdir-alist)))) + (cdr (nth index dired-subdir-alist)))) (if pos (progn (goto-char pos) @@ -3116,7 +3119,7 @@ is the directory where the file on this line resides." (setq elt (car alist) dir (car elt) ;; use `<=' (not `<') as subdir line is part of subdir - alist (if (<= (dired-get-subdir-min elt) here) + alist (if (<= (cdr elt) here) nil ; found (cdr alist)))) (if localp commit f216f38870c14ba995cd004b1e98c9f9ce8c2874 Author: Juri Linkov Date: Sun Nov 10 23:06:37 2019 +0200 Move read-char-from-minibuffer from simple.el to subr.el and document it. * doc/lispref/minibuf.texi (Multiple Queries): Document read-char-from-minibuffer (bug#10477, bug#38076). * lisp/subr.el (read-char-history) (read-char-from-minibuffer-map) (read-char-from-minibuffer-map-hash) (read-char-from-minibuffer-insert-char) (read-char-from-minibuffer-insert-other, empty-history) (read-char-from-minibuffer): Move from simple.el to subr.el. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 41c87ce0ee..c87723df1f 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2253,6 +2253,18 @@ Here is an example of using this function: @end lisp @end defun +If you need a function to read a character like @code{read-char} or +@code{read-char-choice} (@pxref{Reading One Event}) but using the +minibuffer, use @code{read-char-from-minibuffer}. + +@defun read-char-from-minibuffer prompt &optional chars history +This function uses the minibuffer to read and return a single +character. Optionally, it ignores any input that is not a member of +@var{chars}, a list of accepted characters. The @var{history} +argument specifies the history list symbol to use; if is omitted or +@code{nil}, it doesn't use the history. +@end defun + @node Reading a Password @section Reading a Password @cindex passwords, reading diff --git a/etc/NEWS b/etc/NEWS index 8356601cde..4134f7bb5f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2573,6 +2573,7 @@ This macro works like 'progn', but messages how long it takes to evaluate the body forms. The value of the last form is the return value. ++++ ** New function 'read-char-from-minibuffer'. This function works like 'read-char', but uses 'read-from-minibuffer' to read a character, so it maintains a history that can be navigated diff --git a/lisp/simple.el b/lisp/simple.el index 6dc4e5666d..47d4adb0fd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5174,76 +5174,6 @@ and KILLP is t if a prefix arg was specified." ;; Avoid warning about delete-backward-char (with-no-warnings (delete-backward-char n killp)))) -(defvar read-char-history nil - "The default history for the `read-char-from-minibuffer' function.") - -(defvar read-char-from-minibuffer-map - (let ((map (make-sparse-keymap))) - (set-keymap-parent map minibuffer-local-map) - (define-key map [remap self-insert-command] - 'read-char-from-minibuffer-insert-char) - map) - "Keymap for the `read-char-from-minibuffer' function.") - -(defconst read-char-from-minibuffer-map-hash - (make-hash-table :weakness 'key :test 'equal)) - -(defun read-char-from-minibuffer-insert-char () - "Insert the character you type in the minibuffer and exit. -Discard all previous input before inserting and exiting the minibuffer." - (interactive) - (delete-minibuffer-contents) - (insert last-command-event) - (exit-minibuffer)) - -(defun read-char-from-minibuffer-insert-other () - "Handle inserting of a character other than allowed. -Display an error on trying to insert a disallowed character. -Also discard all previous input in the minibuffer." - (interactive) - (delete-minibuffer-contents) - (ding) - (minibuffer-message "Wrong answer") - (sit-for 2)) - -(defvar empty-history) - -(defun read-char-from-minibuffer (prompt &optional chars history) - "Read a character from the minibuffer, prompting for PROMPT. -Like `read-char', but uses the minibuffer to read and return a character. -When CHARS is non-nil, any input that is not one of CHARS is ignored. -When HISTORY is a symbol, then allows navigating in a history. -The navigation commands are `M-p' and `M-n', with `RET' to select -a character from history." - (discard-input) - (let* ((empty-history '()) - (map (if (consp chars) - (or (gethash chars read-char-from-minibuffer-map-hash) - (puthash chars - (let ((map (make-sparse-keymap))) - (set-keymap-parent map read-char-from-minibuffer-map) - (dolist (char chars) - (define-key map (vector char) - 'read-char-from-minibuffer-insert-char)) - (define-key map [remap self-insert-command] - 'read-char-from-minibuffer-insert-other) - map) - read-char-from-minibuffer-map-hash)) - read-char-from-minibuffer-map)) - (result - (read-from-minibuffer prompt nil map nil - (or history 'empty-history))) - (char - (if (> (length result) 0) - ;; We have a string (with one character), so return the first one. - (elt result 0) - ;; The default value is RET. - (when history (push "\r" (symbol-value history))) - ?\r))) - ;; Display the question with the answer. - (message "%s%s" prompt (char-to-string char)) - char)) - (defun zap-to-char (arg char) "Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. diff --git a/lisp/subr.el b/lisp/subr.el index ea56b49087..eaec223585 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2665,6 +2665,78 @@ floating point support." (push (cons t read) unread-command-events) nil)))))) + +(defvar read-char-history nil + "The default history for the `read-char-from-minibuffer' function.") + +(defvar read-char-from-minibuffer-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (define-key map [remap self-insert-command] + 'read-char-from-minibuffer-insert-char) + map) + "Keymap for the `read-char-from-minibuffer' function.") + +(defconst read-char-from-minibuffer-map-hash + (make-hash-table :weakness 'key :test 'equal)) + +(defun read-char-from-minibuffer-insert-char () + "Insert the character you type in the minibuffer and exit. +Discard all previous input before inserting and exiting the minibuffer." + (interactive) + (delete-minibuffer-contents) + (insert last-command-event) + (exit-minibuffer)) + +(defun read-char-from-minibuffer-insert-other () + "Handle inserting of a character other than allowed. +Display an error on trying to insert a disallowed character. +Also discard all previous input in the minibuffer." + (interactive) + (delete-minibuffer-contents) + (ding) + (minibuffer-message "Wrong answer") + (sit-for 2)) + +(defvar empty-history) + +(defun read-char-from-minibuffer (prompt &optional chars history) + "Read a character from the minibuffer, prompting for PROMPT. +Like `read-char', but uses the minibuffer to read and return a character. +When CHARS is non-nil, any input that is not one of CHARS is ignored. +When HISTORY is a symbol, then allows navigating in a history. +The navigation commands are `M-p' and `M-n', with `RET' to select +a character from history." + (discard-input) + (let* ((empty-history '()) + (map (if (consp chars) + (or (gethash chars read-char-from-minibuffer-map-hash) + (puthash chars + (let ((map (make-sparse-keymap))) + (set-keymap-parent map read-char-from-minibuffer-map) + (dolist (char chars) + (define-key map (vector char) + 'read-char-from-minibuffer-insert-char)) + (define-key map [remap self-insert-command] + 'read-char-from-minibuffer-insert-other) + map) + read-char-from-minibuffer-map-hash)) + read-char-from-minibuffer-map)) + (result + (read-from-minibuffer prompt nil map nil + (or history 'empty-history))) + (char + (if (> (length result) 0) + ;; We have a string (with one character), so return the first one. + (elt result 0) + ;; The default value is RET. + (when history (push "\r" (symbol-value history))) + ?\r))) + ;; Display the question with the answer. + (message "%s%s" prompt (char-to-string char)) + char)) + + ;; Behind display-popup-menus-p test. (declare-function x-popup-dialog "menu.c" (position contents &optional header)) commit b15a2fc3481cdce9c1aeb719b90d8348de632a0c Author: Stefan Monnier Date: Sat Nov 9 23:57:22 2019 -0500 * lisp/cedet/semantic/wisent/comp.el (wisent-struct): Remove (core, shifts, reductions, errs): Use cl-defstruct instead. Adjust all users of the set-- setters to use `setf` instead. diff --git a/lisp/cedet/semantic/wisent/comp.el b/lisp/cedet/semantic/wisent/comp.el index a73cdfa2f8..787e30c342 100644 --- a/lisp/cedet/semantic/wisent/comp.el +++ b/lisp/cedet/semantic/wisent/comp.el @@ -84,43 +84,6 @@ (let* ,bindings ,@body)))) -;; A naive implementation of data structures! But it suffice here ;-) - -(defmacro wisent-struct (name &rest fields) - "Define a simple data structure called NAME. -Which contains data stored in FIELDS. FIELDS is a list of symbols -which are field names or pairs (FIELD INITIAL-VALUE) where -INITIAL-VALUE is a constant used as the initial value of FIELD when -the data structure is created. INITIAL-VALUE defaults to nil. - -This defines a `make-NAME' constructor, get-able `NAME-FIELD' and -set-able `set-NAME-FIELD' accessors." - (let ((size (length fields)) - (i 0) - accors field sufx fun ivals) - (while (< i size) - (setq field (car fields) - fields (cdr fields)) - (if (consp field) - (setq ivals (cons (cadr field) ivals) - field (car field)) - (setq ivals (cons nil ivals))) - (setq sufx (format "%s-%s" name field) - fun (intern (format "%s" sufx)) - accors (cons `(defmacro ,fun (s) - (list 'aref s ,i)) - accors) - fun (intern (format "set-%s" sufx)) - accors (cons `(defmacro ,fun (s v) - (list 'aset s ,i v)) - accors) - i (1+ i))) - `(progn - (defmacro ,(intern (format "make-%s" name)) () - (cons 'vector ',(nreverse ivals))) - ,@accors))) -(put 'wisent-struct 'lisp-indent-function 1) - ;; Other utilities (defsubst wisent-pad-string (s n &optional left) @@ -434,7 +397,10 @@ Use `eq' to locate OBJECT." ;; parser's strategy of making all decisions one token ahead of its ;; actions. -(wisent-struct core +;; FIXME: Use `wisent-' prefix to fix namespace pollution! + +(cl-defstruct (core + (:constructor make-core ())) next ; -> core link ; -> core (number 0) @@ -442,19 +408,22 @@ Use `eq' to locate OBJECT." (nitems 0) (items [0])) -(wisent-struct shifts +(cl-defstruct (shifts + (:constructor make-shifts ())) next ; -> shifts (number 0) (nshifts 0) (shifts [0])) -(wisent-struct reductions +(cl-defstruct (reductions + (:constructor make-reductions ())) next ; -> reductions (number 0) (nreds 0) (rules [0])) -(wisent-struct errs +(cl-defstruct (errs + (:constructor make-errs ())) (nerrs 0) (errs [0])) @@ -1175,17 +1144,17 @@ Subroutine of `wisent-get-state'." n (- iend isp1) p (make-core) items (make-vector n 0)) - (set-core-accessing-symbol p symbol) - (set-core-number p nstates) - (set-core-nitems p n) - (set-core-items p items) + (setf (core-accessing-symbol p) symbol) + (setf (core-number p) nstates) + (setf (core-nitems p) n) + (setf (core-items p) items) (setq isp2 0) ;; isp2 = p->items (while (< isp1 iend) ;; *isp2++ = *isp1++; (aset items isp2 (aref kernel-items isp1)) (setq isp1 (1+ isp1) isp2 (1+ isp2))) - (set-core-next last-state p) + (setf (core-next last-state) p) (setq last-state p nstates (1+ nstates)) p)) @@ -1228,7 +1197,7 @@ equivalent one exists already. Used by `wisent-append-states'." (if (core-link sp) (setq sp (core-link sp)) ;; sp = sp->link = new-state(symbol) - (setq sp (set-core-link sp (wisent-new-state symbol)) + (setq sp (setf (core-link sp) (wisent-new-state symbol)) found t))))) ;; bucket is empty ;; state-table[key] = sp = new-state(symbol) @@ -1274,17 +1243,18 @@ SHIFTSET is set up as a vector of state numbers of those states." (setq p (make-shifts) shifts (make-vector nshifts 0) i 0) - (set-shifts-number p (core-number this-state)) - (set-shifts-nshifts p nshifts) - (set-shifts-shifts p shifts) + (setf (shifts-number p) (core-number this-state)) + (setf (shifts-nshifts p) nshifts) + (setf (shifts-shifts p) shifts) (while (< i nshifts) ;; (p->shifts)[i] = shiftset[i]; (aset shifts i (aref shiftset i)) (setq i (1+ i))) - (if last-shift - (set-shifts-next last-shift p) - (setq first-shift p)) + (setf (if last-shift + (shifts-next last-shift) + first-shift) + p) (setq last-shift p))) (defun wisent-insert-start-shift () @@ -1293,17 +1263,17 @@ That is the state to which a shift has already been made in the initial state. Subroutine of `wisent-augment-automaton'." (let (statep sp) (setq statep (make-core)) - (set-core-number statep nstates) - (set-core-accessing-symbol statep start-symbol) - (set-core-next last-state statep) + (setf (core-number statep) nstates) + (setf (core-accessing-symbol statep) start-symbol) + (setf (core-next last-state) statep) (setq last-state statep) ;; Make a shift from this state to (what will be) the final state. (setq sp (make-shifts)) - (set-shifts-number sp nstates) + (setf (shifts-number sp) nstates) (setq nstates (1+ nstates)) - (set-shifts-nshifts sp 1) - (set-shifts-shifts sp (vector nstates)) - (set-shifts-next last-shift sp) + (setf (shifts-nshifts sp) 1) + (setf (shifts-shifts sp) (vector nstates)) + (setf (shifts-next last-shift) sp) (setq last-shift sp))) (defun wisent-augment-automaton () @@ -1341,9 +1311,9 @@ already." (setq i (shifts-nshifts sp) sp2 (make-shifts) shifts (make-vector (1+ i) 0)) - (set-shifts-number sp2 k) - (set-shifts-nshifts sp2 (1+ i)) - (set-shifts-shifts sp2 shifts) + (setf (shifts-number sp2) k) + (setf (shifts-nshifts sp2) (1+ i)) + (setf (shifts-shifts sp2) shifts) (aset shifts 0 nstates) (while (> i 0) ;; sp2->shifts[i] = sp->shifts[i - 1]; @@ -1351,19 +1321,19 @@ already." (setq i (1- i))) ;; Patch sp2 into the chain of shifts in ;; place of sp, following sp1. - (set-shifts-next sp2 (shifts-next sp)) - (set-shifts-next sp1 sp2) + (setf (shifts-next sp2) (shifts-next sp)) + (setf (shifts-next sp1) sp2) (if (eq sp last-shift) (setq last-shift sp2)) ) (setq sp2 (make-shifts)) - (set-shifts-number sp2 k) - (set-shifts-nshifts sp2 1) - (set-shifts-shifts sp2 (vector nstates)) + (setf (shifts-number sp2) k) + (setf (shifts-nshifts sp2) 1) + (setf (shifts-shifts sp2) (vector nstates)) ;; Patch sp2 into the chain of shifts between ;; sp1 and sp. - (set-shifts-next sp2 sp) - (set-shifts-next sp1 sp2) + (setf (shifts-next sp2) sp) + (setf (shifts-next sp1) sp2) (if (not sp) (setq last-shift sp2)) ) @@ -1375,8 +1345,8 @@ already." sp2 (make-shifts) i (shifts-nshifts sp) shifts (make-vector (1+ i) 0)) - (set-shifts-nshifts sp2 (1+ i)) - (set-shifts-shifts sp2 shifts) + (setf (shifts-nshifts sp2) (1+ i)) + (setf (shifts-shifts sp2) shifts) ;; Stick this shift into the vector at the proper place. (setq statep (core-next first-state) k 0 @@ -1395,7 +1365,7 @@ already." (setq k (1+ k))) ;; Patch sp2 into the chain of shifts in place of ;; sp, at the beginning. - (set-shifts-next sp2 (shifts-next sp)) + (setf (shifts-next sp2) (shifts-next sp)) (setq first-shift sp2) (if (eq last-shift sp) (setq last-shift sp2)) @@ -1405,10 +1375,10 @@ already." ;; The initial state didn't even have any shifts. Give it ;; one shift, to the next-to-final state. (setq sp (make-shifts)) - (set-shifts-nshifts sp 1) - (set-shifts-shifts sp (vector nstates)) + (setf (shifts-nshifts sp) 1) + (setf (shifts-shifts sp) (vector nstates)) ;; Patch sp into the chain of shifts at the beginning. - (set-shifts-next sp first-shift) + (setf (shifts-next sp) first-shift) (setq first-shift sp) ;; Create the next-to-final state, with shift to what will ;; be the final state. @@ -1416,8 +1386,8 @@ already." ;; There are no shifts for any state. Make one shift, from the ;; initial state to the next-to-final state. (setq sp (make-shifts)) - (set-shifts-nshifts sp 1) - (set-shifts-shifts sp (vector nstates)) + (setf (shifts-nshifts sp) 1) + (setf (shifts-shifts sp) (vector nstates)) ;; Initialize the chain of shifts with sp. (setq first-shift sp last-shift sp) @@ -1428,25 +1398,25 @@ already." ;; next-to-final state. The symbol for that shift is 0 ;; (end-of-file). (setq statep (make-core)) - (set-core-number statep nstates) - (set-core-next last-state statep) + (setf (core-number statep) nstates) + (setf (core-next last-state) statep) (setq last-state statep) ;; Make the shift from the final state to the termination state. (setq sp (make-shifts)) - (set-shifts-number sp nstates) + (setf (shifts-number sp) nstates) (setq nstates (1+ nstates)) - (set-shifts-nshifts sp 1) - (set-shifts-shifts sp (vector nstates)) - (set-shifts-next last-shift sp) + (setf (shifts-nshifts sp) 1) + (setf (shifts-shifts sp) (vector nstates)) + (setf (shifts-next last-shift) sp) (setq last-shift sp) ;; Note that the variable FINAL-STATE refers to what we sometimes ;; call the termination state. (setq final-state nstates) ;; Make the termination state. (setq statep (make-core)) - (set-core-number statep nstates) + (setf (core-number statep) nstates) (setq nstates (1+ nstates)) - (set-core-next last-state statep) + (setf (core-next last-state) statep) (setq last-state statep))) (defun wisent-save-reductions () @@ -1468,17 +1438,18 @@ their rule numbers." (when (> count 0) (setq p (make-reductions) rules (make-vector count 0)) - (set-reductions-number p (core-number this-state)) - (set-reductions-nreds p count) - (set-reductions-rules p rules) + (setf (reductions-number p) (core-number this-state)) + (setf (reductions-nreds p) count) + (setf (reductions-rules p) rules) (setq i 0) (while (< i count) ;; (p->rules)[i] = redset[i] (aset rules i (aref redset i)) (setq i (1+ i))) - (if last-reduction - (set-reductions-next last-reduction p) - (setq first-reduction p)) + (setf (if last-reduction + (reductions-next last-reduction) + first-reduction) + p) (setq last-reduction p)))) (defun wisent-generate-states () @@ -2064,7 +2035,7 @@ tables so that there is no longer a conflict." errs (make-vector ntokens 0) nerrs 0 i 0) - (set-errs-errs errp errs) + (setf (errs-errs errp) errs) (while (< i ntokens) (setq token (aref tags i)) (when (and (wisent-BITISSET (aref LA lookaheadnum) i) @@ -2113,7 +2084,7 @@ tables so that there is no longer a conflict." ))) (setq i (1+ i))) (when (> nerrs 0) - (set-errs-nerrs errp nerrs) + (setf (errs-nerrs errp) nerrs) (aset err-table state errp)) )) @@ -2944,7 +2915,7 @@ And returns the updated top-of-stack index." (aset rcode r nil) (let* ((actn (aref rcode r)) (n (aref actn 1)) ; nb of val avail. in stack - (NAME (apply 'format "%s:%d" (aref actn 2))) + (NAME (apply #'format "%s:%d" (aref actn 2))) (form (wisent-semantic-action-expand-body (aref actn 0) n)) ($l (car form)) ; list of $vars used in body (form (cdr form)) ; expanded form of body commit e3043a73fb1339410b0a96d954734649d7aa1dd8 Author: Jimmy Aguilar Mena Date: Sun Nov 10 04:39:53 2019 +0100 Add extra bindings to fido-mode. * lisp/icomplete.el (icomplete-fido-mode-map) : Add arrows and other bindings to reproduce ido behaviour. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index f7e08fe135..d0d3d65c34 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -305,10 +305,15 @@ require user confirmation." (define-key map (kbd "C-k") 'icomplete-fido-kill) (define-key map (kbd "C-d") 'icomplete-fido-delete-char) (define-key map (kbd "RET") 'icomplete-fido-ret) + (define-key map (kbd "C-m") 'icomplete-fido-ret) (define-key map (kbd "DEL") 'icomplete-fido-backward-updir) (define-key map (kbd "M-j") 'exit-minibuffer) (define-key map (kbd "C-s") 'icomplete-forward-completions) (define-key map (kbd "C-r") 'icomplete-backward-completions) + (define-key map (kbd "") 'icomplete-forward-completions) + (define-key map (kbd "") 'icomplete-backward-completions) + (define-key map (kbd "C-.") 'icomplete-forward-completions) + (define-key map (kbd "C-,") 'icomplete-backward-completions) map) "Keymap used by `fido-mode' in the minibuffer.") commit 2f36a0821491f25fb52d4f3c6f4a7aebb923225f Author: Glenn Morris Date: Sat Nov 9 19:38:05 2019 -0800 Disable a portion of one doc-test * test/src/doc-tests.el (doc-test-substitute-command-keys): Disable component that fails twice in the past 5 weeks due to changes in the minibuffer map. diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el index 4cfc5a5d57..705675a5c8 100644 --- a/test/src/doc-tests.el +++ b/test/src/doc-tests.el @@ -35,36 +35,39 @@ (should (string= (substitute-command-keys "foo \\=\\=") "foo \\=")) ;; Keymaps. - (should (string= (substitute-command-keys - "\\{minibuffer-local-must-match-map}") - "\ -key binding ---- ------- - -C-g abort-recursive-edit -TAB minibuffer-complete -C-j minibuffer-complete-and-exit -RET minibuffer-complete-and-exit -ESC Prefix Command -SPC minibuffer-complete-word -? minibuffer-completion-help - file-cache-minibuffer-complete - previous-history-element - next-history-element - next-line-or-history-element - next-history-element - switch-to-completions - previous-line-or-history-element - -M-v switch-to-completions - -M-< minibuffer-beginning-of-buffer -M-n next-history-element -M-p previous-history-element -M-r previous-matching-history-element -M-s next-matching-history-element - -")) + ;; I don't see that this is testing anything useful. + ;; AFAICS all it does it fail whenever someone modifies the + ;; minibuffer map. +;;; (should (string= (substitute-command-keys +;;; "\\{minibuffer-local-must-match-map}") +;;; "\ +;;; key binding +;;; --- ------- +;;; +;;; C-g abort-recursive-edit +;;; TAB minibuffer-complete +;;; C-j minibuffer-complete-and-exit +;;; RET minibuffer-complete-and-exit +;;; ESC Prefix Command +;;; SPC minibuffer-complete-word +;;; ? minibuffer-completion-help +;;; file-cache-minibuffer-complete +;;; previous-history-element +;;; next-history-element +;;; next-line-or-history-element +;;; next-history-element +;;; switch-to-completions +;;; previous-line-or-history-element +;;; +;;; M-v switch-to-completions +;;; +;;; M-< minibuffer-beginning-of-buffer +;;; M-n next-history-element +;;; M-p previous-history-element +;;; M-r previous-matching-history-element +;;; M-s next-matching-history-element +;;; +;;; ")) (should (string= (substitute-command-keys "\\\\[abort-recursive-edit]") commit 732e9427987bea61d66def9b46f90614d6a11dbd Author: Juri Linkov Date: Sun Nov 10 00:51:25 2019 +0200 Don't overwrite y-or-n-p prompt by message from asynchronous man (bug#19064) * lisp/man.el (Man-bgproc-sentinel): Postpone displaying the message and deleting the buffer until exiting the code block with with-current-buffer. Use minibuffer-message to display message to handle possibly active minibuffer. diff --git a/lisp/man.el b/lisp/man.el index 9d21e953d1..ce01fdc805 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1389,7 +1389,7 @@ manpage command." (let ((Man-buffer (if (stringp process) (get-buffer process) (process-buffer process))) (delete-buff nil) - (err-mess nil)) + message) (if (null (buffer-name Man-buffer)) ;; deleted buffer (or (stringp process) @@ -1402,9 +1402,9 @@ manpage command." (goto-char (point-min)) (cond ((or (looking-at "No \\(manual \\)*entry for") (looking-at "[^\n]*: nothing appropriate$")) - (setq err-mess (buffer-substring (point) - (progn - (end-of-line) (point))) + (setq message (buffer-substring (point) + (progn + (end-of-line) (point))) delete-buff t)) ;; "-k foo", successful exit, but no output (from man-db) @@ -1415,7 +1415,7 @@ manpage command." (eq (process-status process) 'exit) (= (process-exit-status process) 0) (= (point-min) (point-max))) - (setq err-mess (format "%s: no matches" Man-arguments) + (setq message (format "%s: no matches" Man-arguments) delete-buff t)) ((or (stringp process) @@ -1423,7 +1423,7 @@ manpage command." (= (process-exit-status process) 0)))) (or (zerop (length msg)) (progn - (setq err-mess + (setq message (concat (buffer-name Man-buffer) ": process " (let ((eos (1- (length msg)))) @@ -1432,11 +1432,7 @@ manpage command." (goto-char (point-max)) (insert (format "\nprocess %s" msg)))) )) - (if delete-buff - (if (window-live-p (get-buffer-window Man-buffer t)) - (quit-restore-window - (get-buffer-window Man-buffer t) 'kill) - (kill-buffer Man-buffer)) + (unless delete-buff (run-hooks 'Man-cooked-hook) @@ -1447,10 +1443,8 @@ manpage command." (if (not Man-page-list) (let ((args Man-arguments)) - (if (window-live-p (get-buffer-window (current-buffer) t)) - (quit-restore-window - (get-buffer-window (current-buffer) t) 'kill) - (kill-buffer (current-buffer))) + (setq delete-buff t) + ;; Entries hyphenated due to the window's width ;; won't be found in the man database, so remove ;; the hyphenation -- assuming Groff hyphenates @@ -1460,22 +1454,27 @@ manpage command." (if (string-match "[-‐­]" args) (let ((str (replace-match "" nil nil args))) (Man-getpage-in-background str)) - (message "Can't find the %s manpage" - (Man-page-from-arguments args)))) + (setq message (format "Can't find the %s manpage" + (Man-page-from-arguments args))))) (if Man-fontify-manpage-flag - (message "%s man page formatted" - (Man-page-from-arguments Man-arguments)) - (message "%s man page cleaned up" - (Man-page-from-arguments Man-arguments))) + (setq message (format "%s man page formatted" + (Man-page-from-arguments Man-arguments))) + (setq message (format "%s man page cleaned up" + (Man-page-from-arguments Man-arguments)))) (unless (and (processp process) (not (eq (process-status process) 'exit))) (setq mode-line-process nil)) - (set-buffer-modified-p nil))))) + (set-buffer-modified-p nil)))))) - (if err-mess - (message "%s" err-mess)) - )))) + (when delete-buff + (if (window-live-p (get-buffer-window Man-buffer t)) + (quit-restore-window + (get-buffer-window Man-buffer t) 'kill) + (kill-buffer Man-buffer))) + + (when message + (minibuffer-message "%s" message))))) (defun Man-page-from-arguments (args) ;; Skip arguments and only print the page name. commit 869361113613730d367b0f4966489d32ca533491 Author: Juri Linkov Date: Sun Nov 10 00:46:29 2019 +0200 Don't obscure the minibuffer by message (bug#17272) * lisp/subr.el (do-after-load-evaluation): Use minibuffer-message to not obscure a possibly active minibuffer. * lisp/minibuffer.el (minibuffer-message): Record message in the *Messages* buffer. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 2b1343858f..6e72eb73f9 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -715,6 +715,11 @@ If ARGS are provided, then pass MESSAGE through `format-message'." (message "%s" message)) (prog1 (sit-for (or minibuffer-message-timeout 1000000)) (message nil))) + ;; Record message in the *Messages* buffer + (let ((inhibit-message t)) + (if args + (apply #'message message args) + (message "%s" message))) ;; Clear out any old echo-area message to make way for our new thing. (message nil) (setq message (if (and (null args) diff --git a/lisp/subr.el b/lisp/subr.el index 8ac2f868c0..ea56b49087 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4552,8 +4552,8 @@ This function is called directly from the C code." (byte-compile-warn "%s" msg)) (run-with-timer 0 nil (lambda (msg) - (message "%s" msg)) - msg))))) + (minibuffer-message "%s" msg)) + msg))))) ;; Finally, run any other hook. (run-hook-with-args 'after-load-functions abs-file)) commit 8d68025baf912462748ce94ba79f2f54cdd22283 Author: Juri Linkov Date: Sun Nov 10 00:43:09 2019 +0200 Use the minibuffer to read answer in userlock.el (bug#38076) * lisp/userlock.el: Rename 'fn' to 'filename'. (ask-user-about-supersession-threat): Use read-char-from-minibuffer instead of read-char-choice. diff --git a/lisp/userlock.el b/lisp/userlock.el index 209768620c..1d3ac84584 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -103,11 +103,11 @@ You can uit; don't modify this file.") (define-error 'file-supersession nil 'file-error) -(defun userlock--check-content-unchanged (fn) +(defun userlock--check-content-unchanged (filename) (with-demoted-errors "Unchanged content check: %S" - ;; Even tho we receive `fn', we know that `fn' refers to the current + ;; Even tho we receive `filename', we know that `filename' refers to the current ;; buffer's file. - (cl-assert (equal fn (expand-file-name buffer-file-truename))) + (cl-assert (equal filename (expand-file-name buffer-file-truename))) ;; Note: rather than read the file and compare to the buffer, we could save ;; the buffer and compare to the file, but for encrypted data this ;; wouldn't work well (and would risk exposing the data). @@ -123,7 +123,7 @@ You can uit; don't modify this file.") (when (with-temp-buffer (let ((coding-system-for-read cs) (non-essential t)) - (insert-file-contents fn)) + (insert-file-contents filename)) (when (= (buffer-size) (- end start)) ;Minor optimization. (= 0 (let ((case-fold-search nil)) (compare-buffer-substrings @@ -133,13 +133,13 @@ You can uit; don't modify this file.") 'unchanged))))) ;;;###autoload -(defun userlock--ask-user-about-supersession-threat (fn) +(defun userlock--ask-user-about-supersession-threat (filename) ;; Called from filelock.c. - (unless (userlock--check-content-unchanged fn) - (ask-user-about-supersession-threat fn))) + (unless (userlock--check-content-unchanged filename) + (ask-user-about-supersession-threat filename))) ;;;###autoload -(defun ask-user-about-supersession-threat (fn) +(defun ask-user-about-supersession-threat (filename) "Ask a user who is about to modify an obsolete buffer what to do. This function has two choices: it can return, in which case the modification of the buffer will proceed, or it can (signal \\='file-supersession (file)), @@ -152,14 +152,14 @@ The buffer in question is current when this function is called." (let ((prompt (format "%s changed on disk; \ really edit the buffer? (y, n, r or C-h) " - (file-name-nondirectory fn))) + (file-name-nondirectory filename))) (choices '(?y ?n ?r ?? ?\C-h)) answer) (when noninteractive (message "%s" prompt) (error "Cannot resolve conflict in batch mode")) (while (null answer) - (setq answer (read-char-choice prompt choices)) + (setq answer (read-char-from-minibuffer prompt choices)) (cond ((memq answer '(?? ?\C-h)) (ask-user-about-supersession-help) (setq answer nil)) @@ -167,10 +167,10 @@ really edit the buffer? (y, n, r or C-h) " ;; Ask for confirmation if buffer modified (revert-buffer nil (not (buffer-modified-p))) (signal 'file-supersession - (list "File reverted" fn))) + (list "File reverted" filename))) ((eq answer ?n) (signal 'file-supersession - (list "File changed on disk" fn))))) + (list "File changed on disk" filename))))) (message "File on disk now will become a backup file if you save these changes.") (setq buffer-backed-up nil)))) commit d370c6a686b85abe1a617475e2d9279d506eac46 Author: Stefan Monnier Date: Sat Nov 9 17:42:36 2019 -0500 * lisp/startup.el (package--activated): Fix redundant definition diff --git a/lisp/startup.el b/lisp/startup.el index 651224fe6c..5fd76d9284 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1013,7 +1013,7 @@ the `--debug-init' option to view a complete error backtrace." (when debug-on-error-should-be-set (setq debug-on-error debug-on-error-from-init-file)))) -(defvar package--activated nil) +(defvar package--activated) (defun command-line () "A subroutine of `normal-top-level'. commit 8685db187b891bcadcf61e41dea3124e4c45b7d4 Author: Stefan Monnier Date: Sat Nov 9 13:32:20 2019 -0500 * lisp/ffap.el (ffap-read-file-or-url): Don't use url-file-handler Simplify accordingly (and don't call substitute-in-file-name redundantly). diff --git a/lisp/ffap.el b/lisp/ffap.el index a3a191c5ae..2954faa88a 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1405,34 +1405,19 @@ which may actually result in an URL rather than a filename." (or guess (setq guess default-directory)) ;; Tricky: guess may have or be a local directory, like "w3/w3.elc" ;; or "w3/" or "../el/ffap.el" or "../../../" - (unless (or (ffap-url-p guess) - (ffap-file-remote-p guess)) - (setq guess - (abbreviate-file-name (expand-file-name guess)))) - (if (and (ffap-url-p guess) - ;; Exclude non-filename-like URLs like "mailto:..." - (not (string-match "\\`[a-z]+://" guess))) + (if (ffap-url-p guess) + ;; FIXME: We earlier tried to make use of `url-file-handler' so + ;; `read-file-name' could also be used for URLs, but it + ;; introduced all kinds of subtle breakage such as: + ;; - (file-name-directory "http://a") returning "http://a/" + ;; - Trying to contact remote hosts with no justification + ;; These should be fixed in url-handler-mode before we can try + ;; using it here again. (read-string prompt guess nil nil t) - (let ((fnh-elem (cons ffap-url-regexp #'url-file-handler))) - ;; Explain to `rfn-eshadow' that we can use URLs here. - (push fnh-elem file-name-handler-alist) - (unwind-protect - (let* ((dir (file-name-directory guess)) - ;; FIXME: If `guess' is "http://a" url-handler - ;; somehow returns "https://a/" for the directory and - ;; "a" for the non-directory! - (broken-dir (> (length dir) (length guess)))) - (setq guess - (read-file-name prompt (if broken-dir guess dir) nil nil - (unless broken-dir - (file-name-nondirectory guess))))) - ;; Remove the special handler manually. We used to just let-bind - ;; file-name-handler-alist to preserve its value, but that caused - ;; other modifications to be lost (e.g. when Tramp gets loaded - ;; during the completing-read call). - (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist)))) - (or (ffap-url-p guess) - (substitute-in-file-name guess)))) + (unless (ffap-file-remote-p guess) + (setq guess (abbreviate-file-name (expand-file-name guess)))) + (read-file-name prompt (file-name-directory guess) nil nil + (file-name-nondirectory guess)))) ;; The rest of this page is just to work with package complete.el. ;; This code assumes that you load ffap.el after complete.el. commit 027f218ad227c3966df94b22566c2e89a307362d Author: Juri Linkov Date: Sun Nov 10 00:32:09 2019 +0200 hack-local-variables-confirm uses the minibuffer to read answer (bug#38076) * lisp/files.el (hack-local-variables-confirm): Use read-char-from-minibuffer instead of read-char-choice. Remove special handling of original window scrolling that is now supported in the minibuffer. This fixes https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg01020.html (files--ask-user-about-large-file): Use read-char-from-minibuffer instead of read-char-choice. diff --git a/etc/NEWS b/etc/NEWS index f2685a1bfd..8356601cde 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -726,6 +726,9 @@ at the end of the active minibuffer. +++ *** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer. +*** Some commands that previously used read-char-choice now read +a character using the minibuffer by read-char-from-minibuffer. + ** map.el *** Now also understands plists. *** Now defined via generic functions that can be extended via 'cl-defmethod'. diff --git a/lisp/files.el b/lisp/files.el index f7726b566a..24b882ede2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2120,7 +2120,7 @@ think it does, because \"free\" is pretty hard to define in practice." ("Yes" . ?y) ("No" . ?n) ("Open literally" . ?l))) - (read-char-choice + (read-char-from-minibuffer (concat prompt " (y)es or (n)o or (l)iterally ") '(?y ?Y ?n ?N ?l ?L))))) (cond ((memq choice '(?y ?Y)) nil) @@ -3503,24 +3503,16 @@ n -- to ignore the local variables list.") ;; Display the buffer and read a choice. (save-window-excursion (pop-to-buffer buf '(display-buffer--maybe-at-bottom)) - (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v)) + (let* ((exit-chars '(?y ?n ?\s)) (prompt (format "Please type %s%s: " (if offer-save "y, n, or !" "y or n") (if (< (line-number-at-pos (point-max)) (window-body-height)) "" - (push ?\C-v exit-chars) - ", or C-v to scroll"))) + ", or C-v/M-v to scroll"))) char) (if offer-save (push ?! exit-chars)) - (while (null char) - (setq char (read-char-choice prompt exit-chars t)) - (when (eq char ?\C-v) - (condition-case nil - (scroll-up) - (error (goto-char (point-min)) - (recenter 1))) - (setq char nil))) + (setq char (read-char-from-minibuffer prompt exit-chars)) (when (and offer-save (= char ?!) unsafe-vars) (customize-push-and-save 'safe-local-variable-values unsafe-vars)) (prog1 (memq char '(?! ?\s ?y)) commit 04ab67470706f1c66bdf08e4078ea3dffd79b41e Author: Juri Linkov Date: Sun Nov 10 00:21:26 2019 +0200 Add CHARS arg to read-char-from-minibuffer compatible with read-char-choice. * lisp/simple.el (read-char-history): Rename from read-char-from-minibuffer-history. (Bug#38076) (read-char-from-minibuffer-insert-char): Rename from read-char-from-minibuffer-self-insert. (read-char-from-minibuffer-map-hash): New defconst. (read-char-from-minibuffer-insert-other): New command. (read-char-from-minibuffer): Add optional args CHARS and HISTORY. (zap-to-char): Use 'read-char-history as HISTORY arg of read-char-from-minibuffer. * lisp/emacs-lisp/map-ynp.el (read-answer): Use sit-for instead of sleep-for. Replace short answer history yes-or-no-p-history with read-char-history. diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index a688330b74..5c0e28eac9 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -341,7 +341,7 @@ When `use-dialog-box' is t, pop up a dialog window to get user input." (delete-minibuffer-contents) (beep) (message message) - (sleep-for 2))) + (sit-for 2))) map) read-answer-map--memoize)))) answer) @@ -361,7 +361,7 @@ When `use-dialog-box' is t, pop up a dialog window to get user input." (short (read-from-minibuffer prompt nil short-answer-map nil - 'yes-or-no-p-history)) + 'read-char-history)) (t (read-from-minibuffer prompt nil nil nil @@ -381,7 +381,7 @@ When `use-dialog-box' is t, pop up a dialog window to get user input." ".\n"))) (beep) (message message) - (sleep-for 2))) + (sit-for 2))) answer)) ;;; map-ynp.el ends here diff --git a/lisp/simple.el b/lisp/simple.el index 6677291eba..6dc4e5666d 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5174,46 +5174,83 @@ and KILLP is t if a prefix arg was specified." ;; Avoid warning about delete-backward-char (with-no-warnings (delete-backward-char n killp)))) -(defvar read-char-from-minibuffer-history nil +(defvar read-char-history nil "The default history for the `read-char-from-minibuffer' function.") (defvar read-char-from-minibuffer-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) (define-key map [remap self-insert-command] - 'read-char-from-minibuffer-self-insert) + 'read-char-from-minibuffer-insert-char) map) "Keymap for the `read-char-from-minibuffer' function.") -(defun read-char-from-minibuffer-self-insert () - "Insert the character you type in the minibuffer." +(defconst read-char-from-minibuffer-map-hash + (make-hash-table :weakness 'key :test 'equal)) + +(defun read-char-from-minibuffer-insert-char () + "Insert the character you type in the minibuffer and exit. +Discard all previous input before inserting and exiting the minibuffer." (interactive) (delete-minibuffer-contents) - (insert (event-basic-type last-command-event)) + (insert last-command-event) (exit-minibuffer)) -(defun read-char-from-minibuffer (prompt) - "Read a character from the minibuffer, prompting with string PROMPT. -Like `read-char', but allows navigating in a history. The navigation -commands are `M-p' and `M-n', with `RET' to select a character from -history." - (let ((result - (read-from-minibuffer prompt nil - read-char-from-minibuffer-map nil - 'read-char-from-minibuffer-history))) - (if (> (length result) 0) - ;; We have a string (with one character), so return the first one. - (elt result 0) - ;; The default value is RET. - (push "\r" read-char-from-minibuffer-history) - ?\r))) +(defun read-char-from-minibuffer-insert-other () + "Handle inserting of a character other than allowed. +Display an error on trying to insert a disallowed character. +Also discard all previous input in the minibuffer." + (interactive) + (delete-minibuffer-contents) + (ding) + (minibuffer-message "Wrong answer") + (sit-for 2)) + +(defvar empty-history) + +(defun read-char-from-minibuffer (prompt &optional chars history) + "Read a character from the minibuffer, prompting for PROMPT. +Like `read-char', but uses the minibuffer to read and return a character. +When CHARS is non-nil, any input that is not one of CHARS is ignored. +When HISTORY is a symbol, then allows navigating in a history. +The navigation commands are `M-p' and `M-n', with `RET' to select +a character from history." + (discard-input) + (let* ((empty-history '()) + (map (if (consp chars) + (or (gethash chars read-char-from-minibuffer-map-hash) + (puthash chars + (let ((map (make-sparse-keymap))) + (set-keymap-parent map read-char-from-minibuffer-map) + (dolist (char chars) + (define-key map (vector char) + 'read-char-from-minibuffer-insert-char)) + (define-key map [remap self-insert-command] + 'read-char-from-minibuffer-insert-other) + map) + read-char-from-minibuffer-map-hash)) + read-char-from-minibuffer-map)) + (result + (read-from-minibuffer prompt nil map nil + (or history 'empty-history))) + (char + (if (> (length result) 0) + ;; We have a string (with one character), so return the first one. + (elt result 0) + ;; The default value is RET. + (when history (push "\r" (symbol-value history))) + ?\r))) + ;; Display the question with the answer. + (message "%s%s" prompt (char-to-string char)) + char)) (defun zap-to-char (arg char) "Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found." (interactive (list (prefix-numeric-value current-prefix-arg) - (read-char-from-minibuffer "Zap to char: "))) + (read-char-from-minibuffer "Zap to char: " + nil 'read-char-history))) ;; Avoid "obsolete" warnings for translation-table-for-input. (with-no-warnings (if (char-table-p translation-table-for-input) commit a26a8cc1c85f29fb11209c16d53a8ae4e4ab7ced Author: Juri Linkov Date: Sun Nov 10 00:04:13 2019 +0200 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer (bug#38076) * doc/lispref/minibuf.texi (Yes-or-No Queries): Update the fact that y-or-n-p uses the minibuffer. * lisp/subr.el (y-or-n-p-history-variable): New variable. (y-or-n-p-map): New keymap. (y-or-n-p-insert-y, y-or-n-p-insert-n, y-or-n-p-insert-other): New commands. (y-or-n-p): Rewrite to use read-from-minibuffer and make-composed-keymap with y-or-n-p-map and query-replace-map. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 49add3f7a7..41c87ce0ee 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2020,29 +2020,27 @@ uses keyboard input. You can force use either of the mouse or of keyboard input by binding @code{last-nonmenu-event} to a suitable value around the call. - Strictly speaking, @code{yes-or-no-p} uses the minibuffer and -@code{y-or-n-p} does not; but it seems best to describe them together. + Both @code{yes-or-no-p} and @code{y-or-n-p} use the minibuffer. @defun y-or-n-p prompt -This function asks the user a question, expecting input in the echo -area. It returns @code{t} if the user types @kbd{y}, @code{nil} if the -user types @kbd{n}. This function also accepts @key{SPC} to mean yes -and @key{DEL} to mean no. It accepts @kbd{C-]} to quit, like -@kbd{C-g}, because the question might look like a minibuffer and for -that reason the user might try to use @kbd{C-]} to get out. The answer -is a single character, with no @key{RET} needed to terminate it. Upper -and lower case are equivalent. - -``Asking the question'' means printing @var{prompt} in the echo area, +This function asks the user a question, expecting input in the minibuffer. +It returns @code{t} if the user types @kbd{y}, @code{nil} if the user +types @kbd{n}. This function also accepts @key{SPC} to mean yes and +@key{DEL} to mean no. It accepts @kbd{C-]} and @kbd{C-g} to quit, +because the question uses the minibuffer and for that reason the user +might try to use @kbd{C-]} to get out. The answer is a single +character, with no @key{RET} needed to terminate it. Upper and lower +case are equivalent. + +``Asking the question'' means printing @var{prompt} in the minibuffer, followed by the string @w{@samp{(y or n) }}. If the input is not one of the expected answers (@kbd{y}, @kbd{n}, @kbd{@key{SPC}}, @kbd{@key{DEL}}, or something that quits), the function responds @samp{Please answer y or n.}, and repeats the request. -This function does not actually use the minibuffer, since it does not -allow editing of the answer. It actually uses the echo area (@pxref{The -Echo Area}), which uses the same screen space as the minibuffer. The -cursor moves to the echo area while the question is being asked. +This function actually uses the minibuffer, but does not allow editing +of the answer. The cursor moves to the minibuffer while the question +is being asked. The answers and their meanings, even @samp{y} and @samp{n}, are not hardwired, and are specified by the keymap @code{query-replace-map} @@ -2053,10 +2051,6 @@ special responses @code{recenter}, @code{scroll-up}, @kbd{C-v}, @kbd{M-v}, @kbd{C-M-v} and @kbd{C-M-S-v} in @code{query-replace-map}), this function performs the specified window recentering or scrolling operation, and poses the question again. - -@noindent -We show successive lines of echo area messages, but only one actually -appears on the screen at a time. @end defun @defun y-or-n-p-with-timeout prompt seconds default @@ -2072,7 +2066,7 @@ minibuffer. It returns @code{t} if the user enters @samp{yes}, @code{nil} if the user types @samp{no}. The user must type @key{RET} to finalize the response. Upper and lower case are equivalent. -@code{yes-or-no-p} starts by displaying @var{prompt} in the echo area, +@code{yes-or-no-p} starts by displaying @var{prompt} in the minibuffer, followed by @w{@samp{(yes or no) }}. The user must type one of the expected responses; otherwise, the function responds @samp{Please answer yes or no.}, waits about two seconds and repeats the request. diff --git a/etc/NEWS b/etc/NEWS index 4e6a70f693..f2685a1bfd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -723,6 +723,9 @@ the minibuffer. If non-nil, point will move to the end of the prompt *** Minibuffer now uses 'minibuffer-message' to display error messages at the end of the active minibuffer. ++++ +*** 'y-or-n-p' now uses the minibuffer to read 'y' or 'n' answer. + ** map.el *** Now also understands plists. *** Now defined via generic functions that can be extended via 'cl-defmethod'. diff --git a/lisp/subr.el b/lisp/subr.el index 85e7187fb6..8ac2f868c0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2668,6 +2668,66 @@ floating point support." ;; Behind display-popup-menus-p test. (declare-function x-popup-dialog "menu.c" (position contents &optional header)) +(defvar y-or-n-p-history-variable nil + "History list symbol to add `y-or-n-p' answers to.") + +(defvar y-or-n-p-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + + (dolist (symbol '(act act-and-show act-and-exit automatic)) + (define-key map (vector 'remap symbol) 'y-or-n-p-insert-y)) + + (define-key map [remap skip] 'y-or-n-p-insert-n) + + (dolist (symbol '(help backup undo undo-all edit edit-replacement + delete-and-edit ignore self-insert-command)) + (define-key map (vector 'remap symbol) 'y-or-n-p-insert-other)) + + (define-key map [remap recenter] 'minibuffer-recenter-top-bottom) + (define-key map [remap scroll-up] 'minibuffer-scroll-up-command) + (define-key map [remap scroll-down] 'minibuffer-scroll-down-command) + (define-key map [remap scroll-other-window] 'minibuffer-scroll-other-window) + (define-key map [remap scroll-other-window-down] 'minibuffer-scroll-other-window-down) + + (define-key map [escape] 'abort-recursive-edit) + (dolist (symbol '(quit exit exit-prefix)) + (define-key map (vector 'remap symbol) 'abort-recursive-edit)) + + ;; FIXME: try catch-all instead of explicit bindings: + ;; (define-key map [remap t] 'y-or-n-p-insert-other) + + map) + "Keymap that defines additional bindings for `y-or-n-p' answers.") + +(defun y-or-n-p-insert-y () + "Insert the answer \"y\" and exit the minibuffer of `y-or-n-p'. +Discard all previous input before inserting and exiting the minibuffer." + (interactive) + (delete-minibuffer-contents) + (insert "y") + (exit-minibuffer)) + +(defun y-or-n-p-insert-n () + "Insert the answer \"n\" and exit the minibuffer of `y-or-n-p'. +Discard all previous input before inserting and exiting the minibuffer." + (interactive) + (delete-minibuffer-contents) + (insert "n") + (exit-minibuffer)) + +(defun y-or-n-p-insert-other () + "Handle inserting of other answers in the minibuffer of `y-or-n-p'. +Display an error on trying to insert a disallowed character. +Also discard all previous input in the minibuffer." + (interactive) + (delete-minibuffer-contents) + (ding) + (minibuffer-message "Please answer y or n") + (sit-for 2)) + +(defvar empty-history) + (defun y-or-n-p (prompt) "Ask user a \"y or n\" question. Return t if answer is \"y\" and nil if it is \"n\". @@ -2683,16 +2743,13 @@ documentation of that variable for more information. In this case, the useful bindings are `act', `skip', `recenter', `scroll-up', `scroll-down', and `quit'. An `act' response means yes, and a `skip' response means no. -A `quit' response means to invoke `keyboard-quit'. +A `quit' response means to invoke `abort-recursive-edit'. If the user enters `recenter', `scroll-up', or `scroll-down' responses, perform the requested window recentering or scrolling and ask again. Under a windowing system a dialog box will be used if `last-nonmenu-event' is nil and `use-dialog-box' is non-nil." - ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state - ;; where all the keys were unbound (i.e. it somehow got triggered - ;; within read-key, apparently). I had to kill it. (let ((answer 'recenter) (padded (lambda (prompt &optional dialog) (let ((l (length prompt))) @@ -2718,36 +2775,14 @@ is nil and `use-dialog-box' is non-nil." answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) (t (setq prompt (funcall padded prompt)) - (while - (let* ((scroll-actions '(recenter scroll-up scroll-down - scroll-other-window scroll-other-window-down)) - (key - (let ((cursor-in-echo-area t)) - (when minibuffer-auto-raise - (raise-frame (window-frame (minibuffer-window)))) - (read-key (propertize (if (memq answer scroll-actions) - prompt - (concat "Please answer y or n. " - prompt)) - 'face 'minibuffer-prompt))))) - (setq answer (lookup-key query-replace-map (vector key) t)) - (cond - ((memq answer '(skip act)) nil) - ((eq answer 'recenter) - (recenter) t) - ((eq answer 'scroll-up) - (ignore-errors (scroll-up-command)) t) - ((eq answer 'scroll-down) - (ignore-errors (scroll-down-command)) t) - ((eq answer 'scroll-other-window) - (ignore-errors (scroll-other-window)) t) - ((eq answer 'scroll-other-window-down) - (ignore-errors (scroll-other-window-down)) t) - ((or (memq answer '(exit-prefix quit)) (eq key ?\e)) - (signal 'quit nil) t) - (t t))) - (ding) - (discard-input)))) + (discard-input) + (let* ((empty-history '()) + (str (read-from-minibuffer + prompt nil + (make-composed-keymap y-or-n-p-map query-replace-map) + nil + (or y-or-n-p-history-variable 'empty-history)))) + (setq answer (if (member str '("y" "Y")) 'act 'skip))))) (let ((ret (eq answer 'act))) (unless noninteractive (message "%s%c" prompt (if ret ?y ?n))) commit 898cdc67f19ca15f4ac2b447adf350188baef604 Author: Juri Linkov Date: Sat Nov 9 23:32:46 2019 +0200 Run scroll/recenter commands from minibuffer in original window (bug#38076) * lisp/minibuffer.el (with-minibuffer-selected-window): New macro. (minibuffer-recenter-top-bottom, minibuffer-scroll-up-command) (minibuffer-scroll-down-command, minibuffer-scroll-other-window): (minibuffer-scroll-other-window-down): New commands. (minibuffer-local-map): Remap recenter/scroll symbols to their minibuffer wrappers: recenter-top-bottom to minibuffer-recenter-top-bottom. * src/window.c (Fother_window_for_scrolling): Use 'lambda' value for MINIBUF arg of Fnext_window, so minibuffer-scroll-other-window and minibuffer-scroll-other-window-down doesn't try to scroll the minibuffer window. diff --git a/etc/NEWS b/etc/NEWS index 61b9f933f1..4e6a70f693 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -710,6 +710,9 @@ list the contents of such directories when completing file names. ** Minibuffer +*** Scrolling and recentering commands in the minibuffer are invoked +on the original window (that was selected before activating the minibuffer). + +++ *** A new user option, 'minibuffer-beginning-of-buffer-movement', has been introduced to allow controlling how the 'M-<' command works in diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 5b993e792f..2b1343858f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2236,6 +2236,13 @@ The completion method is determined by `completion-at-point-functions'." (let ((map minibuffer-local-map)) (define-key map "\C-g" 'abort-recursive-edit) (define-key map "\M-<" 'minibuffer-beginning-of-buffer) + + (define-key map [remap recenter-top-bottom] 'minibuffer-recenter-top-bottom) + (define-key map [remap scroll-up-command] 'minibuffer-scroll-up-command) + (define-key map [remap scroll-down-command] 'minibuffer-scroll-down-command) + (define-key map [remap scroll-other-window] 'minibuffer-scroll-other-window) + (define-key map [remap scroll-other-window-down] 'minibuffer-scroll-other-window-down) + (define-key map "\r" 'exit-minibuffer) (define-key map "\n" 'exit-minibuffer)) @@ -3671,6 +3678,46 @@ Otherwise move to the start of the buffer." (when (and arg (not (consp arg))) (forward-line 1))) +(defmacro with-minibuffer-selected-window (&rest body) + "Execute the forms in BODY from the minibuffer in its original window. +When used in a minibuffer window, select the window selected just before +the minibuffer was activated, and execute the forms." + (declare (indent 0) (debug t)) + `(let ((window (minibuffer-selected-window))) + (when window + (with-selected-window window + ,@body)))) + +(defun minibuffer-recenter-top-bottom (&optional arg) + "Run `recenter-top-bottom' from the minibuffer in its original window." + (interactive "P") + (with-minibuffer-selected-window + (recenter-top-bottom arg))) + +(defun minibuffer-scroll-up-command (&optional arg) + "Run `scroll-up-command' from the minibuffer in its original window." + (interactive "^P") + (with-minibuffer-selected-window + (scroll-up-command arg))) + +(defun minibuffer-scroll-down-command (&optional arg) + "Run `scroll-down-command' from the minibuffer in its original window." + (interactive "^P") + (with-minibuffer-selected-window + (scroll-down-command arg))) + +(defun minibuffer-scroll-other-window (&optional arg) + "Run `scroll-other-window' from the minibuffer in its original window." + (interactive "P") + (with-minibuffer-selected-window + (scroll-other-window arg))) + +(defun minibuffer-scroll-other-window-down (&optional arg) + "Run `scroll-other-window-down' from the minibuffer in its original window." + (interactive "^P") + (with-minibuffer-selected-window + (scroll-other-window-down arg))) + (provide 'minibuffer) ;;; minibuffer.el ends here diff --git a/src/window.c b/src/window.c index e122649f59..1984a540ad 100644 --- a/src/window.c +++ b/src/window.c @@ -6253,12 +6253,12 @@ followed by all visible frames on the current terminal. */) { /* Nothing specified; look for a neighboring window on the same frame. */ - window = Fnext_window (selected_window, Qnil, Qnil); + window = Fnext_window (selected_window, Qlambda, Qnil); if (EQ (window, selected_window)) /* That didn't get us anywhere; look for a window on another visible frame on the current terminal. */ - window = Fnext_window (window, Qnil, Qvisible); + window = Fnext_window (window, Qlambda, Qvisible); } CHECK_LIVE_WINDOW (window); commit 06cb8350c69d96c686f17fdb2d1f9260cd16a0df Author: Karl Fogel Date: Mon Nov 4 14:39:14 2019 -0600 Improve an error about the message signer * lisp/gnus/mml-sec.el (mml-secure-epg-sign): Don't suggest setting `mml-secure-smime-sign-with-sender' if it's already non-nil. diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el index c7a2d4664e..a1f5b6386b 100644 --- a/lisp/gnus/mml-sec.el +++ b/lisp/gnus/mml-sec.el @@ -945,7 +945,15 @@ If no one is selected, symmetric encryption will be performed. " (signers (mml-secure-signers context signer-names)) signature micalg) (unless signers - (error "Couldn't find any signer names. Perhaps `mml-secure-smime-sign-with-sender' should be set?")) + (let ((maybe-msg + (if mml-secure-smime-sign-with-sender + "." + "; try setting `mml-secure-smime-sign-with-sender'."))) + ;; If `mml-secure-smime-sign-with-sender' is already non-nil + ;; then there's no point advising the user to examine it. If + ;; there are any other variables worth examining, please + ;; improve this error message by having it mention them. + (error "Couldn't find any signer names%s" maybe-msg))) (when (eq 'OpenPGP protocol) (setf (epg-context-armor context) t) (setf (epg-context-textmode context) t) commit a67b51e92bb36b32f88dca01c3cd3da02b3dfb99 Author: Lars Ingebrigtsen Date: Sat Nov 9 21:02:18 2019 +0100 Fix font-lock-keywords slightly * lisp/font-lock.el (font-lock-keywords): Tweak doc string slightly (bug#35005). diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 875f5b0592..f254211aa2 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -392,7 +392,7 @@ MATCH-HIGHLIGHT should be of the form: SUBEXP is the number of the subexpression of MATCHER to be highlighted. -FACENAME is an expression whose value is the face name to use. +FACENAME is an expression whose value is the face to use. Instead of a face, FACENAME can evaluate to a property list of the form (face FACE PROP1 VAL1 PROP2 VAL2 ...) in which case all the listed text-properties will be set rather than just FACE. In commit f2019fc676c2206bbdc53855e3bc4f1086676d3d Author: Eli Zaretskii Date: Sat Nov 9 21:56:30 2019 +0200 Fix case-insensitive completion of buffer names * test/src/minibuf-tests.el (test-try-completion-ignore-case): New test, suggested by Stefan Monnier . * src/minibuf.c (Ftry_completion): Don't treat strings that are identical but for the case as if they were identical for the purposes of not counting the same string twice. This fixes case-insensitive completion when all the candidates are identical but for the letter-case. (Bug#11339) diff --git a/src/minibuf.c b/src/minibuf.c index f6cf47f1f2..1e87c5044a 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1323,13 +1323,13 @@ is used to further constrain the set of candidates. */) else { compare = min (bestmatchsize, SCHARS (eltstring)); - tem = Fcompare_strings (bestmatch, zero, - make_fixnum (compare), - eltstring, zero, - make_fixnum (compare), + Lisp_Object lcompare = make_fixnum (compare); + tem = Fcompare_strings (bestmatch, zero, lcompare, + eltstring, zero, lcompare, completion_ignore_case ? Qt : Qnil); matchsize = EQ (tem, Qt) ? compare : eabs (XFIXNUM (tem)) - 1; + Lisp_Object old_bestmatch = bestmatch; if (completion_ignore_case) { /* If this is an exact match except for case, @@ -1363,7 +1363,12 @@ is used to further constrain the set of candidates. */) bestmatch = eltstring; } if (bestmatchsize != SCHARS (eltstring) - || bestmatchsize != matchsize) + || bestmatchsize != matchsize + || (completion_ignore_case + && !EQ (Fcompare_strings (old_bestmatch, zero, lcompare, + eltstring, zero, lcompare, + Qnil), + Qt))) /* Don't count the same string multiple times. */ matchcount += matchcount <= 1; bestmatchsize = matchsize; diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el index 12b018b822..c64892822d 100644 --- a/test/src/minibuf-tests.el +++ b/test/src/minibuf-tests.el @@ -399,5 +399,16 @@ (minibuf-tests--test-completion-regexp #'minibuf-tests--strings-to-symbol-hashtable)) +(ert-deftest test-try-completion-ignore-case () + (let ((completion-ignore-case t)) + (should (equal (try-completion "bar" '("bAr" "barfoo")) "bAr")) + (should (equal (try-completion "bar" '("bArfoo" "barbaz")) "bar")) + (should (equal (try-completion "bar" '("bArfoo" "barbaz")) + (try-completion "bar" '("barbaz" "bArfoo")))) + ;; bug#11339 + (should (equal (try-completion "baz" '("baz" "bAz")) "baz")) ;And not `t'! + (should (equal (try-completion "baz" '("bAz" "baz")) + (try-completion "baz" '("baz" "bAz")))))) + ;;; minibuf-tests.el ends here commit a1a724d73afae87b8c4daa2d64382be06fa37d0e Author: Eli Zaretskii Date: Sat Nov 9 21:40:53 2019 +0200 Fix an error in selecting encoding when writing zip files * lisp/international/mule-cmds.el (select-safe-coding-system): Treat no-conversion-multibyte that came from find-auto-coding the same as no-conversion for the purposes of encoding. The same logic that considers no-conversion always safe should do the same with no-conversion-multibyte. (Bug#38155) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 1edf80d14c..e4f5bb2a5f 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -896,6 +896,11 @@ It is highly recommended to fix it before writing to a file." ;; other setting. (let ((base (coding-system-base auto-cs))) (unless (memq base '(nil undecided)) + ;; For encoding, no-conversion-multibyte is the same as + ;; no-conversion. + (if (eq base 'no-conversion-multibyte) + (setq auto-cs 'no-conversion + base 'no-conversion)) (setq default-coding-system (list (cons auto-cs base))) (setq no-other-defaults t)))) commit e73184138d5e32425cdb41e18b88bb1d8604e41f Author: Glenn Morris Date: Sat Nov 9 11:17:20 2019 -0800 * lisp/progmodes/cc-vars.el (c-mark-wrong-style-of-comment): Fix version. diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 273174e041..a7e6315d72 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1757,7 +1757,7 @@ c-macro-names-with-semicolon: %s" `c-toggle-comment-style') is block, or a block comment otherwise." :type 'boolean :group 'c - :version 27.1) + :version "27.1") (defvar c-file-style nil "Variable interface for setting style via File Local Variables. commit afe4969a3b3b38014387a828b66f5dbc3a462a57 Author: João Távora Date: Sat Nov 9 14:54:09 2019 +0000 Revert "Nudge icomplete-mode a little closer to fido-mode" Fixes bug#38131. This is not the best way to have fido-mdoe emulate that particular bit of ido-mode. This reverts commit 5761a1a3939e23d8e8c725241dd9398a12f191b0. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 879068e4e9..f7e08fe135 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -572,13 +572,6 @@ matches exist." (compare (compare-strings name nil nil most nil nil completion-ignore-case)) (ellipsis (if (char-displayable-p ?…) "…" "...")) - ;; `determ' is what we "determined" to be the thing that - ;; TAB will complete to. Also, if we're working with a - ;; large prefix (like when finding files), we want to - ;; truncate the common prefix away. `determ-ellipsis' - ;; says if we should do it with an `ellipsis'. Icomplete - ;; uses one, Ido doesn't. - (determ-ellipsis (if fido-mode "" ellipsis)) (determ (unless (or (eq t compare) (eq t most-try) (= (setq compare (1- (abs compare))) (length most))) @@ -589,10 +582,8 @@ matches exist." (substring most compare)) ;; Don't bother truncating if it doesn't gain ;; us at least 2 columns. - ((< compare (+ 2 (string-width determ-ellipsis))) - most) - (t (concat determ-ellipsis - (substring most compare)))) + ((< compare (+ 2 (string-width ellipsis))) most) + (t (concat ellipsis (substring most compare)))) close-bracket))) ;;"-prospects" - more than one candidate (prospects-len (+ (string-width @@ -673,8 +664,6 @@ matches exist." (mapconcat 'identity prospects icomplete-separator) (and limit (concat icomplete-separator ellipsis)) "}") - (put-text-property 1 (1- (length determ)) - 'face 'icomplete-first-match determ) (concat determ " [Matched]")))))) ;;; Iswitchb compatibility commit 5c74b806a6fb0a4cb237300ab0a5418a109ced5e Author: João Távora Date: Fri Nov 8 23:44:44 2019 +0000 Rename some commands to reflect they are fido-mode specific * lisp/icomplete.el (icomplete-fido-kill) (icomplete-fido-delete-char, icomplete-fido-ret) (icomplete-fido-backward-updir): Rename from icomplete-magic-ido-* versions. (icomplete-fido-mode-map): Use new command names. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index a7f9086d82..879068e4e9 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -225,7 +225,7 @@ Last entry becomes the first and can be selected with ;;; Helpers for `fido-mode' (or `ido-mode' emulation) ;;; -(defun icomplete-magic-ido-kill () +(defun icomplete-fido-kill () "Kill line or current completion, like `ido-mode'. If killing to the end of line make sense, call `kill-line', otherwise kill the currently selected completion candidate. @@ -260,7 +260,7 @@ require user confirmation." (cdr all))) (message nil))))) -(defun icomplete-magic-ido-delete-char () +(defun icomplete-fido-delete-char () "Delete char or maybe call `dired', like `ido-mode'." (interactive) (let* ((beg (icomplete--field-beg)) @@ -272,7 +272,7 @@ require user confirmation." (dired (file-name-directory (icomplete--field-string))) (exit-minibuffer)))) -(defun icomplete-magic-ido-ret () +(defun icomplete-fido-ret () "Exit minibuffer or enter directory, like `ido-mode'." (interactive) (let* ((beg (icomplete--field-beg)) @@ -290,7 +290,7 @@ require user confirmation." (t (exit-minibuffer))))) -(defun icomplete-magic-ido-backward-updir () +(defun icomplete-fido-backward-updir () "Delete char before or go up directory, like `ido-mode'." (interactive) (let* ((beg (icomplete--field-beg)) @@ -302,10 +302,10 @@ require user confirmation." (defvar icomplete-fido-mode-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-k") 'icomplete-magic-ido-kill) - (define-key map (kbd "C-d") 'icomplete-magic-ido-delete-char) - (define-key map (kbd "RET") 'icomplete-magic-ido-ret) - (define-key map (kbd "DEL") 'icomplete-magic-ido-backward-updir) + (define-key map (kbd "C-k") 'icomplete-fido-kill) + (define-key map (kbd "C-d") 'icomplete-fido-delete-char) + (define-key map (kbd "RET") 'icomplete-fido-ret) + (define-key map (kbd "DEL") 'icomplete-fido-backward-updir) (define-key map (kbd "M-j") 'exit-minibuffer) (define-key map (kbd "C-s") 'icomplete-forward-completions) (define-key map (kbd "C-r") 'icomplete-backward-completions) commit d9c6b4378ac851f5e730daa0ae36c9ee2d0292fe Author: João Távora Date: Fri Nov 8 23:40:18 2019 +0000 Protect flex's display-sort-function against 0-length candidates * lisp/minibuffer.el (completion--flex-adjust-metadata): Assume a candidate missing a score has a score of 0. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cc113b926f..5b993e792f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3496,8 +3496,9 @@ that is non-nil." res (lambda (c1 c2) (or (equal c1 minibuffer-default) - (> (get-text-property 0 'completion-score c1) - (get-text-property 0 'completion-score c2))))))))) + (let ((s1 (get-text-property 0 'completion-score c1)) + (s2 (get-text-property 0 'completion-score c2))) + (> (or s1 0) (or s2 0)))))))))) `(metadata (display-sort-function . ,(compose-flex-sort-fn commit 7362554eafd7e255b3d96a4f711e11708dee950f Author: Alan Mackenzie Date: Sat Nov 9 14:30:52 2019 +0000 Widen around c-font-lock-fontify-region. This fixes bug #38049. * lisp/progmodes/cc-mode (c-font-lock-fontify-region): Widen in this function, to ensure that the CC Mode font locking mechanism can examine characters outside the given region. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 6bdfb170f1..73160fc7a4 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2232,44 +2232,46 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") ;; ;; Type a space in the first blank line, and the fontification of the next ;; line was fouled up by context fontification. - (let (new-beg new-end new-region case-fold-search) - (if (and c-in-after-change-fontification - (< beg c-new-END) (> end c-new-BEG)) - ;; Region and the latest after-change fontification region overlap. - ;; Determine the upper and lower bounds of our adjusted region - ;; separately. - (progn - (if (<= beg c-new-BEG) - (setq c-in-after-change-fontification nil)) - (setq new-beg - (if (and (>= beg (c-point 'bol c-new-BEG)) - (<= beg c-new-BEG)) - ;; Either jit-lock has accepted `c-new-BEG', or has - ;; (probably) extended the change region spuriously to - ;; BOL, which position likely has a syntactically - ;; different position. To ensure correct fontification, - ;; we start at `c-new-BEG', assuming any characters to the - ;; left of `c-new-BEG' on the line do not require - ;; fontification. - c-new-BEG - (setq new-region (c-before-context-fl-expand-region beg end) - new-end (cdr new-region)) - (car new-region))) - (setq new-end - (if (and (>= end (c-point 'bol c-new-END)) - (<= end c-new-END)) - c-new-END - (or new-end - (cdr (c-before-context-fl-expand-region beg end)))))) - ;; Context (etc.) fontification. - (setq new-region (c-before-context-fl-expand-region beg end) - new-beg (car new-region) new-end (cdr new-region))) - (c-save-buffer-state nil - (unwind-protect - (progn (c-restore-string-fences new-beg new-end) - (funcall (default-value 'font-lock-fontify-region-function) - new-beg new-end verbose)) - (c-clear-string-fences))))) + (save-restriction + (widen) + (let (new-beg new-end new-region case-fold-search) + (if (and c-in-after-change-fontification + (< beg c-new-END) (> end c-new-BEG)) + ;; Region and the latest after-change fontification region overlap. + ;; Determine the upper and lower bounds of our adjusted region + ;; separately. + (progn + (if (<= beg c-new-BEG) + (setq c-in-after-change-fontification nil)) + (setq new-beg + (if (and (>= beg (c-point 'bol c-new-BEG)) + (<= beg c-new-BEG)) + ;; Either jit-lock has accepted `c-new-BEG', or has + ;; (probably) extended the change region spuriously to + ;; BOL, which position likely has a syntactically + ;; different position. To ensure correct fontification, + ;; we start at `c-new-BEG', assuming any characters to the + ;; left of `c-new-BEG' on the line do not require + ;; fontification. + c-new-BEG + (setq new-region (c-before-context-fl-expand-region beg end) + new-end (cdr new-region)) + (car new-region))) + (setq new-end + (if (and (>= end (c-point 'bol c-new-END)) + (<= end c-new-END)) + c-new-END + (or new-end + (cdr (c-before-context-fl-expand-region beg end)))))) + ;; Context (etc.) fontification. + (setq new-region (c-before-context-fl-expand-region beg end) + new-beg (car new-region) new-end (cdr new-region))) + (c-save-buffer-state nil + (unwind-protect + (progn (c-restore-string-fences new-beg new-end) + (funcall (default-value 'font-lock-fontify-region-function) + new-beg new-end verbose)) + (c-clear-string-fences)))))) (defun c-after-font-lock-init () ;; Put on `font-lock-mode-hook'. This function ensures our after-change commit b293aa91bcc7f553ffbc6c67027f3c86d06ffbd7 Author: Alan Mackenzie Date: Sat Nov 9 12:09:30 2019 +0000 CC Mode. Allow fontification of "wrong" style comments with warning face. This fixes bug #4192. * etc/NEWS: Add a new entry. * lisp/progmodes/cc-defs.el (c-font-lock-flush): New macro. * lisp/progmodes/cc-cmds.el (c-toggle-comment-style): On toggling the comment style, invoke c-font-lock-flush when c-mark-wrong-style-of-comment is non-nil, to cause that marking to be done instead on the other style of comment. * lisp/progmodes/cc-fonts.el (c-maybe-font-lock-wrong-style-comments): New function. (c-cpp-matchers): Call c-maybe-font-lock-wrong-style-comments when appropriate. * lisp/progmodes/cc-vars.el (c-mark-wrong-style-of-comment): New customizable option. * doc/misc/cc-mode.texi (top level, Indentation Commands, Guessing the Style, Custom Macros): For some opening quote marks, correct '' to ``. (Minor Modes): Add an xref to the new page "Wrong Comment Style" in a footnote. (Wrong Comment Style): New page. diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 217261090b..a802ca9886 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -669,7 +669,7 @@ expression, to some statements, or perhaps to whole functions, the syntactic recognition can be wrong. @ccmode{} manages to figure it out correctly most of the time, though. -Some macros, when invoked, ''have their own semicolon''. To get the +Some macros, when invoked, ``have their own semicolon''. To get the next line indented correctly, rather than as a continuation line, @xref{Macros with ;}. @@ -1149,7 +1149,9 @@ find useful while writing new code or editing old code: @table @asis @item comment style This specifies whether comment commands (such as @kbd{M-;}) insert -block comments or line comments. +block comments or line comments@footnote{You can emphasize +non-default style comments in your code by giving their delimiters +@code{font-lock-warning-face}. @xref{Wrong Comment Style}.}. @item electric mode When this is enabled, certain visible characters cause reformatting as they are typed. This is normally helpful, but can be a nuisance when @@ -1866,6 +1868,7 @@ sections apply to the other languages. * Font Locking Preliminaries:: * Faces:: * Doc Comments:: +* Wrong Comment Style:: * Misc Font Locking:: * AWK Mode Font Locking:: @end menu @@ -2069,7 +2072,7 @@ since those aren't syntactic errors in themselves. @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -@node Doc Comments, Misc Font Locking, Faces, Font Locking +@node Doc Comments, Wrong Comment Style, Faces, Font Locking @comment node-name, next, previous, up @section Documentation Comments @cindex documentation comments @@ -2149,7 +2152,29 @@ If you add support for another doc comment style, please consider contributing it: send a note to @email{bug-cc-mode@@gnu.org}. @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -@node Misc Font Locking, AWK Mode Font Locking, Doc Comments, Font Locking +@node Wrong Comment Style, Misc Font Locking, Doc Comments, Font Locking +@comment node-name, next, previous, up +@section Marking ``Wrong'' style comments +@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +Most languages supported by @ccmode{} have two styles of comments, +namely block comments and line comments. Your project may have such a +strong preference for one of them, that you wish ``wrong'' style +comments to be clearly marked. + +You can get @ccmode{} to do this by setting the default comment style, +if necessary, (@pxref{Minor Modes}) and setting the customizable +option @code{c-mark-wrong-style-of-comment} to non-@code{nil}. + +@defvar c-mark-wrong-style-of-comment +@vindex mark-wrong-style-of-comment (c-) +When this customizable option is non-@code{nil}, comment delimiters +which aren't of the default style will be fontified with +@code{font-lock-warning-face}. +@end defvar + +@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +@node Misc Font Locking, AWK Mode Font Locking, Wrong Comment Style, Font Locking @comment node-name, next, previous, up @section Miscellaneous Font Locking @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -2885,11 +2910,11 @@ should not be changed directly; use @code{c-add-style} instead. Instead of specifying a style, you can get @ccmode{} to @dfn{guess} your style by examining an already formatted code buffer. @ccmode{} -then determines the ''most frequent'' offset (@pxref{c-offsets-alist}) +then determines the ``most frequent'' offset (@pxref{c-offsets-alist}) for each of the syntactic symbols (@pxref{Indentation Engine Basics}) -encountered in the buffer, and the ''most frequent'' value of +encountered in the buffer, and the ``most frequent'' value of c-basic-offset (@pxref{Customizing Indentation}), then merges the -current style with these ''guesses'' to form a new style. This +current style with these ``guesses'' to form a new style. This combined style is known as the @dfn{guessed style}. To do this, call @code{c-guess} (or one of the other 5 guessing @@ -6927,7 +6952,7 @@ is @code{nil}, all lines inside macro definitions are analyzed as Because a macro can expand into anything at all, near where one is invoked @ccmode{} can only indent and fontify code heuristically. Sometimes it gets it wrong. Usually you should try to design your -macros so that they ''look like ordinary code'' when you invoke them. +macros so that they ``look like ordinary code'' when you invoke them. However, two situations are so common that @ccmode{} handles them specially: that is when certain macros needn't (or mustn't) be followed by a @samp{;}, and when certain macros (or compiler diff --git a/etc/NEWS b/etc/NEWS index 95d6b9b5bd..61b9f933f1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2264,6 +2264,14 @@ file-local variable, you may need to update the value. *** Declare 'define-overload' and 'define-child-mode' as obsolete *** Rename several internal functions to use a ''mode-local-' prefix +** CC Mode + ++++ +*** You can now flag "wrong style" comments with font-lock-warning-face. +To do this, use c-toggle-comment-style, if needed, to set the desired +default comment style (block or line); then set the option +c-mark-wrong-style-of-comment to non-nil. + * New Modes and Packages in Emacs 27.1 diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 9aa2019ae6..af2efb63fc 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -391,6 +391,16 @@ This action does nothing when the mode only has one comment style." (if c-block-comment-flag (concat " " c-block-comment-ender) "")) + ;; If necessary, invert the sense of fontification of wrong style comments. + (when (and c-mark-wrong-style-of-comment + font-lock-mode + c-block-comment-starter + c-block-comment-ender) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (c-font-lock-flush (point-min) (point-max))))) (c-update-modeline) (c-keep-region-active)) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index e9a3e16db3..6a9371e6f1 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -219,6 +219,13 @@ This variant works around bugs in `eval-when-compile' in various `(cl-delete-duplicates ,cl-seq ,@cl-keys) `(delete-duplicates ,cl-seq ,@cl-keys)))) +(defmacro c-font-lock-flush (beg end) + "Declare the region BEG...END's fontification as out-of-date. +On XEmacs and older Emacsen, this refontifies that region immediately." + (if (fboundp 'font-lock-flush) + `(font-lock-flush ,beg ,end) + `(font-lock-fontify-region ,beg ,end))) + (defmacro c-point (position &optional point) "Return the value of certain commonly referenced POSITIONs relative to POINT. The current point is used if POINT isn't specified. POSITION can be diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index c27b70603e..0daea8c84c 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -95,6 +95,7 @@ ;; during compilation. (cc-bytecomp-defvar c-preprocessor-face-name) (cc-bytecomp-defvar c-reference-face-name) +(cc-bytecomp-defvar c-block-comment-flag) (cc-bytecomp-defun c-fontify-recorded-types-and-refs) (cc-bytecomp-defun c-font-lock-declarators) (cc-bytecomp-defun c-font-lock-objc-method) @@ -532,7 +533,12 @@ stuff. Used on level 1 and higher." (sws-depth (c-lang-const c-syntactic-ws-depth)) (nsws-depth (c-lang-const c-nonempty-syntactic-ws-depth))) - `(;; The stuff after #error and #warning is a message, so + `(;; Fontify "invalid" comment delimiters + ,@(when (and (c-lang-const c-block-comment-starter) + (c-lang-const c-line-comment-starter)) + `(c-maybe-font-lock-wrong-style-comments)) + + ;; The stuff after #error and #warning is a message, so ;; fontify it as a string. ,@(when (c-lang-const c-cpp-message-directives) (let* ((re (c-make-keywords-re 'appendable ; nil @@ -715,6 +721,59 @@ stuff. Used on level 1 and higher." (parse-partial-sexp end limit nil nil state 'syntax-table))) nil) +(defun c-maybe-font-lock-wrong-style-comments (limit) + ;; This function will be called from font-lock-for a region bounded by POINT + ;; and LIMIT, as though it were to identify a keyword for + ;; font-lock-keyword-face. It always returns NIL to inhibit this and + ;; prevent a repeat invocation. See elisp/lispref page "Search-based + ;; Fontification". + ;; + ;; This function fontifies "invalid" comment delimiters with + ;; `font-lock-warning-face'. A delimiter is "invalid" when + ;; `c-mark-wrong-style-of-comment' is non-nil, and the delimiter style is + ;; not the default specified by `c-block-comment-flag'. + (when c-mark-wrong-style-of-comment + (let* ((lit (c-semi-pp-to-literal (point))) + (s (car lit)) ; parse-partial-sexp state. + ) + ;; First, deal with and move out of any literal we start in. + (cond + ((null (cadr lit))) ; Not in a literal + ((eq (cadr lit) 'string) + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table))) + ((and (not c-block-comment-flag) ; In an "invalid" block comment + (eq (cadr lit) 'c)) + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table)) + ;; Font lock the block comment ender with warning face. + (when (not (nth 4 s)) + (c-put-font-lock-face (- (point) (length c-block-comment-ender)) + (point) font-lock-warning-face))) + (t ; In a line comment, or a "valid" block comment + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table)))) + + (while (< (point) limit) + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table)) + (cond + ((or (nth 3 s) ; In a string + (and (nth 4 s) ; In a comment + (eq (nth 7 s) ; Comment style + (if c-block-comment-flag + nil ; Block comment + 1)))) ; Line comment + ;; Move over a "valid" literal. + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table))) + ((nth 4 s) ; In an invalid comment + ;; Fontify the invalid comment opener. + (c-put-font-lock-face (nth 8 s) (point) font-lock-warning-face) + ;; Move to end of comment or LIMIT. + (setq s (parse-partial-sexp (point) limit nil nil s 'syntax-table)) + ;; Fontify an invalid block comment ender, if that's what we have. + (when (and (not c-block-comment-flag) + (not (nth 4 s))) ; We're outside the comment + (c-put-font-lock-face (- (point) (length c-block-comment-ender)) + (point) font-lock-warning-face))))))) + nil) + (c-lang-defconst c-basic-matchers-before "Font lock matchers for basic keywords, labels, references and various other easily recognizable things that should be fontified before generic diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 60ad42f24f..273174e041 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1751,6 +1751,14 @@ variables.") c-macro-names-with-semicolon: %s" c-macro-names-with-semicolon)))))) +(defcustom c-mark-wrong-style-of-comment nil + "Fontify \"invalid\" comment delims with `font-lock-warning-face' if non-nil. +\"Invalid\" means a line comment when the default comment style (set by +`c-toggle-comment-style') is block, or a block comment otherwise." + :type 'boolean + :group 'c + :version 27.1) + (defvar c-file-style nil "Variable interface for setting style via File Local Variables. In a file's Local Variable section, you can set this variable to a commit 6daa80d04e575a27f53f60f5fafd7fcba39b4b2a Author: Nick Helm Date: Mon Oct 14 14:11:25 2019 +1300 Fix unresponsive Help menu in macOS * src/nsterm.m (ns_check_menu_open): Don't postpone mouse drag and non-user-generated mouse down events (Bug#31371). diff --git a/src/nsterm.m b/src/nsterm.m index afe7069aae..9d5082b71d 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4401,14 +4401,22 @@ in certain situations (rapid incoming events). NSEvent *theEvent = [NSApp currentEvent]; struct frame *emacsframe = SELECTED_FRAME (); - [menu cancelTracking]; - menu_will_open_state = MENU_PENDING; - emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; - EV_TRAILER (theEvent); - - CGEventRef ourEvent = CGEventCreate (NULL); - menu_mouse_point = CGEventGetLocation (ourEvent); - CFRelease (ourEvent); + /* On macOS, the following can cause an event loop when the + Spotlight for Help search field is populated. Avoid this by + not postponing mouse drag and non-user-generated mouse down + events (Bug#31371). */ + if (([theEvent type] == NSEventTypeLeftMouseDown) + && [theEvent eventNumber]) + { + [menu cancelTracking]; + menu_will_open_state = MENU_PENDING; + emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; + EV_TRAILER (theEvent); + + CGEventRef ourEvent = CGEventCreate (NULL); + menu_mouse_point = CGEventGetLocation (ourEvent); + CFRelease (ourEvent); + } } else if (menu_will_open_state == MENU_OPENING) { commit 273604dd87f1955f2090650d2699b4ebfb322db8 Author: Eli Zaretskii Date: Sat Nov 9 11:53:02 2019 +0200 Avoid compiler warnings in addpm.c and ddeclient.c * nt/ddeclient.c (DdeCallback): * nt/addpm.c (DdeCallback): Modify types of the last 2 arguments to avoid compiler warnings in 64-bit builds. (Bug#38040) diff --git a/nt/addpm.c b/nt/addpm.c index a8bcd4a5c7..3fd1b1bdc0 100644 --- a/nt/addpm.c +++ b/nt/addpm.c @@ -56,13 +56,13 @@ along with GNU Emacs. If not, see . */ #include "../src/epaths.h" #endif -HDDEDATA CALLBACK DdeCallback (UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, - DWORD); +HDDEDATA CALLBACK DdeCallback (UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD_PTR, + DWORD_PTR); HDDEDATA CALLBACK DdeCallback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, - DWORD dwData1, DWORD dwData2) + DWORD_PTR dwData1, DWORD_PTR dwData2) { return ((HDDEDATA) NULL); } diff --git a/nt/ddeclient.c b/nt/ddeclient.c index e441700397..81ae949130 100644 --- a/nt/ddeclient.c +++ b/nt/ddeclient.c @@ -21,13 +21,13 @@ along with GNU Emacs. If not, see . */ #include #include -HDDEDATA CALLBACK DdeCallback (UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD, - DWORD); +HDDEDATA CALLBACK DdeCallback (UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, DWORD_PTR, + DWORD_PTR); HDDEDATA CALLBACK DdeCallback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, - DWORD dwData1, DWORD dwData2) + DWORD_PTR dwData1, DWORD_PTR dwData2) { return ((HDDEDATA) NULL); } commit 4e4440272ece6d698d88af680d5c17ab322c7b64 Author: Eli Zaretskii Date: Sat Nov 9 11:43:19 2019 +0200 Fix last change * lisp/simple.el (goto-history-element) (next-history-element): Fix quoting of "future history". * doc/lispref/minibuf.texi (Minibuffer Commands) (Text from Minibuffer): Add index entry and cross-reference for "future history". (Bug#38026) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index b5798a9c17..49add3f7a7 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -141,6 +141,7 @@ However, if @var{read} is non-@code{nil}, @code{read-from-minibuffer} reads the text and returns the resulting Lisp object, unevaluated. (@xref{Input Functions}, for information about reading.) +@cindex future history in minibuffer input The argument @var{default} specifies default values to make available through the history commands. It should be a string, a list of strings, or @code{nil}. The string or strings become the minibuffer's @@ -2308,7 +2309,8 @@ This command replaces the minibuffer contents with the value of the @deffn Command next-history-element n This command replaces the minibuffer contents with the value of the @var{n}th more recent history element. The position in the history -can go beyond the current position and invoke ``future history.'' +can go beyond the current position and invoke ``future history'' +(@pxref{Text from Minibuffer}). @end deffn @deffn Command previous-matching-history-element pattern n diff --git a/lisp/simple.el b/lisp/simple.el index b7a601b2e2..6677291eba 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2131,7 +2131,7 @@ the end of the list of defaults just after the default value." The argument NABS specifies the absolute history position in descending order, where 0 means the current element and a positive number N means the Nth previous element. NABS being a -negative number -N means the Nth entry of ``future history.''" +negative number -N means the Nth entry of \"future history.\"" (interactive "p") (when (and (not minibuffer-default-add-done) (functionp minibuffer-default-add-function) @@ -2189,8 +2189,8 @@ negative number -N means the Nth entry of ``future history.''" (defun next-history-element (n) "Puts next element of the minibuffer history in the minibuffer. With argument N, it uses the Nth following element. The position -in the history can go beyond the current position and invoke -``future history.''" +in the history can go beyond the current position and invoke \"future +history.\"" (interactive "p") (or (zerop n) (goto-history-element (- minibuffer-history-position n)))) commit 15f4c4156c1a0afdedbe6f13732431383f44f36f Author: Hong Xu Date: Fri Nov 1 18:06:44 2019 -0700 Mention future history in history-related minibuffer commands * lisp/simple.el (goto-history-element): * doc/lispref/minibuf.texi (Minibuffer Commands): Explain negative NABS. * lisp/simple.el (next-history-element): * doc/lispref/minibuf.texi (Minibuffer Commands): Mention "future history." (Bug#38026) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index d36babd698..b5798a9c17 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2307,7 +2307,8 @@ This command replaces the minibuffer contents with the value of the @deffn Command next-history-element n This command replaces the minibuffer contents with the value of the -@var{n}th more recent history element. +@var{n}th more recent history element. The position in the history +can go beyond the current position and invoke ``future history.'' @end deffn @deffn Command previous-matching-history-element pattern n @@ -2338,7 +2339,9 @@ contents of the minibuffer before the point. This function puts element of the minibuffer history in the minibuffer. The argument @var{nabs} specifies the absolute history position in descending order, where 0 means the current element and a -positive number @var{n} means the @var{n}th previous element. +positive number @var{n} means the @var{n}th previous element. NABS +being a negative number -@var{n} means the @var{n}th entry of ``future +history.'' @end deffn @node Minibuffer Windows diff --git a/lisp/simple.el b/lisp/simple.el index 10aecd651f..b7a601b2e2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2130,7 +2130,8 @@ the end of the list of defaults just after the default value." "Puts element of the minibuffer history in the minibuffer. The argument NABS specifies the absolute history position in descending order, where 0 means the current element and a -positive number N means the Nth previous element." +positive number N means the Nth previous element. NABS being a +negative number -N means the Nth entry of ``future history.''" (interactive "p") (when (and (not minibuffer-default-add-done) (functionp minibuffer-default-add-function) @@ -2187,7 +2188,9 @@ positive number N means the Nth previous element." (defun next-history-element (n) "Puts next element of the minibuffer history in the minibuffer. -With argument N, it uses the Nth following element." +With argument N, it uses the Nth following element. The position +in the history can go beyond the current position and invoke +``future history.''" (interactive "p") (or (zerop n) (goto-history-element (- minibuffer-history-position n)))) commit f8284f1e408b38e6a3c0e2a1d5a465fefac6800a Author: Paul Eggert Date: Fri Nov 8 17:07:13 2019 -0800 Fix some quoting glitches in doc strings This also fixes a misplaced "only". diff --git a/lisp/files.el b/lisp/files.el index 7690357058..f7726b566a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6864,7 +6864,7 @@ regardless of the language.") The return value is a cons (DIR . WILDCARDS); DIR is the `default-directory' in the Dired buffer, and WILDCARDS are the wildcards. -Valid wildcards are '*', '?', '[abc]' and '[a-z]'." +Valid wildcards are `*', `?', `[abc]' and `[a-z]'." (let ((wildcards "[?*")) (when (and (or (not (featurep 'ls-lisp)) ls-lisp-support-shell-wildcards) diff --git a/lisp/mouse.el b/lisp/mouse.el index 4a351f7be2..238852ffdc 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -622,9 +622,9 @@ START-EVENT is the starting mouse event of the drag action. Its position window denotes the frame that will be dragged. PART specifies the part that has been dragged and must be one of -the symbols 'left', 'top', 'right', 'bottom', 'top-left', -'top-right', 'bottom-left', 'bottom-right' to drag an internal -border or edge. If PART equals 'move', this means to move the +the symbols `left', `top', `right', `bottom', `top-left', +`top-right', `bottom-left', `bottom-right' to drag an internal +border or edge. If PART equals `move', this means to move the frame with the mouse." ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index b17364b08f..aa42873a3d 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -5418,7 +5418,7 @@ The default comes from `process-coding-system-alist' and your might try undecided-dos as a coding system. If this doesn't help, Try to set `comint-output-filter-functions' like this: -\(add-hook 'comint-output-filter-functions #\\='comint-strip-ctrl-m 'append) +\(add-hook \\='comint-output-filter-functions #\\='comint-strip-ctrl-m \\='append) \(Type \\[describe-mode] in the SQL buffer for a list of commands.)" (interactive "P") diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 50b5ad0816..16ddcdebc9 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el @@ -4867,8 +4867,8 @@ Known problems: - XEmacs: Incorrect start-up when automatically opening speedbar. - XEmacs: Indentation in XEmacs 21.4 (and higher). -- Indentation incorrect for new 'postponed' VHDL keyword. -- Indentation incorrect for 'protected body' construct. +- Indentation incorrect for new `postponed' VHDL keyword. +- Indentation incorrect for `protected body' construct. The VHDL Mode Authors diff --git a/lisp/so-long.el b/lisp/so-long.el index e2467e4f0f..43602b4831 100644 --- a/lisp/so-long.el +++ b/lisp/so-long.el @@ -1174,7 +1174,7 @@ enabled, and `so-long-predicate' has detected that the file contains long lines. Many Emacs modes struggle with buffers which contain excessively long lines, and may consequently cause unacceptable performance issues. -This is commonly on account of 'minified' code (i.e. code has been compacted +This is commonly on account of \"minified\" code (i.e., code compacted into the smallest file size possible, which often entails removing newlines should they not be strictly necessary). These kinds of files are typically not intended to be edited, so not providing the usual editing mode in these @@ -1626,9 +1626,9 @@ Equivalent to calling (global-so-long-mode 0)" Many Emacs modes struggle with buffers which contain excessively long lines, and may consequently cause unacceptable performance issues. -This is commonly on account of 'minified' code (i.e. code that has been -compacted into the smallest file size possible, which often entails removing -newlines should they not be strictly necessary). +This is commonly on account of \"minified\" code (i.e., code compacted into the +smallest file size possible, which often entails removing newlines should they +not be strictly necessary). When such files are detected by `so-long-predicate', we invoke the selected `so-long-action' to mitigate potential performance problems in the buffer. diff --git a/lisp/subr.el b/lisp/subr.el index 03cf3da278..85e7187fb6 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -838,9 +838,9 @@ destructively modifying the list stored in ALIST. Example: - (setq foo '((a . 0))) - (setf (alist-get 'a foo) 1 - (alist-get 'b foo) 2) + (setq foo \\='((a . 0))) + (setf (alist-get \\='a foo) 1 + (alist-get \\='b foo) 2) foo => ((b . 2) (a . 1)) @@ -852,8 +852,8 @@ deleted from the alist). Example: - (setq foo '((a . 1) (b . 2))) - (setf (alist-get 'b foo nil 'remove) nil) + (setq foo \\='((a . 1) (b . 2))) + (setf (alist-get \\='b foo nil \\='remove) nil) foo => ((a . 1))" (ignore remove) ;;Silence byte-compiler. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index e915930c27..e00839572c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -350,7 +350,7 @@ Also add the number of windows in the window configuration." "Function to get a list of tabs to display in the tab bar. This function should return a list of alists with parameters that include at least the element (name . TAB-NAME). -For example, '((tab (name . \"Tab 1\")) (current-tab (name . \"Tab 2\"))) +For example, \\='((tab (name . \"Tab 1\")) (current-tab (name . \"Tab 2\"))) By default, use function `tab-bar-tabs'.") (defun tab-bar-tabs () diff --git a/lisp/window.el b/lisp/window.el index bf21354703..7478047939 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2292,14 +2292,14 @@ SIDE can be any of the symbols `left', `top', `right' or "Return window in DIRECTION as seen from WINDOW. More precisely, return the nearest window in direction DIRECTION as seen from the position of `window-point' in window WINDOW. -DIRECTION should be one of 'above', 'below', 'left' or 'right'. +DIRECTION should be one of `above', `below', `left' or `right'. WINDOW must be a live window and defaults to the selected one. -Do not return a window whose 'no-other-window' parameter is -non-nil. If the nearest window's 'no-other-window' parameter is +Do not return a window whose `no-other-window' parameter is +non-nil. If the nearest window's `no-other-window' parameter is non-nil, try to find another window in the indicated direction. If, however, the optional argument IGNORE is non-nil, return that -window even if its 'no-other-window' parameter is non-nil. +window even if its `no-other-window' parameter is non-nil. Optional argument SIGN a negative number means to use the right or bottom edge of WINDOW as reference position instead of @@ -2308,7 +2308,7 @@ top edge of WINDOW as reference position. Optional argument WRAP non-nil means to wrap DIRECTION around frame borders. This means to return for WINDOW at the top of the -frame and DIRECTION 'above' the minibuffer window if the frame +frame and DIRECTION `above' the minibuffer window if the frame has one, and a window at the bottom of the frame otherwise. Optional argument MINI nil means to return the minibuffer window @@ -5058,29 +5058,29 @@ absolute value can be less than `window-min-height' or small as one line or two columns. SIZE defaults to half of WINDOW's size. -Optional third argument SIDE nil (or 'below') specifies that the -new window shall be located below WINDOW. SIDE 'above' means the +Optional third argument SIDE nil (or `below') specifies that the +new window shall be located below WINDOW. SIDE `above' means the new window shall be located above WINDOW. In both cases SIZE specifies the new number of lines for WINDOW (or the new window if SIZE is negative) including space reserved for the mode and/or header line. -SIDE t (or 'right') specifies that the new window shall be -located on the right side of WINDOW. SIDE 'left' means the new +SIDE t (or `right') specifies that the new window shall be +located on the right side of WINDOW. SIDE `left' means the new window shall be located on the left of WINDOW. In both cases SIZE specifies the new number of columns for WINDOW (or the new window provided SIZE is negative) including space reserved for fringes and the scrollbar or a divider column. -For compatibility reasons, SIDE 'up' and 'down' are interpreted -as 'above' and 'below'. Any other non-nil value for SIDE is -currently handled like t (or 'right'). +For compatibility reasons, SIDE `up' and `down' are interpreted +as `above' and `below'. Any other non-nil value for SIDE is +currently handled like t (or `right'). PIXELWISE, if non-nil, means to interpret SIZE pixelwise. If the variable `ignore-window-parameters' is non-nil or the -'split-window' parameter of WINDOW equals t, do not process any -parameters of WINDOW. Otherwise, if the 'split-window' parameter +`split-window' parameter of WINDOW equals t, do not process any +parameters of WINDOW. Otherwise, if the `split-window' parameter of WINDOW specifies a function, call that function with all three arguments and return the value returned by that function. @@ -6896,18 +6896,18 @@ already before that action function was called or is a new window created by that function. ALIST is a buffer display action alist as compiled by `display-buffer'. -TYPE must be one of the following symbols: 'reuse' (which means +TYPE must be one of the following symbols: `reuse' (which means WINDOW existed before the call of `display-buffer' and may -already show BUFFER or not), 'window' (WINDOW was created on an -existing frame) or 'frame' (WINDOW was created on a new frame). +already show BUFFER or not), `window' (WINDOW was created on an +existing frame) or `frame' (WINDOW was created on a new frame). TYPE is passed unaltered to `display-buffer-record-window'. Handle WINDOW's dedicated flag as follows: If WINDOW already shows BUFFER, leave it alone. Otherwise, if ALIST contains a -'dedicated' entry and WINDOW is either new or that entry's value -equals 'side', set WINDOW's dedicated flag to the value of that +`dedicated' entry and WINDOW is either new or that entry's value +equals `side', set WINDOW's dedicated flag to the value of that entry. Otherwise, if WINDOW is new and the value of -'display-buffer-mark-dedicated' is non-nil, set WINDOW's +`display-buffer-mark-dedicated' is non-nil, set WINDOW's dedicated flag to that value. In any other case, reset WINDOW's dedicated flag to nil. @@ -7227,18 +7227,18 @@ Action functions and the action they try to perform are: have `display-buffer' return nil immediately. Action alist entries are: - 'inhibit-same-window' -- A non-nil value prevents the same + `inhibit-same-window' -- A non-nil value prevents the same window from being used for display. - 'inhibit-switch-frame' -- A non-nil value prevents any frame + `inhibit-switch-frame' -- A non-nil value prevents any frame used for showing the buffer from being raised or selected. - 'reusable-frames' -- The value specifies the set of frames to + `reusable-frames' -- The value specifies the set of frames to search for a window that already displays the buffer. Possible values are nil (the selected frame), t (any live frame), visible (any visible frame), 0 (any visible or iconified frame) or an existing live frame. - 'pop-up-frame-parameters' -- The value specifies an alist of + `pop-up-frame-parameters' -- The value specifies an alist of frame parameters to give a new frame, if one is created. - 'window-height' -- The value specifies the desired height of the + `window-height' -- The value specifies the desired height of the window chosen and is either an integer (the total height of the window), a floating point number (the fraction of its total height with respect to the total height of the frame's @@ -7247,23 +7247,23 @@ Action alist entries are: height of the window; its return value is ignored. Suitable functions are `shrink-window-if-larger-than-buffer' and `fit-window-to-buffer'. - 'window-width' -- The value specifies the desired width of the + `window-width' -- The value specifies the desired width of the window chosen and is either an integer (the total width of the window), a floating point number (the fraction of its total width with respect to the width of the frame's root window) or a function to be called with one argument - the chosen window. The function is supposed to adjust the width of the window; its return value is ignored. - 'preserve-size' -- The value should be either (t . nil) to + `preserve-size' -- The value should be either (t . nil) to preserve the width of the chosen window, (nil . t) to preserve its height or (t . t) to preserve its height and width in future changes of the window configuration. - 'window-parameters' -- The value specifies an alist of window + `window-parameters' -- The value specifies an alist of window parameters to give the chosen window. - 'allow-no-window' -- A non-nil value means that `display-buffer' + `allow-no-window' -- A non-nil value means that `display-buffer' may not display the buffer and return nil immediately. -The entries 'window-height', 'window-width' and 'preserve-size' +The entries `window-height', `window-width' and `preserve-size' are applied only when the window used for displaying the buffer never showed another buffer before. @@ -7710,16 +7710,16 @@ indirectly called by the latter." (defun windows-sharing-edge (&optional window edge within) "Return list of live windows sharing the same edge with WINDOW. WINDOW must be a valid window and defaults to the selected one. -EDGE stands for the edge to share and must be either 'left', -'above', 'right' or 'below'. Omitted or nil, EDGE defaults to -'left'. +EDGE stands for the edge to share and must be either `left', +`above', `right' or `below'. Omitted or nil, EDGE defaults to +`left'. WITHIN nil means to find a live window that shares the opposite -EDGE with WINDOW. For example, if EDGE equals 'left', WINDOW has +EDGE with WINDOW. For example, if EDGE equals `left', WINDOW has to share (part of) the right edge of any window returned. WITHIN non-nil means to find all live windows that share the same EDGE with WINDOW (Window must be internal in this case). So if EDGE -equals 'left', WINDOW's left edge has to fully encompass the left +equals `left', WINDOW's left edge has to fully encompass the left edge of any window returned." (setq window (window-normalize-window window)) (setq edge (or edge 'left)) diff --git a/src/nsfns.m b/src/nsfns.m index 184fd71678..4c1fb76dea 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1971,7 +1971,7 @@ Frames are listed from topmost (first) to bottommost (last). */) DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel, 0, 0, 0, - doc: /* Shows the 'Info' or 'About' panel for Emacs. */) + doc: /* Shows the `Info' or `About' panel for Emacs. */) (void) { check_window_system (NULL); diff --git a/src/process.c b/src/process.c index 8aa4811f7e..9158cfd347 100644 --- a/src/process.c +++ b/src/process.c @@ -3761,7 +3761,7 @@ host, and only clients connecting to that address will be accepted. If all interfaces should be bound, an address of \"0.0.0.0\" (for IPv4) or \"::\" (for IPv6) can be used. (On some operating systems, using \"::\" listens on both IPv4 and IPv6.) `local' will use IPv4 by -default, use a FAMILY of 'ipv6 to override this. +default, use a FAMILY of `ipv6' to override this. :service SERVICE -- SERVICE is name of the service desired, or an integer specifying a port number to connect to. If SERVICE is t, diff --git a/src/window.c b/src/window.c index 0fa0bdf7b9..e122649f59 100644 --- a/src/window.c +++ b/src/window.c @@ -3539,8 +3539,8 @@ DEFUN ("run-window-scroll-functions", Frun_window_scroll_functions, doc: /* Run `window-scroll-functions' for WINDOW. If WINDOW is omitted or nil, it defaults to the selected window. -This function is curently only called by 'split-window' for the new -window after it has established the size of the new window. */) +This function is called by `split-window' for the new window, after it +has established the size of the new window. */) (Lisp_Object window) { struct window *w = decode_live_window (window); @@ -7661,7 +7661,7 @@ display marginal areas and the text area. Optional fifth argument PERSISTENT non-nil means that fringe settings for WINDOW are persistent, i.e., remain unchanged when another buffer is shown in WINDOW. PERSISTENT nil means that fringes are reset from -buffer local values when 'set-window-buffer' is called on WINDOW with +buffer local values when `set-window-buffer' is called on WINDOW with the argument KEEP-MARGINS nil. Leave fringes unchanged if WINDOW is not large enough to accommodate @@ -7812,7 +7812,7 @@ order to show a scroll bar for mini windows. Optional sixth argument PERSISTENT non-nil means that scroll bar settings for WINDOW are persistent, i.e., remain unchanged when another buffer is shown in WINDOW. PERSISTENT nil means that scroll -bars are reset from buffer local values when 'set-window-buffer' is +bars are reset from buffer local values when `set-window-buffer' is called on WINDOW with the argument KEEP-MARGINS nil. If WINDOW is not large enough to accommodate a scroll bar of the commit b7f843adfd91bdbb24af7539a782d12767646fce Author: Stefan Monnier Date: Fri Nov 8 13:59:23 2019 -0500 * lisp/ffap.el (ffap-read-file-or-url): Fix some URL cases diff --git a/lisp/ffap.el b/lisp/ffap.el index 6cf7656fb4..a3a191c5ae 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1409,20 +1409,30 @@ which may actually result in an URL rather than a filename." (ffap-file-remote-p guess)) (setq guess (abbreviate-file-name (expand-file-name guess)))) - (let ((fnh-elem (cons ffap-url-regexp #'url-file-handler))) - ;; Explain to `rfn-eshadow' that we can use URLs here. - (push fnh-elem file-name-handler-alist) - (unwind-protect - (setq guess - (read-file-name prompt (file-name-directory guess) nil nil - (file-name-nondirectory guess))) - ;; Remove the special handler manually. We used to just let-bind - ;; file-name-handler-alist to preserve its value, but that caused - ;; other modifications to be lost (e.g. when Tramp gets loaded - ;; during the completing-read call). - (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist)))) - (or (ffap-url-p guess) - (substitute-in-file-name guess))) + (if (and (ffap-url-p guess) + ;; Exclude non-filename-like URLs like "mailto:..." + (not (string-match "\\`[a-z]+://" guess))) + (read-string prompt guess nil nil t) + (let ((fnh-elem (cons ffap-url-regexp #'url-file-handler))) + ;; Explain to `rfn-eshadow' that we can use URLs here. + (push fnh-elem file-name-handler-alist) + (unwind-protect + (let* ((dir (file-name-directory guess)) + ;; FIXME: If `guess' is "http://a" url-handler + ;; somehow returns "https://a/" for the directory and + ;; "a" for the non-directory! + (broken-dir (> (length dir) (length guess)))) + (setq guess + (read-file-name prompt (if broken-dir guess dir) nil nil + (unless broken-dir + (file-name-nondirectory guess))))) + ;; Remove the special handler manually. We used to just let-bind + ;; file-name-handler-alist to preserve its value, but that caused + ;; other modifications to be lost (e.g. when Tramp gets loaded + ;; during the completing-read call). + (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist)))) + (or (ffap-url-p guess) + (substitute-in-file-name guess)))) ;; The rest of this page is just to work with package complete.el. ;; This code assumes that you load ffap.el after complete.el. commit 24b74c35d5d037fbbe4a61be05ec0354ce150903 Author: Stefan Monnier Date: Fri Nov 8 13:32:46 2019 -0500 * lisp/ffap.el (ffap-read-file-or-url): Simplify further diff --git a/lisp/ffap.el b/lisp/ffap.el index 542aec77f8..6cf7656fb4 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1403,34 +1403,26 @@ which may actually result in an URL rather than a filename." (defun ffap-read-file-or-url (prompt guess) "Read file or URL from minibuffer, with PROMPT and initial GUESS." (or guess (setq guess default-directory)) - (let (dir) - ;; Tricky: guess may have or be a local directory, like "w3/w3.elc" - ;; or "w3/" or "../el/ffap.el" or "../../../" - (unless (ffap-url-p guess) - (unless (ffap-file-remote-p guess) - (setq guess - (abbreviate-file-name (expand-file-name guess)))) - (setq dir (file-name-directory guess))) - (let ((minibuffer-completing-file-name t) - (completion-ignore-case read-file-name-completion-ignore-case) - (fnh-elem (cons ffap-url-regexp #'url-file-handler))) - ;; Explain to `rfn-eshadow' that we can use URLs here. - (push fnh-elem file-name-handler-alist) - (unwind-protect - (setq guess - (let ((default-directory (if dir (expand-file-name dir) - default-directory))) - (read-file-name prompt default-directory - (and buffer-file-name - (abbreviate-file-name buffer-file-name)) - nil))) - ;; Remove the special handler manually. We used to just let-bind - ;; file-name-handler-alist to preserve its value, but that caused - ;; other modifications to be lost (e.g. when Tramp gets loaded - ;; during the completing-read call). - (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist)))) - (or (ffap-url-p guess) - (substitute-in-file-name guess)))) + ;; Tricky: guess may have or be a local directory, like "w3/w3.elc" + ;; or "w3/" or "../el/ffap.el" or "../../../" + (unless (or (ffap-url-p guess) + (ffap-file-remote-p guess)) + (setq guess + (abbreviate-file-name (expand-file-name guess)))) + (let ((fnh-elem (cons ffap-url-regexp #'url-file-handler))) + ;; Explain to `rfn-eshadow' that we can use URLs here. + (push fnh-elem file-name-handler-alist) + (unwind-protect + (setq guess + (read-file-name prompt (file-name-directory guess) nil nil + (file-name-nondirectory guess))) + ;; Remove the special handler manually. We used to just let-bind + ;; file-name-handler-alist to preserve its value, but that caused + ;; other modifications to be lost (e.g. when Tramp gets loaded + ;; during the completing-read call). + (setq file-name-handler-alist (delq fnh-elem file-name-handler-alist)))) + (or (ffap-url-p guess) + (substitute-in-file-name guess))) ;; The rest of this page is just to work with package complete.el. ;; This code assumes that you load ffap.el after complete.el. commit 0a51c7012268d764ac4282b5969e4901ebeabfdb Author: Thierry Volpiatto Date: Fri Nov 8 10:20:40 2019 -0500 * lisp/ffap.el (ffap-read-file-or-url): Use `read-file-name` Since we use `url-handler-mode` to deal with URLs, `read-file-name` works just as well, with the added benefit that it interacts correctly with packages that rebind `read-file-name-function`, such as Helm. (ffap-read-url-internal, ffap-read-file-or-url-internal): Remove, unused. diff --git a/lisp/ffap.el b/lisp/ffap.el index c4e6d8dbf4..542aec77f8 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1397,9 +1397,8 @@ which may actually result in an URL rather than a filename." ;; ;; We want to complete filenames as in read-file-name, but also url's ;; which read-file-name-internal would truncate at the "//" string. -;; The solution here is to replace read-file-name-internal with -;; `ffap-read-file-or-url-internal', which checks the minibuffer -;; contents before attempting to complete filenames. +;; The solution here is to forcefully activate url-handler-mode, which +;; takes care of it for us. (defun ffap-read-file-or-url (prompt guess) "Read file or URL from minibuffer, with PROMPT and initial GUESS." @@ -1414,22 +1413,17 @@ which may actually result in an URL rather than a filename." (setq dir (file-name-directory guess))) (let ((minibuffer-completing-file-name t) (completion-ignore-case read-file-name-completion-ignore-case) - (fnh-elem (cons ffap-url-regexp 'url-file-handler))) + (fnh-elem (cons ffap-url-regexp #'url-file-handler))) ;; Explain to `rfn-eshadow' that we can use URLs here. (push fnh-elem file-name-handler-alist) (unwind-protect (setq guess (let ((default-directory (if dir (expand-file-name dir) default-directory))) - (completing-read - prompt - 'ffap-read-file-or-url-internal - nil - nil - (if dir (cons guess (length dir)) guess) - 'file-name-history - (and buffer-file-name - (abbreviate-file-name buffer-file-name))))) + (read-file-name prompt default-directory + (and buffer-file-name + (abbreviate-file-name buffer-file-name)) + nil))) ;; Remove the special handler manually. We used to just let-bind ;; file-name-handler-alist to preserve its value, but that caused ;; other modifications to be lost (e.g. when Tramp gets loaded @@ -1438,24 +1432,6 @@ which may actually result in an URL rather than a filename." (or (ffap-url-p guess) (substitute-in-file-name guess)))) -(defun ffap-read-url-internal (string pred action) - "Complete URLs from history, treating given string as valid." - (let ((hist (ffap-symbol-value 'url-global-history-hash-table))) - (cond - ((not action) - (or (try-completion string hist pred) string)) - ((eq action t) - (or (all-completions string hist pred) (list string))) - ;; action == lambda, documented where? Tests whether string is a - ;; valid "match". Let us always say yes. - (t t)))) - -(defun ffap-read-file-or-url-internal (string pred action) - (let ((url (ffap-url-p string))) - (if url - (ffap-read-url-internal url pred action) - (read-file-name-internal (or string default-directory) pred action)))) - ;; The rest of this page is just to work with package complete.el. ;; This code assumes that you load ffap.el after complete.el. ;; commit 05167c1173c4a6c6850ba62da6757760e2df3507 Author: Eli Zaretskii Date: Fri Nov 8 15:41:26 2019 +0100 Fix MS-Windows version reference in FAQ * doc/misc/efaq-w32.texi (Which versions of Windows): Clarify that we support all recent versions of MS-Windows. (Bug#38023) diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi index cdd01e47f0..3e2b0b12cf 100644 --- a/doc/misc/efaq-w32.texi +++ b/doc/misc/efaq-w32.texi @@ -125,10 +125,12 @@ systems. @cindex Windows, versions @cindex supported versions of Windows -Emacs @value{EMACSVER} is known to run on all versions of Windows from -Windows 98 and Windows NT 4.0 through to Windows 8.1. The Windows -port is built using the Win32 API and supports most features of the X -version, including variable width fonts, images and tooltips. +Emacs @value{EMACSVER} is known to run on all versions of Windows 9X +from Windows 98 onward, and all versions of the NT family starting +from NT 4.0; this includes all the modern versions from Windows XP and +on. The Windows port is built using the Win32 API and supports most +features of the X version, including variable width fonts, images and +tooltips. Emacs on Windows can be compiled as either a 32-bit or a 64-bit executable, using the MinGW GCC compiler and development tools. commit 5761a1a3939e23d8e8c725241dd9398a12f191b0 Author: João Távora Date: Fri Nov 8 00:11:34 2019 +0000 Nudge icomplete-mode a little closer to fido-mode * lisp/icomplete.el (icomplete-completions): Don't use ellipsis when truncating determ in fido-mode. Highlight the center part of determ with icomplete-first-match. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 40f4f0bc68..a7f9086d82 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -572,6 +572,13 @@ matches exist." (compare (compare-strings name nil nil most nil nil completion-ignore-case)) (ellipsis (if (char-displayable-p ?…) "…" "...")) + ;; `determ' is what we "determined" to be the thing that + ;; TAB will complete to. Also, if we're working with a + ;; large prefix (like when finding files), we want to + ;; truncate the common prefix away. `determ-ellipsis' + ;; says if we should do it with an `ellipsis'. Icomplete + ;; uses one, Ido doesn't. + (determ-ellipsis (if fido-mode "" ellipsis)) (determ (unless (or (eq t compare) (eq t most-try) (= (setq compare (1- (abs compare))) (length most))) @@ -582,8 +589,10 @@ matches exist." (substring most compare)) ;; Don't bother truncating if it doesn't gain ;; us at least 2 columns. - ((< compare (+ 2 (string-width ellipsis))) most) - (t (concat ellipsis (substring most compare)))) + ((< compare (+ 2 (string-width determ-ellipsis))) + most) + (t (concat determ-ellipsis + (substring most compare)))) close-bracket))) ;;"-prospects" - more than one candidate (prospects-len (+ (string-width @@ -664,6 +673,8 @@ matches exist." (mapconcat 'identity prospects icomplete-separator) (and limit (concat icomplete-separator ellipsis)) "}") + (put-text-property 1 (1- (length determ)) + 'face 'icomplete-first-match determ) (concat determ " [Matched]")))))) ;;; Iswitchb compatibility commit d558d9fa1e0daf7e8f511cac4595c1eeeeeeb177 Author: João Távora Date: Thu Nov 7 23:54:21 2019 +0000 Have pcm styles apply faces to face prop, not font-lock-face This is the way the basic completion styles work. This fixes candidate highlighting in icomplete. * lisp/minibuffer.el (completion-pcm--hilit-commonality): Apply faces to 'face property, not font-lock-face. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 43dd277a2e..cc113b926f 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3145,16 +3145,16 @@ one-letter-long matches).") (while md (funcall update-score start (car md)) (put-text-property start (pop md) - 'font-lock-face 'completions-common-part + 'face 'completions-common-part str) (setq start (pop md))) (funcall update-score len len) (put-text-property start end - 'font-lock-face 'completions-common-part + 'face 'completions-common-part str) (if (> (length str) pos) (put-text-property pos (1+ pos) - 'font-lock-face 'completions-first-difference + 'face 'completions-first-difference str)) (unless (zerop (length str)) (put-text-property commit 42eaac3134ee199ffb20863c42c1867d25b33623 Author: Eli Zaretskii Date: Fri Nov 8 11:55:36 2019 +0200 Minor copyedits in ELisp manual * doc/lispref/lists.texi (Sets And Lists): Minor rewording of the "Common Lisp note". (Bug#37811) diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index c06e95640d..92972b040d 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1212,9 +1212,8 @@ functions for sets include @code{memq} and @code{delq}, and their @quotation @b{Common Lisp note:} Common Lisp has functions @code{union} (which avoids duplicate elements) and @code{intersection} for set operations. -Although standard GNU Emacs Lisp does not have them, the @file{cl-lib} -library provides versions. -@xref{Lists as Sets,,, cl, Common Lisp Extensions}. +In Emacs Lisp, variants of these facilities are provided by the +@file{cl-lib} library. @xref{Lists as Sets,,,cl,Common Lisp Extensions}. @end quotation @defun memq object list commit 063277c5ecd82551b2bf1409d1583edc7c0fcaad Author: Robert Pluim Date: Thu Nov 7 16:16:39 2019 +0100 Ensure building and running on non-IPv6 capable hosts works * src/process.c (Fmake_network_process) [AF_INET6]: Only build ::1 localhost when IPv6 is supported. (Fnetwork_lookup_address_info) [AF_INET6]: Move check for Qipv6 inside ifdef, since its definition depends on AF_INET6. Don't return IPv6 addresses when they're not supported. * test/src/process-tests.el (lookup-family-specification, lookup-google): Only do IPv6 lookup if IPv6 is supported. diff --git a/src/process.c b/src/process.c index 1f959e3960..8aa4811f7e 100644 --- a/src/process.c +++ b/src/process.c @@ -4015,9 +4015,11 @@ usage: (make-network-process &rest ARGS) */) if (family != AF_LOCAL) #endif { +#ifdef AF_INET6 if (family == AF_INET6) host = build_string ("::1"); else +#endif host = build_string ("127.0.0.1"); } } @@ -4027,9 +4029,11 @@ usage: (make-network-process &rest ARGS) */) { /* Depending on setup, "localhost" may map to different IPv4 and/or IPv6 addresses, so it's better to be explicit (Bug#6781). */ +#ifdef AF_INET6 if (family == AF_INET6) host = build_string ("::1"); else +#endif host = build_string ("127.0.0.1"); } CHECK_STRING (host); @@ -4622,7 +4626,8 @@ DEFUN ("network-lookup-address-info", Fnetwork_lookup_address_info, Optional parameter FAMILY controls whether to look up IPv4 or IPv6 addresses. The default of nil means both, symbol `ipv4' means IPv4 only, symbol `ipv6' means IPv6 only. Returns a list of addresses, or -nil if none were found. Each address is a vector of integers. */) +nil if none were found. Each address is a vector of integers, as per +the description of ADDRESS in `make-network-process'. */) (Lisp_Object name, Lisp_Object family) { Lisp_Object addresses = Qnil; @@ -4636,12 +4641,9 @@ nil if none were found. Each address is a vector of integers. */) hints.ai_family = AF_UNSPEC; else if (EQ (family, Qipv4)) hints.ai_family = AF_INET; - else if (EQ (family, Qipv6)) #ifdef AF_INET6 + else if (EQ (family, Qipv6)) hints.ai_family = AF_INET6; -#else - /* If we don't support IPv6, querying will never work anyway */ - return addresses; #endif else error ("Unsupported lookup type"); @@ -4653,9 +4655,15 @@ nil if none were found. Each address is a vector of integers. */) else { for (lres = res; lres; lres = lres->ai_next) - addresses = Fcons (conv_sockaddr_to_lisp (lres->ai_addr, - lres->ai_addrlen), - addresses); + { +#ifndef AF_INET6 + if (lres->ai_family != AF_INET) + continue; +#endif + addresses = Fcons (conv_sockaddr_to_lisp (lres->ai_addr, + lres->ai_addrlen), + addresses); + } addresses = Fnreverse (addresses); freeaddrinfo (res); diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 158c036aaa..f065d393d2 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -337,7 +337,8 @@ See Bug#30460." (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (should-error (network-lookup-address-info "google.com" 'both)) (should (network-lookup-address-info "google.com" 'ipv4)) - (should (network-lookup-address-info "google.com" 'ipv6))) + (when (featurep 'make-network-process '(:family ipv6)) + (should (network-lookup-address-info "google.com" 'ipv6)))) (ert-deftest lookup-unicode-domains () "Unicode domains should fail" @@ -354,11 +355,11 @@ See Bug#30460." "Check that we can look up google IP addresses" (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (let ((addresses-both (network-lookup-address-info "google.com")) - (addresses-v4 (network-lookup-address-info "google.com" 'ipv4)) - (addresses-v6 (network-lookup-address-info "google.com" 'ipv6))) + (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))) (should addresses-both) - (should addresses-v4) - (should addresses-v6))) + (should addresses-v4)) + (when (featurep 'make-network-process '(:family ipv6)) + (should (network-lookup-address-info "google.com" 'ipv6)))) (ert-deftest non-existent-lookup-failure () (skip-unless (not (getenv "EMACS_HYDRA_CI"))) commit 82323253378c310c71cfea393d228321d1fc51f4 Author: Jimmy Aguilar Mena Date: Fri Nov 8 09:31:33 2019 +0100 Handle case where a face's :extend attribute is unspecified (Bug#37774) * src/xfaces.c (merge_face_vectors, merge_named_face): Handle case where the :extend attribute's value is 'unspecified' (Bug#37774). diff --git a/src/xfaces.c b/src/xfaces.c index 3806fa90e2..67fa9e24b8 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2062,8 +2062,13 @@ merge_face_vectors (struct window *w, struct frame *f, eassert (attr_filter < LFACE_VECTOR_SIZE); - /* When FROM sets attr_filter to nil explicitly we don't merge it. */ - if (attr_filter > 0 && NILP(from[attr_filter])) + /* When FROM sets attr_filter explicitly to nil or unspecified + without inheriting don't merge it. */ + if (attr_filter > 0 + && (NILP(from[attr_filter]) + || (UNSPECIFIEDP(from[attr_filter]) + && (NILP (from[LFACE_INHERIT_INDEX]) + || UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]))))) return; /* If FROM inherits from some other faces, merge their attributes into @@ -2082,7 +2087,7 @@ merge_face_vectors (struct window *w, struct frame *f, else if (UNSPECIFIEDP (from[attr_filter])) /* FROM don't specify filter */ { Lisp_Object tmp[LFACE_VECTOR_SIZE]; - memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof *tmp); + memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof(*tmp)); merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], tmp, false, named_merge_points, attr_filter); @@ -2177,7 +2182,8 @@ merge_named_face (struct window *w, && !UNSPECIFIEDP(from[attr_filter])) || (!NILP(from[attr_filter]) /* Filter, unspecified, but inherited. */ && UNSPECIFIEDP(from[attr_filter]) - && !NILP (from[LFACE_INHERIT_INDEX])))) + && !NILP (from[LFACE_INHERIT_INDEX]) + && !UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])))) merge_face_vectors (w, f, from, to, named_merge_points, attr_filter); return ok; commit a070bd1c8b5213ad469d41dd80d392f924644aed Author: Stefan Monnier Date: Thu Nov 7 17:08:51 2019 -0500 * lisp/emacs-lisp/easymenu.el: Don't quote lambdas (easy-menu-do-define, easy-menu-make-symbol): Replace `(lambda ..) with a closure. diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index f274f62164..292d50b91a 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -183,17 +183,17 @@ This is expected to be bound to a mouse event." (when symbol (set symbol keymap) (defalias symbol - `(lambda (event) ,doc (interactive "@e") + (lambda (event) (:documentation doc) (interactive "@e") ;; FIXME: XEmacs uses popup-menu which calls the binding ;; while x-popup-menu only returns the selection. (x-popup-menu event - (or (and (symbolp ,symbol) + (or (and (symbolp symbol) (funcall - (or (plist-get (get ,symbol 'menu-prop) + (or (plist-get (get symbol 'menu-prop) :filter) 'identity) - (symbol-function ,symbol))) - ,symbol))))) + (symbol-function symbol))) + symbol))))) (dolist (map (if (keymapp maps) (list maps) maps)) (define-key map (vector 'menu-bar (easy-menu-intern (car menu))) @@ -475,7 +475,7 @@ When non-nil, NOEXP indicates that CALLBACK cannot be an expression ;; `functionp' is probably not needed. (functionp callback) noexp) callback - `(lambda () (interactive) ,callback))) + (lambda () (interactive) callback))) command)) ;;;###autoload commit e8bcf45f306bcf4c9e8d643d68e4aabe0c69c7ca Author: Michael Albinus Date: Thu Nov 7 18:40:13 2019 +0100 Handle different system names of w32 in Tramp (Bug#38079) * lisp/net/tramp.el (tramp-restricted-shell-hosts-alist): Initialize with `system-name' in small and capital chars. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 09d125945a..50f8c5d991 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -458,15 +458,20 @@ interpreted as a regular expression which always matches." :version "24.3" :type 'boolean) +;; For some obscure technical reasons, `system-name' on w32 returns +;; either lower case or upper case letters. See +;; . (defcustom tramp-restricted-shell-hosts-alist (when (memq system-type '(windows-nt)) - (list (concat "\\`" (regexp-quote (system-name)) "\\'"))) + (list (format "\\`\\(%s\\|%s\\)\\'" + (regexp-quote (downcase (system-name))) + (regexp-quote (upcase (system-name)))))) "List of hosts, which run a restricted shell. This is a list of regular expressions, which denote hosts running -a registered shell like \"rbash\". Those hosts can be used as +a restricted shell like \"rbash\". Those hosts can be used as proxies only, see `tramp-default-proxies-alist'. If the local -host runs a registered shell, it shall be added to this list, too." - :version "24.3" +host runs a restricted shell, it shall be added to this list, too." + :version "27.1" :type '(repeat (regexp :tag "Host regexp"))) (defcustom tramp-local-host-regexp commit 8ce2ec15f483a17ead34514242cba384d2d795a2 Author: Robert Pluim Date: Thu Nov 7 14:19:43 2019 +0100 Describe IPv6 format in docstring for 'make-network-process' * src/process.c (Fmake_network_process): Add description of IPv6 address format. diff --git a/src/process.c b/src/process.c index af282652eb..1f959e3960 100644 --- a/src/process.c +++ b/src/process.c @@ -3794,6 +3794,8 @@ process, the FAMILY, HOST, and SERVICE args are ignored. The format of ADDRESS depends on the address family: - An IPv4 address is represented as a vector of integers [A B C D P] corresponding to numeric IP address A.B.C.D and port number P. +- An IPv6 address has the same format as an IPv4 address but with 9 +elements rather than 5. - A local address is represented as a string with the address in the local address space. - An "unsupported family" address is represented by a cons (F . AV) commit e06324a032e9248cb9bce0e40077a726cc4ea719 Author: Eli Zaretskii Date: Thu Nov 7 19:11:23 2019 +0200 Revert "Don't flash previous buffer when connecting with emacsclient" This reverts commit 49fc040077b33bd1e78ee425575e76329b772a41. It turns out that the fix for a minor aesthetical annoyance caused much more serious bugs: bug#31038, bug#35726, Bug#37097, diff --git a/lisp/server.el b/lisp/server.el index 45fa55ad6b..14114c8b3a 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1098,8 +1098,7 @@ The following commands are accepted by the client: tty-type ; string. files filepos - args-left - create-frame-func) + args-left) ;; Remove this line from STRING. (setq string (substring string (match-end 0))) (setq args-left @@ -1251,29 +1250,28 @@ The following commands are accepted by the client: (or files commands) (setq use-current-frame t)) - (setq create-frame-func - (lambda () - (cond - ((and use-current-frame - (or (eq use-current-frame 'always) - ;; We can't use the Emacs daemon's - ;; terminal frame. - (not (and (daemonp) - (null (cdr (frame-list))) - (eq (selected-frame) - terminal-frame))))) - (setq tty-name nil tty-type nil) - (if display (server-select-display display))) - ((or (and (eq system-type 'windows-nt) - (daemonp) - (setq display "w32")) - (eq tty-name 'window-system)) - (server-create-window-system-frame display nowait proc - parent-id - frame-parameters)) - ;; When resuming on a tty, tty-name is nil. - (tty-name - (server-create-tty-frame tty-name tty-type proc))))) + (setq frame + (cond + ((and use-current-frame + (or (eq use-current-frame 'always) + ;; We can't use the Emacs daemon's + ;; terminal frame. + (not (and (daemonp) + (null (cdr (frame-list))) + (eq (selected-frame) + terminal-frame))))) + (setq tty-name nil tty-type nil) + (if display (server-select-display display))) + ((or (and (eq system-type 'windows-nt) + (daemonp) + (setq display "w32")) + (eq tty-name 'window-system)) + (server-create-window-system-frame display nowait proc + parent-id + frame-parameters)) + ;; When resuming on a tty, tty-name is nil. + (tty-name + (server-create-tty-frame tty-name tty-type proc)))) (process-put proc 'continuation @@ -1285,7 +1283,7 @@ The following commands are accepted by the client: (if (and dir (file-directory-p dir)) dir default-directory))) (server-execute proc files nowait commands - dontkill create-frame-func tty-name))))) + dontkill frame tty-name))))) (when (or frame files) (server-goto-toplevel proc)) @@ -1294,7 +1292,7 @@ The following commands are accepted by the client: ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill create-frame-func tty-name) +(defun server-execute (proc files nowait commands dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the @@ -1304,29 +1302,20 @@ The following commands are accepted by the client: ;; including code that needs to wait. (with-local-quit (condition-case err - (let* ((buffers (server-visit-files files proc nowait)) - ;; If we were told only to open a new client, obey - ;; `initial-buffer-choice' if it specifies a file - ;; or a function. - (initial-buffer (unless (or files commands) - (let ((buf - (cond ((stringp initial-buffer-choice) - (find-file-noselect initial-buffer-choice)) - ((functionp initial-buffer-choice) - (funcall initial-buffer-choice))))) - (if (buffer-live-p buf) buf (startup--get-buffer-create-scratch))))) - ;; Set current buffer so that newly created tty frames - ;; show the correct buffer initially. - (frame (with-current-buffer (or (car buffers) - initial-buffer - (current-buffer)) - (prog1 - (funcall create-frame-func) - ;; Switch to initial buffer in case the frame was reused. - (when initial-buffer - (switch-to-buffer initial-buffer 'norecord)))))) - - (mapc #'funcall (nreverse commands)) + (let ((buffers (server-visit-files files proc nowait))) + (mapc 'funcall (nreverse commands)) + ;; If we were told only to open a new client, obey + ;; `initial-buffer-choice' if it specifies a file + ;; or a function. + (unless (or files commands) + (let ((buf + (cond ((stringp initial-buffer-choice) + (find-file-noselect initial-buffer-choice)) + ((functionp initial-buffer-choice) + (funcall initial-buffer-choice))))) + (switch-to-buffer + (if (buffer-live-p buf) buf (get-buffer-create "*scratch*")) + 'norecord))) ;; Delete the client if necessary. (cond commit 1b715834c3de2231fd602f43530d04f710281451 Author: Eli Zaretskii Date: Thu Nov 7 18:55:55 2019 +0200 ; * etc/NEWS: Fix wording of last change. diff --git a/etc/NEWS b/etc/NEWS index 2e4f938060..95d6b9b5bd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1447,8 +1447,8 @@ The maximum level is used by default; customize --- *** New user option 'python-pdbtrack-kill-buffers'. -If nil, buffers opened during pdbtracking session are not killed when -pdbtracking session is finished. +If non-nil, the default, buffers opened during pdbtracking session are +killed when pdbtracking session is finished. ** Help commit e50587b1db8475fd45e6668f97ca7bc28b798996 Author: Andrii Kolomoiets Date: Sat Nov 2 18:08:13 2019 +0200 python.el: Pdbtracking improvements Allow not to kill buffers when pdbtracking session is finished. Pdbtracking session considered finished judging from the user input. * lisp/progmodes/python.el (python-pdbtrack-kill-buffers): New customizable variable. (python-pdbtrack-set-tracked-buffer): Use it. (python-pdbtrack-unset-tracked-buffer) (python-pdbtrack-tracking-finish): New functions. (python-pdbtrack-continue-command, python-pdbtrack-exit-command): New customizable variables. (python-pdbtrack-process-sentinel): New function. Finish pdbtracking session when process is killed. (python-pdbtrack-prev-command-continue): New variable. (python-pdbtrack-comint-input-filter-function): New function. Finish pdbtracking session based on commands sent to pdb. (python-pdbtrack-comint-output-filter-function): Unset/set tracking buffer if looking at pdb prompt; finish pdbtracking session if filename of current stack frame starts with "<" e.g. "". (python-pdbtrack-comint-output-filter-function): Don't override overlay-arrow-string. (python-pdbtrack-setup-tracking): New function. (inferior-python-mode): Use it. (python-pdbtrack-stacktrace-info-regexp): Default value is changed. Must also match lines with filename like "" and "". * etc/NEWS: Mention python-pdbtrack-kill-buffers diff --git a/etc/NEWS b/etc/NEWS index e5d0fc1c6c..2e4f938060 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1445,6 +1445,11 @@ unescaping text. The maximum level is used by default; customize 'font-lock-maximum-decoration' to tone down the decoration. +--- +*** New user option 'python-pdbtrack-kill-buffers'. +If nil, buffers opened during pdbtracking session are not killed when +pdbtracking session is finished. + ** Help --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index bdc0f1cd96..e672645c73 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2785,7 +2785,6 @@ variable. (set (make-local-variable 'comint-output-filter-functions) '(ansi-color-process-output python-shell-comint-watch-for-first-prompt-output-filter - python-pdbtrack-comint-output-filter-function python-comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)) (set (make-local-variable 'compilation-error-regexp-alist) @@ -2794,12 +2793,11 @@ variable. #'python-shell-completion-at-point nil 'local) (define-key inferior-python-mode-map "\t" 'python-shell-completion-complete-or-indent) - (make-local-variable 'python-pdbtrack-buffers-to-kill) - (make-local-variable 'python-pdbtrack-tracked-buffer) (make-local-variable 'python-shell-internal-last-output) (when python-shell-font-lock-enable (python-shell-font-lock-turn-on)) - (compilation-shell-minor-mode 1)) + (compilation-shell-minor-mode 1) + (python-pdbtrack-setup-tracking)) (defun python-shell-make-comint (cmd proc-name &optional show internal) "Create a Python shell comint buffer. @@ -3728,19 +3726,72 @@ If not try to complete." ;;; PDB Track integration (defcustom python-pdbtrack-activate t - "Non-nil makes Python shell enable pdbtracking." + "Non-nil makes Python shell enable pdbtracking. +Pdbtracking would open the file for current stack frame found in pdb output by +`python-pdbtrack-stacktrace-info-regexp' and add overlay arrow in currently +inspected line in that file. + +After command listed in `python-pdbtrack-continue-command' or +`python-pdbtrack-exit-command' is sent to pdb, pdbtracking session is +considered over. Overlay arrow will be removed from currentry tracked +buffer. Additionally, if `python-pdbtrack-kill-buffers' is non-nil, all +files opened by pdbtracking will be killed." :type 'boolean :group 'python :safe 'booleanp) (defcustom python-pdbtrack-stacktrace-info-regexp - "> \\([^\"(<]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" + "> \\([^\"(]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()" "Regular expression matching stacktrace information. -Used to extract the current line and module being inspected." +Used to extract the current line and module being inspected. + +Must match lines with real filename, like + > /path/to/file.py(42)()->None +and lines in which filename starts with '<', e.g. + > (1)()->None + +In the first case /path/to/file.py file will be visited and overlay icon +will be placed in line 42. +In the second case pdbtracking session will be considered over because +the top stack frame has been reached. + +Filename is expected in the first parenthesized expression. +Line number is expected in the second parenthesized expression." :type 'string - :group 'python + :version "27.1" :safe 'stringp) +(defcustom python-pdbtrack-continue-command '("c" "cont" "continue") + "Pdb 'continue' command aliases. +After one of this commands is sent to pdb, pdbtracking session is +considered over. + +This command is remembered by pdbtracking. If next command sent to pdb +is empty string, it considered 'continue' command if previous command +was 'continue'. This behavior slightly differentiate 'continue' command +from 'exit' commands listed in `python-pdbtrack-exit-command'. + +See `python-pdbtrack-activate' for pdbtracking session overview." + :type 'list + :version "27.1") + +(defcustom python-pdbtrack-exit-command '("q" "quit" "exit") + "Pdb 'exit' command aliases. +After one of this commands is sent to pdb, pdbtracking session is +considered over. + +See `python-pdbtrack-activate' for pdbtracking session overview." + :type 'list + :version "27.1") + +(defcustom python-pdbtrack-kill-buffers t + "If non-nil, kill buffers when pdbtracking session is over. +Only buffers opened by pdbtracking will be killed. + +See `python-pdbtrack-activate' for pdbtracking session overview." + :type 'boolean + :version "27.1") + (defvar python-pdbtrack-tracked-buffer nil "Variable containing the value of the current tracked buffer. Never set this variable directly, use @@ -3749,6 +3800,9 @@ Never set this variable directly, use (defvar python-pdbtrack-buffers-to-kill nil "List of buffers to be deleted after tracking finishes.") +(defvar python-pdbtrack-prev-command-continue nil + "Is t if previous pdb command was 'continue'.") + (defun python-pdbtrack-set-tracked-buffer (file-name) "Set the buffer for FILE-NAME as the tracked buffer. Internally it uses the `python-pdbtrack-tracked-buffer' variable. @@ -3756,8 +3810,7 @@ Returns the tracked buffer." (let* ((file-name-prospect (concat (file-remote-p default-directory) file-name)) (file-buffer (get-file-buffer file-name-prospect))) - (if file-buffer - (setq python-pdbtrack-tracked-buffer file-buffer) + (unless file-buffer (cond ((file-exists-p file-name-prospect) (setq file-buffer (find-file-noselect file-name-prospect))) @@ -3765,10 +3818,55 @@ Returns the tracked buffer." (file-exists-p file-name)) ;; Fallback to a locally available copy of the file. (setq file-buffer (find-file-noselect file-name-prospect)))) - (when (not (member file-buffer python-pdbtrack-buffers-to-kill)) + (when (and python-pdbtrack-kill-buffers + (not (member file-buffer python-pdbtrack-buffers-to-kill))) (add-to-list 'python-pdbtrack-buffers-to-kill file-buffer))) + (setq python-pdbtrack-tracked-buffer file-buffer) file-buffer)) +(defun python-pdbtrack-unset-tracked-buffer () + "Untrack currently tracked buffer." + (when python-pdbtrack-tracked-buffer + (with-current-buffer python-pdbtrack-tracked-buffer + (set-marker overlay-arrow-position nil)) + (setq python-pdbtrack-tracked-buffer nil))) + +(defun python-pdbtrack-tracking-finish () + "Finish tracking." + (python-pdbtrack-unset-tracked-buffer) + (when python-pdbtrack-kill-buffers + (mapc #'(lambda (buffer) + (ignore-errors (kill-buffer buffer))) + python-pdbtrack-buffers-to-kill)) + (setq python-pdbtrack-buffers-to-kill nil)) + +(defun python-pdbtrack-process-sentinel (process _event) + "Untrack buffers when PROCESS is killed." + (unless (process-live-p process) + (let ((buffer (process-buffer process))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (python-pdbtrack-tracking-finish)))))) + +(defun python-pdbtrack-comint-input-filter-function (input) + "Finish tracking session depending on command in INPUT. +Commands that must finish tracking session is listed in +`python-pdbtrack-untracking-commands'." + (when (and python-pdbtrack-tracked-buffer + ;; Empty input is sent by C-d or `comint-send-eof' + (or (string-empty-p input) + ;; "n some text" is "n" command for pdb. Split input and get firs part + (let* ((command (car (split-string (string-trim input) " ")))) + (setq python-pdbtrack-prev-command-continue + (or (member command python-pdbtrack-continue-command) + ;; if command is empty and previous command was 'continue' + ;; then current command is 'continue' too. + (and (string-empty-p command) + python-pdbtrack-prev-command-continue))) + (or python-pdbtrack-prev-command-continue + (member command python-pdbtrack-exit-command))))) + (python-pdbtrack-tracking-finish))) + (defun python-pdbtrack-comint-output-filter-function (output) "Move overlay arrow to current pdb line in tracked buffer. Argument OUTPUT is a string with the output from the comint process." @@ -3788,19 +3886,27 @@ Argument OUTPUT is a string with the output from the comint process." ;; the _last_ stack frame printed in the most recent ;; batch of output, then jump to the corresponding ;; file/line number. + ;; Parse output only if at pdb prompt to avoid double code + ;; run in situation when output and pdb prompt received in + ;; different hunks (goto-char (point-max)) - (when (re-search-backward python-pdbtrack-stacktrace-info-regexp nil t) + (goto-char (line-beginning-position)) + (when (and (looking-at python-shell-prompt-pdb-regexp) + (re-search-backward python-pdbtrack-stacktrace-info-regexp nil t)) (setq line-number (string-to-number (match-string-no-properties 2))) (match-string-no-properties 1))))) - (if (and file-name line-number) - (let* ((tracked-buffer - (python-pdbtrack-set-tracked-buffer file-name)) + (when (and file-name line-number) + (if (string-prefix-p "<" file-name) + ;; Finish tracking session if stacktrace info is like + ;; "> (1)()->None" + (python-pdbtrack-tracking-finish) + (python-pdbtrack-unset-tracked-buffer) + (let* ((tracked-buffer (python-pdbtrack-set-tracked-buffer file-name)) (shell-buffer (current-buffer)) (tracked-buffer-window (get-buffer-window tracked-buffer)) (tracked-buffer-line-pos)) (with-current-buffer tracked-buffer - (set (make-local-variable 'overlay-arrow-string) "=>") (set (make-local-variable 'overlay-arrow-position) (make-marker)) (setq tracked-buffer-line-pos (progn (goto-char (point-min)) @@ -3811,17 +3917,21 @@ Argument OUTPUT is a string with the output from the comint process." tracked-buffer-window tracked-buffer-line-pos)) (set-marker overlay-arrow-position tracked-buffer-line-pos)) (pop-to-buffer tracked-buffer) - (switch-to-buffer-other-window shell-buffer)) - (when python-pdbtrack-tracked-buffer - (with-current-buffer python-pdbtrack-tracked-buffer - (set-marker overlay-arrow-position nil)) - (mapc #'(lambda (buffer) - (ignore-errors (kill-buffer buffer))) - python-pdbtrack-buffers-to-kill) - (setq python-pdbtrack-tracked-buffer nil - python-pdbtrack-buffers-to-kill nil))))) + (switch-to-buffer-other-window shell-buffer)))))) output) +(defun python-pdbtrack-setup-tracking () + "Setup pdb tracking in current buffer." + (make-local-variable 'python-pdbtrack-buffers-to-kill) + (make-local-variable 'python-pdbtrack-tracked-buffer) + (add-to-list (make-local-variable 'comint-input-filter-functions) + #'python-pdbtrack-comint-input-filter-function) + (add-to-list (make-local-variable 'comint-output-filter-functions) + #'python-pdbtrack-comint-output-filter-function) + (add-function :before (process-sentinel (get-buffer-process (current-buffer))) + #'python-pdbtrack-process-sentinel) + (add-hook 'kill-buffer-hook #'python-pdbtrack-tracking-finish nil t)) + ;;; Symbol completion commit 3df1cf75f2f2be9549b6ffe3649387d2b4246f06 Author: Eli Zaretskii Date: Thu Nov 7 16:16:12 2019 +0200 ; * etc/NEWS: Minor copyedits in the Fido mode entry. diff --git a/etc/NEWS b/etc/NEWS index 4d5d9f2a7d..e5d0fc1c6c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1216,10 +1216,11 @@ A new command 'xref-revert-buffer' is bound to 'g'. ** Icomplete +++ -*** A new minor mode based on Icomplete, Fido mode, is made available. -The point of this mode, named after "Fake Ido", is to recover much of -the functionality that still separated the popular ido-mode from -Icomplete, while still cooperating fully with all of Emacs's +*** New minor mode Fido mode. +This mode is based on Icomplete, and its name stands for "Fake Ido". +The point of this mode is to be an ido-mode workalike, but provide +most of the functionality present in Icomplete that is not in +ido-mode, while being much more compatible with all of Emacs's completion facilities. ** Ecomplete commit 4ab780012649bbab60238148efd9d3b4a819fd61 Author: Michael Albinus Date: Thu Nov 7 12:03:19 2019 +0100 Make ange-ftp fit for tramp-tests * lisp/net/ange-ftp.el (ange-ftp-repaint-minibuffer): Use empty message. (ange-ftp-quote-string): Unquote the string. (ange-ftp-substitute-in-file-name, ange-ftp-access-file) (ange-ftp-copy-directory, ange-ftp-make-symbolic-link) (ange-ftp-add-name-to-file): New defuns. Set 'ange-ftp property. (ange-ftp-real-substitute-in-file-name) (ange-ftp-real-copy-directory): New defuns. (ange-ftp-file-name-as-directory): Care about `non-essential'. (ange-ftp-file-attributes): Handle ID-STRING. (ange-ftp-copy-file-internal, ange-ftp-rename-file) (ange-ftp-make-directory): Improve error handling. (ange-ftp-insert-directory): Initialize SWITCHES if they are nil. * test/lisp/net/tramp-tests.el (ange-ftp-make-backup-files): Declare. (tramp-test39-make-nearby-temp-file, tramp--test-ange-ftp-p): New defun. (tramp-test05-expand-file-name-relative) (tramp-test06-directory-file-name, tramp-test10-write-region) (tramp-test11-copy-file, tramp-test12-rename-file) (tramp-test17-insert-directory) (tramp-test26-file-name-completion) (tramp-test37-make-auto-save-file-name) (tramp-test38-find-backup-file-name) (tramp--test-special-characters): Use it. diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index a5fc9631e8..16e8e757dc 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -1463,7 +1463,7 @@ only return the directory part of FILE." (defun ange-ftp-repaint-minibuffer () "Clear any existing minibuffer message; let the minibuffer contents show." - (message nil)) + (message "")) ;; Return the name of the buffer that collects output from the ftp process ;; connected to the given HOST and USER pair. @@ -1512,8 +1512,10 @@ then kill the related FTP process." ;; and that by doubling it. But experiment says UNIX-style kind of ;; quoting is correct when talking to ftp on GNU/Linux systems, and ;; W32-style kind of quoting on, yes, W32 systems. + ;; STRING could be a quoted file name, we unquote it. It is + ;; unlikely, that other strings but file names look alike. (if (stringp string) - (shell-quote-argument string) + (shell-quote-argument (file-name-unquote string)) "")) (defun ange-ftp-barf-if-not-directory (directory) @@ -3144,6 +3146,12 @@ logged in as user USER and cd'd to directory DIR." (ange-ftp-real-expand-file-name name "/")) ((ange-ftp-canonize-filename (concat (file-name-as-directory default) name)))))) + +(defun ange-ftp-substitute-in-file-name (filename) + "Documented as `substitute-in-file-name'." + (if (file-name-quoted-p filename) + filename + (ange-ftp-real-substitute-in-file-name filename))) ;;; These are problems--they are currently not enabled. @@ -3156,7 +3164,7 @@ system TYPE.") "Documented as `file-name-as-directory'." (let ((parsed (ange-ftp-ftp-name name))) (if parsed - (if (string-equal (nth 2 parsed) "") + (if (and non-essential (string-equal (nth 2 parsed) "")) name (funcall (or (cdr (assq (ange-ftp-host-type (car parsed)) @@ -3392,6 +3400,11 @@ system TYPE.") t))) (ange-ftp-real-file-exists-p name))) +(defun ange-ftp-access-file (filename string) + (unless (file-readable-p (file-truename filename)) + (signal + 'file-missing (list "%s: No such file or directory %s" string filename)))) + (defun ange-ftp-file-directory-p (name) (setq name (expand-file-name name)) (if (ange-ftp-ftp-name name) @@ -3465,8 +3478,10 @@ system TYPE.") (file-name-directory file)) dirp) ;0 file type -1 ;1 link count - -1 ;2 uid - -1 ;3 gid + (if (eq id-format 'string) + "nobody" -1) ;2 uid + (if (eq id-format 'string) + "nobody" -1) ;3 gid '(0 0) ;4 atime (ange-ftp-file-modtime file) ;5 mtime '(0 0) ;6 ctime @@ -3613,6 +3628,16 @@ so return the size on the remote host exactly. See RFC 3659." absname querystring))) (signal 'file-already-exists (list absname)))))) +(defun ange-ftp-copy-directory + (directory newname &optional keep-date parents copy-contents) + ;; `copy-directory' creates `newname' before running this check. So + ;; we do it ourselves. + (unless (file-exists-p directory) + (signal 'file-missing (list "No such file or directory" directory))) + ;; We must do it file-wise. + (ange-ftp-real-copy-directory + directory newname keep-date parents copy-contents)) + ;; async local copy commented out for now since I don't seem to get ;; the process sentinel called for some processes. ;; @@ -3662,6 +3687,12 @@ so return the size on the remote host exactly. See RFC 3659." (signal 'file-missing (list "Copy file" "No such file or directory" filename))) + (and (not ok-if-already-exists) (file-exists-p newname) + (signal 'file-already-exists (list newname))) + + (and (file-directory-p newname) (not (directory-name-p newname)) + (signal 'file-error (list "File is a directory %s" newname))) + ;; canonicalize newname if a directory. (if (file-directory-p newname) (setq newname (expand-file-name (file-name-nondirectory filename) newname))) @@ -3929,6 +3960,11 @@ E.g., (defun ange-ftp-rename-file (filename newname &optional ok-if-already-exists) (interactive "fRename file: \nFRename %s to file: \np") + + (or (file-exists-p filename) + (signal 'file-missing + (list "Copy file" "No such file or directory" filename))) + (setq filename (expand-file-name filename)) (setq newname (expand-file-name newname)) (let* ((f-parsed (ange-ftp-ftp-name filename)) @@ -4093,7 +4129,9 @@ directory, so that Emacs will know its current contents." (ange-ftp-make-directory parent parents)))) (if (file-exists-p dir) (unless parents - (error "Cannot make directory %s: file already exists" dir)) + (signal + 'file-already-exists + (list "Cannot make directory: file already exists" dir))) (let ((parsed (ange-ftp-ftp-name dir))) (if parsed (let* ((host (nth 0 parsed)) @@ -4206,7 +4244,7 @@ directory, so that Emacs will know its current contents." (while (and tryfiles (not copy)) (catch 'ftp-error (let ((ange-ftp-waiting-flag t)) - (condition-case _error + (condition-case nil (setq copy (ange-ftp-file-local-copy (car tryfiles))) (ftp-error nil)))) (setq tryfiles (cdr tryfiles))) @@ -4389,6 +4427,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (put 'file-name-as-directory 'ange-ftp 'ange-ftp-file-name-as-directory) (put 'directory-file-name 'ange-ftp 'ange-ftp-directory-file-name) (put 'expand-file-name 'ange-ftp 'ange-ftp-expand-file-name) +(put 'substitute-in-file-name 'ange-ftp 'ange-ftp-substitute-in-file-name) (put 'make-directory 'ange-ftp 'ange-ftp-make-directory) (put 'delete-directory 'ange-ftp 'ange-ftp-delete-directory) (put 'insert-file-contents 'ange-ftp 'ange-ftp-insert-file-contents) @@ -4403,11 +4442,13 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (put 'file-executable-p 'ange-ftp 'ange-ftp-file-executable-p) (put 'file-symlink-p 'ange-ftp 'ange-ftp-file-symlink-p) (put 'file-regular-p 'ange-ftp 'ange-ftp-file-regular-p) +(put 'access-file 'ange-ftp 'ange-ftp-access-file) (put 'delete-file 'ange-ftp 'ange-ftp-delete-file) (put 'verify-visited-file-modtime 'ange-ftp 'ange-ftp-verify-visited-file-modtime) (put 'file-exists-p 'ange-ftp 'ange-ftp-file-exists-p) (put 'write-region 'ange-ftp 'ange-ftp-write-region) +(put 'copy-directory 'ange-ftp 'ange-ftp-copy-directory) (put 'copy-file 'ange-ftp 'ange-ftp-copy-file) (put 'rename-file 'ange-ftp 'ange-ftp-rename-file) (put 'file-attributes 'ange-ftp 'ange-ftp-file-attributes) @@ -4425,6 +4466,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (put 'load 'ange-ftp 'ange-ftp-load) (put 'find-backup-file-name 'ange-ftp 'ange-ftp-find-backup-file-name) (put 'set-file-modes 'ange-ftp 'ange-ftp-set-file-modes) +(put 'make-symbolic-link 'ange-ftp 'ange-ftp-make-symbolic-link) +(put 'add-name-to-file 'ange-ftp 'ange-ftp-add-name-to-file) ;; Turn off truename processing to save time. ;; Treat each name as its own truename. @@ -4439,7 +4482,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") ;; This returns nil for any file name as argument. (put 'vc-registered 'ange-ftp 'null) -;; We can handle process-file in a restricted way (just for chown). +;; We can handle `process-file' in a restricted way (just for chown). ;; Nothing possible for `start-file-process'. (put 'exec-path 'ange-ftp 'ignore) (put 'make-process 'ange-ftp 'ignore) @@ -4473,6 +4516,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (ange-ftp-run-real-handler 'directory-file-name args)) (defun ange-ftp-real-expand-file-name (&rest args) (ange-ftp-run-real-handler 'expand-file-name args)) +(defun ange-ftp-real-substitute-in-file-name (&rest args) + (ange-ftp-run-real-handler 'substitute-in-file-name args)) (defun ange-ftp-real-make-directory (&rest args) (ange-ftp-run-real-handler 'make-directory args)) (defun ange-ftp-real-delete-directory (&rest args) @@ -4507,6 +4552,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (ange-ftp-run-real-handler 'write-region args)) (defun ange-ftp-real-backup-buffer (&rest args) (ange-ftp-run-real-handler 'backup-buffer args)) +(defun ange-ftp-real-copy-directory (&rest args) + (ange-ftp-run-real-handler 'copy-directory args)) (defun ange-ftp-real-copy-file (&rest args) (ange-ftp-run-real-handler 'copy-file args)) (defun ange-ftp-real-rename-file (&rest args) @@ -4552,6 +4599,8 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") ;; because some FTP servers react to "ls foo" by listing the symlink foo ;; rather than the directory it points to. Now that ange-ftp-ls uses ;; "cd foo; ls" instead, this is not necessary any more. + ;; SWITCHES cannot be nil or the empty string. + (unless switches (setq switches "--")) (let ((beg (point)) (end (point-marker))) (set-marker-insertion-type end t) @@ -4693,6 +4742,33 @@ NEWNAME should be the name to give the new compressed or uncompressed file.") (defun ange-ftp-set-file-modes (filename mode) (ange-ftp-call-chmod (list (format "%o" mode) filename))) + +(defun ange-ftp-make-symbolic-link (&rest _arguments) + (signal 'file-error (list "make-symbolic-link not supported"))) + +(defun ange-ftp-add-name-to-file + (filename newname &optional ok-if-already-exists) + (let ((f-parsed (ange-ftp-ftp-name filename)) + (n-parsed (ange-ftp-ftp-name newname))) + (unless (and (string-equal (nth 0 f-parsed) (nth 0 n-parsed)) + (string-equal (nth 1 f-parsed) (nth 1 n-parsed))) + (signal + 'file-error + (list "add-name-to-file: only implemented for same user, same host"))) + ;; Do the 'confirm if exists' thing. + (when (file-exists-p newname) + ;; What to do? + (if (or (null ok-if-already-exists) ; not allowed to exist + (and (numberp ok-if-already-exists) + (not (yes-or-no-p + (format + "File %s already exists; make it a link anyway? " + (nth 2 n-parsed)))))) + (signal 'file-already-exists (list newname)) + (delete-file newname))) + (copy-file + filename newname 'ok-if-already-exists 'keep-time + 'preserve-uid-gid 'preserve-permissions))) ;; This is turned off because it has nothing properly to do ;; with dired. It could be reasonable to adapt this to diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 9b73f7ca28..271ac7299d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -57,6 +57,7 @@ (declare-function tramp-method-out-of-band-p "tramp-sh") (declare-function tramp-smb-get-localname "tramp-smb") (declare-function tramp-time-diff "tramp") +(defvar ange-ftp-make-backup-files) (defvar auto-save-file-name-transforms) (defvar tramp-connection-properties) (defvar tramp-copy-size-limit) @@ -264,7 +265,7 @@ properly. BODY shall not contain a timeout." ;; No newline or linefeed. (should-not (tramp-tramp-file-p "/method::file\nname")) (should-not (tramp-tramp-file-p "/method::file\rname")) - ;; Ange-ftp syntax. + ;; Ange-FTP syntax. (should-not (tramp-tramp-file-p "/host:")) (should-not (tramp-tramp-file-p "/user@host:")) (should-not (tramp-tramp-file-p "/1.2.3.4:")) @@ -398,7 +399,7 @@ properly. BODY shall not contain a timeout." ;; No strings. (should-not (tramp-tramp-file-p nil)) (should-not (tramp-tramp-file-p 'symbol)) - ;; Ange-ftp syntax. + ;; Ange-FTP syntax. (should-not (tramp-tramp-file-p "/host:")) (should-not (tramp-tramp-file-p "/user@host:")) (should-not (tramp-tramp-file-p "/1.2.3.4:")) @@ -2065,7 +2066,8 @@ properly. BODY shall not contain a timeout." (skip-unless (tramp--test-enabled)) ;; These are the methods the test doesn't fail. - (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) (tramp--test-rclone-p) + (when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p) + (tramp--test-rclone-p) (tramp-smb-file-name-p tramp-test-temporary-file-directory)) (setf (ert-test-expected-result-type (ert-get-test 'tramp-test05-expand-file-name-relative)) @@ -2150,7 +2152,7 @@ This checks also `file-name-as-directory', `file-name-directory', (string-equal (file-name-as-directory file) (if (tramp-completion-mode-p) - file (concat file "./")))) + file (concat file (if (tramp--test-ange-ftp-p) "/" "./"))))) (should (string-equal (file-name-directory file) file)) (should (string-equal (file-name-nondirectory file) ""))))))) @@ -2255,18 +2257,19 @@ This checks also `file-name-as-directory', `file-name-directory', (should (string-equal (buffer-string) "foo"))) ;; Append. - (with-temp-buffer - (insert "bla") - (write-region nil nil tmp-name 'append)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foobla"))) - (with-temp-buffer - (insert "baz") - (write-region nil nil tmp-name 3)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foobaz"))) + (unless (tramp--test-ange-ftp-p) + (with-temp-buffer + (insert "bla") + (write-region nil nil tmp-name 'append)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foobla"))) + (with-temp-buffer + (insert "baz") + (write-region nil nil tmp-name 3)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foobaz")))) ;; Write string. (write-region "foo" nil tmp-name) @@ -2286,7 +2289,8 @@ This checks also `file-name-as-directory', `file-name-directory', ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1. (with-no-warnings (when (symbol-plist 'ert-with-message-capture) (let ((tramp-message-show-message t)) - (dolist (noninteractive '(nil t)) + (dolist + (noninteractive (unless (tramp--test-ange-ftp-p) '(nil t))) (dolist (visit '(nil t "string" no-message)) (ert-with-message-capture tramp--test-messages (write-region "foo" nil tmp-name nil visit) @@ -2300,12 +2304,16 @@ This checks also `file-name-as-directory', `file-name-directory', tramp--test-messages)))))))) ;; Do not overwrite if excluded. - (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t))) + (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t)) + ;; Ange-FTP. + ((symbol-function 'yes-or-no-p) (lambda (_prompt) t))) (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) ;; `mustbenew' is passed to Tramp since Emacs 26.1. (when (tramp--test-emacs26-p) (should-error - (cl-letf (((symbol-function 'y-or-n-p) 'ignore)) + (cl-letf (((symbol-function 'y-or-n-p) 'ignore) + ;; Ange-FTP. + ((symbol-function 'yes-or-no-p) 'ignore)) (write-region "foo" nil tmp-name nil nil nil 'mustbenew)) :type 'file-already-exists) (should-error @@ -2394,7 +2402,7 @@ This checks also `file-name-as-directory', `file-name-directory', (unwind-protect ;; FIXME: This fails on my QNAP server, see ;; /share/Web/owncloud/data/owncloud.log - (unless (tramp--test-nextcloud-p) + (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) (write-region "foo" nil source) (should (file-exists-p source)) (make-directory target) @@ -2420,7 +2428,7 @@ This checks also `file-name-as-directory', `file-name-directory', (unwind-protect ;; FIXME: This fails on my QNAP server, see ;; /share/Web/owncloud/data/owncloud.log - (unless (tramp--test-nextcloud-p) + (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) (make-directory source) (should (file-directory-p source)) (write-region "foo" nil (expand-file-name "foo" source)) @@ -2443,7 +2451,7 @@ This checks also `file-name-as-directory', `file-name-directory', (unwind-protect ;; FIXME: This fails on my QNAP server, see ;; /share/Web/owncloud/data/owncloud.log - (unless (tramp--test-nextcloud-p) + (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) (make-directory source) (should (file-directory-p source)) (write-region "foo" nil (expand-file-name "foo" source)) @@ -2538,7 +2546,7 @@ This checks also `file-name-as-directory', `file-name-directory', (unwind-protect ;; FIXME: This fails on my QNAP server, see ;; /share/Web/owncloud/data/owncloud.log - (unless (tramp--test-nextcloud-p) + (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) (make-directory source) (should (file-directory-p source)) (write-region "foo" nil (expand-file-name "foo" source)) @@ -2562,7 +2570,7 @@ This checks also `file-name-as-directory', `file-name-directory', (unwind-protect ;; FIXME: This fails on my QNAP server, see ;; /share/Web/owncloud/data/owncloud.log - (unless (tramp--test-nextcloud-p) + (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p)) (make-directory source) (should (file-directory-p source)) (write-region "foo" nil (expand-file-name "foo" source)) @@ -2810,6 +2818,10 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (ert-deftest tramp-test17-insert-directory () "Check `insert-directory'." (skip-unless (tramp--test-enabled)) + ;; Ange-FTP is very special. It does not include the header line + ;; (this is performed by `dired'). If FULL is nil, it shows just + ;; one file. So we refrain from testing. + (skip-unless (not (tramp--test-ange-ftp-p))) (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) (let* ((tmp-name1 @@ -3928,9 +3940,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should (equal (file-name-completion "foo" tmp-name) t)) (should (equal (file-name-completion "b" tmp-name) "bo")) (should-not (file-name-completion "a" tmp-name)) - (should - (equal - (file-name-completion "b" tmp-name #'file-directory-p) "boz/")) + ;; Ange-FTP does not support predicates. + (unless (tramp--test-ange-ftp-p) + (should + (equal + (file-name-completion "b" tmp-name #'file-directory-p) + "boz/"))) (should (equal (file-name-all-completions "fo" tmp-name) '("foo"))) (should @@ -3940,14 +3955,17 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (should-not (file-name-all-completions "a" tmp-name)) ;; `completion-regexp-list' restricts the completion to ;; files which match all expressions in this list. - (let ((completion-regexp-list - `(,directory-files-no-dot-files-regexp "b"))) - (should - (equal (file-name-completion "" tmp-name) "bo")) - (should - (equal - (sort (file-name-all-completions "" tmp-name) #'string-lessp) - '("bold" "boz/")))) + ;; Ange-FTP does not complete "". + (unless (tramp--test-ange-ftp-p) + (let ((completion-regexp-list + `(,directory-files-no-dot-files-regexp "b"))) + (should + (equal (file-name-completion "" tmp-name) "bo")) + (should + (equal + (sort + (file-name-all-completions "" tmp-name) #'string-lessp) + '("bold" "boz/"))))) ;; `file-name-completion' ignores file names that end in ;; any string in `completion-ignored-extensions'. (let ((completion-ignored-extensions '(".ext"))) @@ -4881,49 +4899,52 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." tramp-test-temporary-file-directory)))))) ;; Use default `tramp-auto-save-directory' mechanism. - (let ((tramp-auto-save-directory tmp-name2)) - (with-temp-buffer - (setq buffer-file-name tmp-name1) - (should - (string-equal - (make-auto-save-file-name) - ;; This is taken from Tramp. - (expand-file-name - (format - "#%s#" - (tramp-subst-strs-in-string - '(("_" . "|") - ("/" . "_a") - (":" . "_b") - ("|" . "__") - ("[" . "_l") - ("]" . "_r")) - (tramp-compat-file-name-unquote tmp-name1))) - tmp-name2))) - (should (file-directory-p tmp-name2)))) - - ;; Relative file names shall work, too. - (let ((tramp-auto-save-directory ".")) - (with-temp-buffer - (setq buffer-file-name tmp-name1 - default-directory tmp-name2) - (should - (string-equal - (make-auto-save-file-name) - ;; This is taken from Tramp. - (expand-file-name - (format - "#%s#" - (tramp-subst-strs-in-string - '(("_" . "|") - ("/" . "_a") - (":" . "_b") - ("|" . "__") - ("[" . "_l") - ("]" . "_r")) - (tramp-compat-file-name-unquote tmp-name1))) - tmp-name2))) - (should (file-directory-p tmp-name2))))) + ;; Ange-FTP doesn't care. + (unless (tramp--test-ange-ftp-p) + (let ((tramp-auto-save-directory tmp-name2)) + (with-temp-buffer + (setq buffer-file-name tmp-name1) + (should + (string-equal + (make-auto-save-file-name) + ;; This is taken from Tramp. + (expand-file-name + (format + "#%s#" + (tramp-subst-strs-in-string + '(("_" . "|") + ("/" . "_a") + (":" . "_b") + ("|" . "__") + ("[" . "_l") + ("]" . "_r")) + (tramp-compat-file-name-unquote tmp-name1))) + tmp-name2))) + (should (file-directory-p tmp-name2))))) + + ;; Relative file names shall work, too. Ange-FTP doesn't care. + (unless (tramp--test-ange-ftp-p) + (let ((tramp-auto-save-directory ".")) + (with-temp-buffer + (setq buffer-file-name tmp-name1 + default-directory tmp-name2) + (should + (string-equal + (make-auto-save-file-name) + ;; This is taken from Tramp. + (expand-file-name + (format + "#%s#" + (tramp-subst-strs-in-string + '(("_" . "|") + ("/" . "_a") + (":" . "_b") + ("|" . "__") + ("[" . "_l") + ("]" . "_r")) + (tramp-compat-file-name-unquote tmp-name1))) + tmp-name2))) + (should (file-directory-p tmp-name2)))))) ;; Cleanup. (ignore-errors (delete-file tmp-name1)) @@ -4936,6 +4957,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (ange-ftp-make-backup-files t) ;; These settings are not used by Tramp, so we ignore them. version-control delete-old-versions (kept-old-versions (default-toplevel-value 'kept-old-versions)) @@ -4983,58 +5005,61 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ignore-errors (delete-directory tmp-name2 'recursive))) (unwind-protect - ;; Map `tramp-backup-directory-alist'. - (let ((tramp-backup-directory-alist `(("." . ,tmp-name2))) - backup-directory-alist) - (should - (equal - (find-backup-file-name tmp-name1) - (list - (funcall - (if quoted #'tramp-compat-file-name-quote #'identity) - (expand-file-name - (format - "%s~" - ;; This is taken from `make-backup-file-name-1'. We - ;; call `convert-standard-filename', because on MS - ;; Windows the (local) colons must be replaced by - ;; exclamation marks. - (subst-char-in-string - ?/ ?! - (replace-regexp-in-string - "!" "!!" (convert-standard-filename tmp-name1)))) - tmp-name2))))) - ;; The backup directory is created. - (should (file-directory-p tmp-name2))) + ;; Map `tramp-backup-directory-alist'. Ange-FTP doesn't care. + (unless (tramp--test-ange-ftp-p) + (let ((tramp-backup-directory-alist `(("." . ,tmp-name2))) + backup-directory-alist) + (should + (equal + (find-backup-file-name tmp-name1) + (list + (funcall + (if quoted #'tramp-compat-file-name-quote #'identity) + (expand-file-name + (format + "%s~" + ;; This is taken from `make-backup-file-name-1'. + ;; We call `convert-standard-filename', because on + ;; MS Windows the (local) colons must be replaced + ;; by exclamation marks. + (subst-char-in-string + ?/ ?! + (replace-regexp-in-string + "!" "!!" (convert-standard-filename tmp-name1)))) + tmp-name2))))) + ;; The backup directory is created. + (should (file-directory-p tmp-name2)))) ;; Cleanup. (ignore-errors (delete-directory tmp-name2 'recursive))) (unwind-protect ;; Map `tramp-backup-directory-alist' with local file name. - (let ((tramp-backup-directory-alist - `(("." . ,(file-remote-p tmp-name2 'localname)))) - backup-directory-alist) - (should - (equal - (find-backup-file-name tmp-name1) - (list - (funcall - (if quoted #'tramp-compat-file-name-quote #'identity) - (expand-file-name - (format - "%s~" - ;; This is taken from `make-backup-file-name-1'. We - ;; call `convert-standard-filename', because on MS - ;; Windows the (local) colons must be replaced by - ;; exclamation marks. - (subst-char-in-string - ?/ ?! - (replace-regexp-in-string - "!" "!!" (convert-standard-filename tmp-name1)))) - tmp-name2))))) - ;; The backup directory is created. - (should (file-directory-p tmp-name2))) + ;; Ange-FTP doesn't care. + (unless (tramp--test-ange-ftp-p) + (let ((tramp-backup-directory-alist + `(("." . ,(file-remote-p tmp-name2 'localname)))) + backup-directory-alist) + (should + (equal + (find-backup-file-name tmp-name1) + (list + (funcall + (if quoted #'tramp-compat-file-name-quote #'identity) + (expand-file-name + (format + "%s~" + ;; This is taken from `make-backup-file-name-1'. + ;; We call `convert-standard-filename', because on + ;; MS Windows the (local) colons must be replaced + ;; by exclamation marks. + (subst-char-in-string + ?/ ?! + (replace-regexp-in-string + "!" "!!" (convert-standard-filename tmp-name1)))) + tmp-name2))))) + ;; The backup directory is created. + (should (file-directory-p tmp-name2)))) ;; Cleanup. (ignore-errors (delete-directory tmp-name2 'recursive)))))) @@ -5043,6 +5068,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ert-deftest tramp-test39-make-nearby-temp-file () "Check `make-nearby-temp-file' and `temporary-file-directory'." (skip-unless (tramp--test-enabled)) + (skip-unless (not (tramp--test-ange-ftp-p))) ;; Since Emacs 26.1. (skip-unless (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) @@ -5099,6 +5125,12 @@ variables, so we check the Emacs version directly." This requires restrictions of file name syntax." (tramp-adb-file-name-p tramp-test-temporary-file-directory)) +(defun tramp--test-ange-ftp-p () + "Check, whether Ange-FTP is used." + (eq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + 'tramp-ftp-file-name-handler)) + (defun tramp--test-docker-p () "Check, whether the docker method is used. This does not support some special file names." @@ -5373,7 +5405,8 @@ This requires restrictions of file name syntax." ;; expanded to . (let ((files (list - (if (or (tramp--test-gvfs-p) + (if (or (tramp--test-ange-ftp-p) + (tramp--test-gvfs-p) (tramp--test-rclone-p) (tramp--test-sudoedit-p) (tramp--test-windows-nt-or-smb-p)) commit ddb797cf4c5f121a5ed003b9746ffaa849d42af5 Author: Stefan Kangas Date: Thu Nov 7 04:10:43 2019 +0100 Clean up major mode check in package-menu-mode * lisp/emacs-lisp/package.el (package--ensure-package-menu-mode): Extract function to warn about incorrect major mode... (package-menu-toggle-hiding, package-menu-refresh) (package-menu-execute): ...from here. (package-menu--mark-upgrades-1): And here, but move call... (package-menu-mark-upgrades): ...here instead. (package-menu-hide-package, package-menu-mark-delete) (package-menu-mark-install, package-menu-mark-unmark) (package-menu-quick-help, package-menu-get-status) (package-menu-filter-by-keyword, package-menu-filter-by-name) (package-menu-clear-filter): Add call to new function. (Bug#37891) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 9f8ee8368e..6b75ecf783 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2791,6 +2791,11 @@ package PKG-DESC, add one. The alist is keyed with PKG-DESC." (defvar package--emacs-version-list (version-to-list emacs-version) "The value of variable `emacs-version' as a list.") +(defun package--ensure-package-menu-mode () + "Signal a user-error if major mode is not `package-menu-mode'." + (unless (derived-mode-p 'package-menu-mode) + (user-error "The current buffer is not a Package Menu"))) + (defun package--incompatible-p (pkg &optional shallow) "Return non-nil if PKG has no chance of being installable. PKG is a `package-desc' object. @@ -2866,8 +2871,7 @@ Installed obsolete packages are always displayed.") (defun package-menu-toggle-hiding () "In Package Menu, toggle visibility of obsolete available packages." (interactive) - (unless (derived-mode-p 'package-menu-mode) - (user-error "The current buffer is not a Package Menu")) + (package--ensure-package-menu-mode) (setq package-menu--hide-packages (not package-menu--hide-packages)) (if package-menu--hide-packages @@ -3175,8 +3179,7 @@ user-error if there is already a refresh running asynchronously. `package-menu-mode' sets `revert-buffer-function' to this function. The args ARG and NOCONFIRM, passed from `revert-buffer', are ignored." - (unless (derived-mode-p 'package-menu-mode) - (user-error "The current buffer is not a Package Menu")) + (package--ensure-package-menu-mode) (when (and package-menu-async package--downloads-in-progress) (user-error "Package refresh is already in progress, please wait...")) (setq package-menu--old-archive-contents package-archive-contents) @@ -3188,6 +3191,7 @@ function. The args ARG and NOCONFIRM, passed from "Hide a package under point in Package Menu. If optional arg BUTTON is non-nil, describe its associated package." (interactive) + (package--ensure-package-menu-mode) (declare (interactive-only "change `package-hidden-regexps' instead.")) (let* ((name (when (derived-mode-p 'package-menu-mode) (concat "\\`" (regexp-quote (symbol-name (package-desc-name @@ -3221,6 +3225,7 @@ If optional arg BUTTON is non-nil, describe its associated package." (defun package-menu-mark-delete (&optional _num) "Mark a package for deletion and move to the next line." (interactive "p") + (package--ensure-package-menu-mode) (if (member (package-menu-get-status) '("installed" "dependency" "obsolete" "unsigned")) (tabulated-list-put-tag "D" t) @@ -3229,6 +3234,7 @@ If optional arg BUTTON is non-nil, describe its associated package." (defun package-menu-mark-install (&optional _num) "Mark a package for installation and move to the next line." (interactive "p") + (package--ensure-package-menu-mode) (if (member (package-menu-get-status) '("available" "avail-obso" "new" "dependency")) (tabulated-list-put-tag "I" t) (forward-line))) @@ -3236,17 +3242,20 @@ If optional arg BUTTON is non-nil, describe its associated package." (defun package-menu-mark-unmark (&optional _num) "Clear any marks on a package and move to the next line." (interactive "p") + (package--ensure-package-menu-mode) (tabulated-list-put-tag " " t)) (defun package-menu-backup-unmark () "Back up one line and clear any marks on that package." (interactive) + (package--ensure-package-menu-mode) (forward-line -1) (tabulated-list-put-tag " ")) (defun package-menu-mark-obsolete-for-deletion () "Mark all obsolete packages for deletion." (interactive) + (package--ensure-package-menu-mode) (save-excursion (goto-char (point-min)) (while (not (eobp)) @@ -3277,6 +3286,7 @@ If optional arg BUTTON is non-nil, describe its associated package." "Show short key binding help for `package-menu-mode'. The full list of keys can be viewed with \\[describe-mode]." (interactive) + (package--ensure-package-menu-mode) (message (mapconcat #'package--prettify-quick-help-key package--quick-help-keys "\n"))) @@ -3285,6 +3295,7 @@ The full list of keys can be viewed with \\[describe-mode]." (defun package-menu-get-status () "Return status text of package at point in Package Menu." + (package--ensure-package-menu-mode) (let* ((id (tabulated-list-get-id)) (entry (and id (assoc id tabulated-list-entries)))) (if entry @@ -3340,8 +3351,6 @@ corresponding to the newer version." (defun package-menu--mark-upgrades-1 () "Mark all upgradable packages in the Package Menu. Implementation of `package-menu-mark-upgrades'." - (unless (derived-mode-p 'package-menu-mode) - (error "The current buffer is not a Package Menu")) (setq package-menu--mark-upgrades-pending nil) (let ((upgrades (package-menu--find-upgrades))) (if (null upgrades) @@ -3373,6 +3382,7 @@ If there's an async refresh operation in progress, the flags will be placed as part of `package-menu--post-refresh' instead of immediately." (interactive) + (package--ensure-package-menu-mode) (if (not package--downloads-in-progress) (package-menu--mark-upgrades-1) (setq package-menu--mark-upgrades-pending t) @@ -3466,8 +3476,7 @@ Packages marked for installation are downloaded and installed; packages marked for deletion are removed. Optional argument NOQUERY non-nil means do not ask the user to confirm." (interactive) - (unless (derived-mode-p 'package-menu-mode) - (error "The current buffer is not in Package Menu mode")) + (package--ensure-package-menu-mode) (let (install-list delete-list cmd pkg-desc) (save-excursion (goto-char (point-min)) @@ -3693,6 +3702,7 @@ Statuses available include \"incompat\", \"available\", (interactive (list (completing-read-multiple "Keywords (comma separated): " (package-all-keywords)))) + (package--ensure-package-menu-mode) (package-show-package-list t (if (stringp keyword) (list keyword) keyword))) @@ -3702,6 +3712,7 @@ Statuses available include \"incompat\", \"available\", Show only those items whose name matches the regular expression NAME. If NAME is nil or the empty string, show all packages." (interactive (list (read-from-minibuffer "Filter by name (regexp): "))) + (package--ensure-package-menu-mode) (if (or (not name) (string-empty-p name)) (package-show-package-list t nil) ;; Update `tabulated-list-entries' so that it contains all @@ -3719,6 +3730,7 @@ NAME. If NAME is nil or the empty string, show all packages." (defun package-menu-clear-filter () "Clear any filter currently applied to the \"*Packages*\" buffer." (interactive) + (package--ensure-package-menu-mode) (package-menu--generate t t)) (defun package-list-packages-no-fetch () commit 1428dfe630ceccd3bec13a3f7f44ee67af88b99f Author: Stefan Kangas Date: Thu Nov 7 01:42:31 2019 +0100 Test that comint-password-prompt-regexp matches "git push" * test/lisp/comint-tests.el (comint-testsuite-password-strings): Test that 'comint-password-prompt-regexp' matches 'git push' output. (Bug#20910) diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 068fec8995..213a5c7c9e 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -29,6 +29,7 @@ (defvar comint-testsuite-password-strings '("foo@example.net's password: " ; ssh "Password for foo@example.org: " ; kinit + "Password for 'https://foo@example.org':" ; git push Bug#20910 "Please enter the password for foo@example.org: " ; kinit "Kerberos password for devnull/root GNU.ORG: " ; ksu "Enter passphrase: " ; ssh-add commit deb61da7a27698ddc0b95ba92d18c20f533bb802 Author: Juri Linkov Date: Thu Nov 7 01:14:58 2019 +0200 * lisp/dired-aux.el (dired-vc-rename-file): New defcustom. (dired-rename-file): Call vc-rename-file when dired-vc-rename-file is non-nil. * lisp/vc/vc.el (vc-rename-file): Allow renaming added files. Call vc-file-clearprops on new file too for the case when old and new files were renamed to each other back and forth. https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00069.html diff --git a/etc/NEWS b/etc/NEWS index 737053a099..4d5d9f2a7d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -846,6 +846,9 @@ directories in the destination. *** The non-nil value of 'dired-dwim-target' uses one of the most recently visited windows with a Dired buffer instead of the next window. +*** When the new user option 'dired-vc-rename-file' is non-nil, +Dired performs file renaming using underlying version control system. + ** Find-Dired *** New user option 'find-dired-refine-function'. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index b1521ecf01..722d036e3f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1635,11 +1635,26 @@ If `ask', ask for user confirmation." dired-create-files-failures) (dired-log "Can't set date on %s:\n%s\n" from err)))))) +(defcustom dired-vc-rename-file nil + "Whether Dired should register file renaming in underlying vc system. +If nil, use default `rename-file'. +If non-nil and the renamed files are under version control, +rename them using `vc-rename-file'." + :type '(choice (const :tag "Use rename-file" nil) + (const :tag "Use vc-rename-file" t)) + :group 'dired + :version "27.1") + ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists) (dired-handle-overwrite newname) (dired-maybe-create-dirs (file-name-directory newname)) - (rename-file file newname ok-if-already-exists) ; error is caught in -create-files + (if (and dired-vc-rename-file + (vc-backend file) + (ignore-errors (vc-responsible-backend newname))) + (vc-rename-file file newname) + ;; error is caught in -create-files + (rename-file file newname ok-if-already-exists)) ;; Silently rename the visited file of any buffer visiting this file. (and (get-file-buffer file) (with-current-buffer (get-file-buffer file) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c982b0220e..20056dec7f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2913,11 +2913,12 @@ current buffer's file name if it's under version control." (when (file-exists-p new) (error "New file already exists")) (let ((state (vc-state old))) - (unless (memq state '(up-to-date edited)) + (unless (memq state '(up-to-date edited added)) (error "Please %s files before moving them" (if (stringp state) "check in" "update")))) (vc-call rename-file old new) (vc-file-clearprops old) + (vc-file-clearprops new) ;; Move the actual file (unless the backend did it already) (when (file-exists-p old) (rename-file old new)) ;; ?? Renaming a file might change its contents due to keyword expansion. commit 528485d0172f00e5f0c8ea548013a49964be501b Author: Juri Linkov Date: Thu Nov 7 01:01:12 2019 +0200 * lisp/tab-bar.el (tab-bar-history-old): Rename from tab-bar-history-current. (tab-bar-history-old-minibuffer-depth): Rename from tab-bar-history--minibuffer-depth. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 8777e20807..e915930c27 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -923,27 +923,27 @@ function `tab-bar-tab-name-function'." (defvar tab-bar-history-forward (make-hash-table) "History of forward changes in every tab per frame.") -(defvar tab-bar-history-current nil +(defvar tab-bar-history-old nil "Window configuration before the current command.") -(defvar tab-bar-history--minibuffer-depth 0 +(defvar tab-bar-history-old-minibuffer-depth 0 "Minibuffer depth before the current command.") (defun tab-bar-history--pre-change () - (setq tab-bar-history--minibuffer-depth (minibuffer-depth)) + (setq tab-bar-history-old-minibuffer-depth (minibuffer-depth)) ;; Store wc before possibly entering the minibuffer - (when (zerop tab-bar-history--minibuffer-depth) - (setq tab-bar-history-current + (when (zerop tab-bar-history-old-minibuffer-depth) + (setq tab-bar-history-old `((wc . ,(current-window-configuration)) (wc-point . ,(point-marker)))))) (defun tab-bar--history-change () (when (and (not tab-bar-history-omit) - tab-bar-history-current + tab-bar-history-old ;; Store wc before possibly entering the minibuffer - (zerop tab-bar-history--minibuffer-depth)) + (zerop tab-bar-history-old-minibuffer-depth)) (puthash (selected-frame) - (seq-take (cons tab-bar-history-current + (seq-take (cons tab-bar-history-old (gethash (selected-frame) tab-bar-history-back)) tab-bar-history-limit) tab-bar-history-back)) @@ -959,7 +959,7 @@ function `tab-bar-tab-name-function'." (if (window-configuration-p wc) (progn (puthash (selected-frame) - (cons tab-bar-history-current + (cons tab-bar-history-old (gethash (selected-frame) tab-bar-history-forward)) tab-bar-history-forward) (set-window-configuration wc) @@ -976,7 +976,7 @@ function `tab-bar-tab-name-function'." (if (window-configuration-p wc) (progn (puthash (selected-frame) - (cons tab-bar-history-current + (cons tab-bar-history-old (gethash (selected-frame) tab-bar-history-back)) tab-bar-history-back) (set-window-configuration wc) commit f5f40af1daba7dd2b9a979cc6c414ee7b44a6d8c Author: Juri Linkov Date: Thu Nov 7 00:59:28 2019 +0200 * lisp/tab-line.el: More configurability for tab buffer groups. * lisp/tab-line.el (tab-line-tabs-buffer-group-function) (tab-line-tabs-buffer-group-sort-function) (tab-line-tabs-buffer-groups-sort-function): New defvars. (tab-line-tabs-buffer-group-name): Rename from tab-line-tabs-buffer-groups--name and use tab-line-tabs-buffer-group-function. (tab-line-tabs-buffer-groups): Use tab-line-tabs-buffer-groups-sort-function and tab-line-tabs-buffer-group-sort-function. (tab-line-new-tab): Let bind tab-line-tabs-buffer-groups to mouse-buffer-menu-mode-groups. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 95f26e20ac..bf090374fa 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -289,33 +289,44 @@ with the same major mode as the current buffer." (derived-mode-p mode))) (buffer-list))))) +(defvar tab-line-tabs-buffer-group-function nil + "Function to put a buffer to the group. +Takes a buffer as arg and should return a group name as string. +When the return value is nil, filter out the buffer.") + +(defvar tab-line-tabs-buffer-group-sort-function nil + "Function to sort buffers in group.") + +(defvar tab-line-tabs-buffer-groups-sort-function #'string< + "Function to sort group names.") + (defvar tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups "How to group various major modes together in the tab line. Each element has the form (REGEXP . GROUPNAME). If the major mode's name string matches REGEXP, use GROUPNAME instead.") -(defun tab-line-tabs-buffer-groups--name (&optional buffer) - (let* ((buffer (or buffer (current-buffer))) - (mode (with-current-buffer buffer - (format-mode-line mode-name)))) - (or (cdr (seq-find (lambda (group) - (string-match-p (car group) mode)) - tab-line-tabs-buffer-groups)) - mode))) +(defun tab-line-tabs-buffer-group-name (&optional buffer) + (if (functionp tab-line-tabs-buffer-group-function) + (funcall tab-line-tabs-buffer-group-function buffer) + (unless (= (elt (buffer-name buffer) 0) ?\s) + (let ((mode (if buffer (with-current-buffer buffer + (format-mode-line mode-name)) + (format-mode-line mode-name)))) + (or (cdr (seq-find (lambda (group) + (string-match-p (car group) mode)) + tab-line-tabs-buffer-groups)) + mode))))) (defun tab-line-tabs-buffer-groups () (if (window-parameter nil 'tab-line-groups) - (let* ((buffers (seq-filter (lambda (b) - (not (= (elt (buffer-name b) 0) ?\s))) - (buffer-list))) + (let* ((buffers (buffer-list)) (groups - (seq-sort #'string< - (seq-map #'car - (seq-group-by - (lambda (buffer) - (tab-line-tabs-buffer-groups--name - buffer)) - buffers)))) + (seq-sort tab-line-tabs-buffer-groups-sort-function + (delq nil (mapcar #'car (seq-group-by + (lambda (buffer) + (tab-line-tabs-buffer-group-name + buffer)) + buffers))))) (selected-group (window-parameter nil 'tab-line-group)) (tabs (mapcar (lambda (group) @@ -324,12 +335,13 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") (selected . ,(equal group selected-group)) (select . ,(lambda () (set-window-parameter nil 'tab-line-groups nil) - (set-window-parameter nil 'tab-line-group group))))) + (set-window-parameter nil 'tab-line-group group) + (set-window-parameter nil 'tab-line-hscroll nil))))) groups))) tabs) (let* ((window-parameter (window-parameter nil 'tab-line-group)) - (group-name (tab-line-tabs-buffer-groups--name)) + (group-name (tab-line-tabs-buffer-group-name)) (group (prog1 (or window-parameter group-name) (when (equal window-parameter group-name) (set-window-parameter nil 'tab-line-group nil)))) @@ -338,21 +350,26 @@ If the major mode's name string matches REGEXP, use GROUPNAME instead.") ;; Just to highlight the current group name (selected . t) (select . ,(lambda () - (set-window-parameter nil 'tab-line-groups t) - (set-window-parameter nil 'tab-line-group group))))) + (set-window-parameter nil 'tab-line-groups t) + (set-window-parameter nil 'tab-line-group group) + (set-window-parameter nil 'tab-line-hscroll nil))))) (buffers - (seq-sort-by #'buffer-name #'string< - (seq-filter (lambda (b) - (and (not (= (elt (buffer-name b) 0) ?\s)) - (equal (tab-line-tabs-buffer-groups--name b) - group))) - (buffer-list)))) + (seq-filter (lambda (b) + (equal (tab-line-tabs-buffer-group-name b) + group)) + (seq-uniq (append (list (current-buffer)) + (reverse (mapcar #'car (window-prev-buffers))) + (buffer-list))))) + (sorted-buffers (if (functionp tab-line-tabs-buffer-group-sort-function) + (seq-sort tab-line-tabs-buffer-group-sort-function + buffers) + buffers)) (tabs (mapcar (lambda (buffer) `(tab (name . ,(funcall tab-line-tab-name-function buffer)) (selected . ,(eq buffer (current-buffer))) (buffer . ,buffer))) - buffers))) + sorted-buffers))) (cons group-tab tabs)))) (defun tab-line-tabs-window-buffers () @@ -470,10 +487,11 @@ corresponding to the switched buffer." (interactive (list last-nonmenu-event)) (if (functionp tab-line-new-tab-choice) (funcall tab-line-new-tab-choice) - (if (and (listp mouse-event) window-system) ; (display-popup-menus-p) - (mouse-buffer-menu mouse-event) ; like (buffer-menu-open) - ;; tty menu doesn't support mouse clicks, so use tmm - (tmm-prompt (mouse-buffer-menu-keymap))))) + (let ((tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups)) + (if (and (listp mouse-event) window-system) ; (display-popup-menus-p) + (mouse-buffer-menu mouse-event) ; like (buffer-menu-open) + ;; tty menu doesn't support mouse clicks, so use tmm + (tmm-prompt (mouse-buffer-menu-keymap)))))) (defun tab-line-select-tab (&optional e) "Switch to the selected tab. commit b5bcc6f9ea23118f7d181c2dcdf17eb03b200be8 Author: Paul Eggert Date: Wed Nov 6 11:47:39 2019 -0800 Simplify fixnum division slightly * src/data.c (arith_driver): Streamline fixnum division a bit more, and add a comment about why overflow is impossible. This responds to a private comment by Stefan Monnier. diff --git a/src/data.c b/src/data.c index 955e507390..649dc174f9 100644 --- a/src/data.c +++ b/src/data.c @@ -2943,7 +2943,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, /* Set ACCUM to the next operation's result if it fits, else exit the loop. */ - bool overflow = false; + bool overflow; intmax_t a; switch (code) { @@ -2953,9 +2953,11 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, case Adiv: if (next == 0) xsignal0 (Qarith_error); - eassert (! INT_DIVIDE_OVERFLOW (accum, next)); - a = accum / next; - break; + /* This cannot overflow, as integer overflow can + occur only if the dividend is INTMAX_MIN, but + INTMAX_MIN < MOST_NEGATIVE_FIXNUM <= accum. */ + accum /= next; + continue; case Alogand: accum &= next; continue; case Alogior: accum |= next; continue; case Alogxor: accum ^= next; continue; commit 4ad6c932a826c2928ac82e56e5ae541eff7e5ca7 Author: Alan Mackenzie Date: Wed Nov 6 19:35:43 2019 +0000 Add a full set of CC Mode language variables to js.el. This will allow js.el to work after maintenance changes in CC Mode, e.g. the fix to bug #11165. * lisp/progmodes/js.el (top level): Create a CC Mode derived language called js-mode and based on Java Mode. (js-mode): call c-init-language-vars for js-mode. Remove the direct settings of several CC Mode language variables which are now defined through the derived language mechanism. Call c-set-style and set up the needed style variables c-block-comment-prefix and c-comment-prefix-regexp. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 599923dd27..5f0913470f 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -46,6 +46,9 @@ ;;; Code: (require 'cc-mode) +(eval-when-compile + (require 'cc-langs) + (require 'cc-fonts)) (require 'newcomment) (require 'imenu) (require 'moz nil t) @@ -4529,12 +4532,22 @@ This function is intended for use in `after-change-functions'." (when (js-jsx--detect-and-enable 'arbitrarily) (remove-hook 'after-change-functions #'js-jsx--detect-after-change t)))))) +;; Ensure all CC Mode "lang variables" are set to valid values. +;; js-mode, however, currently uses only those needed for filling. +(eval-and-compile + (c-add-language 'js-mode 'java-mode)) + +(c-lang-defconst c-paragraph-start + js-mode "\\(@[[:alpha:]]+\\>\\|$\\)") + ;;; Main Function ;;;###autoload (define-derived-mode js-mode prog-mode "JavaScript" "Major mode for editing JavaScript." :group 'js + ;; Ensure all CC Mode "lang variables" are set to valid values. + (c-init-language-vars js-mode) (setq-local indent-line-function #'js-indent-line) (setq-local beginning-of-defun-function #'js-beginning-of-defun) (setq-local end-of-defun-function #'js-end-of-defun) @@ -4576,16 +4589,9 @@ This function is intended for use in `after-change-functions'." (setq imenu-create-index-function #'js--imenu-create-index) ;; for filling, pretend we're cc-mode - (setq c-comment-prefix-regexp "//+\\|\\**" - c-paragraph-start "\\(@[[:alpha:]]+\\>\\|$\\)" - c-paragraph-separate "$" - c-block-comment-prefix "* " - c-line-comment-starter "//" - c-comment-start-regexp "/[*/]\\|\\s!") + (c-init-language-vars js-mode) (setq-local comment-line-break-function #'c-indent-new-comment-line) - (setq-local c-block-comment-start-regexp "/\\*") (setq-local comment-multi-line t) - (setq-local electric-indent-chars (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". (setq-local electric-layout-rules @@ -4599,6 +4605,13 @@ This function is intended for use in `after-change-functions'." (make-local-variable 'paragraph-ignore-fill-prefix) (make-local-variable 'adaptive-fill-mode) (make-local-variable 'adaptive-fill-regexp) + ;; While the full CC Mode style system is not yet in use, set the + ;; pertinent style variables manually. + (c-initialize-builtin-style) + (let ((style (cc-choose-style-for-mode 'js-mode c-default-style))) + (c-set-style style)) + (setq c-block-comment-prefix "* " + c-comment-prefix-regexp "//+\\|\\**") (c-setup-paragraph-variables)) ;; Important to fontify the whole buffer syntactically! If we don't, commit e72a48ee8b412e0149a9659f49111f84dd8aa2dc Author: Eli Zaretskii Date: Wed Nov 6 19:22:11 2019 +0200 Minor fix in the Emacs manual * doc/emacs/msdos.texi (ls in Lisp): Fix the description of 'ls-lisp-verbosity'. (Bug#38077) diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi index 55093a080a..95b3d132ca 100644 --- a/doc/emacs/msdos.texi +++ b/doc/emacs/msdos.texi @@ -389,15 +389,16 @@ non-@code{nil} value. @vindex ls-lisp-verbosity The variable @code{ls-lisp-verbosity} controls the file attributes -that @file{ls-lisp.el} displays. The value should be a list that -contains one or more of the symbols @code{links}, @code{uid}, and -@code{gid}. @code{links} means display the count of different file -names that are associated with (a.k.a.@: @dfn{links to}) the file's -data; this is only useful on NTFS volumes. @code{uid} means display -the numerical identifier of the user who owns the file. @code{gid} -means display the numerical identifier of the file owner's group. The -default value is @code{(links uid gid)} i.e., all the 3 optional -attributes are displayed. +that @file{ls-lisp.el} displays. The value should be either +@code{nil} or a list that contains one or more of the symbols +@code{links}, @code{uid}, and @code{gid}. @code{links} means display +the count of different file names that are associated with (a.k.a.@: +@dfn{links to}) the file's data; this is only useful on NTFS volumes. +@code{uid} means display the numerical identifier of the user who owns +the file. @code{gid} means display the numerical identifier of the +file owner's group. The default value is @code{(links uid gid)} i.e., +all the 3 optional attributes are displayed. The value @code{nil} +means not to display any of these attributes. @vindex ls-lisp-emulation The variable @code{ls-lisp-emulation} controls the flavor of the commit 9ce67baa9a3733ae93885b6242130497b13c8703 Author: Stephen Gildea Date: Wed Nov 6 08:31:48 2019 -0800 time-stamp: add support for time zone numeric offset * time-stamp.el: Implement %:z as expanding to the numeric time zone offset, to address the feature request of bug#32931. Do not document it yet, to discourage compatibility problems in mixed Emacs 26 and Emacs 27 environments. Documentation will be added in a subsequent release at least two years later. (We cannot yet use %z for numeric time zone because in Emacs 26 it was documented to do something else.) * time-stamp-tests.el (time-stamp-test-format-time-zone): expand this test and break it into two tests, time-stamp-test-format-time-zone-name and time-stamp-test-format-time-zone-offset. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 6b1ff3e618..55892cdb83 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -570,11 +570,13 @@ and all `time-stamp-format' compatibility." (string-to-number (time-stamp--format "%Y" time))))) ((eq cur-char ?Y) ;4-digit year (string-to-number (time-stamp--format "%Y" time))) - ((eq cur-char ?z) ;time zone lower case + ((eq cur-char ?z) ;time zone offset (if change-case "" ;discourage %z variations - (time-stamp--format "%#Z" time))) - ((eq cur-char ?Z) + (if alt-form + (time-stamp--format "%z" time) + (time-stamp--format "%#Z" time)))) ;backward compat, will change + ((eq cur-char ?Z) ;time zone name (if change-case (time-stamp--format "%#Z" time) (time-stamp--format "%Z" time))) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index ad2cb0ead7..77cd6c5b94 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -299,18 +299,33 @@ (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) -(ert-deftest time-stamp-test-format-time-zone () - "Test time-stamp formats for time zone." +(ert-deftest time-stamp-test-format-time-zone-name () + "Test time-stamp format %Z." (with-time-stamp-test-env (let ((UTC-abbr (format-time-string "%Z" ref-time1 t)) (utc-abbr (format-time-string "%#Z" ref-time1 t))) ;; implemented and documented since 1995 (should (equal (time-stamp-string "%Z" ref-time1) UTC-abbr)) - ;; documented 1995-2019 - (should (equal (time-stamp-string "%z" ref-time1) utc-abbr)) ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%#Z" ref-time1) utc-abbr))))) +(ert-deftest time-stamp-test-format-time-zone-offset () + "Test time-stamp format %z." + (with-time-stamp-test-env + ;; documented 1995-2019, will change + (should (equal (time-stamp-string "%z" ref-time1) + (format-time-string "%#Z" ref-time1 t))) + ;; undocumented, changed in 2019 + (should (equal (time-stamp-string "%:z" ref-time1) "+0000")) + (should (equal (time-stamp-string "%:7z" ref-time1) " +0000")) + (should (equal (time-stamp-string "%:07z" ref-time1) " +0000")) + (let ((time-stamp-time-zone "PST8")) + (should (equal (time-stamp-string "%:z" ref-time1) "-0800"))) + (let ((time-stamp-time-zone "HST10")) + (should (equal (time-stamp-string "%:z" ref-time1) "-1000"))) + (let ((time-stamp-time-zone "CET-1")) + (should (equal (time-stamp-string "%:z" ref-time1) "+0100"))))) + (ert-deftest time-stamp-test-format-non-date-conversions () "Test time-stamp formats for non-date items." (with-time-stamp-test-env commit da2df1c1b5b5a7373f361875b43dd003a221e2e0 Author: Michael Albinus Date: Wed Nov 6 16:49:35 2019 +0100 More error checks in Tramp's make-directory * lisp/net/tramp-adb.el (tramp-adb-handle-make-directory): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-make-directory): * lisp/net/tramp-sh.el (tramp-sh-handle-make-directory): * lisp/net/tramp-smb.el (tramp-smb-handle-make-directory): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-make-directory): Signal `file-already-exists' if DIR exists. * test/lisp/net/tramp-tests.el (tramp-test04-substitute-in-file-name): Fix thinko. (tramp-test13-make-directory, tramp-test14-delete-directory) (tramp-test15-copy-directory): Extend tests. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index a4f5760f72..cfbda0824e 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -514,6 +514,8 @@ Emacs dired can't find files." "Like `make-directory' for Tramp files." (setq dir (expand-file-name dir)) (with-parsed-tramp-file-name dir nil + (when (and (null parents) (file-exists-p dir)) + (tramp-error v 'file-already-exists "Directory already exists %s" dir)) (when parents (let ((par (expand-file-name ".." dir))) (unless (file-directory-p par) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index dbda24b9ac..f13564c544 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1310,6 +1310,8 @@ file-notify events." "Like `make-directory' for Tramp files." (setq dir (directory-file-name (expand-file-name dir))) (with-parsed-tramp-file-name dir nil + (when (and (null parents) (file-exists-p dir)) + (tramp-error v 'file-already-exists "Directory already exists %s" dir)) (tramp-flush-directory-properties v localname) (save-match-data (let ((ldir (file-name-directory dir))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index be531ed319..76bb10a277 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2513,6 +2513,8 @@ The method used must be an out-of-band method." "Like `make-directory' for Tramp files." (setq dir (expand-file-name dir)) (with-parsed-tramp-file-name dir nil + (when (and (null parents) (file-exists-p dir)) + (tramp-error v 'file-already-exists "Directory already exists %s" dir)) ;; When PARENTS is non-nil, DIR could be a chain of non-existent ;; directories a/b/c/... Instead of checking, we simply flush the ;; whole cache. diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index f87d4becfe..95cdb4cbff 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1139,6 +1139,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (unless (file-name-absolute-p dir) (setq dir (expand-file-name dir default-directory))) (with-parsed-tramp-file-name dir nil + (when (and (null parents) (file-exists-p dir)) + (tramp-error v 'file-already-exists "Directory already exists %s" dir)) (let* ((ldir (file-name-directory dir))) ;; Make missing directory parts. (when (and parents diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index e7a892c746..43ac6ff66b 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -587,6 +587,8 @@ the result will be a local, non-Tramp, file name." "Like `make-directory' for Tramp files." (setq dir (expand-file-name dir)) (with-parsed-tramp-file-name dir nil + (when (and (null parents) (file-exists-p dir)) + (tramp-error v 'file-already-exists "Directory already exists %s" dir)) ;; When PARENTS is non-nil, DIR could be a chain of non-existent ;; directories a/b/c/... Instead of checking, we simply flush the ;; whole cache. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index acb5a93687..09d125945a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3019,8 +3019,8 @@ User is always nil." (defun tramp-handle-copy-directory (directory newname &optional keep-date parents copy-contents) "Like `copy-directory' for Tramp files." - ;; `directory-files' creates `newname' before running this check. - ;; So we do it ourselves. + ;; `copy-directory' creates NEWNAME before running this check. So + ;; we do it ourselves. (unless (file-exists-p directory) (tramp-error (tramp-dissect-file-name directory) tramp-file-missing diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ec9cda0bbd..9b73f7ca28 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -1958,7 +1958,7 @@ properly. BODY shall not contain a timeout." ;; Forwhatever reasons, the following tests let Emacs crash for ;; Emacs 24 and Emacs 25, occasionally. No idea what's up. - (when (or (tramp--test-emacs26-p) (tramp--test-emacs27-p)) + (when (tramp--test-emacs26-p) (should (string-equal (substitute-in-file-name "/method:host://~foo") "/~foo")) (should @@ -2593,9 +2593,14 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (unwind-protect (progn (make-directory tmp-name1) + (should-error + (make-directory tmp-name1) + :type 'file-already-exists) (should (file-directory-p tmp-name1)) (should (file-accessible-directory-p tmp-name1)) - (should-error (make-directory tmp-name2) :type 'file-error) + (should-error + (make-directory tmp-name2) + :type 'file-error) (make-directory tmp-name2 'parents) (should (file-directory-p tmp-name2)) (should (file-accessible-directory-p tmp-name2)) @@ -2627,7 +2632,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (should (file-directory-p tmp-name2)) (write-region "foo" nil (expand-file-name "bla" tmp-name2)) (should (file-exists-p (expand-file-name "bla" tmp-name2))) - (should-error (delete-directory tmp-name1) :type 'file-error) + (should-error + (delete-directory tmp-name1) + :type 'file-error) (delete-directory tmp-name1 'recursive) (should-not (file-directory-p tmp-name1))))) @@ -2663,7 +2670,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (when (tramp--test-emacs26-p) (should-error (copy-directory tmp-name1 tmp-name2) - :type 'file-error)) + :type 'file-already-exists)) (copy-directory tmp-name1 (file-name-as-directory tmp-name2)) (should (file-directory-p tmp-name3)) (should (file-exists-p tmp-name6))) @@ -3523,7 +3530,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." :type 'file-error) (make-symbolic-link tmp-name1 tmp-name2) (should (file-symlink-p tmp-name2)) - (should-error (file-truename tmp-name1) :type 'file-error)))) + (should-error + (file-truename tmp-name1) + :type 'file-error)))) ;; Cleanup. (ignore-errors @@ -4276,7 +4285,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (while (accept-process-output proc nil nil 0))) (should-not (process-live-p proc)) ;; An interrupted process cannot be interrupted, again. - (should-error (interrupt-process proc) :type 'error)) + (should-error + (interrupt-process proc) + :type 'error)) ;; Cleanup. (ignore-errors (delete-process proc))))) commit d30f5e7eeecd5425e236542189a1d683c00e7ed7 Author: Stefan Kangas Date: Wed Nov 6 14:48:23 2019 +0100 Fix problem with my last commit in package.el * lisp/emacs-lisp/package.el (package-menu--refresh-archives): Rename from duplicated name package-menu--refresh. (Bug#38084) (package-menu-mode, list-packages): Use new name. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index b7a528dac4..9f8ee8368e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2767,7 +2767,7 @@ Letters do not insert themselves; instead, they are commands. (setq tabulated-list-sort-key (cons "Status" nil)) (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) (tabulated-list-init-header) - (setq revert-buffer-function 'package-menu--refresh) + (setq revert-buffer-function 'package-menu--refresh-contents) (setf imenu-prev-index-position-function #'package--imenu-prev-index-position-function) (setf imenu-extract-index-name-function @@ -3166,7 +3166,7 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." (defvar package-menu--old-archive-contents nil "`package-archive-contents' before the latest refresh.") -(defun package-menu--refresh (&optional _arg _noconfirm) +(defun package-menu--refresh-contents (&optional _arg _noconfirm) "In Package Menu, download the Emacs Lisp package archive. Fetch the contents of each archive specified in `package-archives', and then refresh the package menu. Signal a @@ -3646,7 +3646,7 @@ short description." (package-menu-mode) ;; Fetch the remote list of packages. - (unless no-fetch (package-menu--refresh)) + (unless no-fetch (package-menu--refresh-contents)) ;; If we're not async, this would be redundant. (when package-menu-async commit 2b1dc8c26e243d4eb9eeac0ddadd6b59d0b9f072 Author: Paul Eggert Date: Tue Nov 5 22:59:00 2019 -0800 Update from Gnulib This incorporates: 2019-10-24 timespec-add, timespec-sub: simplify * lib/timespec-add.c, lib/timespec-sub.c: Copy from Gnulib. diff --git a/lib/timespec-add.c b/lib/timespec-add.c index e0a9f12e14..abee154820 100644 --- a/lib/timespec-add.c +++ b/lib/timespec-add.c @@ -33,36 +33,30 @@ timespec_add (struct timespec a, struct timespec b) int ns = a.tv_nsec + b.tv_nsec; int nsd = ns - TIMESPEC_HZ; int rns = ns; - time_t tmin = TYPE_MINIMUM (time_t); - time_t tmax = TYPE_MAXIMUM (time_t); if (0 <= nsd) { rns = nsd; - if (bs < tmax) - bs++; + time_t bs1; + if (!INT_ADD_WRAPV (bs, 1, &bs1)) + bs = bs1; else if (rs < 0) rs++; else goto high_overflow; } - /* INT_ADD_WRAPV is not appropriate since time_t might be unsigned. - In theory time_t might be narrower than int, so plain - INT_ADD_OVERFLOW does not suffice. */ - if (! INT_ADD_OVERFLOW (rs, bs) && tmin <= rs + bs && rs + bs <= tmax) - rs += bs; - else + if (INT_ADD_WRAPV (rs, bs, &rs)) { - if (rs < 0) + if (bs < 0) { - rs = tmin; + rs = TYPE_MINIMUM (time_t); rns = 0; } else { high_overflow: - rs = tmax; + rs = TYPE_MAXIMUM (time_t); rns = TIMESPEC_HZ - 1; } } diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c index 48434e8150..77b9353df1 100644 --- a/lib/timespec-sub.c +++ b/lib/timespec-sub.c @@ -33,36 +33,30 @@ timespec_sub (struct timespec a, struct timespec b) time_t bs = b.tv_sec; int ns = a.tv_nsec - b.tv_nsec; int rns = ns; - time_t tmin = TYPE_MINIMUM (time_t); - time_t tmax = TYPE_MAXIMUM (time_t); if (ns < 0) { rns = ns + TIMESPEC_HZ; - if (bs < tmax) - bs++; + time_t bs1; + if (!INT_ADD_WRAPV (bs, 1, &bs1)) + bs = bs1; else if (- TYPE_SIGNED (time_t) < rs) rs--; else goto low_overflow; } - /* INT_SUBTRACT_WRAPV is not appropriate since time_t might be unsigned. - In theory time_t might be narrower than int, so plain - INT_SUBTRACT_OVERFLOW does not suffice. */ - if (! INT_SUBTRACT_OVERFLOW (rs, bs) && tmin <= rs - bs && rs - bs <= tmax) - rs -= bs; - else + if (INT_SUBTRACT_WRAPV (rs, bs, &rs)) { - if (rs < 0) + if (0 < bs) { low_overflow: - rs = tmin; + rs = TYPE_MINIMUM (time_t); rns = 0; } else { - rs = tmax; + rs = TYPE_MAXIMUM (time_t); rns = TIMESPEC_HZ - 1; } } commit 6039acb86113e21409dafe5ebf75d04fbe4577f6 Author: Paul Eggert Date: Tue Nov 5 22:55:23 2019 -0800 Remove unneeded overflow check in integer division * src/data.c (arith_driver): Remove unnecessary runtime test, since integer overflow is impossible on division of fixnums, given that the worst case is MOST_NEGATIVE_FIXNUM / -1 which is representable as an EMACS_INT (albeit not as a fixnum). diff --git a/src/data.c b/src/data.c index d968ac9e3a..955e507390 100644 --- a/src/data.c +++ b/src/data.c @@ -2944,7 +2944,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, /* Set ACCUM to the next operation's result if it fits, else exit the loop. */ bool overflow = false; - intmax_t a UNINIT; + intmax_t a; switch (code) { case Aadd : overflow = INT_ADD_WRAPV (accum, next, &a); break; @@ -2953,9 +2953,8 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args, case Adiv: if (next == 0) xsignal0 (Qarith_error); - overflow = INT_DIVIDE_OVERFLOW (accum, next); - if (!overflow) - a = accum / next; + eassert (! INT_DIVIDE_OVERFLOW (accum, next)); + a = accum / next; break; case Alogand: accum &= next; continue; case Alogior: accum |= next; continue; commit 0661a39d1b501a41e439df8c73f7b7f3bf3e3761 Author: Stefan Kangas Date: Wed Nov 6 01:19:23 2019 +0100 Avoid changing value of defcustom package-enable-at-startup * lisp/emacs-lisp/package.el (package--activated): New variable to avoid changing value of defcustom 'package-enable-at-startup'. (package-initialize): Don't set 'package-enable-at-startup'. (package-initialize, package-activate-all): Set 'package--activated' instead of 'package-enable-at-startup'. (package--initialized): Add doc string. * lisp/startup.el (command-line): Check if 'package--activated' is non-nil before activating packages. * doc/lispref/package.texi (Packaging Basics): Update docs. diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi index 57f4cbc5db..236855bdf8 100644 --- a/doc/lispref/package.texi +++ b/doc/lispref/package.texi @@ -117,10 +117,7 @@ init file. This function makes the packages available to the current session. The user option @code{package-load-list} specifies which packages to make available; by default, all installed packages are made available. -If called during startup, this function also sets -@code{package-enable-at-startup} to @code{nil}, to avoid accidentally -evaluating package autoloads more than once. @xref{Package -Installation,,, emacs, The GNU Emacs Manual}. +@xref{Package Installation,,, emacs, The GNU Emacs Manual}. In most cases, you should not need to call @code{package-activate-all}, as this is done automatically during startup. Simply make sure to put diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 3c14b50f3e..b7a528dac4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1543,20 +1543,24 @@ If successful, set or update `package-archive-contents'." (dolist (archive package-archives) (package-read-archive-contents (car archive)))) + ;;;; Package Initialize ;; A bit of a milestone. This brings together some of the above ;; sections and populates all relevant lists of packages from contents ;; available on disk. -(defvar package--initialized nil) + +(defvar package--initialized nil + "Non-nil if `package-initialize' has been run.") + +;;;###autoload +(defvar package--activated nil + "Non-nil if `package-activate-all' has been run.") ;;;###autoload (defun package-initialize (&optional no-activate) "Load Emacs Lisp packages, and activate them. The variable `package-load-list' controls which packages to load. If optional arg NO-ACTIVATE is non-nil, don't activate packages. -If called as part of loading `user-init-file', set -`package-enable-at-startup' to nil, to prevent accidentally -loading packages twice. It is not necessary to adjust `load-path' or `require' the individual packages after calling `package-initialize' -- this is @@ -1573,7 +1577,6 @@ that code in the early init-file." (lwarn '(package reinitialization) :warning "Unnecessary call to `package-initialize' in init file")) (setq package-alist nil) - (setq package-enable-at-startup nil) (package-load-all-descriptors) (package-read-all-archive-contents) (setq package--initialized t) @@ -1589,7 +1592,7 @@ that code in the early init-file." (defun package-activate-all () "Activate all installed packages. The variable `package-load-list' controls which packages to load." - (setq package-enable-at-startup nil) + (setq package--activated t) (if (file-readable-p package-quickstart-file) ;; Skip load-source-file-function which would slow us down by a factor ;; 2 (this assumes we were careful to save this file so it doesn't need diff --git a/lisp/startup.el b/lisp/startup.el index 30f1a253ee..651224fe6c 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1013,6 +1013,8 @@ the `--debug-init' option to view a complete error backtrace." (when debug-on-error-should-be-set (setq debug-on-error debug-on-error-from-init-file)))) +(defvar package--activated nil) + (defun command-line () "A subroutine of `normal-top-level'. Amongst another things, it parses the command-line arguments." @@ -1233,6 +1235,7 @@ please check its value") ;; If any package directory exists, initialize the package system. (and user-init-file package-enable-at-startup + (not package--activated) (catch 'package-dir-found (let (dirs) (if (boundp 'package-directory-list) commit 0c293f1520dd73203c03d7934ac21b2bae6eaf37 Author: Stefan Kangas Date: Wed Nov 6 00:58:57 2019 +0100 Make 'g' refresh package data in package menu * lisp/emacs-lisp/package.el (package-menu--refresh): Rename from 'package-menu-refresh', make internal and non-interactive. (package-menu-mode-map, package-menu-mode-menu, package-menu-mode) (list-packages): Use the above. (Bug#35504) (package-menu-refresh): Redefine as obsolete fuction alias for 'revert-buffer'. * doc/emacs/package.texi (Package Menu): Document it. * etc/NEWS: Announce it. diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index 19efff7445..1c0f853427 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -149,12 +149,13 @@ Download and install all packages marked with @kbd{i}, and their dependencies; also, delete all packages marked with @kbd{d} (@code{package-menu-execute}). This also removes the marks. +@item g @item r +@kindex g @r{(Package Menu)} @kindex r @r{(Package Menu)} -@findex package-menu-refresh -Refresh the package list (@code{package-menu-refresh}). This fetches -the list of available packages from the package archive again, and -recomputes the package list. +Refresh the package list (@code{revert-buffer}). This fetches the +list of available packages from the package archive again, and +redisplays the package list. @item / k @kindex / k @r{(Package Menu)} diff --git a/etc/NEWS b/etc/NEWS index 87aa5b5505..737053a099 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1152,6 +1152,14 @@ the 'package-menu-clear-filter' function, bound to '/ /' by default. --- *** The package list can now be sorted by version or description. ++++ +*** In Package Menu, 'g' now updates package data from archives. +Previously, 'g' invoked 'tabulated-list-revert' which did not update +the cached archive data. It is now bound to 'revert-buffer', which +will now update the data. + +'package-menu-refresh' is an obsolete alias for 'revert-buffer'. + ** Info +++ diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 80ffdc3019..3c14b50f3e 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2690,7 +2690,7 @@ either a full name or nil, and EMAIL is a valid email address." (define-key map "d" 'package-menu-mark-delete) (define-key map "i" 'package-menu-mark-install) (define-key map "U" 'package-menu-mark-upgrades) - (define-key map "r" 'package-menu-refresh) + (define-key map "r" 'revert-buffer) (define-key map (kbd "/ k") 'package-menu-filter-by-keyword) (define-key map (kbd "/ n") 'package-menu-filter-by-name) (define-key map (kbd "/ /") 'package-menu-clear-filter) @@ -2709,7 +2709,7 @@ either a full name or nil, and EMAIL is a valid email address." ["Describe Package" package-menu-describe-package :help "Display information about this package"] ["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"] "--" - ["Refresh Package List" package-menu-refresh + ["Refresh Package List" revert-buffer :help "Redownload the ELPA archive" :active (not package--downloads-in-progress)] ["Redisplay buffer" revert-buffer :help "Update the buffer with current list of packages"] @@ -2764,6 +2764,7 @@ Letters do not insert themselves; instead, they are commands. (setq tabulated-list-sort-key (cons "Status" nil)) (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) (tabulated-list-init-header) + (setq revert-buffer-function 'package-menu--refresh) (setf imenu-prev-index-position-function #'package--imenu-prev-index-position-function) (setf imenu-extract-index-name-function @@ -3162,12 +3163,15 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])." (defvar package-menu--old-archive-contents nil "`package-archive-contents' before the latest refresh.") -(defun package-menu-refresh () +(defun package-menu--refresh (&optional _arg _noconfirm) "In Package Menu, download the Emacs Lisp package archive. Fetch the contents of each archive specified in `package-archives', and then refresh the package menu. Signal a -user-error if there is already a refresh running asynchronously." - (interactive) +user-error if there is already a refresh running asynchronously. + +`package-menu-mode' sets `revert-buffer-function' to this +function. The args ARG and NOCONFIRM, passed from +`revert-buffer', are ignored." (unless (derived-mode-p 'package-menu-mode) (user-error "The current buffer is not a Package Menu")) (when (and package-menu-async package--downloads-in-progress) @@ -3175,6 +3179,7 @@ user-error if there is already a refresh running asynchronously." (setq package-menu--old-archive-contents package-archive-contents) (setq package-menu--new-package-list nil) (package-refresh-contents package-menu-async)) +(define-obsolete-function-alias 'package-menu-refresh 'revert-buffer "27.1") (defun package-menu-hide-package () "Hide a package under point in Package Menu. @@ -3638,7 +3643,7 @@ short description." (package-menu-mode) ;; Fetch the remote list of packages. - (unless no-fetch (package-menu-refresh)) + (unless no-fetch (package-menu--refresh)) ;; If we're not async, this would be redundant. (when package-menu-async commit c91c145d61cb53cb9f88686cbde4aaf6d9c42794 Author: Stefan Kangas Date: Wed Nov 6 00:49:02 2019 +0100 Rename *-multiframe-window to *-window-any-frame Suggested by Drew Adams. * lisp/frame.el (next-multiframe-window): Define as obsolete alias for... (next-window-any-frame): ...new function name. (previous-multiframe-window): Define as obsolete alias for... (previous-window-any-frame): ...new function name. (Bug#12436) * lisp/term/ns-win.el (global-map): Use new command name. * doc/emacs/windows.texi (Other Window): Document it. * etc/NEWS: Announce it. diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 19f6cff7bf..53e9a4bb58 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -181,12 +181,12 @@ the minibuffer window to one of the other windows, and later switch back and finish supplying the minibuffer argument that is requested. @xref{Minibuffer Edit}. -@findex next-multiframe-window +@findex next-window-any-frame The @code{other-window} command will normally only switch to the next window in the current frame (unless otherwise configured). If you work in a multi-frame environment and you want windows in all frames to be part of the cycle, you can rebind @kbd{C-x o} to the -@code{next-multiframe-window} command. (@xref{Rebinding}, for how to +@code{next-window-any-frame} command. (@xref{Rebinding}, for how to rebind a command.) @kindex C-M-v diff --git a/etc/NEWS b/etc/NEWS index a5b9dbdebd..87aa5b5505 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -202,6 +202,16 @@ the new version of the file again.) * Changes in Emacs 27.1 ++++ +** 'next/previous-multiframe-window' have been renamed. +The new names are as follows: + + 'next-multiframe-window' -> 'next-window-any-frame' + 'previous-multiframe-window' -> 'previous-window-any-frame' + +The old function names are maintained as aliases for backward +compatibility. + ** emacsclient +++ diff --git a/lisp/frame.el b/lisp/frame.el index 92fe57fbe6..1a15a4c9f2 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -673,7 +673,7 @@ Create one if necessary. Note that the minibuffer frame, if separate, is not considered (see `next-frame')." (if (equal (next-frame) (selected-frame)) (make-frame) (next-frame))) -(defun next-multiframe-window () +(defun next-window-any-frame () "Select the next window, regardless of which frame it is on." (interactive) (select-window (next-window (selected-window) @@ -681,7 +681,7 @@ is not considered (see `next-frame')." 0)) (select-frame-set-input-focus (selected-frame))) -(defun previous-multiframe-window () +(defun previous-window-any-frame () "Select the previous window, regardless of which frame it is on." (interactive) (select-window (previous-window (selected-window) @@ -689,6 +689,9 @@ is not considered (see `next-frame')." 0)) (select-frame-set-input-focus (selected-frame))) +(defalias 'next-multiframe-window 'next-window-any-frame) +(defalias 'previous-multiframe-window 'previous-window-any-frame) + (defun window-system-for-display (display) "Return the window system for DISPLAY. Return nil if we don't know how to interpret DISPLAY." diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 83b845b1a5..1841e679ac 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -102,7 +102,7 @@ The properties returned may include `top', `left', `height', and `width'." ;; Here are some Nextstep-like bindings for command key sequences. (define-key global-map [?\s-,] 'customize) -(define-key global-map [?\s-'] 'next-multiframe-window) +(define-key global-map [?\s-'] 'next-window-any-frame) (define-key global-map [?\s-`] 'other-frame) (define-key global-map [?\s-~] 'ns-prev-frame) (define-key global-map [?\s--] 'center-line) commit a8dbb7cc865f227a39708df3fe8d24e6f52b6e28 Author: João Távora Date: Tue Nov 5 23:37:30 2019 +0000 Follow JSONRPC spec by not sending :result field on errors Also don't send :error field on non-errors. * lisp/jsonrpc.el (jsonrpc--reply): Don't send :result and :error if none supplied. (Version): Bump to 1.0.8 diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index 41cd84627b..abab445fe5 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -5,7 +5,7 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions ;; Package-Requires: ((emacs "25.2")) -;; Version: 1.0.7 +;; Version: 1.0.8 ;; This is an Elpa :core package. Don't use functionality that is not ;; compatible with Emacs 25.2. @@ -460,9 +460,13 @@ With optional CLEANUP, kill any associated buffers." (json-null nil)) (json-encode object))))) -(cl-defun jsonrpc--reply (connection id &key (result nil result-supplied-p) error) +(cl-defun jsonrpc--reply + (connection id &key (result nil result-supplied-p) (error nil error-supplied-p)) "Reply to CONNECTION's request ID with RESULT or ERROR." - (jsonrpc-connection-send connection :id id :result result :error error)) + (apply #'jsonrpc-connection-send connection + `(:id ,id + ,@(and result-supplied-p `(:result ,result)) + ,@(and error-supplied-p `(:error ,error))))) (defun jsonrpc--call-deferred (connection) "Call CONNECTION's deferred actions, who may again defer themselves." commit fbcfee3ae492922abc34e62381354c7d8b989fea Author: Juri Linkov Date: Wed Nov 6 01:35:47 2019 +0200 Add prefix arg to more isearch commands (bug#14563) * lisp/isearch.el (isearch--yank-char-or-syntax) (isearch-yank-word-or-char, isearch-yank-symbol-or-char) (isearch-yank-until-char): Add optional prefix arg. diff --git a/etc/NEWS b/etc/NEWS index db3434f55b..a5b9dbdebd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1458,6 +1458,8 @@ commands repeat the search for the specified occurrence of the search string. A negative argument repeats the search in the opposite direction. This makes possible also to use a prefix argument for 'M-s .' ('isearch-forward-symbol-at-point') to find the next Nth symbol. +Also a prefix argument is supported for 'isearch-yank-until-char', +'isearch-yank-word-or-char', 'isearch-yank-symbol-or-char'. *** To go to the first/last occurrence of the current search string is possible now with new commands 'isearch-beginning-of-buffer' and diff --git a/lisp/isearch.el b/lisp/isearch.el index 1e4a87ff48..a46f4fc3ee 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2541,25 +2541,28 @@ If optional ARG is non-nil, pull in the next ARG characters." (interactive "p") (isearch-yank-internal (lambda () (forward-char arg) (point)))) -(defun isearch--yank-char-or-syntax (syntax-list fn) +(defun isearch--yank-char-or-syntax (syntax-list fn &optional arg) (isearch-yank-internal (lambda () - (if (or (memq (char-syntax (or (char-after) 0)) syntax-list) - (memq (char-syntax (or (char-after (1+ (point))) 0)) - syntax-list)) - (funcall fn 1) - (forward-char 1)) + (dotimes (_ arg) + (if (or (memq (char-syntax (or (char-after) 0)) syntax-list) + (memq (char-syntax (or (char-after (1+ (point))) 0)) + syntax-list)) + (funcall fn 1) + (forward-char 1))) (point)))) -(defun isearch-yank-word-or-char () - "Pull next character or word from buffer into search string." - (interactive) - (isearch--yank-char-or-syntax '(?w) 'forward-word)) +(defun isearch-yank-word-or-char (&optional arg) + "Pull next character or word from buffer into search string. +If optional ARG is non-nil, pull in the next ARG characters/words." + (interactive "p") + (isearch--yank-char-or-syntax '(?w) 'forward-word arg)) -(defun isearch-yank-symbol-or-char () - "Pull next character or symbol from buffer into search string." - (interactive) - (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol)) +(defun isearch-yank-symbol-or-char (&optional arg) + "Pull next character or symbol from buffer into search string. +If optional ARG is non-nil, pull in the next ARG characters/symbols." + (interactive "p") + (isearch--yank-char-or-syntax '(?w ?_) 'forward-symbol arg)) (defun isearch-yank-word (&optional arg) "Pull next word from buffer into search string. @@ -2567,17 +2570,18 @@ If optional ARG is non-nil, pull in the next ARG words." (interactive "p") (isearch-yank-internal (lambda () (forward-word arg) (point)))) -(defun isearch-yank-until-char (char) +(defun isearch-yank-until-char (char &optional arg) "Pull everything until next instance of CHAR from buffer into search string. Interactively, prompt for CHAR. +If optional ARG is non-nil, pull until next ARGth instance of CHAR. This is often useful for keyboard macros, for example in programming languages or markup languages in which CHAR marks a token boundary." - (interactive "cYank until character: ") + (interactive "cYank until character: \np") (isearch-yank-internal (lambda () (let ((inhibit-field-text-motion t)) (condition-case nil (progn - (search-forward (char-to-string char)) + (search-forward (char-to-string char) nil nil arg) (forward-char -1)) (search-failed (message "`%c' not found" char) commit e4f49e87e7251511d9613899d7041ed4626dc28e Author: Juri Linkov Date: Wed Nov 6 01:21:57 2019 +0200 * lisp/tab-line.el: New option for tabs where buffers are grouped by mode. * lisp/tab-line.el (tab-line-tabs-function): Add option tab-line-tabs-buffer-groups. (tab-line-tabs-buffer-groups): New defvar defaulted to mouse-buffer-menu-mode-groups. (tab-line-tabs-buffer-groups--name, tab-line-tabs-buffer-groups): New functions. (tab-line-format): Support tabs in the format '(tab (name . "name") ...)'. (tab-line-select-tab): Move part of code to tab-line-select-tab-buffer. (tab-line-select-tab-buffer): New function. (tab-line-tab-current): Rename from tab-line-tab-selected. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 0d3834ab74..95f26e20ac 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -77,14 +77,14 @@ :version "27.1" :group 'tab-line-faces) -(defface tab-line-tab-selected +(defface tab-line-tab-current '((default :inherit tab-line-tab) (((class color) (min-colors 88)) :background "grey85") (t :inverse-video t)) - "Tab line face for tab in the selected window." + "Tab line face for tab with current buffer in selected window." :version "27.1" :group 'tab-line-faces) @@ -254,6 +254,7 @@ Reduce tab width proportionally to space taken by other tabs." tab-line-tab-name-ellipsis) 'help-echo tab-name)))) + (defvar tab-line-tabs-limit nil "Maximum number of buffer tabs displayed in the tab line. If nil, no limit.") @@ -270,6 +271,8 @@ with the same major mode as the current buffer." tab-line-tabs-window-buffers) (const :tag "Same mode buffers" tab-line-tabs-mode-buffers) + (const :tag "Grouped buffers" + tab-line-tabs-buffer-groups) (function :tag "Function")) :initialize 'custom-initialize-default :set (lambda (sym val) @@ -280,14 +283,78 @@ with the same major mode as the current buffer." (defun tab-line-tabs-mode-buffers () "Return a list of buffers with the same major mode with current buffer." - (let* ((window (selected-window)) - (buffer (window-buffer window)) - (mode (with-current-buffer buffer major-mode))) + (let ((mode major-mode)) (seq-sort-by #'buffer-name #'string< (seq-filter (lambda (b) (with-current-buffer b (derived-mode-p mode))) (buffer-list))))) +(defvar tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups + "How to group various major modes together in the tab line. +Each element has the form (REGEXP . GROUPNAME). +If the major mode's name string matches REGEXP, use GROUPNAME instead.") + +(defun tab-line-tabs-buffer-groups--name (&optional buffer) + (let* ((buffer (or buffer (current-buffer))) + (mode (with-current-buffer buffer + (format-mode-line mode-name)))) + (or (cdr (seq-find (lambda (group) + (string-match-p (car group) mode)) + tab-line-tabs-buffer-groups)) + mode))) + +(defun tab-line-tabs-buffer-groups () + (if (window-parameter nil 'tab-line-groups) + (let* ((buffers (seq-filter (lambda (b) + (not (= (elt (buffer-name b) 0) ?\s))) + (buffer-list))) + (groups + (seq-sort #'string< + (seq-map #'car + (seq-group-by + (lambda (buffer) + (tab-line-tabs-buffer-groups--name + buffer)) + buffers)))) + (selected-group (window-parameter nil 'tab-line-group)) + (tabs + (mapcar (lambda (group) + `(tab + (name . ,group) + (selected . ,(equal group selected-group)) + (select . ,(lambda () + (set-window-parameter nil 'tab-line-groups nil) + (set-window-parameter nil 'tab-line-group group))))) + groups))) + tabs) + + (let* ((window-parameter (window-parameter nil 'tab-line-group)) + (group-name (tab-line-tabs-buffer-groups--name)) + (group (prog1 (or window-parameter group-name) + (when (equal window-parameter group-name) + (set-window-parameter nil 'tab-line-group nil)))) + (group-tab `(tab + (name . ,group) + ;; Just to highlight the current group name + (selected . t) + (select . ,(lambda () + (set-window-parameter nil 'tab-line-groups t) + (set-window-parameter nil 'tab-line-group group))))) + (buffers + (seq-sort-by #'buffer-name #'string< + (seq-filter (lambda (b) + (and (not (= (elt (buffer-name b) 0) ?\s)) + (equal (tab-line-tabs-buffer-groups--name b) + group))) + (buffer-list)))) + (tabs (mapcar (lambda (buffer) + `(tab + (name . ,(funcall tab-line-tab-name-function buffer)) + (selected . ,(eq buffer (current-buffer))) + (buffer . ,buffer))) + buffers))) + (cons group-tab tabs)))) + (defun tab-line-tabs-window-buffers () "Return a list of tabs that should be displayed in the tab line. By default returns a list of window buffers, i.e. buffers previously @@ -321,6 +388,7 @@ variable `tab-line-tabs-function'." (list buffer) next-buffers)))) + (defun tab-line-format () "Template for displaying tab line for selected window." (let* ((window (selected-window)) @@ -331,26 +399,29 @@ variable `tab-line-tabs-function'." (strings (mapcar (lambda (tab) - (concat - separator - (apply 'propertize - (concat (propertize + (let* ((buffer-p (bufferp tab)) + (selected-p (if buffer-p + (eq tab selected-buffer) + (cdr (assq 'selected tab)))) + (name (if buffer-p (funcall tab-line-tab-name-function tab tabs) - 'keymap tab-line-tab-map) - (or (and tab-line-close-button-show - (not (eq tab-line-close-button-show - (if (eq tab selected-buffer) - 'non-selected - 'selected))) - tab-line-close-button) "")) - `( - tab ,tab - face ,(if (eq tab selected-buffer) - (if (eq (selected-window) (old-selected-window)) - 'tab-line-tab-selected - 'tab-line-tab) - 'tab-line-tab-inactive) - mouse-face tab-line-highlight)))) + (cdr (assq 'name tab))))) + (concat + separator + (apply 'propertize + (concat (propertize name 'keymap tab-line-tab-map) + (or (and tab-line-close-button-show + (not (eq tab-line-close-button-show + (if selected-p 'non-selected 'selected))) + tab-line-close-button) "")) + `( + tab ,tab + face ,(if selected-p + (if (eq (selected-window) (old-selected-window)) + 'tab-line-tab-current + 'tab-line-tab) + 'tab-line-tab-inactive) + mouse-face tab-line-highlight))))) tabs))) (append (list separator @@ -361,8 +432,9 @@ variable `tab-line-tabs-function'." (> (length strings) 1)) tab-line-right-button)) (if hscroll (nthcdr hscroll strings) strings) - (list (concat separator (when tab-line-new-tab-choice - tab-line-new-button)))))) + (when (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (list (concat separator (when tab-line-new-tab-choice + tab-line-new-button))))))) (defun tab-line-hscroll (&optional arg window) @@ -410,9 +482,17 @@ So for example, switching to a previous tab is equivalent to using the `previous-buffer' command." (interactive "e") (let* ((posnp (event-start e)) - (window (posn-window posnp)) - (buffer (get-pos-property 1 'tab (car (posn-string posnp)))) - (window-buffer (window-buffer window)) + (tab (get-pos-property 1 'tab (car (posn-string posnp)))) + (buffer (if (bufferp tab) tab (cdr (assq 'buffer tab))))) + (if buffer + (tab-line-select-tab-buffer buffer (posn-window posnp)) + (let ((select (cdr (assq 'select tab)))) + (when (functionp select) + (funcall select) + (force-mode-line-update)))))) + +(defun tab-line-select-tab-buffer (buffer &optional window) + (let* ((window-buffer (window-buffer window)) (next-buffers (seq-remove (lambda (b) (eq b window-buffer)) (window-next-buffers window))) (prev-buffers (seq-remove (lambda (b) (eq b window-buffer)) commit 213643a890913f10bac710ca8537e8b1125941d6 Author: João Távora Date: Tue Nov 5 18:04:20 2019 +0000 Document fido-mode * doc/emacs/buffers.texi (Icomplete): Document Fido Mode. * etc/NEWS: Mention Fido Mode. * lisp/icomplete.el (icomplete-mode): Ensure fido-mode is off. (fido-mode): Ensure icomplete-mode is off. (icomplete-magic-ido-ret): Don't force completions if no completions. diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 74e6211f80..b5a17416d7 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -725,6 +725,22 @@ of directories. the variable @code{icomplete-mode} to @code{t} (@pxref{Easy Customization}). +@findex fido-mode +@cindex fido mode + + An alternative to Icomplete mode is Fido mode. This is very similar +to Icomplete mode, but retains some functionality from a popular +extension called Ido mode (in fact the name is derived from ``Fake +Ido''). Among other things, in Fido mode, @kbd{C-s} and @kbd{C-r} are +also used to rotate the completions list, @kbd{C-k} can be used to +delete files and kill buffers in-list. Another noteworthy aspect is +that @code{flex} is used as the default completion style +(@pxref{Completion Styles}). + + To enable Fido mode, type @kbd{M-x fido-mode}, or customize +the variable @code{fido-mode} to @code{t} (@pxref{Easy +Customization}). + @node Buffer Menus @subsection Customizing Buffer Menus diff --git a/etc/NEWS b/etc/NEWS index b6e61c76e2..db3434f55b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1192,6 +1192,15 @@ A new command 'xref-revert-buffer' is bound to 'g'. --- *** Imenu support has been added to 'xref--xref-buffer-mode'. +** Icomplete + ++++ +*** A new minor mode based on Icomplete, Fido mode, is made available. +The point of this mode, named after "Fake Ido", is to recover much of +the functionality that still separated the popular ido-mode from +Icomplete, while still cooperating fully with all of Emacs's +completion facilities. + ** Ecomplete *** The ecomplete sorting has changed to a decay-based algorithm. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 777fdce13a..40f4f0bc68 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -273,20 +273,22 @@ require user confirmation." (exit-minibuffer)))) (defun icomplete-magic-ido-ret () - "Exit forcing completion or enter directory, like `ido-mode'." + "Exit minibuffer or enter directory, like `ido-mode'." (interactive) (let* ((beg (icomplete--field-beg)) (md (completion--field-metadata beg)) (category (alist-get 'category (cdr md))) (dir (and (eq category 'file) (file-name-directory (icomplete--field-string)))) - (current (and dir - (car (completion-all-sorted-completions)))) - (probe (and current + (current (car (completion-all-sorted-completions))) + (probe (and dir current (expand-file-name (directory-file-name current) dir)))) - (if (and probe (file-directory-p probe) (not (string= current "./"))) - (icomplete-force-complete) - (icomplete-force-complete-and-exit)))) + (cond ((and probe (file-directory-p probe) (not (string= current "./"))) + (icomplete-force-complete)) + (current + (icomplete-force-complete-and-exit)) + (t + (exit-minibuffer))))) (defun icomplete-magic-ido-backward-updir () "Delete char before or go up directory, like `ido-mode'." @@ -330,6 +332,7 @@ more like `ido-mode' than regular `icomplete-mode'." (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) (remove-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup) (when fido-mode + (icomplete-mode -1) (setq icomplete-mode t) (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) (add-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup))) @@ -355,6 +358,7 @@ completions: (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) (remove-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup) (when icomplete-mode + (fido-mode -1) (when icomplete-in-buffer (add-hook 'completion-in-region-mode-hook #'icomplete--in-region-setup)) (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup))) commit e1d24f3c4cdc052d9ba87801fde09fae0d86d0b3 Author: João Távora Date: Sun Nov 3 13:10:40 2019 +0000 New fido-mode, emulates ido-mode with icomplete-mode * lisp/icomplete.el (icomplete-fido-mode-map): New variable. (icomplete--fido-mode-setup): New function. (fido-mode): New global minor mode. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index e1d6236943..777fdce13a 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -223,21 +223,7 @@ Last entry becomes the first and can be selected with (push (car last) comps) (completion--cache-all-sorted-completions beg end comps)))) -;;; `ido-mode' emulation -;;; -;;; The following "magic-ido" commands can be bound in -;;; `icomplete-mode-map' to make `icomplete-mode' behave more like -;;; `ido-mode'. Evaluate this to try it out. -;;; -;;; (let ((imap icomplete-minibuffer-map)) -;;; (define-key imap (kbd "C-k") 'icomplete-magic-ido-kill) -;;; (define-key imap (kbd "C-d") 'icomplete-magic-ido-delete-char) -;;; (define-key imap (kbd "RET") 'icomplete-magic-ido-ret) -;;; (define-key imap (kbd "DEL") 'icomplete-magic-ido-backward-updir)) -;;; -;;; For more ido behaviour, you'll probably like this too: -;;; -;;; (setq icomplete-tidy-shadowed-file-names t) +;;; Helpers for `fido-mode' (or `ido-mode' emulation) ;;; (defun icomplete-magic-ido-kill () "Kill line or current completion, like `ido-mode'. @@ -312,6 +298,42 @@ require user confirmation." (backward-kill-sexp 1) (call-interactively 'backward-delete-char)))) +(defvar icomplete-fido-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-k") 'icomplete-magic-ido-kill) + (define-key map (kbd "C-d") 'icomplete-magic-ido-delete-char) + (define-key map (kbd "RET") 'icomplete-magic-ido-ret) + (define-key map (kbd "DEL") 'icomplete-magic-ido-backward-updir) + (define-key map (kbd "M-j") 'exit-minibuffer) + (define-key map (kbd "C-s") 'icomplete-forward-completions) + (define-key map (kbd "C-r") 'icomplete-backward-completions) + map) + "Keymap used by `fido-mode' in the minibuffer.") + +(defun icomplete--fido-mode-setup () + "Setup `fido-mode''s minibuffer." + (use-local-map (make-composed-keymap icomplete-fido-mode-map + (current-local-map))) + (setq-local icomplete-tidy-shadowed-file-names t + icomplete-show-matches-on-no-input t + icomplete-hide-common-prefix nil + completion-styles '(flex) + completion-category-defaults nil)) + +;;;###autoload +(define-minor-mode fido-mode + "An enhanced `icomplete-mode' that emulates `ido-mode'. + +This global minor mode makes minibuffer completion behave +more like `ido-mode' than regular `icomplete-mode'." + :global t :group 'icomplete + (remove-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) + (remove-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup) + (when fido-mode + (setq icomplete-mode t) + (add-hook 'minibuffer-setup-hook #'icomplete-minibuffer-setup) + (add-hook 'minibuffer-setup-hook #'icomplete--fido-mode-setup))) + ;;;_ > icomplete-mode (&optional prefix) ;;;###autoload (define-minor-mode icomplete-mode commit e5f10c6755f3e1670e4dc59842be72cdf62d3f91 Author: Paul Eggert Date: Tue Nov 5 13:43:44 2019 -0800 Pacify byte-compiler in calculator.el * lisp/calculator.el (calculator-expt): Open-code cl-evenp to pacify warning “the function ‘cl-evenp’ might not be defined”. Problem reported by Juanma Barranquero in: https://lists.gnu.org/r/emacs-devel/2019-11/msg00118.html diff --git a/lisp/calculator.el b/lisp/calculator.el index fab365d5f2..6c07ee2225 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -1620,7 +1620,9 @@ To use this, apply a binary operator (evaluate it), then call this." (condition-case nil (expt x y) (overflow-error - (if (or (natnump x) (cl-evenp y)) + ;; X and Y must be integers, as expt silently returns floating-point + ;; infinity on floating-point overflow. + (if (or (natnump x) (zerop (logand x 1))) 1.0e+INF -1.0e+INF)))) commit edec35aa9472dca3a80966c62131f00e5288ee49 Author: Stefan Monnier Date: Tue Nov 5 15:05:38 2019 -0500 * admin/unidata/uvs.el: Use lexical-binding diff --git a/admin/unidata/uvs.el b/admin/unidata/uvs.el index dfea479652..2d0f92422b 100644 --- a/admin/unidata/uvs.el +++ b/admin/unidata/uvs.el @@ -1,4 +1,4 @@ -;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts. +;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts -*- lexical-binding:t -*- ;; Copyright (C) 2014-2019 Free Software Foundation, Inc. @@ -30,7 +30,7 @@ ;;; Code: (defun uvs-fields-total-size (fields) - (apply '+ (mapcar (lambda (field) (get field 'uvs-field-size)) fields))) + (apply #'+ (mapcar (lambda (field) (get field 'uvs-field-size)) fields))) ;;; Fields in Format 14 header. (defconst uvs-format-14-header-fields @@ -85,7 +85,8 @@ where selectors and bases are sorted in ascending order." "\\(?:" (regexp-quote collection-id) "\\)" "[[:blank:]]*;[[:blank:]]*" "\\([^\n[:blank:]]+\\)" - "[[:blank:]]*$") nil t) + "[[:blank:]]*$") + nil t) (let* ((base (string-to-number (match-string 1) 16)) (selector (string-to-number (match-string 2) 16)) (sequence-id (match-string 3)) @@ -105,7 +106,7 @@ where selectors and bases are sorted in ascending order." "Convert integer VALUE to a list of SIZE bytes. The most significant byte comes first." (let (result) - (dotimes (i size) + (dotimes (_ size) (push (logand value #xff) result) (setq value (ash value -8))) result)) @@ -118,7 +119,7 @@ respectively. Byte length of each value is determined by the (while fields (let ((field (car fields)) (value (car values))) - (insert (apply 'unibyte-string + (insert (apply #'unibyte-string (uvs-int-to-bytes value (get field 'uvs-field-size)))) (setq fields (cdr fields) values (cdr values))))) @@ -126,9 +127,9 @@ respectively. Byte length of each value is determined by the "Insert UVS-ALIST as a sequence of bytes to the current buffer." (let* ((nrecords (length uvs-alist)) ; # of selectors (total-nmappings - (apply '+ (mapcar - (lambda (selector-bgs) (length (cdr selector-bgs))) - uvs-alist))) + (apply #'+ (mapcar + (lambda (selector-bgs) (length (cdr selector-bgs))) + uvs-alist))) (non-default-offset (+ uvs-format-14-header-size (* uvs-variation-selector-record-size nrecords)))) @@ -158,15 +159,15 @@ respectively. Byte length of each value is determined by the (car base-glyph) (cdr base-glyph)))))) -(defun uvs-dump (&optional bytes-per-line separator separator-eol line-prefix) +(defun uvs-dump (&optional bytes-per-line separator separator-eol bol-prefix) "Print the current buffer as in representation of C array contents." (or bytes-per-line (setq bytes-per-line 8)) (or separator (setq separator ", ")) (or separator-eol (setq separator-eol ",")) - (or line-prefix (setq line-prefix " ")) + (or bol-prefix (setq bol-prefix " ")) (goto-char (point-min)) (while (> (- (point-max) (point)) bytes-per-line) - (princ line-prefix) + (princ bol-prefix) (princ (mapconcat (lambda (byte) (format "0x%02x" byte)) (string-to-unibyte (buffer-substring (point) (+ (point) bytes-per-line))) @@ -174,7 +175,7 @@ respectively. Byte length of each value is determined by the (princ separator-eol) (terpri) (forward-char bytes-per-line)) - (princ line-prefix) + (princ bol-prefix) (princ (mapconcat (lambda (byte) (format "0x%02x" byte)) (string-to-unibyte (buffer-substring (point) (point-max))) commit ec5433f676035a5ad3ad8fcb22884cf0e0c290f6 Author: Stefan Monnier Date: Tue Nov 5 14:33:36 2019 -0500 * lisp/doc-view.el (doc-view--revert-buffer): Fix last change diff --git a/lisp/doc-view.el b/lisp/doc-view.el index d88150735f..15a1dc3b9b 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -451,9 +451,13 @@ Typically \"page-%s.png\".") (apply orig-fun args) ;; Update the cached version of the pdf file, ;; too. This is the one that's used when - ;; rendering. - (doc-view-make-safe-dir doc-view-cache-directory) - (write-region nil nil doc-view--buffer-file-name)))) + ;; rendering (bug#26996). + (unless (equal buffer-file-name + doc-view--buffer-file-name) + ;; FIXME: Lars says he needed to recreate + ;; the dir, we should figure out why. + (doc-view-make-safe-dir doc-view-cache-directory) + (write-region nil nil doc-view--buffer-file-name))))) (if (and (eq 'pdf doc-view-doc-type) (executable-find "pdfinfo")) ;; We don't want to revert if the PDF file is corrupted which commit d76bc06abc38e8b6489c7e526711a87fb5450784 Author: Stefan Kangas Date: Tue Nov 5 15:45:22 2019 +0100 Declare unused macro package--push obsolete * lisp/emacs-lisp/package.el (package--push): Declare obsolete. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 8c8e86aead..80ffdc3019 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2773,6 +2773,7 @@ Letters do not insert themselves; instead, they are commands. "Convenience macro for `package-menu--generate'. If the alist stored in the symbol LISTNAME lacks an entry for a package PKG-DESC, add one. The alist is keyed with PKG-DESC." + (declare (obsolete nil "27.1")) `(unless (assoc ,pkg-desc ,listname) ;; FIXME: Should we move status into pkg-desc? (push (cons ,pkg-desc ,status) ,listname))) commit d270d7d4ad8693202777ce29363947d38899bf6c Author: Michael Albinus Date: Tue Nov 5 12:58:47 2019 +0100 Improve Tramp's copy-directory * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add `copy-directory'. * lisp/net/tramp.el (tramp-handle-copy-directory): New defun. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index e3098190e2..a4f5760f72 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -94,7 +94,7 @@ It is used for TCP/IP devices." '((access-file . tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) ;; `byte-compiler-base-file-name' performed by default handler. - ;; `copy-directory' performed by default handler. + (copy-directory . tramp-handle-copy-directory) (copy-file . tramp-adb-handle-copy-file) (delete-directory . tramp-adb-handle-delete-directory) (delete-file . tramp-adb-handle-delete-file) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 6f5cade4c6..dbda24b9ac 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -535,7 +535,7 @@ It has been changed in GVFS 1.14.") '((access-file . tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) ;; `byte-compiler-base-file-name' performed by default handler. - ;; `copy-directory' performed by default handler. + (copy-directory . tramp-handle-copy-directory) (copy-file . tramp-gvfs-handle-copy-file) (delete-directory . tramp-gvfs-handle-delete-directory) (delete-file . tramp-gvfs-handle-delete-file) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 2b3799ef00..56afdba742 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -70,7 +70,7 @@ '((access-file . tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) ;; `byte-compiler-base-file-name' performed by default handler. - ;; `copy-directory' performed by default handler. + (copy-directory . tramp-handle-copy-directory) (copy-file . tramp-rclone-handle-copy-file) (delete-directory . tramp-rclone-handle-delete-directory) (delete-file . tramp-rclone-handle-delete-file) diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index 2d9d7ff789..e7a892c746 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -66,7 +66,7 @@ See `tramp-actions-before-shell' for more info.") '((access-file . tramp-handle-access-file) (add-name-to-file . tramp-sudoedit-handle-add-name-to-file) (byte-compiler-base-file-name . ignore) - ;; `copy-directory' performed by default handler. + (copy-directory . tramp-handle-copy-directory) (copy-file . tramp-sudoedit-handle-copy-file) (delete-directory . tramp-sudoedit-handle-delete-directory) (delete-file . tramp-sudoedit-handle-delete-file) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 88ff36d98e..acb5a93687 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3016,6 +3016,20 @@ User is always nil." filename newname 'ok-if-already-exists 'keep-time 'preserve-uid-gid 'preserve-permissions))) +(defun tramp-handle-copy-directory + (directory newname &optional keep-date parents copy-contents) + "Like `copy-directory' for Tramp files." + ;; `directory-files' creates `newname' before running this check. + ;; So we do it ourselves. + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) + ;; We must do it file-wise. + (tramp-run-real-handler + 'copy-directory + (list directory newname keep-date parents copy-contents))) + (defun tramp-handle-directory-file-name (directory) "Like `directory-file-name' for Tramp files." ;; If localname component of filename is "/", leave it unchanged. commit 91c732f687a61ba130acf38d5142bec6369ebd68 Author: Robert Pluim Date: Thu Jan 24 14:35:30 2019 +0100 Always check for client-certificates * lisp/net/network-stream.el (network-stream-use-client-certificates): New user option. (open-network-stream): If 'network-stream-use-client-certificates' is t, and the user hasn't specified :client-certificate, do certificate lookups via 'auth-source'. (network-stream-certificate): Only return key and certificate files that exist. * doc/lispref/processes.texi (Network): Document new client-certificate behavior. * etc/NEWS: Document 'network-stream-use-client-certificates'. diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 287221a184..5caf0a2426 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2516,12 +2516,16 @@ Emacs will warn if the connection isn't encrypted. This is useful for protocols like @acronym{IMAP} and the like, where most users would expect the network traffic to be encrypted. +@vindex network-stream-use-client-certificates @item :client-certificate @var{list-or-t} Either a list of the form @code{(@var{key-file} @var{cert-file})}, naming the certificate key file and certificate file itself, or @code{t}, meaning to query @code{auth-source} for this information -(@pxref{Top,,Overview, auth, The Auth-Source Manual}). -Only used for @acronym{TLS} or @acronym{STARTTLS}. +(@pxref{Help for users,,auth-source, auth, Emacs auth-source Library}). +Only used for @acronym{TLS} or @acronym{STARTTLS}. If +@code{:client-certificate} is not specified, behave as if it were t, +customize @code{network-stream-use-client-certificates} to change +this. @item :return-list @var{cons-or-nil} The return value of this function. If omitted or @code{nil}, return a diff --git a/etc/NEWS b/etc/NEWS index 7ff9df6e0f..b6e61c76e2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -321,6 +321,12 @@ Previously, this support was only available when using the external ':client-certificate t' to trigger looking up of per-server certificates via 'auth-source'. ++++ +** New user option 'network-stream-use-client-certificates'. +When non-nil, 'open-network-stream' performs lookups of client +certificates using 'auth-source' as if ':client-certificate t' were +specified. Defaults to t. + +++ ** New function 'fill-polish-nobreak-p', to be used in 'fill-nobreak-predicate'. It blocks line breaking after a one-letter word, also in the case when diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 2b3292b71b..4050c83eb0 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -58,6 +58,21 @@ (defvar starttls-gnutls-program) (defvar starttls-program) +(defcustom network-stream-use-client-certificates t + "Whether to use client certificates for network connections. + +When non-nil, `open-network-stream' will automatically look for +matching client certificates (via 'auth-source') for a +destination server, if it is called without a :client-certificate +keyword. + +Set to nil to disable this lookup globally. To disable on a +per-connection basis, specify ':client-certificate nil' when +calling `open-network-stream'." + :group 'network + :type 'boolean + :version "27.1") + ;;;###autoload (defun open-network-stream (name buffer host service &rest parameters) "Open a TCP connection to HOST, optionally with encryption. @@ -132,7 +147,9 @@ values: element is the certificate file name itself, or t, which means that `auth-source' will be queried for the key and the certificate. This parameter will only be used when doing TLS - or STARTTLS connections. + or STARTTLS connections. If :client-certificate is not + specified, behave as if it were t, customize + `network-stream-use-client-certificates' to change this. :use-starttls-if-possible is a boolean that says to do opportunistic STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality. @@ -181,6 +198,11 @@ gnutls-boot (as returned by `gnutls-boot-parameters')." ((memq type '(tls ssl)) 'network-stream-open-tls) ((eq type 'shell) 'network-stream-open-shell) (t (error "Invalid connection type %s" type)))) + (parameters + (if (and network-stream-use-client-certificates + (not (plist-member parameters :client-certificate))) + (plist-put parameters :client-certificate t) + parameters)) result) (unwind-protect (setq result (funcall fun name work-buffer host service parameters)) @@ -209,7 +231,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')." :port service))) (key (plist-get auth-info :key)) (cert (plist-get auth-info :cert))) - (and key cert + (and key cert (file-readable-p key) (file-readable-p cert) (list key cert))))))) ;;;###autoload commit 3843711abd8d599206acbcc0aa97dae708285416 Author: Paul Eggert Date: Mon Nov 4 23:19:36 2019 -0800 Simplify calculator-expt * lisp/calculator.el (calculator-expt): Simplify, now that expt does the right thing if the first arg is -1, 0, or 1. diff --git a/lisp/calculator.el b/lisp/calculator.el index 281151c7c2..fab365d5f2 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -1619,30 +1619,10 @@ To use this, apply a binary operator (evaluate it), then call this." "Compute X^Y, dealing with errors appropriately." (condition-case nil (expt x y) - (domain-error 0.0e+NaN) - (range-error - (cond ((and (< x 1.0) (> x -1.0)) - ;; For small x, the range error comes from large y. - 0.0) - ((and (> x 0.0) (< y 0.0)) - ;; For large positive x and negative y, the range error - ;; comes from large negative y. - 0.0) - ((and (> x 0.0) (> y 0.0)) - ;; For large positive x and positive y, the range error - ;; comes from large y. - 1.0e+INF) - ;; For the rest, x must be large and negative. - ;; The range errors come from large integer y. - ((< y 0.0) - 0.0) - ((eq (logand (truncate y) 1) 1) ; expansion of cl `oddp' - ;; If y is odd - -1.0e+INF) - (t - ;; - 1.0e+INF))) - (error 0.0e+NaN))) + (overflow-error + (if (or (natnump x) (cl-evenp y)) + 1.0e+INF + -1.0e+INF)))) (defun calculator-fact (x) "Simple factorial of X." commit 799d738bc7404b5bda4fe3c544a4fc24e6580f46 Author: Paul Eggert Date: Mon Nov 4 23:17:06 2019 -0800 Overflow errors are range errors * etc/NEWS: Mention this. * doc/lispref/errors.texi (Standard Errors): Document overflow-error, which was formerly undocumented. It is a range error, not a domain error. * src/data.c (syms_of_data): overflow-error and (undocumented) underflow-error are subtypes range-error, not domain-error. This fixes bugs in timezone-time-from-absolute and in erc-ctcp-reply-PING. diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index cf9b67c80d..dc9089ad1e 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -163,6 +163,10 @@ The message is @samp{Attempt to modify a protected file}. @item range-error The message is @code{Arithmetic range error}. + +@item overflow-error +The message is @samp{Arithmetic overflow error}. This is a subcategory +of @code{range-error}. This can happen with integers exceeding the @code{integer-width} limit. @xref{Integer Basics}. @@ -229,10 +233,6 @@ mathematical functions. @xref{Math Functions}. @item domain-error The message is @samp{Arithmetic domain error}. -@item overflow-error -The message is @samp{Arithmetic overflow error}. This is a subcategory -of @code{domain-error}. - @item singularity-error The message is @samp{Arithmetic singularity error}. This is a subcategory of @code{domain-error}. diff --git a/etc/NEWS b/etc/NEWS index e897fe06c9..7ff9df6e0f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2617,6 +2617,11 @@ like 'file-attributes' that compute file sizes and other attributes, functions like 'process-id' that compute process IDs, and functions like 'user-uid' and 'group-gid' that compute user and group IDs. ++++ +** overflow-error is now documented as a subcategory of range-error. +Formerly it was undocumented, and was (incorrectly) a subcategory +of domain-error. + ** Time values +++ diff --git a/src/data.c b/src/data.c index a338dadfb6..d968ac9e3a 100644 --- a/src/data.c +++ b/src/data.c @@ -3935,9 +3935,9 @@ syms_of_data (void) PUT_ERROR (Qsingularity_error, Fcons (Qdomain_error, arith_tail), "Arithmetic singularity error"); - PUT_ERROR (Qoverflow_error, Fcons (Qdomain_error, arith_tail), + PUT_ERROR (Qoverflow_error, Fcons (Qrange_error, arith_tail), "Arithmetic overflow error"); - PUT_ERROR (Qunderflow_error, Fcons (Qdomain_error, arith_tail), + PUT_ERROR (Qunderflow_error, Fcons (Qrange_error, arith_tail), "Arithmetic underflow error"); /* Types that type-of returns. */ commit 5ab29400a4e9b29928aaf63d1f89a0b059491b29 Author: Paul Eggert Date: Mon Nov 4 23:10:12 2019 -0800 Don’t signal overflow for (expt 1 bignum) Similarly for (expt 0 bignum) and (expt -1 bignum). The result is always a -1, 0 or 1, so do not signal overflow. * src/data.c (expt_integer): Do not signal an overflow if -1 <= X <= 1. Be clearer about when overflow is signaled. * test/src/floatfns-tests.el (bignum-expt): Test this. diff --git a/src/data.c b/src/data.c index 1d9222e75a..a338dadfb6 100644 --- a/src/data.c +++ b/src/data.c @@ -3290,14 +3290,29 @@ In this case, the sign bit is duplicated. */) Lisp_Object expt_integer (Lisp_Object x, Lisp_Object y) { + /* Special cases for -1 <= x <= 1, which never overflow. */ + if (EQ (x, make_fixnum (1))) + return x; + if (EQ (x, make_fixnum (0))) + return EQ (x, y) ? make_fixnum (1) : x; + if (EQ (x, make_fixnum (-1))) + return ((FIXNUMP (y) ? XFIXNUM (y) & 1 : mpz_odd_p (*xbignum_val (y))) + ? x : make_fixnum (1)); + unsigned long exp; - if (TYPE_RANGED_FIXNUMP (unsigned long, y)) - exp = XFIXNUM (y); - else if (MOST_POSITIVE_FIXNUM < ULONG_MAX && BIGNUMP (y) - && mpz_fits_ulong_p (*xbignum_val (y))) - exp = mpz_get_ui (*xbignum_val (y)); + if (FIXNUMP (y)) + { + if (ULONG_MAX < XFIXNUM (y)) + overflow_error (); + exp = XFIXNUM (y); + } else - overflow_error (); + { + if (ULONG_MAX <= MOST_POSITIVE_FIXNUM + || !mpz_fits_ulong_p (*xbignum_val (y))) + overflow_error (); + exp = mpz_get_ui (*xbignum_val (y)); + } emacs_mpz_pow_ui (mpz[0], *bignum_integer (&mpz[0], x), exp); return make_integer_mpz (); diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el index 643866f114..62201a877d 100644 --- a/test/src/floatfns-tests.el +++ b/test/src/floatfns-tests.el @@ -51,7 +51,12 @@ (ert-deftest bignum-expt () (dolist (n (list most-positive-fixnum (1+ most-positive-fixnum) most-negative-fixnum (1- most-negative-fixnum) + (* 5 most-negative-fixnum) + (* 5 (1+ most-positive-fixnum)) -2 -1 0 1 2)) + (should (or (<= n 0) (= (expt 0 n) 0))) + (should (= (expt 1 n) 1)) + (should (or (< n 0) (= (expt -1 n) (if (zerop (logand n 1)) 1 -1)))) (should (= (expt n 0) 1)) (should (= (expt n 1) n)) (should (= (expt n 2) (* n n))) commit 96c8e4fa414f69790fc8b2cc8ded9c758511326f Author: Ronnie Schnell Date: Mon Nov 4 13:54:48 2019 -0500 Fixes bug where restoring game saved in an endgame question room would show 'nil' as the question. diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 0a9ab37d19..5d412f8808 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -2995,6 +2995,8 @@ File not found"))) (dun-save-val "dun-cdpath") (dun-save-val "dun-correct-answer") (dun-save-val "dun-inbus") + (dun-save-val "dun-endgame-question") + (if (dun-compile-save-out filename) (dun-mprincl "Error saving to file.") (dun-do-logfile 'save nil))) commit dd19cc3aa16ccc441a8a2bfcdeb3005a6eef2543 Author: Michael Albinus Date: Mon Nov 4 17:34:31 2019 +0100 Improve Tramp error handling * lisp/net/tramp.el (tramp-set-syntax): Add missing argument. (tramp-signal-hook-function): Make it more robust. (tramp-handle-directory-files): * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes) (tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file) (tramp-rclone-handle-directory-files): * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes) (tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file): * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory) (tramp-smb-handle-copy-file, tramp-smb-handle-directory-files) (tramp-smb-handle-rename-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-do-copy-or-rename-file): Improve error handling. * test/lisp/net/tramp-tests.el (tramp-test11-copy-file) (tramp-test12-rename-file, tramp-test14-delete-directory) (tramp-test15-copy-directory, tramp-test16-directory-files) (tramp-test19-directory-files-and-attributes): Extend tests. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index e1706bebe6..e3098190e2 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -383,6 +383,10 @@ ARGUMENTS to pass to the OPERATION." (defun tramp-adb-handle-directory-files-and-attributes (directory &optional full match nosort id-format) "Like `directory-files-and-attributes' for Tramp files." + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) (when (file-directory-p directory) (with-parsed-tramp-file-name (expand-file-name directory) nil (copy-tree @@ -706,6 +710,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (let ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "Copying file" "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) @@ -784,6 +792,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (let ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "Renaming file" "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c08c7194cc..6f5cade4c6 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -765,6 +765,10 @@ file names." (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "%s file" msg-operation "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 1f0c7eadbc..2b3799ef00 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -213,6 +213,10 @@ file names." (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "%s file" msg-operation "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) @@ -298,6 +302,10 @@ file names." (defun tramp-rclone-handle-directory-files (directory &optional full match nosort) "Like `directory-files' for Tramp files." + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) (when (file-directory-p directory) (setq directory (file-name-as-directory (expand-file-name directory))) (with-parsed-tramp-file-name directory nil diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 3c80c58309..be531ed319 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1713,6 +1713,10 @@ of." (directory &optional full match nosort id-format) "Like `directory-files-and-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) (when (file-directory-p directory) (setq directory (expand-file-name directory)) (let* ((temp @@ -1923,6 +1927,10 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" (let ((t1 (tramp-tramp-file-p dirname)) (t2 (tramp-tramp-file-p newname))) (with-parsed-tramp-file-name (if t1 dirname newname) nil + (unless (file-exists-p dirname) + (tramp-error + v tramp-file-missing + "Copying directory" "No such file or directory" dirname)) (if (and (not copy-contents) (tramp-get-method-parameter v 'tramp-copy-recursive) ;; When DIRNAME and NEWNAME are remote, they must have @@ -2011,6 +2019,9 @@ file names." (apply #'file-extended-attributes (list filename))))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 5e52b26e7c..f87d4becfe 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -415,6 +415,10 @@ pass to the OPERATION." (with-parsed-tramp-file-name (if t1 dirname newname) nil (with-tramp-progress-reporter v 0 (format "Copying %s to %s" dirname newname) + (unless (file-exists-p dirname) + (tramp-error + v tramp-file-missing + "Copying directory" "No such file or directory" dirname)) (when (and (file-directory-p newname) (not (tramp-compat-directory-name-p newname))) (tramp-error v 'file-already-exists newname)) @@ -570,6 +574,13 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (if (file-directory-p filename) (copy-directory filename newname keep-date 'parents 'copy-contents) + (unless (file-exists-p filename) + (tramp-error + (tramp-dissect-file-name + (if (tramp-tramp-file-p filename) filename newname)) + tramp-file-missing + "Copying file" "No such file or directory" filename)) + (let ((tmpfile (file-local-copy filename))) (if tmpfile ;; Remote filename. @@ -669,6 +680,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (defun tramp-smb-handle-directory-files (directory &optional full match nosort) "Like `directory-files' for Tramp files." + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) (let ((result (mapcar #'directory-file-name (file-name-all-completions "" directory)))) ;; Discriminate with regexp. @@ -1333,6 +1348,10 @@ component is used as the target of the symlink." (with-parsed-tramp-file-name (if (tramp-tramp-file-p filename) filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "Renaming file" "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index bfc9b3bdc3..2d9d7ff789 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -241,6 +241,10 @@ absolute file names." (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) (with-parsed-tramp-file-name (if t1 filename newname) nil + (unless (file-exists-p filename) + (tramp-error + v tramp-file-missing + "%s file" msg-operation "No such file or directory" filename)) (when (and (not ok-if-already-exists) (file-exists-p newname)) (tramp-error v 'file-already-exists newname)) (when (and (file-directory-p newname) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 21b6f0070f..88ff36d98e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -719,7 +719,7 @@ Used in user option `tramp-syntax'. There are further variables to be set, depending on VALUE." ;; Check allowed values. (unless (memq value (tramp-syntax-values)) - (tramp-user-error "Wrong `tramp-syntax' %s" value)) + (tramp-user-error nil "Wrong `tramp-syntax' %s" value)) ;; Cleanup existing buffers. (unless (eq (symbol-value symbol) value) (tramp-cleanup-all-buffers)) @@ -1889,8 +1889,13 @@ the resulting error message." ;; This function provides traces in case of errors not triggered by ;; Tramp functions. (defun tramp-signal-hook-function (error-symbol data) - "Funtion to be called via `signal-hook-function'." - (tramp-error (car tramp-current-connection) error-symbol "%s" data)) + "Function to be called via `signal-hook-function'." + ;; `custom-initialize-*' functions provoke `void-variable' errors. + ;; We don't want to see them in the backtrace. + (unless (eq error-symbol 'void-variable) + (tramp-error + (car tramp-current-connection) error-symbol + "%s" (mapconcat (lambda (x) (format "%s" x)) data " ")))) (defmacro with-parsed-tramp-file-name (filename var &rest body) "Parse a Tramp filename and make components available in the body. @@ -3025,6 +3030,10 @@ User is always nil." (defun tramp-handle-directory-files (directory &optional full match nosort) "Like `directory-files' for Tramp files." + (unless (file-exists-p directory) + (tramp-error + (tramp-dissect-file-name directory) tramp-file-missing + "No such file or directory" directory)) (when (file-directory-p directory) (setq directory (file-name-as-directory (expand-file-name directory))) (let ((temp (nreverse (file-name-all-completions "" directory))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index baebae17e1..ec9cda0bbd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2370,6 +2370,9 @@ This checks also `file-name-as-directory', `file-name-directory', ;; Copy simple file. (unwind-protect (progn + (should-error + (copy-file source target) + :type tramp-file-missing) (write-region "foo" nil source) (should (file-exists-p source)) (copy-file source target) @@ -2482,6 +2485,9 @@ This checks also `file-name-as-directory', `file-name-directory', ;; Rename simple file. (unwind-protect (progn + (should-error + (rename-file source target) + :type tramp-file-missing) (write-region "foo" nil source) (should (file-exists-p source)) (rename-file source target) @@ -2605,20 +2611,25 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (skip-unless (tramp--test-enabled)) (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil))) - (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (expand-file-name "foo" tmp-name1))) ;; Delete empty directory. - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (delete-directory tmp-name) - (should-not (file-directory-p tmp-name)) + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (delete-directory tmp-name1) + (should-not (file-directory-p tmp-name1)) ;; Delete non-empty directory. - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (write-region "foo" nil (expand-file-name "bla" tmp-name)) - (should (file-exists-p (expand-file-name "bla" tmp-name))) - (should-error (delete-directory tmp-name) :type 'file-error) - (delete-directory tmp-name 'recursive) - (should-not (file-directory-p tmp-name))))) + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (write-region "foo" nil (expand-file-name "bla" tmp-name1)) + (should (file-exists-p (expand-file-name "bla" tmp-name1))) + (make-directory tmp-name2) + (should (file-directory-p tmp-name2)) + (write-region "foo" nil (expand-file-name "bla" tmp-name2)) + (should (file-exists-p (expand-file-name "bla" tmp-name2))) + (should-error (delete-directory tmp-name1) :type 'file-error) + (delete-directory tmp-name1 'recursive) + (should-not (file-directory-p tmp-name1))))) (ert-deftest tramp-test15-copy-directory () "Check `copy-directory'." @@ -2636,6 +2647,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." ;; Copy complete directory. (unwind-protect (progn + (should-error + (copy-directory tmp-name1 tmp-name2) + :type tramp-file-missing) ;; Copy empty directory. (make-directory tmp-name1) (write-region "foo" nil tmp-name4) @@ -2696,6 +2710,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." (tmp-name3 (expand-file-name "foo" tmp-name1))) (unwind-protect (progn + (should-error + (directory-files tmp-name1) + :type tramp-file-missing) (make-directory tmp-name1) (write-region "foo" nil tmp-name2) (write-region "bla" nil tmp-name3) @@ -3174,6 +3191,9 @@ They might differ only in time attributes or directory size." attr) (unwind-protect (progn + (should-error + (directory-files-and-attributes tmp-name1) + :type tramp-file-missing) (make-directory tmp-name1) (should (file-directory-p tmp-name1)) (setq tramp--test-start-time commit a256e03bd944384efb3da05858264a5d3b72462d Author: Eli Zaretskii Date: Mon Nov 4 17:39:12 2019 +0200 Fix last change in dired.c * src/dired.c (file_name_completion): Fix arguments to Fcompare_strings. (Bug#38056) diff --git a/src/dired.c b/src/dired.c index 0e1c88f03c..a5153790c4 100644 --- a/src/dired.c +++ b/src/dired.c @@ -585,7 +585,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, cmp_len = make_fixnum (elt_len); if (skip < 0 || !EQ (Fcompare_strings (name, make_fixnum (skip), - cmp_len, + Qnil, elt, zero, cmp_len, Qt), Qt)) continue; @@ -619,7 +619,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, cmp_len = make_fixnum (elt_len); if (skip < 0 || !EQ (Fcompare_strings (name, make_fixnum (skip), - cmp_len, + Qnil, elt, zero, cmp_len, Qt), Qt)) continue; commit 1d4862e8c18aff5e2a59b9fb37e643a389683047 Author: Stephen Gildea Date: Sun Nov 3 18:36:05 2019 -0800 Fix English grammar in some doc strings and comments (files.el subr.el): Fix some grammar errors in doc strings and comments. (frame.c fringe.c image.c xfns.c xterm.c): Fix some English grammar errors in doc strings. diff --git a/lisp/files.el b/lisp/files.el index f6dc4baa7f..7690357058 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -67,7 +67,7 @@ FROM and TO should be equivalent names, which refer to the same directory. TO should be an absolute directory name. Do not use `~' in the TO strings. -Use this feature when you have directories which you normally refer to +Use this feature when you have directories that you normally refer to via absolute symbolic links. Make TO the name of the link, and FROM a regexp matching the name it is linked to." :type '(repeat (cons :format "%v" @@ -123,7 +123,7 @@ This variable is relevant only if `backup-by-copying' is nil." "Non-nil means create backups by copying if this preserves owner or group. Renaming may still be used (subject to control of other variables) when it would not result in changing the owner or group of the file; -that is, for files which are owned by you and whose group matches +that is, for files that are owned by you and whose group matches the default for a new file created there by you. This variable is relevant only if `backup-by-copying' is nil." :version "24.1" @@ -239,7 +239,7 @@ have fast storage with limited space, such as a RAM disk." (concat "^\\([^A-Z[-`a-z]\\|..+\\)?:\\|" ; colon except after drive "[|<>\"?*\000-\037]"))) ; invalid characters (t (purecopy "[\000]"))) - "Regexp recognizing file names which aren't allowed by the filesystem.") + "Regexp recognizing file names that aren't allowed by the filesystem.") (defcustom file-precious-flag nil "Non-nil means protect against I/O errors while saving files. @@ -338,7 +338,7 @@ A value of nil means don't add newlines. Certain major modes set this locally to the value obtained from `mode-require-final-newline'. -This variable is only heeded when visiting files (or saving +This variable is heeded only when visiting files (or saving buffers into files they visit). Writing data to the file system with `write-region' and the like is not influenced by this variable." :safe #'symbolp @@ -504,7 +504,7 @@ for the file's directory." (define-obsolete-variable-alias 'write-file-hooks 'write-file-functions "22.1") (defvar write-file-functions nil "List of functions to be called before saving a buffer to a file. -Only used by `save-buffer'. +Used only by `save-buffer'. If one of them returns non-nil, the file is considered already written and the rest are not called. These hooks are considered to pertain to the visited file. @@ -532,7 +532,7 @@ updates before the buffer is saved, use `before-save-hook'.") (defvar write-contents-functions nil "List of functions to be called before writing out a buffer to a file. -Only used by `save-buffer'. If one of them returns non-nil, the +Used only by `save-buffer'. If one of them returns non-nil, the file is considered already written and the rest are not called and neither are the functions in `write-file-functions'. This hook can thus be used to create save behavior for buffers that @@ -707,7 +707,7 @@ non-empty string that was inserted by this function. (If DEFAULT-DIRNAME is omitted, DIR combined with INITIAL is used, or just DIR if INITIAL is nil.) If the user exits with an empty minibuffer, this function returns -an empty string. (This can only happen if the user erased the +an empty string. (This can happen only if the user erased the pre-inserted contents or if `insert-default-directory' is nil.) Fourth arg MUSTMATCH non-nil means require existing directory's name. Non-nil and non-t means also require confirmation after completion. @@ -934,7 +934,7 @@ one or more of those symbols." ;; entries for the poor soul looking just for "foo". OTOH, sometimes ;; the user does want to pay attention to the extension. We try to ;; diffuse this tension by stripping the suffix, except when the - ;; result is a single element (i.e. usually we only list "foo" unless + ;; result is a single element (i.e. usually we list only "foo" unless ;; it's the only remaining element in the list, in which case we do ;; list "foo", "foo.elc" and "foo.el"). (fullnames '()) @@ -956,11 +956,11 @@ one or more of those symbols." ;; which can cause problems with things like partial-completion. ;; To minimize the problem, filter out completion-regexp-list, so that ;; M-x load-library RET t/x.e TAB finds some files. Also remove elements - ;; from `names' which only matched `string' when they still had + ;; from `names' that matched `string' only when they still had ;; their suffix. (setq names (all-completions string names)) ;; Remove duplicates of the first element, so that we can easily check - ;; if `names' really only contains a single element. + ;; if `names' really contains only a single element. (when (cdr names) (setcdr names (delete (car names) (cdr names)))) (unless (cdr names) ;; There's no more than one matching non-suffixed element, so expand @@ -979,10 +979,10 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)." (defvar locate-dominating-stop-dir-regexp (purecopy "\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'") - "Regexp of directory names which stop the search in `locate-dominating-file'. + "Regexp of directory names that stop the search in `locate-dominating-file'. Any directory whose name matches this regexp will be treated like -a kind of root directory by `locate-dominating-file' which will stop its search -when it bumps into it. +a kind of root directory by `locate-dominating-file', which will stop its +search when it bumps into it. The default regexp prevents fruitless and time-consuming attempts to find special files in directories in which filenames are interpreted as hostnames, or mount points potentially requiring authentication as a different user.") @@ -1051,7 +1051,7 @@ directory if it does not exist." (when (and errtype user-emacs-directory-warning (not (get 'user-emacs-directory-warning 'this-session))) - ;; Only warn once per Emacs session. + ;; Warn only once per Emacs session. (put 'user-emacs-directory-warning 'this-session t) (display-warning 'initialization (format "\ @@ -1065,7 +1065,7 @@ customize the variable `user-emacs-directory-warning'." (defun exec-path () "Return list of directories to search programs to run in remote subprocesses. The remote host is identified by `default-directory'. For remote -hosts which do not support subprocesses, this returns `nil'. +hosts that do not support subprocesses, this returns `nil'. If `default-directory' is a local directory, this function returns the value of the variable `exec-path'." (let ((handler (find-file-name-handler default-directory 'exec-path))) @@ -1114,7 +1114,7 @@ A file is considered remote if accessing it is likely to be slower or less reliable than accessing local files. `file-remote-p' never opens a new remote connection. It can -only reuse a connection that is already open. +reuse only a connection that is already open. Return nil or a string identifying the remote connection \(ideally a prefix of FILE). Return nil if FILE is a relative @@ -1254,7 +1254,7 @@ both at the level of the file and at the level of the directories containing it, until no links are left at any level. \(fn FILENAME)" ;; Don't document the optional arguments. - ;; COUNTER and PREV-DIRS are only used in recursive calls. + ;; COUNTER and PREV-DIRS are used only in recursive calls. ;; COUNTER can be a cons cell whose car is the count of how many ;; more links to chase before getting an error. ;; PREV-DIRS can be a cons cell whose car is an alist @@ -1452,7 +1452,7 @@ constraints do not force a specific format." ;;(concat ;; "^" (regexp-opt '("/afs/" "/media/" "/mnt" "/net/" "/tmp_mnt/")))) "^\\(?:/\\(?:afs/\\|m\\(?:edia/\\|nt\\)\\|\\(?:ne\\|tmp_mn\\)t/\\)\\)") - "File systems which ought to be mounted." + "File systems that ought to be mounted." :group 'files :version "26.1" :require 'regexp-opt @@ -1592,8 +1592,8 @@ use with M-x." (defcustom confirm-nonexistent-file-or-buffer 'after-completion "Whether confirmation is requested before visiting a new file or buffer. If nil, confirmation is not requested. -If the value is `after-completion', confirmation is only - requested if the user called `minibuffer-complete' right before +If the value is `after-completion', confirmation is requested + only if the user called `minibuffer-complete' right before `minibuffer-complete-and-exit'. Any other non-nil value means to request confirmation. @@ -1755,7 +1755,7 @@ expand wildcards (if any) and visit multiple files." (defun find-file-existing (filename) "Edit the existing file FILENAME. -Like \\[find-file], but only allow a file that exists, and do not allow +Like \\[find-file], but allow only a file that exists, and do not allow file names with wildcards." (interactive (nbutlast (find-file-read-args "Find existing file: " t))) (if (and (not (called-interactively-p 'interactive)) @@ -2208,7 +2208,7 @@ the various files." (truename (abbreviate-file-name (file-truename filename))) (attributes (file-attributes truename)) (number (nthcdr 10 attributes)) - ;; Find any buffer for a file which has same truename. + ;; Find any buffer for a file that has same truename. (other (and (not buf) (find-buffer-visiting filename)))) ;; Let user know if there is a buffer with the same truename. (if other @@ -2299,13 +2299,13 @@ the various files." "The file %s is already visited normally, and you have edited the buffer. Now you have asked to visit it literally, meaning no coding system handling, format conversion, or local variables. -Emacs can only visit a file in one way at a time. +Emacs can visit a file in only one way at a time. Do you want to save the file, and visit it literally instead? " "The file %s is already visited literally, meaning no coding system handling, format conversion, or local variables. You have edited the buffer. Now you have asked to visit the file normally, -but Emacs can only visit a file in one way at a time. +but Emacs can visit a file in only one way at a time. Do you want to save the file, and visit it normally instead? ") (file-name-nondirectory filename))) @@ -2330,13 +2330,13 @@ Do you want to discard your changes, and visit the file normally now? "))) "The file %s is already visited normally. You have asked to visit it literally, meaning no coding system decoding, format conversion, or local variables. -But Emacs can only visit a file in one way at a time. +But Emacs can visit a file in only one way at a time. Do you want to revisit the file literally now? " "The file %s is already visited literally, meaning no coding system decoding, format conversion, or local variables. You have asked to visit it normally, -but Emacs can only visit a file in one way at a time. +but Emacs can visit a file in only one way at a time. Do you want to revisit the file normally now? ") (file-name-nondirectory filename))) @@ -2476,7 +2476,7 @@ and local variable specifications in the file are ignored. Automatic uncompression and adding a newline at the end of the file due to `require-final-newline' is also disabled. -If Emacs already has a buffer which is visiting the file, +If Emacs already has a buffer that is visiting the file, this command asks you whether to visit it literally instead. In non-interactive use, the value is the buffer where the file is @@ -3678,7 +3678,7 @@ except that any settings of `mode' are ignored. If HANDLE-MODE is t, all we do is check whether a \"mode:\" is specified, and return the corresponding mode symbol, or nil. -In this case, we try to ignore minor-modes, and only return a +In this case, we try to ignore minor-modes, and return only a major-mode. If `enable-local-variables' or `local-enable-local-variables' is nil, @@ -3908,12 +3908,12 @@ It is dangerous if either of these conditions are met: (cond ((memq prop '(lisp-indent-hook lisp-indent-function scheme-indent-function)) - ;; Only allow safe values (not functions). + ;; Allow only safe values (not functions). (or (numberp val) (and (hack-one-local-variable-quotep val) (eq (nth 1 val) 'defun)))) ((eq prop 'edebug-form-spec) - ;; Only allow indirect form specs. + ;; Allow only indirect form specs. ;; During bootstrapping, edebug-basic-spec might not be ;; defined yet. (and (fboundp 'edebug-basic-spec) @@ -4008,7 +4008,7 @@ Returns the new list." (let* ((variable (car pair)) (value (cdr pair)) (slot (assq variable variables))) - ;; If variables are specified more than once, only use the last. (Why?) + ;; If variables are specified more than once, use only the last. (Why?) ;; The pseudo-variables mode and eval are different (bug#3430). (if (and slot (not (memq variable '(mode eval)))) (setcdr slot value) @@ -4264,7 +4264,7 @@ criteria." (defun dir-locals-read-from-dir (dir) "Load all variables files in DIR and register a new class and instance. -DIR is the absolute name of a directory which must contain at +DIR is the absolute name of a directory, which must contain at least one dir-local file (which is a file holding variables to apply). Return the new class name, which is a symbol named DIR." @@ -5042,7 +5042,7 @@ Uses `backup-directory-alist' in the same way as (defun file-relative-name (filename &optional directory) "Convert FILENAME to be relative to DIRECTORY (default: `default-directory'). -This function returns a relative file name which is equivalent to FILENAME +This function returns a relative file name that is equivalent to FILENAME when used with that default directory as the default. If FILENAME is a relative file name, it will be interpreted as existing in `default-directory'. @@ -5183,14 +5183,14 @@ the last real save, but optional arg FORCE non-nil means delete anyway." (defcustom before-save-hook nil "Normal hook that is run before a buffer is saved to its file. -Only used by `save-buffer'." +Used only by `save-buffer'." :options '(copyright-update time-stamp) :type 'hook :group 'files) (defcustom after-save-hook nil "Normal hook that is run after a buffer is saved to its file. -Only used by `save-buffer'." +Used only by `save-buffer'." :options '(executable-make-buffer-file-executable-if-script-p) :type 'hook :group 'files) @@ -5350,7 +5350,7 @@ Before and after saving the buffer, this function runs (file-name-nondirectory buffer-file-name))) (setq tempsetmodes t) - (error "Attempt to save to a file which you aren't allowed to write")))))) + (error "Attempt to save to a file that you aren't allowed to write")))))) (or buffer-backed-up (setq setmodes (backup-buffer))) (let* ((dir (file-name-directory buffer-file-name)) @@ -5800,7 +5800,7 @@ RECURSIVE if DIRECTORY is nonempty." (handler (funcall handler 'delete-directory directory recursive trash)) ((and delete-by-moving-to-trash trash) - ;; Only move non-empty dir to trash if recursive deletion was + ;; Move non-empty dir to trash only if recursive deletion was ;; requested. This mimics the non-`delete-by-moving-to-trash' ;; case, where the operation fails in delete-directory-internal. ;; As `move-file-to-trash' trashes directories (empty or @@ -5994,7 +5994,7 @@ This function ignores its argument. This returns non-nil if the current buffer is visiting a readable file whose modification time does not match that of the buffer. -This function only handles buffers that are visiting files. +This function handles only buffers that are visiting files. Non-file buffers need a custom function." (and buffer-file-name (file-readable-p buffer-file-name) @@ -6028,7 +6028,7 @@ buffer is sufficient for knowing when that buffer needs to be updated in Auto Revert Mode. Such notification does not include changes to files in that directory, only to the directory itself. -This variable only applies to buffers where `buffer-file-name' is +This variable applies only to buffers where `buffer-file-name' is nil; other buffers are tracked by their files.") (defvar before-revert-hook nil @@ -6062,14 +6062,14 @@ With a prefix argument, offer to revert from latest auto-save file, if that is more recent than the visited file. This command also implements an interface for special buffers -that contain text which doesn't come from a file, but reflects +that contain text that doesn't come from a file, but reflects some other data instead (e.g. Dired buffers, `buffer-list' buffers). This is done via the variable `revert-buffer-function'. In these cases, it should reconstruct the buffer contents from the appropriate data. -When called from Lisp, the first argument is IGNORE-AUTO; only offer -to revert from the auto-save file when this is nil. Note that the +When called from Lisp, the first argument is IGNORE-AUTO; offer to +revert from the auto-save file only when this is nil. Note that the sense of this argument is the reverse of the prefix argument, for the sake of backward compatibility. IGNORE-AUTO is optional, defaulting to nil. @@ -6088,7 +6088,7 @@ to do the work, with arguments IGNORE-AUTO and NOCONFIRM. The default function runs the hooks `before-revert-hook' and `after-revert-hook'." ;; I admit it's odd to reverse the sense of the prefix argument, but - ;; there is a lot of code out there which assumes that the first + ;; there is a lot of code out there that assumes that the first ;; argument should be t to avoid consulting the auto-save file, and ;; there's no straightforward way to encourage authors to notice a ;; reversal of the argument sense. So I'm just changing the user @@ -6109,7 +6109,7 @@ Calls `revert-buffer-insert-file-contents-function' to reread the contents of the visited file, with two arguments: the first is the file name, the second is non-nil if reading an auto-save file. -This function only handles buffers that are visiting files. +This function handles only buffers that are visiting files. Non-file buffers need a custom function." (with-current-buffer (or (buffer-base-buffer (current-buffer)) (current-buffer)) @@ -6507,7 +6507,7 @@ See also `auto-save-file-name-p'." (let ((buffer-name (buffer-name)) (limit 0) file-name) - ;; Restrict the characters used in the file name to those which + ;; Restrict the characters used in the file name to those that ;; are known to be safe on all filesystems, url-encoding the ;; rest. ;; We do this on all platforms, because even if we are not @@ -6641,7 +6641,7 @@ by `sh' are supported." (defun file-expand-wildcards (pattern &optional full) "Expand wildcard pattern PATTERN. -This returns a list of file names which match the pattern. +This returns a list of file names that match the pattern. Files are sorted in `string<' order. If PATTERN is written as an absolute file name, @@ -6725,7 +6725,7 @@ and `list-directory-verbose-switches'." PATTERN is assumed to represent a file-name wildcard suitable for the underlying filesystem. For Unix and GNU/Linux, each character from the set [ \\t\\n;<>&|()\\=`\\='\"#$] is quoted with a backslash; for DOS/Windows, all -the parts of the pattern which don't include wildcard characters are +the parts of the pattern that don't include wildcard characters are quoted with double quotes. This function leaves alone existing quote characters (\\ on Unix and \" @@ -7290,7 +7290,7 @@ only these files will be asked to be saved." file-name-handler-alist)) ;; We depend on being the last handler on the list, -;; so that anything else which does need handling +;; so that anything else that does need handling ;; has been handled already. ;; So it is safe for us to inhibit *all* magic file name handlers for ;; operations, which return a file name. See Bug#29579. @@ -7318,7 +7318,7 @@ only these files will be asked to be saved." (expand-file-name (unhandled-file-name-directory default-directory))) default-directory)) - ;; Get a list of the indices of the args which are file names. + ;; Get a list of the indices of the args that are file names. (file-arg-indices (cdr (or (assq operation '(;; The first seven are special because they @@ -7349,7 +7349,7 @@ only these files will be asked to be saved." (copy-file local-copy) (rename-file local-copy) (copy-directory local-copy) - ;; List the arguments which are filenames. + ;; List the arguments that are filenames. (file-name-completion 0 1) (file-name-all-completions 0 1) (file-equal-p 0 1) @@ -7399,7 +7399,7 @@ only these files will be asked to be saved." ;; We can't use `cl-letf' with `(buffer-local-value)' here ;; because it wouldn't work during bootstrapping. (let ((buffer (current-buffer))) - ;; `unquote-then-quote' is only used for the + ;; `unquote-then-quote' is used only for the ;; `verify-visited-file-modtime' action, which takes a buffer ;; as only optional argument. (with-current-buffer (or (car arguments) buffer) @@ -7593,7 +7593,7 @@ based on existing mode bits, as in \"og+rX-w\"." ;; Trashcan handling. (defcustom trash-directory nil "Directory for `move-file-to-trash' to move files and directories to. -This directory is only used when the function `system-move-file-to-trash' +This directory is used only when the function `system-move-file-to-trash' is not defined. Relative paths are interpreted relative to `default-directory'. If the value is nil, Emacs uses a freedesktop.org-style trashcan." @@ -7616,8 +7616,8 @@ If the function `system-move-file-to-trash' is defined, call it Otherwise, if `trash-directory' is non-nil, move FILENAME to that directory. Otherwise, trash FILENAME using the freedesktop.org conventions, - like the GNOME, KDE and XFCE desktop environments. Emacs only - moves files to \"home trash\", ignoring per-volume trashcans." + like the GNOME, KDE and XFCE desktop environments. Emacs moves + files only to \"home trash\", ignoring per-volume trashcans." (interactive "fMove file to trash: ") ;; If `system-move-file-to-trash' is defined, use it. (cond ((fboundp 'system-move-file-to-trash) diff --git a/lisp/subr.el b/lisp/subr.el index b408ef0931..03cf3da278 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -185,7 +185,7 @@ buffer-local wherever it is set." (defmacro push (newelt place) "Add NEWELT to the list stored in the generalized variable PLACE. This is morally equivalent to (setf PLACE (cons NEWELT PLACE)), -except that PLACE is only evaluated once (after NEWELT)." +except that PLACE is evaluated only once (after NEWELT)." (declare (debug (form gv-place))) (if (symbolp place) ;; Important special case, to avoid triggering GV too early in @@ -696,7 +696,7 @@ non-nil." "Return a sequence of numbers from FROM to TO (both inclusive) as a list. INC is the increment used between numbers in the sequence and defaults to 1. So, the Nth element of the list is (+ FROM (* N INC)) where N counts from -zero. TO is only included if there is an N for which TO = FROM + N * INC. +zero. TO is included only if there is an N for which TO = FROM + N * INC. If TO is nil or numerically equal to FROM, return (FROM). If INC is positive and TO is less than FROM, or INC is negative and TO is larger than FROM, return nil. @@ -892,7 +892,7 @@ This is the same format used for saving keyboard macros (see `edmacro-mode'). For an approximate inverse of this, see `key-description'." - ;; Don't use a defalias, since the `pure' property is only true for + ;; Don't use a defalias, since the `pure' property is true only for ;; the calling convention of `kbd'. (read-kbd-macro keys)) (put 'kbd 'pure t) @@ -955,7 +955,7 @@ AFTER should be a single event type--a symbol or a character, not a sequence. Bindings are always added before any inherited map. -The order of bindings in a keymap only matters when it is used as +The order of bindings in a keymap matters only when it is used as a menu, so this function is not useful for non-menu keymaps." (unless after (setq after t)) (or (keymapp keymap) @@ -1169,7 +1169,7 @@ KEY is a string or vector representing a sequence of keystrokes." "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF. In other words, OLDDEF is replaced with NEWDEF wherever it appears. Alternatively, if optional fourth argument OLDMAP is specified, we redefine -in KEYMAP as NEWDEF those keys which are defined as OLDDEF in OLDMAP. +in KEYMAP as NEWDEF those keys that are defined as OLDDEF in OLDMAP. If you don't specify OLDMAP, you can usually get the same results in a cleaner way with command remapping, like this: @@ -1241,7 +1241,7 @@ in a cleaner way with command remapping, like this: (defvar global-map nil "Default global keymap mapping Emacs keyboard input into commands. -The value is a keymap which is usually (but not necessarily) Emacs's +The value is a keymap that is usually (but not necessarily) Emacs's global map.") (defvar esc-map nil @@ -1611,7 +1611,7 @@ be a list of the form returned by `event-start' and `event-end'." "expect it to be removed in a future version." "25.2") ;; This was introduced in 21.4 for pre-unicode unification. That -;; usage was rendered obsolete in 23.1 which uses Unicode internally. +;; usage was rendered obsolete in 23.1, which uses Unicode internally. ;; Other uses are possible, so this variable is not _really_ obsolete, ;; but Stefan insists to mark it so. (make-obsolete-variable 'translation-table-for-input nil "23.1") @@ -1761,12 +1761,12 @@ the hook's buffer-local value rather than its default value." (defmacro letrec (binders &rest body) "Bind variables according to BINDERS then eval BODY. The value of the last form in BODY is returned. -Each element of BINDERS is a list (SYMBOL VALUEFORM) which binds +Each element of BINDERS is a list (SYMBOL VALUEFORM) that binds SYMBOL to the value of VALUEFORM. The main difference between this macro and `let'/`let*' is that all symbols are bound before any of the VALUEFORMs are evalled." - ;; Only useful in lexical-binding mode. + ;; Useful only in lexical-binding mode. ;; As a special-form, we could implement it more efficiently (and cleanly, ;; making the vars actually unbound during evaluation of the binders). (declare (debug let) (indent 1)) @@ -1871,7 +1871,7 @@ can do the job." (msg (format-message "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'" sym)) - ;; Big ugly hack so we only output a warning during + ;; Big ugly hack, so we output a warning only during ;; byte-compilation, and so we can use ;; byte-compile-not-lexical-var-p to silence the warning ;; when a defvar has been seen but not yet executed. @@ -2046,7 +2046,7 @@ running their FOO-mode-hook." "Execute BODY, but delay any `run-mode-hooks'. These hooks will be executed by the first following call to `run-mode-hooks' that occurs outside any `delay-mode-hooks' form. -Only affects hooks run in the current buffer." +Affects only hooks run in the current buffer." (declare (debug t) (indent 0)) `(progn (make-local-variable 'delay-mode-hooks) @@ -2118,7 +2118,7 @@ tho trying to avoid AVOIDED-MODES." This is an XEmacs-compatibility function. Use `define-minor-mode' instead. -TOGGLE is a symbol which is the name of a buffer-local variable that +TOGGLE is a symbol that is the name of a buffer-local variable that is toggled on or off to say whether the minor mode is active or not. NAME specifies what will appear in the mode line when the minor mode @@ -2405,9 +2405,9 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." ;; Wait long enough that Emacs has the time to receive and ;; process all the raw events associated with the single-key. ;; But don't wait too long, or the user may find the delay - ;; annoying (or keep hitting more keys which may then get + ;; annoying (or keep hitting more keys, which may then get ;; lost or misinterpreted). - ;; This is only relevant for keys which Emacs perceives as + ;; This is relevant only for keys that Emacs perceives as ;; "prefixes", such as C-x (because of the C-x 8 map in ;; key-translate-table and the C-x @ map in function-key-map) ;; or ESC (because of terminal escape sequences in @@ -3168,7 +3168,7 @@ alternatives." (defun function-get (f prop &optional autoload) "Return the value of property PROP of function F. If AUTOLOAD is non-nil and F is autoloaded, try to autoload it -in the hope that it will set PROP. If AUTOLOAD is `macro', only do it +in the hope that it will set PROP. If AUTOLOAD is `macro', do it only if it's an autoloaded macro." (let ((val nil)) (while (and (symbolp f) @@ -3664,7 +3664,7 @@ See also `with-temp-file' and `with-output-to-string'." (defmacro with-silent-modifications (&rest body) "Execute BODY, pretending it does not modify the buffer. This macro is typically used around modifications of -text properties which do not really affect the buffer's content. +text properties that do not really affect the buffer's content. If BODY performs real modifications to the buffer's text, other than cosmetic ones, undo data may become corrupted. @@ -3776,8 +3776,8 @@ FORMAT is a string passed to `message' to format any error message. It should contain a single %-sequence; e.g., \"Error: %S\". If `debug-on-error' is non-nil, run BODY without catching its errors. -This is to be used around code which is not expected to signal an error -but which should be robust in the unexpected case that an error is signaled. +This is to be used around code that is not expected to signal an error +but that should be robust in the unexpected case that an error is signaled. For backward compatibility, if FORMAT is not a constant string, it is assumed to be part of BODY, in which case the message format @@ -4139,7 +4139,7 @@ the substrings between the splitting points are collected as a list, which is returned. If SEPARATORS is non-nil, it should be a regular expression matching text -which separates, but is not part of, the substrings. If nil it defaults to +that separates, but is not part of, the substrings. If nil it defaults to `split-string-default-separators', normally \"[ \\f\\t\\n\\r\\v]+\", and OMIT-NULLS is forced to t. @@ -4282,7 +4282,7 @@ and replace a sub-expression, e.g. ;; To avoid excessive consing from multiple matches in long strings, ;; don't just call `replace-match' continually. Walk down the ;; string looking for matches of REGEXP and building up a (reversed) - ;; list MATCHES. This comprises segments of STRING which weren't + ;; list MATCHES. This comprises segments of STRING that weren't ;; matched interspersed with replacements for segments that were. ;; [For a `large' number of replacements it's more efficient to ;; operate in a temporary buffer; we can't tell from the function's @@ -4298,7 +4298,7 @@ and replace a sub-expression, e.g. ;; If we matched the empty string, make sure we advance by one char (when (= me mb) (setq me (min l (1+ mb)))) ;; Generate a replacement for the matched substring. - ;; Operate only on the substring to minimize string consing. + ;; Operate on only the substring to minimize string consing. ;; Set up match data for the substring for replacement; ;; presumably this is likely to be faster than munging the ;; match data directly in Lisp. @@ -4339,7 +4339,7 @@ attention to case differences." Normally, inserting a string with right-to-left (RTL) script into a buffer may cause some subsequent text to be displayed as part of the RTL segment (usually this affects punctuation characters). -This function returns a string which displays as STR but forces +This function returns a string that displays as STR but forces subsequent text to be displayed as left-to-right. If STR contains any RTL character, this function returns a string @@ -4555,7 +4555,7 @@ Used from `delayed-warnings-hook' (which see)." (push warning collapsed))) (setq delayed-warnings-list (nreverse collapsed)))) -;; At present this is only used for Emacs internals. +;; At present this is used only for Emacs internals. ;; Ref https://lists.gnu.org/r/emacs-devel/2012-02/msg00085.html (defvar delayed-warnings-hook '(collapse-delayed-warnings display-delayed-warnings) @@ -4621,7 +4621,7 @@ Value is what BODY returns." (defun make-syntax-table (&optional oldtable) "Return a new syntax table. -Create a syntax table which inherits from OLDTABLE (if non-nil) or +Create a syntax table that inherits from OLDTABLE (if non-nil) or from `standard-syntax-table' otherwise." (let ((table (make-char-table 'syntax-table nil))) (set-char-table-parent table (or oldtable (standard-syntax-table))) @@ -4640,7 +4640,7 @@ If POS is outside the buffer's accessible portion, return nil." "Return the code for the syntax class described by SYNTAX. SYNTAX should be a raw syntax descriptor; the return value is a -integer which encodes the corresponding syntax class. See Info +integer that encodes the corresponding syntax class. See Info node `(elisp)Syntax Table Internals' for a list of codes. If SYNTAX is nil, return nil." @@ -4911,7 +4911,7 @@ the number of frames to skip (minus 1).") (defun called-interactively-p (&optional kind) "Return t if the containing function was called by `call-interactively'. -If KIND is `interactive', then only return t if the call was made +If KIND is `interactive', then return t only if the call was made interactively by the user, i.e. not in `noninteractive' mode nor when `executing-kbd-macro'. If KIND is `any', on the other hand, it will return t for any kind of @@ -5044,9 +5044,9 @@ if it returns non-nil, then MAP stays active. Optional arg ON-EXIT, if non-nil, specifies a function that is called, with no arguments, after MAP is deactivated. -This uses `overriding-terminal-local-map' which takes precedence over all other -keymaps. As usual, if no match for a key is found in MAP, the normal key -lookup sequence then continues. +This uses `overriding-terminal-local-map', which takes precedence over all +other keymaps. As usual, if no match for a key is found in MAP, the normal +key lookup sequence then continues. This returns an \"exit function\", which can be called with no argument to deactivate this transient map, regardless of KEEP-PRED." @@ -5224,7 +5224,7 @@ NEW-MESSAGE, if non-nil, sets a new message for the reporter." max-value)) (when (integerp value) (setcar reporter (ceiling (car reporter)))) - ;; Only print message if enough time has passed + ;; Print message only if enough time has passed (when enough-time-passed (if suffix (aset parameters 6 suffix) diff --git a/src/frame.c b/src/frame.c index 8ca5106cb2..486d025e6d 100644 --- a/src/frame.c +++ b/src/frame.c @@ -6120,7 +6120,7 @@ which need to do mouse handling at the Lisp level. */); DEFVAR_LISP ("mouse-highlight", Vmouse_highlight, doc: /* If non-nil, clickable text is highlighted when mouse is over it. -If the value is an integer, highlighting is only shown after moving the +If the value is an integer, highlighting is shown only after moving the mouse, while keyboard input turns off the highlight even when the mouse is over the clickable text. However, the mouse shape still indicates when the mouse is over clickable text. */); diff --git a/src/fringe.c b/src/fringe.c index 08bf271ed5..ded7c44e90 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1716,8 +1716,8 @@ syms_of_fringe (void) DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe, doc: /* Non-nil means that newline may flow into the right fringe. -This means that display lines which are exactly as wide as the window -\(not counting the final newline) will only occupy one screen line, by +This means that display lines that are exactly as wide as the window +\(not counting the final newline) will occupy only one screen line, by showing (or hiding) the final newline in the right fringe; when point is at the final newline, the cursor is shown in the right fringe. If nil, also continue lines which are exactly as wide as the window. */); diff --git a/src/image.c b/src/image.c index 08e420837a..870f008b14 100644 --- a/src/image.c +++ b/src/image.c @@ -1758,7 +1758,7 @@ DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, doc: /* Clear the image cache. FILTER nil or a frame means clear all images in the selected frame. FILTER t means clear the image caches of all frames. -Anything else, means only clear those images which refer to FILTER, +Anything else means clear only those images that refer to FILTER, which is then usually a filename. */) (Lisp_Object filter) { @@ -10055,7 +10055,7 @@ DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0, doc: /* Initialize image library implementing image type TYPE. Return t if TYPE is a supported image type. -If image libraries are loaded dynamically (currently only the case on +If image libraries are loaded dynamically (currently the case only on MS-Windows), load the library for TYPE if it is not yet loaded, using the library file(s) specified by `dynamic-library-alist'. */) (Lisp_Object type) diff --git a/src/xfns.c b/src/xfns.c index 20e63a2650..b1b40702c2 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1,4 +1,4 @@ -/* Functions for the X window system. +/* Functions for the X Window System. Copyright (C) 1989, 1992-2019 Free Software Foundation, Inc. @@ -5351,8 +5351,8 @@ and width values are in pixels. FRAME. `outer-border-width' is the width of the X border of FRAME. The X - border is usually only shown for frames without window manager - decorations like child and tooltip frames. */) + border is usually shown only for frames without window manager + decorations, such as child and tooltip frames. */) (Lisp_Object frame) { return frame_geometry (frame, Qnil); @@ -5787,7 +5787,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, doc: /* If ON is non-nil, report X errors as soon as the erring request is made. -This function only has an effect on X Windows. With MS Windows, it is +This function has an effect only on X Windows. With MS Windows, it is defined but does nothing. If ON is nil, allow buffering of requests. @@ -7365,9 +7365,9 @@ Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file selection box, if specified. If MUSTMATCH is non-nil, the returned file or directory must exist. -This function is only defined on NS, MS Windows, and X Windows with the +This function is defined only on NS, MS Windows, and X Windows with the Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. -Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. +Otherwise, if ONLY-DIR-P is non-nil, the user can select only directories. On MS Windows 7 and later, the file selection dialog "remembers" the last directory where the user selected a file, and will open that directory instead of DIR on subsequent invocations of this function with the same diff --git a/src/xterm.c b/src/xterm.c index 045589534f..44fbd27b11 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13636,7 +13636,7 @@ baseline level. The default value is nil. */); DEFVAR_BOOL ("x-mouse-click-focus-ignore-position", x_mouse_click_focus_ignore_position, doc: /* Non-nil means that a mouse click to focus a frame does not move point. -This variable is only used when the window manager requires that you +This variable is used only when the window manager requires that you click on a frame to select it (give it focus). In that case, a value of nil, means that the selected window and cursor position changes to reflect the mouse click position, while a non-nil value means that the commit 8ae7c8866d01d792127591a56221f382692d2571 Author: Paul Eggert Date: Sun Nov 3 17:38:13 2019 -0800 Improve time documentation a bit more * doc/lispref/os.texi (Time of Day, Time Conversion) (Time Parsing, Time Calculations): Improve doc. diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index d3ddee251b..97edcc392a 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1283,20 +1283,20 @@ warnings are intended to be removed in a future Emacs version.} @item A list of four integers @code{(@var{high} @var{low} @var{micro} -@var{pico})}, where 0 @leq{} @var{low} < 65536, 0 @leq{} @var{micro} < -1000000, and 0 @leq{} @var{pico} < 1000000. +@var{pico})}, where 0@leq{}@var{low}<65536, +0@leq{}@var{micro}<1000000, and 0@leq{}@var{pico}<1000000. This represents the number of seconds using the formula: @ifnottex @var{high} * 2**16 + @var{low} + @var{micro} * 10**@minus{}6 + @var{pico} * 10**@minus{}12. @end ifnottex @tex -$high*2^{16} + low + micro*10^{-6} + pico*10^{-12}$. +$high \times 2^{16} + low + micro \times 10^{-6} + pico \times 10^{-12}$. @end tex In some cases, functions may default to returning two- or -three-element lists, with omitted @var{microsec} and @var{picosec} +three-element lists, with omitted @var{micro} and @var{pico} components defaulting to zero. -On all current machines @var{picosec} is a multiple of 1000, but this +On all current machines @var{pico} is a multiple of 1000, but this may change as higher-resolution clocks become available. @end itemize @@ -1309,9 +1309,11 @@ time, a single floating-point number for seconds, or a list @var{low})} that is a truncated list timestamp with missing elements taken to be zero. +@cindex Specified time is not representable Time values can be converted to and from calendrical and other forms. Some of these conversions rely on operating system functions that -limit the range of possible time values, and signal an error if the +limit the range of possible time values, and signal an error such as +@samp{"Specified time is not representable"} if the limits are exceeded. For instance, a system may not support years before 1970, or years before 1901, or years far in the future. You can convert a time value into @@ -1642,7 +1644,7 @@ convention, @var{zone} defaults to the current time zone rule Year numbers less than 100 are not treated specially. If you want them to stand for years above 1900, or years above 2000, you must alter them yourself before you call @code{encode-time}. -The operating system limits the range of time values. +The operating system limits the range of time and zone values. The @code{encode-time} function acts as a rough inverse to @code{decode-time}. For example, you can pass the output of @@ -1671,9 +1673,9 @@ Time values include @code{nil}, numbers, and Lisp timestamps This function parses the time-string @var{string} and returns the corresponding Lisp timestamp. The argument @var{string} should represent a date-time, and should be in one of the forms recognized by -@code{parse-time-string} (see below). This function assumes the GMT -timezone if @var{string} lacks an explicit timezone information. -The operating system limits the range of time values. +@code{parse-time-string} (see below). This function assumes Universal +Time if @var{string} lacks explicit time zone information. +The operating system limits the range of time and zone values. @end defun @defun parse-time-string string @@ -1697,7 +1699,7 @@ less well-formed time strings as well. @vindex ISO 8601 date/time strings @defun iso8601-parse string For a more strict function (that will error out upon invalid input), -this function can be used instead. It's able to parse all variants of +this function can be used instead. It can parse all variants of the ISO 8601 standard, so in addition to the formats mentioned above, it also parses things like ``1998W45-3'' (week number) and ``1998-245'' (ordinal day number). To parse durations, there's @@ -1999,13 +2001,14 @@ Here is how to add a number of seconds to a time value: @defun time-to-days time-value This function returns the number of days between the beginning of year -1 and @var{time-value}. -The operating system limits the range of time values. +1 and @var{time-value}, assuming the default time zone. +The operating system limits the range of time and zone values. @end defun @defun time-to-day-in-year time-value -This returns the day number within the year corresponding to @var{time-value}. -The operating system limits the range of time values. +This returns the day number within the year corresponding to @var{time-value}, +assuming the default time zone. +The operating system limits the range of time and zone values. @end defun @defun date-leap-year-p year commit 58fde6362f88e1d943ae033bda31becc67892112 Author: Juri Linkov Date: Sun Nov 3 23:52:23 2019 +0200 * lisp/help-fns.el (describe-variable): Add quotes to symbol value of origval. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 235aa9a6e1..14dea7de9b 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1018,7 +1018,11 @@ it is displayed along with the global value." (not (equal origval :help-eval-error))) (princ "\nOriginal value was \n") (setq from (point)) - (cl-prin1 origval) + (if (and (symbolp origval) (not (booleanp origval))) + (let* ((rep (cl-prin1-to-string origval)) + (print-rep (format-message "`%s'" rep))) + (insert print-rep)) + (cl-prin1 origval)) (save-restriction (narrow-to-region from (point)) (save-excursion (pp-buffer))) commit da087965f294bacf178892e81cb3d3e89e341029 Author: Juri Linkov Date: Sun Nov 3 23:48:53 2019 +0200 * lisp/tab-bar.el: Better handling of tab-bar-history. * lisp/tab-bar.el (tab-bar-history-limit): Increase to 10 since wc is not saved to the desktop file anymore, so doesn't affect its size. (tab-bar-history--pre-change, tab-bar--history-change): Store wc before possibly entering the minibuffer. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 1a0ac26f68..8777e20807 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -345,6 +345,7 @@ Also add the number of windows in the window configuration." 'nomini))) ", ")) + (defvar tab-bar-tabs-function #'tab-bar-tabs "Function to get a list of tabs to display in the tab bar. This function should return a list of alists with parameters @@ -372,6 +373,7 @@ Return its existing value or a new value." (set-frame-parameter nil 'tabs tabs)) tabs)) + (defun tab-bar-make-keymap-1 () "Generate an actual keymap from `tab-bar-map', without caching." (let* ((separator (or tab-bar-separator (if window-system " " "|"))) @@ -628,7 +630,7 @@ FROM-INDEX and TO-INDEX count from 1." (let* ((tabs (funcall tab-bar-tabs-function)) (from-index (or from-index (1+ (tab-bar--current-tab-index tabs)))) (from-tab (nth (1- from-index) tabs)) - (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) + (to-index (max 0 (min (1- (or to-index 1)) (1- (length tabs)))))) (setq tabs (delq from-tab tabs)) (cl-pushnew from-tab (nthcdr to-index tabs)) (set-frame-parameter nil 'tabs tabs) @@ -909,7 +911,7 @@ function `tab-bar-tab-name-function'." ;;; Tab history mode -(defvar tab-bar-history-limit 3 +(defvar tab-bar-history-limit 10 "The number of history elements to keep.") (defvar tab-bar-history-omit nil @@ -928,18 +930,18 @@ function `tab-bar-tab-name-function'." "Minibuffer depth before the current command.") (defun tab-bar-history--pre-change () - (setq tab-bar-history--minibuffer-depth (minibuffer-depth) - tab-bar-history-current - `((wc . ,(current-window-configuration)) - (wc-point . ,(point-marker))))) + (setq tab-bar-history--minibuffer-depth (minibuffer-depth)) + ;; Store wc before possibly entering the minibuffer + (when (zerop tab-bar-history--minibuffer-depth) + (setq tab-bar-history-current + `((wc . ,(current-window-configuration)) + (wc-point . ,(point-marker)))))) (defun tab-bar--history-change () (when (and (not tab-bar-history-omit) tab-bar-history-current - ;; Entering the minibuffer - (zerop tab-bar-history--minibuffer-depth) - ;; Exiting the minibuffer - (zerop (minibuffer-depth))) + ;; Store wc before possibly entering the minibuffer + (zerop tab-bar-history--minibuffer-depth)) (puthash (selected-frame) (seq-take (cons tab-bar-history-current (gethash (selected-frame) tab-bar-history-back)) commit c472df8ad30741a9585fb591db3189812b66e8c9 Author: Juri Linkov Date: Sun Nov 3 23:44:44 2019 +0200 * lisp/tab-bar.el: Filter out non-persistent tab parameters from frameset. * lisp/tab-bar.el (frameset-filter-tabs): New function added to 'frameset-filter-alist' for frame parameter 'tabs'. (tab-bar--tab): Remove ws-bl/ws-bbl that are not needed because frameset doesn't save frame buffer-list to desktop anyway. (tab-bar-select-tab): Remove ws-bl/ws-bbl related code. * lisp/emacs-lisp/seq.el (seq-reduce): Add autoload cookie. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 810b4792b2..2fd735617b 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -323,6 +323,7 @@ list." (seq-filter (lambda (elt) (not (funcall pred elt))) sequence)) +;;;###autoload (cl-defgeneric seq-reduce (function sequence initial-value) "Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index ef58e9060b..1a0ac26f68 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -436,6 +436,25 @@ Return its existing value or a new value." :help "New tab")))))) +;; Some window-configuration parameters don't need to be persistent. +;; Don't save to the desktop file such tab parameters that are saved +;; as "Unprintable entity" so can't be used after restoring the desktop. +;; Actually tab-bar-select-tab already can handle unprintable entities, +;; but it's better not to waste the desktop file with useless data. +(defun frameset-filter-tabs (current _filtered _parameters saving) + (if saving + (mapcar (lambda (current) + (if (consp current) + (seq-reduce (lambda (current param) + (assq-delete-all param current)) + '(wc wc-point wc-bl wc-bbl wc-history-back wc-history-forward) + (copy-sequence current)) + current)) + current) + current)) + +(push '(tabs . frameset-filter-tabs) frameset-filter-alist) + (defun tab-bar--tab () (let* ((tab (assq 'current-tab (frame-parameter nil 'tabs))) (tab-explicit-name (cdr (assq 'explicit-name tab))) @@ -447,16 +466,14 @@ Return its existing value or a new value." (funcall tab-bar-tab-name-function))) (explicit-name . ,tab-explicit-name) (time . ,(time-convert nil 'integer)) + (ws . ,(window-state-get + (frame-root-window (selected-frame)) 'writable)) (wc . ,(current-window-configuration)) (wc-point . ,(point-marker)) (wc-bl . ,bl) (wc-bbl . ,bbl) (wc-history-back . ,(gethash (selected-frame) tab-bar-history-back)) - (wc-history-forward . ,(gethash (selected-frame) tab-bar-history-forward)) - (ws . ,(window-state-get - (frame-root-window (selected-frame)) 'writable)) - (ws-bl . ,(mapcar #'buffer-name bl)) - (ws-bbl . ,(mapcar #'buffer-name bbl))))) + (wc-history-forward . ,(gethash (selected-frame) tab-bar-history-forward))))) (defun tab-bar--current-tab (&optional tab) ;; `tab` here is an argument meaning 'use tab as template'. This is @@ -555,14 +572,7 @@ to the numeric argument. ARG counts from 1." tab-bar-history-forward))) (ws - (window-state-put ws (frame-root-window (selected-frame)) 'safe) - - (let ((ws-bl (seq-filter #'buffer-live-p - (mapcar #'get-buffer (cdr (assq 'ws-bl to-tab))))) - (ws-bbl (seq-filter #'buffer-live-p - (mapcar #'get-buffer (cdr (assq 'ws-bbl to-tab)))))) - (when ws-bl (set-frame-parameter nil 'buffer-list ws-bl)) - (when ws-bbl (set-frame-parameter nil 'buried-buffer-list ws-bbl))))) + (window-state-put ws (frame-root-window (selected-frame)) 'safe))) (setq tab-bar-history-omit t) commit 84a3793b194efe92e2eb80cd0f625f3324bf4cae Author: Stefan Kangas Date: Sun Nov 3 17:45:48 2019 +0100 Handle truncate-lines in customize-group * lisp/cus-edit.el (custom-group--draw-horizontal-line): New function to draw horizontal lines which handles a non-nil value of 'truncate-lines'. (Bug#25308) (custom-group-value-create): Use it. Co-authored-by: Jonas Bernoulli diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index b9fd3e0a2d..081d4c9213 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -4062,6 +4062,22 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." (push entry members))) (nreverse members)))) +(defun custom-group--draw-horizontal-line () + "Draw a horizontal line at point. +This works for both graphical and text displays." + (let ((p (point))) + (insert "\n") + (put-text-property p (1+ p) 'face '(:underline t)) + (overlay-put (make-overlay p (1+ p)) + 'before-string + (propertize "\n" 'face '(:underline t) + 'display + (list 'space :align-to + `(+ (0 . right) + ,(min (window-hscroll) + (- (line-end-position) + (line-beginning-position))))))))) + (defun custom-group-value-create (widget) "Insert a customize group for WIDGET in the current buffer." (unless (eq (widget-get widget :custom-state) 'hidden) @@ -4188,15 +4204,7 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." ;; Nested style. (t ;Visible. - ;; Draw a horizontal line (this works for both graphical - ;; and text displays): - (let ((p (point))) - (insert "\n") - (put-text-property p (1+ p) 'face '(:underline t)) - (overlay-put (make-overlay p (1+ p)) - 'before-string - (propertize "\n" 'face '(:underline t) - 'display '(space :align-to 999)))) + (custom-group--draw-horizontal-line) ;; Add parent groups references above the group. (when (eq level 1) @@ -4287,13 +4295,7 @@ If GROUPS-ONLY is non-nil, return only those members that are groups." (widget-put widget :children children) (custom-group-state-update widget)) ;; End line - (let ((p (1+ (point)))) - (insert "\n\n") - (put-text-property p (1+ p) 'face '(:underline t)) - (overlay-put (make-overlay p (1+ p)) - 'before-string - (propertize "\n" 'face '(:underline t) - 'display '(space :align-to 999)))))))) + (custom-group--draw-horizontal-line))))) (defvar custom-group-menu `(("Set for Current Session" custom-group-set commit fc6f1f59fe6b49612cdc1963f9078d062b83fdc7 Author: Lars Ingebrigtsen Date: Sun Nov 3 17:19:26 2019 +0100 Fix doc of font-lock-syntactic-face-function * doc/lispref/modes.texi (Syntactic Font Lock): Don't refer to no-longer-existing OTHER-VARS (bug#17730) and include an example. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index fda5a106bb..b7e574740a 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3381,13 +3381,23 @@ Table Functions}). @defvar font-lock-syntactic-face-function If this variable is non-@code{nil}, it should be a function to determine which face to use for a given syntactic element (a string or a comment). -The value is normally set through an @var{other-vars} element in -@code{font-lock-defaults}. The function is called with one argument, the parse state at point returned by @code{parse-partial-sexp}, and should return a face. The default value returns @code{font-lock-comment-face} for comments and -@code{font-lock-string-face} for strings (@pxref{Faces for Font Lock}). +@code{font-lock-string-face} for strings (@pxref{Faces for Font +Lock}). + +This variable is normally set through the ``other'' elements in +@code{font-lock-defaults}: + +@lisp +(setq-local font-lock-defaults + `(,python-font-lock-keywords + nil nil nil nil + (font-lock-syntactic-face-function + . python-font-lock-syntactic-face-function))) +@end lisp @end defvar @node Multiline Font Lock commit 2ad06e28e34924bdb08df9cf9e385ab4451c1274 Author: Eli Zaretskii Date: Sun Nov 3 18:13:38 2019 +0200 Fix file-tests.el on MS-Windows * test/lisp/files-tests.el (files-tests-file-name-non-special-start-file-process): On MS-Windows, wait till the process dies before returning from the files-tests--with-temp-non-special macro, to ensure the temporary directory is successfully deleted. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 60387e1ab2..d73c6a7842 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1052,7 +1052,13 @@ unquoted file names." (should (search-forward emacs-version nil t)) ;; Don't stop the test run with a query, as the subprocess ;; may or may not be dead by the time we reach here. - (set-process-query-on-exit-flag proc nil))))) + (set-process-query-on-exit-flag proc nil) + ;; On MS-Windows, wait for the process to die, since the OS + ;; will not let us delete a directory that is the cwd of a + ;; running process. + (when (eq system-type 'windows-nt) + (while (process-live-p proc) + (sleep-for 0.1))))))) (files-tests--with-temp-non-special-and-file-name-handler (tmpdir nospecial-dir t) (with-temp-buffer commit 0b21ecdb5ea9db8cf7a4a4ee59b29bf6273f2915 Author: Eli Zaretskii Date: Sun Nov 3 18:08:45 2019 +0200 Fix case-insensitive completion of non-ASCII file names * src/dired.c (scmp): Comment on (non)applicability to comparisons of non-ASCII strings case-insensitively. (file_name_completion): Decode early the file names read from the directory, and use the decoded names for comparison when letter-case should be ignored. (Bug#11339) diff --git a/src/dired.c b/src/dired.c index 3768b6dbb7..0e1c88f03c 100644 --- a/src/dired.c +++ b/src/dired.c @@ -481,18 +481,32 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, record_unwind_protect_ptr (directory_files_internal_unwind, d); /* Loop reading directory entries. */ + Lisp_Object zero = make_fixnum (0); + ptrdiff_t enc_file_len = SCHARS (encoded_file); + Lisp_Object file_len = make_fixnum (SCHARS (file)); for (struct dirent *dp; (dp = read_dirent (d, dirname)); ) { ptrdiff_t len = dirent_namelen (dp); bool canexclude = 0; maybe_quit (); - if (len < SCHARS (encoded_file) - || (scmp (dp->d_name, SSDATA (encoded_file), - SCHARS (encoded_file)) - >= 0)) + + if (len < enc_file_len + /* scmp cannot reliably compare non-ASCII strings while + ignoring letter-case. */ + || (!completion_ignore_case + && scmp (dp->d_name, SSDATA (encoded_file), enc_file_len) >= 0)) continue; + name = make_unibyte_string (dp->d_name, len); + name = DECODE_FILE (name); + ptrdiff_t name_blen = SBYTES (name), name_len = SCHARS (name); + if (completion_ignore_case + && !EQ (Fcompare_strings (name, zero, file_len, file, zero, file_len, + Qt), + Qt)) + continue; + switch (dirent_type (dp)) { case DT_DIR: @@ -515,6 +529,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, if (!all_flag) { ptrdiff_t skip; + Lisp_Object cmp_len = make_fixnum (name_len); #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */ /* If this entry matches the current bestmatch, the only @@ -538,7 +553,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, actually in the way in a directory with only one file. */ if (TRIVIAL_DIRECTORY_ENTRY (dp->d_name)) canexclude = 1; - else if (len > SCHARS (encoded_file)) + else if (len > enc_file_len) /* Ignore directories if they match an element of completion-ignored-extensions which ends in a slash. */ for (tem = Vcompletion_ignored_extensions; @@ -550,21 +565,31 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, elt = XCAR (tem); if (!STRINGP (elt)) continue; - /* Need to encode ELT, since scmp compares unibyte - strings only. */ - elt = ENCODE_FILE (elt); - elt_len = SCHARS (elt) - 1; /* -1 for trailing / */ + elt_len = SBYTES (elt) - 1; /* -1 for trailing / */ if (elt_len <= 0) continue; p1 = SSDATA (elt); if (p1[elt_len] != '/') continue; - skip = len - elt_len; + skip = name_blen - elt_len; if (skip < 0) continue; - if (scmp (dp->d_name + skip, p1, elt_len) >= 0) + if (!completion_ignore_case + && scmp (SSDATA (name) + skip, p1, elt_len) >= 0) continue; + if (completion_ignore_case) + { + elt_len = SCHARS (elt) - 1; + skip = name_len - elt_len; + cmp_len = make_fixnum (elt_len); + if (skip < 0 + || !EQ (Fcompare_strings (name, make_fixnum (skip), + cmp_len, + elt, zero, cmp_len, Qt), + Qt)) + continue; + } break; } } @@ -572,22 +597,33 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, { /* Compare extensions-to-be-ignored against end of this file name */ /* if name is not an exact match against specified string */ - if (len > SCHARS (encoded_file)) + if (len > enc_file_len) /* and exit this for loop if a match is found */ for (tem = Vcompletion_ignored_extensions; CONSP (tem); tem = XCDR (tem)) { elt = XCAR (tem); if (!STRINGP (elt)) continue; - /* Need to encode ELT, since scmp compares unibyte - strings only. */ - elt = ENCODE_FILE (elt); - skip = len - SCHARS (elt); + ptrdiff_t elt_len = SBYTES (elt); + skip = len - elt_len; if (skip < 0) continue; - if (scmp (dp->d_name + skip, SSDATA (elt), SCHARS (elt)) - >= 0) + if (!completion_ignore_case + && (scmp (SSDATA (name) + skip, SSDATA (elt), elt_len) + >= 0)) continue; + if (completion_ignore_case) + { + elt_len = SCHARS (elt); + skip = name_len - elt_len; + cmp_len = make_fixnum (elt_len); + if (skip < 0 + || !EQ (Fcompare_strings (name, make_fixnum (skip), + cmp_len, + elt, zero, cmp_len, Qt), + Qt)) + continue; + } break; } } @@ -611,24 +647,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, matchcount = 0; } } - /* FIXME: If we move this `decode' earlier we can eliminate - the repeated ENCODE_FILE on Vcompletion_ignored_extensions. */ - name = make_unibyte_string (dp->d_name, len); - name = DECODE_FILE (name); - { - Lisp_Object regexps, table = (completion_ignore_case - ? Vascii_canon_table : Qnil); + Lisp_Object regexps, table = (completion_ignore_case + ? Vascii_canon_table : Qnil); - /* Ignore this element if it fails to match all the regexps. */ - for (regexps = Vcompletion_regexp_list; CONSP (regexps); - regexps = XCDR (regexps)) - if (fast_string_match_internal (XCAR (regexps), name, table) < 0) - break; + /* Ignore this element if it fails to match all the regexps. */ + for (regexps = Vcompletion_regexp_list; CONSP (regexps); + regexps = XCDR (regexps)) + if (fast_string_match_internal (XCAR (regexps), name, table) < 0) + break; - if (CONSP (regexps)) - continue; - } + if (CONSP (regexps)) + continue; /* This is a possible completion */ if (directoryp) @@ -642,8 +672,6 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, /* Reject entries where the encoded strings match, but the decoded don't. For example, "a" should not match "a-ring" on file systems that store decomposed characters. */ - Lisp_Object zero = make_fixnum (0); - if (check_decoded && SCHARS (file) <= SCHARS (name)) { /* FIXME: This is a copy of the code below. */ @@ -757,6 +785,9 @@ scmp (const char *s1, const char *s2, ptrdiff_t len) if (completion_ignore_case) { + /* WARNING: This only works for pure ASCII strings, as we + compare bytes, not characters! Use Fcompare_strings for + comparing non-ASCII strings case-insensitively. */ while (l && (downcase ((unsigned char) *s1++) == downcase ((unsigned char) *s2++))) commit 3c86424a182892db1e0216b9aa7e8389ae6f13de Author: Eli Zaretskii Date: Sun Nov 3 17:58:31 2019 +0200 ; * src/font.c (Ffont_info): Minor fix of doc string. diff --git a/src/font.c b/src/font.c index 156107e589..8dfbfa0fac 100644 --- a/src/font.c +++ b/src/font.c @@ -5127,7 +5127,9 @@ where FEATURE is a symbol representing OpenType feature tag. If the font is not an OpenType font, there are no elements - in CAPABILITY except the font format symbol. */) + in CAPABILITY except the font format symbol. + +If the named font cannot be opened and loaded, return nil. */) (Lisp_Object name, Lisp_Object frame) { struct frame *f; commit 5c8375bd681a7819e536dda84d63fb950595967d Author: Lars Ingebrigtsen Date: Sun Nov 3 16:33:15 2019 +0100 describe-font/font-info works with unloaded fonts * lisp/international/mule-diag.el (describe-font): This function can be used on unloaded fonts, so remove that restriction from the doc string (bug#16815). Also allow completion over all fonts on the system. * src/font.c (Ffont_info): Ditto for the doc string. diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el index dcdcafcea7..c4122c9271 100644 --- a/lisp/international/mule-diag.el +++ b/lisp/international/mule-diag.el @@ -835,9 +835,16 @@ The IGNORED argument is ignored." ;;;###autoload (defun describe-font (fontname) - "Display information about a font whose name is FONTNAME. -The font must be already used by Emacs." - (interactive "sFont name (default current choice for ASCII chars): ") + "Display information about a font whose name is FONTNAME." + (interactive + (list (completing-read + "Font name (default current choice for ASCII chars): " + (and window-system + (fboundp 'fontset-list) + ;; The final element in `fontset-list' is a default + ;; (generic) one, so don't include that. + (nconc (butlast (fontset-list)) + (x-list-fonts "*")))))) (or (and window-system (fboundp 'fontset-list)) (error "No fonts being used")) (let ((xref-item (list #'describe-font fontname)) @@ -847,9 +854,8 @@ The font must be already used by Emacs." (setq font-info (font-info fontname)) (if (null font-info) (if (fontp fontname 'font-object) - ;; The font should be surely used. So, there's some - ;; problem about getting information about it. It is - ;; better to print the fontname to show which font has + ;; If there's some problem with getting information about + ;; the font, print the font name to show which font has ;; this problem. (message "No information about \"%s\"" (font-xlfd-name fontname)) (message "No matching font found")) diff --git a/src/font.c b/src/font.c index 7fdadb17c1..156107e589 100644 --- a/src/font.c +++ b/src/font.c @@ -5127,9 +5127,7 @@ where FEATURE is a symbol representing OpenType feature tag. If the font is not an OpenType font, there are no elements - in CAPABILITY except the font format symbol. - -If the named font is not yet loaded, return nil. */) + in CAPABILITY except the font format symbol. */) (Lisp_Object name, Lisp_Object frame) { struct frame *f; commit ba8a7882de5bbdb39c9c1d74297a9613aa28463f Author: Lars Ingebrigtsen Date: Sun Nov 3 16:06:26 2019 +0100 Add a skeleton to html-mode * lisp/textmodes/sgml-mode.el (html-id-anchor): New skeleton and keystroke (bug#37651). diff --git a/etc/NEWS b/etc/NEWS index 033cb48978..e897fe06c9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -575,6 +575,11 @@ current and the previous or the next line, as before. * Changes in Specialized Modes and Packages in Emacs 27.1 +--- +** New HTML mode skeleton 'html-id-anchor'. +This new command (which inserts an _ skeleton) is +bound to 'C-c C-c #'. + +++ ** New command 'font-lock-refontify'. This is an interactive convenience function to be used when developing diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index d8210037c6..f75ce90547 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -1801,6 +1801,7 @@ This takes effect when first loading the library.") (define-key map "\C-c\C-cl" 'html-list-item) (define-key map "\C-c\C-ch" 'html-href-anchor) (define-key map "\C-c\C-cn" 'html-name-anchor) + (define-key map "\C-c\C-c#" 'html-id-anchor) (define-key map "\C-c\C-ci" 'html-image) (when html-quick-keys (define-key map "\C-c-" 'html-horizontal-rule) @@ -1812,6 +1813,7 @@ This takes effect when first loading the library.") (define-key map "\C-cl" 'html-list-item) (define-key map "\C-ch" 'html-href-anchor) (define-key map "\C-cn" 'html-name-anchor) + (define-key map "\C-c#" 'html-id-anchor) (define-key map "\C-ci" 'html-image) (define-key map "\C-cs" 'html-span)) (define-key map "\C-c\C-s" 'html-autoview-mode) @@ -1839,6 +1841,7 @@ This takes effect when first loading the library.") (define-key menu-map "i" '("Image" . html-image)) (define-key menu-map "h" '("Href Anchor" . html-href-anchor)) (define-key menu-map "n" '("Name Anchor" . html-name-anchor)) + (define-key menu-map "#" '("ID Anchor" . html-id-anchor)) map) "Keymap for commands for use in HTML mode.") @@ -2451,6 +2454,11 @@ HTML Autoview mode is a buffer-local minor mode for use with (if sgml-xml-mode (concat " id=\"" str "\"")) ">" _ "") +(define-skeleton html-id-anchor + "HTML anchor tag with id attribute." + "ID: " + "" _ "") + (define-skeleton html-headline-1 "HTML level 1 headline tags." nil commit e323a84c9f208f7ce5c3416581c8b14c75ec5c11 Author: Juanma Barranquero Date: Sun Nov 3 14:15:18 2019 +0100 * lisp/bs.el (bs-mode): Improve mode docstring. diff --git a/lisp/bs.el b/lisp/bs.el index cd9524a440..d31274256e 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -612,29 +612,43 @@ manipulating the buffer list and buffers. For faster navigation each digit key is a digit argument. \\[bs-select] or SPACE -- select current line's buffer and other marked buffers. -\\[bs-toggle-show-all] -- toggle between all buffers and a special subset. +\\[bs-select-in-one-window] -- select current's line buffer in one \ +window, and delete other + windows in the same frame. \\[bs-select-other-window] -- select current line's buffer in other window. -\\[bs-tmp-select-other-window] -- make another window display that buffer and - remain in Buffer Selection Menu. +\\[bs-tmp-select-other-window] -- display current line's buffer in \ +other window, and remain in + Buffer Selection Menu. +\\[bs-select-other-frame] -- select current's line buffer in a new frame. +\\[bs-view] -- view current's line buffer in View mode. +\\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer. \\[bs-mouse-select] -- select current line's buffer and other marked buffers. -\\[bs-save] -- save current line's buffer immediately. -\\[bs-delete] -- kill current line's buffer immediately. -\\[bs-toggle-readonly] -- toggle read-only status of current line's buffer. -\\[bs-clear-modified] -- clear modified-flag on that buffer. +\\[bs-mouse-select-other-frame] -- select current's line buffer in a new frame. + \\[bs-mark-current] -- mark current line's buffer to be displayed. \\[bs-unmark-current] -- unmark current line's buffer to be displayed. -\\[bs-unmark-all] -- unmark all buffer lines. \\[bs-unmark-previous] -- unmark previous line's buffer to be displayed. -\\[bs-show-sorted] -- display buffer list sorted by next sort aspect. -\\[bs-set-configuration-and-refresh] -- ask user for a configuration and \ -apply selected configuration. -\\[bs-select-next-configuration] -- select and apply next \ -available Buffer Selection Menu configuration. -\\[bs-kill] -- leave Buffer Selection Menu without a selection. -\\[bs-toggle-current-to-show] -- toggle status of appearance. +\\[bs-unmark-all] -- unmark all buffer lines. + +\\[bs-bury-buffer] -- bury current's line buffer. +\\[bs-save] -- save current line's buffer immediately. +\\[bs-delete] -- kill current line's buffer immediately. +\\[bs-delete-backward] -- like \\[bs-delete], but then move to previous line. +\\[bs-clear-modified] -- clear modified-flag on that buffer. +\\[bs-toggle-readonly] -- toggle read-only status of current line's buffer. \\[bs-set-current-buffer-to-show-always] -- mark current line's buffer \ to show always. -\\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer. +\\[bs-toggle-current-to-show] -- toggle status of appearance. + +\\[bs-toggle-show-all] -- toggle between all buffers and a special subset. +\\[bs-select-next-configuration] -- select and apply next available \ +configuration. +\\[bs-set-configuration-and-refresh] -- ask user for a configuration and \ +apply it. +\\[bs-show-sorted] -- display buffer list sorted by next sort aspect. + +\\[bs-kill] -- leave Buffer Selection Menu without a selection. +\\[bs-refresh] -- refresh Buffer Selection Menu. \\[bs-help] -- display this help text." (buffer-disable-undo) (setq buffer-read-only t commit 0b9dc0a8fe7ce66d5a79ffefd7ca9b42882e3fe4 Author: Juri Linkov Date: Sat Nov 2 23:39:15 2019 +0200 * lisp/tab-line.el (tab-line-tab-selected): New face. (tab-line-format): Use new face tab-line-tab-selected. ([tab-line]): Move tab-switching mouse wheel commands to S-keys. diff --git a/lisp/tab-line.el b/lisp/tab-line.el index cfb4223bd2..0d3834ab74 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -77,6 +77,17 @@ :version "27.1" :group 'tab-line-faces) +(defface tab-line-tab-selected + '((default + :inherit tab-line-tab) + (((class color) (min-colors 88)) + :background "grey85") + (t + :inverse-video t)) + "Tab line face for tab in the selected window." + :version "27.1" + :group 'tab-line-faces) + (defface tab-line-highlight '((default :inherit tab-line-tab)) "Tab line face for highlighting." @@ -335,7 +346,9 @@ variable `tab-line-tabs-function'." `( tab ,tab face ,(if (eq tab selected-buffer) - 'tab-line-tab + (if (eq (selected-window) (old-selected-window)) + 'tab-line-tab-selected + 'tab-line-tab) 'tab-line-tab-inactive) mouse-face tab-line-highlight)))) tabs))) @@ -517,10 +530,10 @@ from the tab line." (global-set-key [tab-line wheel-up] 'tab-line-hscroll-left) (global-set-key [tab-line wheel-down] 'tab-line-hscroll-right) -(global-set-key [tab-line C-mouse-4] 'tab-line-switch-to-prev-tab) -(global-set-key [tab-line C-mouse-5] 'tab-line-switch-to-next-tab) -(global-set-key [tab-line C-wheel-up] 'tab-line-switch-to-prev-tab) -(global-set-key [tab-line C-wheel-down] 'tab-line-switch-to-next-tab) +(global-set-key [tab-line S-mouse-4] 'tab-line-switch-to-prev-tab) +(global-set-key [tab-line S-mouse-5] 'tab-line-switch-to-next-tab) +(global-set-key [tab-line S-wheel-up] 'tab-line-switch-to-prev-tab) +(global-set-key [tab-line S-wheel-down] 'tab-line-switch-to-next-tab) (provide 'tab-line) commit e6b806f29e06e472a44763def6b4d904b5f1ba54 Author: Óscar Fuentes Date: Sat Nov 2 18:01:01 2019 +0100 Fix data-directory when executing from an out-of-source build Fixes #36828. * src/callproc.c (init_callproc): detect out-of-source build. diff --git a/src/callproc.c b/src/callproc.c index 007465cd40..b51594c2d5 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1567,7 +1567,7 @@ init_callproc (void) tem = Fexpand_file_name (build_string ("NEWS"), Vdata_directory); if (!NILP (Fequal (srcdir, Vinvocation_directory)) - || NILP (Ffile_exists_p (tem))) + || NILP (Ffile_exists_p (tem)) || !NILP (Vinstallation_directory)) { Lisp_Object newdir; newdir = Fexpand_file_name (build_string ("../etc/"), lispdir); commit adb5f45d7bc4612916a5b8e4bd2b92d49119b57a Author: João Távora Date: Sat Nov 2 16:38:53 2019 +0000 Allow flymake diagnostic types to have shorter names Eglot, a third-party package which uses Flymake, has its own diagnostic types such as 'eglot-error', 'eglot-warning', etc... While not being too long, they will not fit in the type column of the "list all diagnostics" buffer. This commit allows diagnostic types to have user-defined names and also assigns names to the default categories. * doc/misc/flymake.texi (Flymake error types): Describe flymake-type-name prop. * lisp/progmodes/flymake.el (flymake--diagnostics-buffer-entries): Use type names. (flymake-error, flymake-warning, flymake-note): Give these diagnostic categories default type names. diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index cedf1d84f9..21653b4a6d 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -336,6 +336,11 @@ error. If the overlay property @code{priority} is not specified in @code{flymake-overlay-control}, @code{flymake-severity} is used to set it and help sort overlapping overlays. +@item +@vindex flymake-type-name +@code{flymake-type-name} is a string used to succinctly name the error +type, in case the name of the symbol associated with it is very long. + @item @vindex flymake-category @code{flymake-category} is a symbol whose property list is considered diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e394096e23..f052e002df 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -553,16 +553,19 @@ Node `(Flymake)Flymake error types'" (put 'flymake-error 'flymake-bitmap 'flymake-error-bitmap) (put 'flymake-error 'severity (warning-numeric-level :error)) (put 'flymake-error 'mode-line-face 'compilation-error) +(put 'flymake-error 'flymake-type-name "error") (put 'flymake-warning 'face 'flymake-warning) (put 'flymake-warning 'flymake-bitmap 'flymake-warning-bitmap) (put 'flymake-warning 'severity (warning-numeric-level :warning)) (put 'flymake-warning 'mode-line-face 'compilation-warning) +(put 'flymake-warning 'flymake-type-name "warning") (put 'flymake-note 'face 'flymake-note) (put 'flymake-note 'flymake-bitmap 'flymake-note-bitmap) (put 'flymake-note 'severity (warning-numeric-level :debug)) (put 'flymake-note 'mode-line-face 'compilation-info) +(put 'flymake-note 'flymake-type-name "note") (defun flymake--lookup-type-property (type prop &optional default) "Look up PROP for diagnostic TYPE. @@ -1336,7 +1339,9 @@ POS can be a buffer position or a button" 'severity (warning-numeric-level :error))) `[,(format "%s" line) ,(format "%s" col) - ,(propertize (format "%s" type) + ,(propertize (format "%s" + (flymake--lookup-type-property + type 'flymake-type-name type)) 'face (flymake--lookup-type-property type 'mode-line-face 'flymake-error)) (,(format "%s" (flymake--diag-text diag)) commit 455e753a2b8fa2e83d23be1771f3371ba90b85f9 Author: João Távora Date: Sat Nov 2 16:16:14 2019 +0000 Avoid face clashes between Flymake and region highlighting Fix bug#34022. * lisp/progmodes/flymake.el (flymake--highlight-line): Use (PRIMARY . SECONDARY) priority value. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 474c633587..e394096e23 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -652,7 +652,9 @@ associated `flymake-category' return DEFAULT." (flymake-diagnostics pos) "\n")))) (default-maybe 'severity (warning-numeric-level :error)) - (default-maybe 'priority (+ 100 (overlay-get ov 'severity)))) + ;; Use (PRIMARY . SECONDARY) priority, to avoid clashing with + ;; `region' face, for example (bug#34022). + (default-maybe 'priority (cons nil (+ 40 (overlay-get ov 'severity))))) ;; Some properties can't be overridden. ;; (overlay-put ov 'evaporate t) commit b32c4d7bac8e0b3642d8ad90ee40a44466e29aad Author: João Távora Date: Sat Nov 2 15:53:45 2019 +0000 Clarify consequences of mismatching Flymake diagnostic buffers Fix bug#34418. * doc/misc/flymake.texi (Flymake utility functions): Add note to flymake-make-diagnostic. * lisp/progmodes/flymake.el (flymake--handle-report): Discard diagnostics from other buffers. diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index ebb89c3203..cedf1d84f9 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -543,7 +543,9 @@ by calling the function @code{flymake-make-diagnostic}. Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to @var{end}. @var{type} is a diagnostic symbol (@pxref{Flymake error types}), and @var{text} is a description of the problem detected in -this region. +this region. Currently, it is unspecified behaviour to make +diagnostics for buffers other than the buffer that the Flymake backend +is responsible for. @end deffn @cindex access diagnostic object diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 6891e19fd1..474c633587 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -749,7 +749,10 @@ report applies to that region." (format "Unknown action %S" report-action)) (flymake-error "Expected report, but got unknown key %s" report-action)) (t - (setq new-diags report-action) + (setq new-diags + (cl-remove-if-not + (lambda (diag) (eq (flymake--diag-buffer diag) (current-buffer))) + report-action)) (save-restriction (widen) ;; Before adding to backend's diagnostic list, decide if commit 3937c9f6e23b92ed5d7e6d42b8bf00101628af00 Author: Lars Ingebrigtsen Date: Sat Nov 2 16:05:42 2019 +0100 Further fixup of the previous doc fix in the Faces node * doc/lispref/display.texi (Faces): Improve wording from previous change. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 95f9cc15a8..ddbae40ac9 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2248,10 +2248,9 @@ is equivalent to a Lisp symbol with the same name.}. Named faces are defined using the @code{defface} macro (@pxref{Defining Faces}). Emacs comes with several standard named faces (@pxref{Basic Faces}). - Many parts of Emacs require named faces, but some do not accept -anonymous faces (e.g., the functions documented in @ref{Attribute -Functions}). Unless otherwise stated, we will use the term @dfn{face} -to refer only to named faces. + Some parts of Emacs require named faces (e.g., the functions +documented in @ref{Attribute Functions}). Unless otherwise stated, we +will use the term @dfn{face} to refer only to named faces. @defun facep object This function returns a non-@code{nil} value if @var{object} is a commit c2e77ff89a9fdb8af2c36e9692f01bb9e1fe512d Author: Lars Ingebrigtsen Date: Sat Nov 2 15:36:42 2019 +0100 Revert "Make the debbugs groups also include robot messages" This reverts commit 682eae776efa9d57842345de67becf5c56cafc91. The change made the bug# disappear from the Subject lines. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 8f5f5d66e4..742f8f4be5 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2390,7 +2390,7 @@ Valid input formats include: (gnus-read-ephemeral-gmane-group group start range))) (defcustom gnus-bug-group-download-format-alist - '((emacs . "https://debbugs.gnu.org/cgi/bugreport.cgi?mboxstat=yes;bug=%s") + '((emacs . "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes") (debian . "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s&mbox=yes;mboxmaint=yes")) "Alist of symbols for bug trackers and the corresponding URL format string. commit ec16dd1a1e0cc4c315fb57f8720083aabfd434e5 Author: Alan Mackenzie Date: Sat Nov 2 13:03:50 2019 +0000 CC Mode. Fix slow scrolling by adding a search limit. This fixes bug #10149. * lisp/progmodes/cc-fonts.el (c-font-lock-single-decl) Limit the search by c-go-up-list-backwards to 500 non-literal characters. diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index f58caf2f1a..c27b70603e 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1244,7 +1244,7 @@ casts and declarations are fontified. Used on level 2 and higher." (if (save-excursion (and (car (cddr decl-or-cast)) ; maybe-expression flag. - (c-go-up-list-backward) + (c-go-up-list-backward nil (c-determine-limit 500)) (eq (char-after) ?\() (progn (c-backward-syntactic-ws) (c-simple-skip-symbol-backward)) commit 6911ef3da69333cb7adc1a7fb0a0fc001220a0c4 Author: João Távora Date: Sat Nov 2 11:09:55 2019 +0000 Correct merge blunder in last icomplete commit * lisp/icomplete.el (icomplete-exhibit): Use while-no-input-ignore-events. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 8357fd900f..e1d6236943 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -443,11 +443,7 @@ See `icomplete-mode' and `minibuffer-setup-hook'." ;; Don't delay if the completions are known. completion-all-sorted-completions ;; Don't delay if alternatives number is small enough: - ;; Not sure why, but such requests seem to come - ;; every once in a while. It's not fully - ;; deterministic but `C-x C-f M-DEL M-DEL ...' - ;; seems to trigger it fairly often! - (while-no-input-ignore-events '(selection-request)) (and (sequencep (icomplete--completion-table)) + (and (sequencep (icomplete--completion-table)) (< (length (icomplete--completion-table)) icomplete-delay-completions-threshold)) ;; Delay - give some grace time for next keystroke, before commit 996e08b05f6f29d2e80db1c3f23a749fe70eb6ae Author: Eli Zaretskii Date: Sat Nov 2 12:50:27 2019 +0200 Document Windows font selection quirks * doc/emacs/msdos.texi (Windows Fonts): Document 'w32-use-w32-font-dialog' and 'w32-fixed-font-alist'. diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi index 5377df91d1..55093a080a 100644 --- a/doc/emacs/msdos.texi +++ b/doc/emacs/msdos.texi @@ -1133,6 +1133,15 @@ file. (If the function returns @code{nil}, you have no fonts installed that can display characters from the scripts which need this facility.) +@vindex w32-use-w32-font-dialog +@vindex w32-fixed-font-alist +The variable @code{w32-use-w32-font-dialog} controls the way fonts can +be selected via @kbd{S-mouse-1} (@code{mouse-appearance-menu}). If +the value is @code{t}, the default, Emacs uses the standard Windows +font selection dialog. If the value is @code{nil}, Emacs instead pops +a menu of a fixed set of fonts. The fonts to appear in the menu are +determined by @code{w32-fixed-font-alist}. + @node Windows Misc @section Miscellaneous Windows-specific features commit cacd58463b9265ab737a85cceb502cd8538d3c9b Author: Eli Zaretskii Date: Sat Nov 2 12:41:51 2019 +0200 Improve documentation of 'set-face-font' * lisp/faces.el (set-face-font): * doc/emacs/frames.texi (Fonts): * doc/lispref/display.texi (Face Attributes) (Attribute Functions): Clarify and correct the documentation of set-face-font and related descriptions of font specifications. (Bug#14647) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index cac1f7fea6..091c011fb9 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -592,9 +592,9 @@ command can be helpful. It describes the character at point, and names the font that it's rendered in. @cindex fontconfig - On X, there are four different ways to express a font name. The -first is to use a @dfn{Fontconfig pattern}. Fontconfig patterns have -the following form: + There are four different ways to express a font name. The first is +to use a @dfn{Fontconfig pattern}. Fontconfig patterns have the +following form: @example @var{fontname}[-@var{fontsize}][:@var{name1}=@var{values1}][:@var{name2}=@var{values2}]... @@ -650,6 +650,10 @@ For a more detailed description of Fontconfig patterns, see the Fontconfig manual, which is distributed with Fontconfig and available online at @url{https://fontconfig.org/fontconfig-user.html}. +On MS-Windows, only the subset of the form +@var{fontname}[-@var{fontsize}] is supported for all fonts; the full +Fontconfig pattern might not work for all of them. + @cindex GTK font pattern The second way to specify a font is to use a @dfn{GTK font pattern}. These have the syntax @@ -685,12 +689,15 @@ Monospace 12 Monospace Bold Italic 12 @end example +On MS-Windows, only the subset @var{fontname} is supported. + @cindex XLFD @cindex X Logical Font Description The third way to specify a font is to use an @dfn{XLFD} (@dfn{X Logical Font Description}). This is the traditional method for -specifying fonts under X@. Each XLFD consists of fourteen words or -numbers, separated by dashes, like this: +specifying fonts under X, and is also supported on MS-Windows. Each +XLFD consists of fourteen words or numbers, separated by dashes, like +this: @example -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 @@ -774,6 +781,8 @@ equivalent to -misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-iso8859-1 @end example +This form is not supported on MS-Windows. + @cindex client-side fonts @cindex server-side fonts On X, Emacs recognizes two types of fonts: @dfn{client-side} fonts, diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 29abc0a9f2..95f9cc15a8 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2466,16 +2466,18 @@ or a fontset. @xref{Low-Level Font}, for information about font objects, font specs, and font entities. @xref{Fontsets}, for information about fontsets. -When specifying this attribute using @code{set-face-attribute} -(@pxref{Attribute Functions}), you may also supply a font spec, a font -entity, or a string. Emacs converts such values to an appropriate -font object, and stores that font object as the actual attribute -value. If you specify a string, the contents of the string should be -a font name (@pxref{Fonts,,, emacs, The GNU Emacs Manual}); if the -font name is an XLFD containing wildcards, Emacs chooses the first -font matching those wildcards. Specifying this attribute also changes -the values of the @code{:family}, @code{:foundry}, @code{:width}, -@code{:height}, @code{:weight}, and @code{:slant} attributes. +@anchor{face-font-attribute} +When specifying this attribute using @code{set-face-attribute} or +@code{set-face-font} (@pxref{Attribute Functions}), you may also +supply a font spec, a font entity, or a string. Emacs converts such +values to an appropriate font object, and stores that font object as +the actual attribute value. If you specify a string, the contents of +the string should be a font name (@pxref{Fonts,,, emacs, The GNU Emacs +Manual}); if the font name is an XLFD containing wildcards, Emacs +chooses the first font matching those wildcards. Specifying this +attribute also changes the values of the @code{:family}, +@code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and +@code{:slant} attributes. @cindex inheritance, for faces @item :inherit @@ -2834,10 +2836,13 @@ This sets the @code{:stipple} attribute of @var{face} to @deffn Command set-face-font face font &optional frame Change the font-related attributes of @var{face} to those of -@var{font} (a string). This sets the attributes @code{:family}, -@code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and -@code{:slant}. If @var{frame} is non-@code{nil}, only change the -attributes on the specified frame. +@var{font} (a string or a font object). @xref{face-font-attribute}, +for the supported formats of the @var{font} argument. This function +sets the attribute @code{:font} of the face, and indirectly also the +@code{:family}, @code{:foundry}, @code{:width}, @code{:height}, +@code{:weight}, and @code{:slant} attributes, as defined by the font. +If @var{frame} is non-@code{nil}, only change the attributes on the +specified frame. @end deffn @defun set-face-bold face bold-p &optional frame diff --git a/lisp/faces.el b/lisp/faces.el index 75753ecefc..dc5bcca760 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -887,10 +887,13 @@ Use `set-face-attribute' for finer control of font weight and slant." (defun set-face-font (face font &optional frame) - "Change font-related attributes of FACE to those of FONT (a string). -The format of the font varies based on the font system in used, -but it can commonly be an X logical font description (XLFD) -string, or a simpler XFD string like \"courier:size=10\". + "Change font-related attributes of FACE to those of FONT. +FONT can be a string, a font spec, a font entity, a font object, +or a fontset. However, interactively, only strings are accepted. +The format of the font string specification varies based on the font +system in use, but it can commonly be an X Logical Font +Description (XLFD) string, or a simpler string like \"Courier-10\" +or \"courier:size=10\". FRAME nil or not specified means change face on all frames. This sets the attributes `:family', `:foundry', `:width', commit 5a778d504fdbc4fd729ff2cc80be0ca5a68679b6 Author: Eli Zaretskii Date: Sat Nov 2 09:52:39 2019 +0200 Revert "Omit edition numbers and dates in manuals" This reverts commit 2f42832895942fdeaa0c500511aa19860fa806cd. Editions of Emacs manuals must be coordinated with the FSF publishing staff, as they appear on the printed books. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 678ccb9ba5..a7967ecaee 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -3,10 +3,28 @@ @setfilename ../../info/emacs.info @settitle GNU Emacs Manual @include docstyle.texi + +@c The edition number appears in more than one place in this file +@c I don't really know what it means... +@c For example, it has said "Sixteenth" since sometime in the Emacs 22 +@c series, all through 23, and into 24. So it is not very useful IMO, +@c and offers nothing that EMACSVER does not. I guess it relates +@c mainly to the published book sold by the FSF. Hence no longer +@c bother including it except iftex. Really, I think it should not be +@c here at all (since anyone can make a pdf version), but should just +@c be something added by the FSF during the publishing process. +@c Also, the lispref uses a float (3.0), whereas this uses an ordinal, +@c so the format is not even consistent. +@set EDITION Seventeenth @include emacsver.texi @copying +@iftex +This is the @value{EDITION} edition of the @cite{GNU Emacs Manual},@* +@end iftex +@ifnottex This is the @cite{GNU Emacs Manual}, +@end ifnottex updated for Emacs version @value{EMACSVER}. Copyright @copyright{} 1985--1987, 1993--2019 Free Software Foundation, Inc. @@ -64,7 +82,7 @@ developing GNU and promoting software freedom.'' @sp 6 @center @titlefont{GNU Emacs Manual} @sp 4 -@center Updated for Emacs Version @value{EMACSVER} +@center @value{EDITION} Edition, Updated for Emacs Version @value{EMACSVER}. @sp 5 @center Richard Stallman et al. @page diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 9ad4cf102e..489ba8d6ef 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -63,6 +63,10 @@ \global\hbadness=6666 % don't worry about not-too-underfull boxes @end tex +@c These refer to the printed book sold by the FSF. +@set edition-number 3.10 +@set update-date 28 October 2009 + @c For next or subsequent edition: @c create function using with-output-to-temp-buffer @c create a major mode, with keymaps @@ -102,6 +106,9 @@ This is @cite{An Introduction to Programming in Emacs Lisp}, for people who are not programmers. @sp 1 +@iftex +Edition @value{edition-number}, @value{update-date} +@end iftex @ifnottex Distributed with Emacs version @value{EMACSVER}. @end ifnottex diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 652175c395..d667c51d78 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -52,7 +52,12 @@ @end ifset @end tex + +@c Version of the manual and of Emacs. +@c (See comments for EDITION in emacs.texi) +@set VERSION 3.1 @include emacsver.texi +@set DATE October 2014 @c in general, keep the following line commented out, unless doing a @c copy of this manual that will be published. The manual should go @@ -86,7 +91,12 @@ @c @syncodeindex tp fn @copying -This is the @cite{GNU Emacs Lisp Reference Manual}, +@iftex +This is edition @value{VERSION} of the @cite{GNU Emacs Lisp Reference Manual},@* +@end iftex +@ifnottex +This is the @cite{GNU Emacs Lisp Reference Manual} +@end ifnottex corresponding to Emacs version @value{EMACSVER}. Copyright @copyright{} 1990--1996, 1998--2019 Free Software Foundation, Inc. @@ -117,6 +127,7 @@ developing GNU and promoting software freedom.'' @subtitle @value{voltitle} @end ifset @subtitle For Emacs Version @value{EMACSVER} +@subtitle Revision @value{VERSION}, @value{DATE} @author by Bil Lewis, Dan LaLiberte, Richard Stallman, @author the GNU Manual Group, et al. commit 4ac6c9b6683d6a5c705efd9d99688de3b6ddf5b7 Author: Stefan Kangas Date: Sat Nov 2 04:32:03 2019 +0100 ; * etc/NEWS: Fix my previous change for package-initialize. diff --git a/etc/NEWS b/etc/NEWS index e614197125..033cb48978 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -179,7 +179,7 @@ into the init file when Emacs was started. This call can now safely be removed. Alternatively, if you want to ensure that your init file is still compatible with earlier versions of Emacs, change it to: -(when (version< emacs-version "27.1") +(when (< emacs-major-version 27) (package-initialize)) However, if your init file changes the values of 'package-load-list' commit 7cde03484b1622ba9e5acc54f49c96b18bb79d98 Author: Stefan Kangas Date: Sat Nov 2 04:24:44 2019 +0100 * .dir-locals.el: Add explanatory header. diff --git a/.dir-locals.el b/.dir-locals.el index 35dc154375..27d50c6069 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,3 +1,6 @@ +;;; Directory Local Variables +;;; For more information see (info "(emacs) Directory Variables") + ((nil . ((tab-width . 8) (sentence-end-double-space . t) (fill-column . 70) commit 6c82aafcc04b4948f5dea5ec040880bba7228cc5 Author: Stefan Kangas Date: Sat Nov 2 04:23:24 2019 +0100 Add auto-insert skeleton for ".dir-locals.el" * lisp/autoinsert.el (auto-insert-alist): Add auto-insert skeleton for ".dir-locals.el". diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index b8c2bfd606..f2ac907153 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -162,6 +162,29 @@ If this contains a %s, that will be replaced by the matching rule." (replace-match (capitalize (user-login-name)) t t)) '(end-of-line 1) " <" (progn user-mail-address) ">\n") + (".dir-locals.el" + nil + ";;; Directory Local Variables\n" + ";;; For more information see (info \"(emacs) Directory Variables\")\n\n" + "((" + '(setq v1 (let (modes) + (mapatoms (lambda (mode) + (let ((name (symbol-name mode))) + (when (string-match "-mode$" name) + (add-to-list 'modes name))))) + (sort modes 'string<))) + (completing-read "Local variables for mode: " v1 nil t) + " . ((" + (let ((all-variables + (apropos-internal ".*" + (lambda (symbol) + (and (boundp symbol) + (get symbol 'variable-documentation)))))) + (completing-read "Variable to set: " all-variables)) + " . " + (completing-read "Value to set it to: " nil) + "))))\n") + (("\\.el\\'" . "Emacs Lisp header") "Short description: " ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str @@ -315,7 +338,7 @@ described above, e.g. [\"header.insert\" date-and-author-update]." ;; There's no custom equivalent of "repeat" for vectors. :value-type (choice file function (sexp :tag "Skeleton or vector"))) - :version "25.1") + :version "27.1") ;; Establish a default value for auto-insert-directory commit 730e7da7ba6a4b545176ea246653928edb10cff4 Author: João Távora Date: Thu Oct 31 10:58:38 2019 +0000 New icomplete-tidy-shadowed-file-names variable * lisp/icomplete.el (rfn-eshadow): Require it. (icomplete-tidy-shadowed-file-names): New variable. (icomplete-exhibit): Use icomplete-tidy-shadowed-file-names. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 47e47f895f..8357fd900f 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -49,6 +49,8 @@ ;;; Code: +(require 'rfn-eshadow) ; rfn-eshadow-overlay + (defgroup icomplete nil "Show completions dynamically in minibuffer." :prefix "icomplete-" @@ -66,6 +68,12 @@ When nil, show candidates in full." :type 'boolean :version "24.4") +(defvar icomplete-tidy-shadowed-file-names nil + "If non-nil, delete superflous parts of input file names. +For example, if the user types ~/ after a long path name, +everything preceding the ~/ is discarded so the interactive +selection process starts again from the user's $HOME.") + (defcustom icomplete-show-matches-on-no-input nil "When non-nil, show completions when first prompting for input." :type 'boolean @@ -226,7 +234,11 @@ Last entry becomes the first and can be selected with ;;; (define-key imap (kbd "C-d") 'icomplete-magic-ido-delete-char) ;;; (define-key imap (kbd "RET") 'icomplete-magic-ido-ret) ;;; (define-key imap (kbd "DEL") 'icomplete-magic-ido-backward-updir)) - +;;; +;;; For more ido behaviour, you'll probably like this too: +;;; +;;; (setq icomplete-tidy-shadowed-file-names t) +;;; (defun icomplete-magic-ido-kill () "Kill line or current completion, like `ido-mode'. If killing to the end of line make sense, call `kill-line', @@ -422,44 +434,59 @@ See `icomplete-mode' and `minibuffer-setup-hook'." (save-excursion (goto-char (point-max)) ; Insert the match-status information: - (if (and (or icomplete-show-matches-on-no-input - (> (icomplete--field-end) (icomplete--field-beg))) - (or - ;; Don't bother with delay after certain number of chars: - (> (- (point) (icomplete--field-beg)) - icomplete-max-delay-chars) - ;; Don't delay if the completions are known. - completion-all-sorted-completions - ;; Don't delay if alternatives number is small enough: - (and (sequencep (icomplete--completion-table)) - (< (length (icomplete--completion-table)) - icomplete-delay-completions-threshold)) - ;; Delay - give some grace time for next keystroke, before - ;; embarking on computing completions: - (sit-for icomplete-compute-delay))) - (let* ((field-string (icomplete--field-string)) - ;; Not sure why, but such requests seem to come - ;; every once in a while. It's not fully - ;; deterministic but `C-x C-f M-DEL M-DEL ...' - ;; seems to trigger it fairly often! - (while-no-input-ignore-events '(selection-request)) - (text (while-no-input - (icomplete-completions - field-string - (icomplete--completion-table) - (icomplete--completion-predicate) - (if (window-minibuffer-p) - (not minibuffer-completion-confirm))))) - (buffer-undo-list t) - deactivate-mark) - ;; Do nothing if while-no-input was aborted. - (when (stringp text) - (move-overlay icomplete-overlay (point) (point) (current-buffer)) - ;; The current C cursor code doesn't know to use the overlay's - ;; marker's stickiness to figure out whether to place the cursor - ;; before or after the string, so let's spoon-feed it the pos. - (put-text-property 0 1 'cursor t text) - (overlay-put icomplete-overlay 'after-string text))))))) + (when (and (or icomplete-show-matches-on-no-input + (> (icomplete--field-end) (icomplete--field-beg))) + (or + ;; Don't bother with delay after certain number of chars: + (> (- (point) (icomplete--field-beg)) + icomplete-max-delay-chars) + ;; Don't delay if the completions are known. + completion-all-sorted-completions + ;; Don't delay if alternatives number is small enough: + ;; Not sure why, but such requests seem to come + ;; every once in a while. It's not fully + ;; deterministic but `C-x C-f M-DEL M-DEL ...' + ;; seems to trigger it fairly often! + (while-no-input-ignore-events '(selection-request)) (and (sequencep (icomplete--completion-table)) + (< (length (icomplete--completion-table)) + icomplete-delay-completions-threshold)) + ;; Delay - give some grace time for next keystroke, before + ;; embarking on computing completions: + (sit-for icomplete-compute-delay))) + (when (and + icomplete-tidy-shadowed-file-names + (eq (alist-get 'category + (cdr (completion--field-metadata + (icomplete--field-beg)))) + 'file) + rfn-eshadow-overlay (overlay-buffer rfn-eshadow-overlay) + (or (>= (- (point) (overlay-end rfn-eshadow-overlay)) 2) + (eq ?/ (char-before (- (point) 2))))) + (delete-region (overlay-start rfn-eshadow-overlay) + (overlay-end rfn-eshadow-overlay)) ) + (let* ((field-string (icomplete--field-string)) + ;; Not sure why, but such requests seem to come + ;; every once in a while. It's not fully + ;; deterministic but `C-x C-f M-DEL M-DEL ...' + ;; seems to trigger it fairly often! + (while-no-input-ignore-events '(selection-request)) + (text (while-no-input + (icomplete-completions + field-string + (icomplete--completion-table) + (icomplete--completion-predicate) + (if (window-minibuffer-p) + (not minibuffer-completion-confirm))))) + (buffer-undo-list t) + deactivate-mark) + ;; Do nothing if while-no-input was aborted. + (when (stringp text) + (move-overlay icomplete-overlay (point) (point) (current-buffer)) + ;; The current C cursor code doesn't know to use the overlay's + ;; marker's stickiness to figure out whether to place the cursor + ;; before or after the string, so let's spoon-feed it the pos. + (put-text-property 0 1 'cursor t text) + (overlay-put icomplete-overlay 'after-string text))))))) ;;;_ > icomplete-completions (name candidates predicate require-match) (defun icomplete-completions (name candidates predicate require-match) commit 0bb97ad8b89af91e296ea791f34b46963323ce7a Author: João Távora Date: Thu Oct 31 20:19:35 2019 +0000 Fix icomplete-force-complete-and-exit for no-input situations If there is no minibuffer input, but the user has already cycled some pre-calculated completions, we should be calling minibuffer-force-complete-and-exit instead of minibuffer-complete-and-exit. The former is guaranteed to be fast in this situation and yields the desired "selected" completion, while the latter will just give us the default, ignoring all the cycling of icomplete-{forward|backward}-completions. * lisp/icomplete.el (icomplete-force-complete-and-exit): Add comments and fix for empty input but some completions calculated. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 89318ca4c7..47e47f895f 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -152,13 +152,33 @@ icompletion is occurring." "Keymap used by `icomplete-mode' in the minibuffer.") (defun icomplete-force-complete-and-exit () - "Complete the minibuffer and exit. + "Complete the minibuffer with the longest possible match and exit. Use the first of the matches if there are any displayed, and use the default otherwise." (interactive) - (if (or (and (not minibuffer-default) icomplete-show-matches-on-no-input) - (> (icomplete--field-end) (icomplete--field-beg))) + ;; This function is tricky. The mandate is to "force", meaning we + ;; should take the first possible valid completion for the input. + ;; However, if there is no input and we can prove that that + ;; coincides with the default, it is much faster to just call + ;; `minibuffer-complete-and-exit'. Otherwise, we have to call + ;; `minibuffer-force-complete-and-exit', which needs the full + ;; completion set and is potentially slow and blocking. Do the + ;; latter if: + (if (or + ;; there's some input, meaning the default in off the table by + ;; definition; OR + (> (icomplete--field-end) (icomplete--field-beg)) + ;; there's no input, but there's also no minibuffer default + ;; (and the user really wants to see completions on no input, + ;; meaning he expects a "force" to be at least attempted); OR + (and (not minibuffer-default) + icomplete-show-matches-on-no-input) + ;; there's no input but the full completion set has been + ;; calculated, This causes the first cached completion to + ;; be taken (i.e. the one that the user sees highlighted) + completion-all-sorted-completions) (minibuffer-force-complete-and-exit) + ;; Otherwise take the faster route... (minibuffer-complete-and-exit))) (defun icomplete-force-complete () commit 88f193ed05649b8c622867b8b2623b8cb08fdc96 Author: João Távora Date: Sat Nov 2 02:29:56 2019 +0000 Improve fix for icomplete's backward-kill-word bug#38024 * lisp/icomplete.el (icomplete-exhibit): Use while-no-input-ignore-events, not redisplay. Co-authored-by: Stefan Monnier diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 02eae55a19..89318ca4c7 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -399,8 +399,6 @@ Should be run via minibuffer `post-command-hook'. See `icomplete-mode' and `minibuffer-setup-hook'." (when (and icomplete-mode (icomplete-simple-completing-p)) ;Shouldn't be necessary. - (redisplay) ; FIXME: why is this sometimes needed when moving - ; up dirs in a file-finding table? (save-excursion (goto-char (point-max)) ; Insert the match-status information: @@ -420,6 +418,11 @@ See `icomplete-mode' and `minibuffer-setup-hook'." ;; embarking on computing completions: (sit-for icomplete-compute-delay))) (let* ((field-string (icomplete--field-string)) + ;; Not sure why, but such requests seem to come + ;; every once in a while. It's not fully + ;; deterministic but `C-x C-f M-DEL M-DEL ...' + ;; seems to trigger it fairly often! + (while-no-input-ignore-events '(selection-request)) (text (while-no-input (icomplete-completions field-string commit 3b2f11f268372d0d01a8eb735eee0098212a9705 Author: Stefan Kangas Date: Sat Nov 2 03:22:58 2019 +0100 * doc/emacs/package.texi (Package Menu): Add index items. diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index d97648af1b..19efff7445 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi @@ -85,16 +85,23 @@ The following commands are available in the package menu: @table @kbd @item h +@kindex h @r{(Package Menu)} +@findex package-menu-quick-help Print a short message summarizing how to use the package menu (@code{package-menu-quick-help}). @item ? @itemx @key{RET} +@kindex ? @r{(Package Menu)} +@kindex RET @r{(Package Menu)} +@findex package-menu-describe-package Display a help buffer for the package on the current line (@code{package-menu-describe-package}), similar to the help window displayed by the @kbd{C-h P} command (@pxref{Packages}). @item i +@kindex i @r{(Package Menu)} +@findex package-menu-mark-install Mark the package on the current line for installation (@code{package-menu-mark-install}). If the package status is @samp{available}, this adds an @samp{I} character to the start of the @@ -102,6 +109,8 @@ line; typing @kbd{x} (see below) will download and install the package. @item d +@kindex d @r{(Package Menu)} +@findex package-menu-mark-delete Mark the package on the current line for deletion (@code{package-menu-mark-delete}). If the package status is @samp{installed}, this adds a @samp{D} character to the start of the @@ -110,52 +119,73 @@ line; typing @kbd{x} (see below) will delete the package. entails. @item ~ +@kindex ~ @r{(Package Menu)} +@findex package-menu-mark-obsolete-for-deletion Mark all obsolete packages for deletion (@code{package-menu-mark-obsolete-for-deletion}). This marks for deletion all the packages whose status is @samp{obsolete}. @item u @itemx @key{DEL} +@kindex u @r{(Package Menu)} +@findex package-menu-mark-unmark Remove any installation or deletion mark previously added to the -current line by an @kbd{i} or @kbd{d} command. +current line by an @kbd{i} or @kbd{d} command +(@code{package-menu-mark-unmark}). @item U +@kindex U @r{(Package Menu)} +@findex package-menu-mark-upgrades Mark all package with a newer available version for upgrading (@code{package-menu-mark-upgrades}). This places an installation mark on the new available versions, and a deletion mark on the old installed versions. @item x +@kindex x @r{(Package Menu)} @vindex package-menu-async +@findex package-menu-execute Download and install all packages marked with @kbd{i}, and their dependencies; also, delete all packages marked with @kbd{d} (@code{package-menu-execute}). This also removes the marks. @item r +@kindex r @r{(Package Menu)} +@findex package-menu-refresh Refresh the package list (@code{package-menu-refresh}). This fetches the list of available packages from the package archive again, and recomputes the package list. @item / k +@kindex / k @r{(Package Menu)} +@findex package-menu-filter-by-keyword Filter the package list by keyword (@code{package-menu-filter-by-keyword}). This prompts for a keyword (e.g., @samp{games}), then shows only the packages that relate to that keyword. @item / n +@kindex / n @r{(Package Menu)} +@findex package-menu-filter-by-name Filter the package list by name (@code{package-menu-filter-by-name}). This prompts for a string, then shows only the packages whose names match a regexp with that value. @item / / +@kindex / / @r{(Package Menu)} +@findex package-menu-clear-filter Clear filter currently applied to the package list (@code{package-menu-clear-filter}). @item H +@kindex H @r{(Package Menu)} +@findex package-menu-hide-package Permanently hide packages that match a regexp (@code{package-menu-hide-package}). @item ( +@kindex ( @r{(Package Menu)} +@findex package-menu-toggle-hiding Toggle visibility of old versions of packages and also of versions from lower-priority archives (@code{package-menu-toggle-hiding}). @end table commit 6b2745fe2ecc5190e90f398022710256beb5c4e1 Author: Stefan Kangas Date: Sun Oct 6 04:02:27 2019 +0200 Use PASSWORD_STORE_DIR in auth-source-pass when set * lisp/auth-source-pass.el (auth-source-pass-filename): Initialize to PASSWORD_STORE_DIR environment variable when set. (Bug#29663) diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el index c45c782c27..524a72792c 100644 --- a/lisp/auth-source-pass.el +++ b/lisp/auth-source-pass.el @@ -45,7 +45,8 @@ :group 'auth-source :version "27.1") -(defcustom auth-source-pass-filename "~/.password-store" +(defcustom auth-source-pass-filename + (or (getenv "PASSWORD_STORE_DIR") "~/.password-store") "Filename of the password-store folder." :type 'directory :version "27.1") commit 6297eb0fca9967649bcde6fd160bb6b5d3ce6878 Author: Stefan Kangas Date: Sat Nov 2 01:30:36 2019 +0100 Don't refuse to install packages without a "footer line" * lisp/emacs-lisp/package.el (package-buffer-info): Don't signal an error when the "footer line" is missing. Warn only. (Bug#26490) * etc/NEWS: Announce it. diff --git a/etc/NEWS b/etc/NEWS index 7a76d90ed5..e614197125 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1075,6 +1075,20 @@ it can't find the config file. ** Package +*** Warn if "footer line" is missing, but still install package. +package.el used to refuse to install a package without the so-called +"footer line", which appears at the very end of the file: + +;;; FILENAME ends here + +package.el will now install packages without this line, but it will +issue a warning. To avoid this warning, packages should keep the +"footer line". + +Note that versions of Emacs older than 27.1 will not only refuse to +install packages without such a line -- they will be unable to parse +package data. It is therefore recommended to keep this line. + *** Change of 'package-check-signature' for packages with multiple sigs In previous Emacsen, 't' checked that all signatures are valid. Now 't' only checks that at least one signature is valid and the new 'all' diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 645e831bcc..8c8e86aead 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1082,10 +1082,13 @@ boundaries." (let ((file-name (match-string-no-properties 1)) (desc (match-string-no-properties 2)) (start (line-beginning-position))) - ;; The terminating comment format could be extended to accept a - ;; generic string that is not in English. + ;; This warning was added in Emacs 27.1, and should be removed at + ;; the earliest in version 31.1. The idea is to phase out the + ;; requirement for a "footer line" without unduly impacting users + ;; on earlier Emacs versions. See Bug#26490 for more details. (unless (search-forward (concat ";;; " file-name ".el ends here")) - (error "Package lacks a terminating comment")) + (lwarn '(package package-format) :warning + "Package lacks a terminating comment")) ;; Try to include a trailing newline. (forward-line) (narrow-to-region start (point)) commit 2f42832895942fdeaa0c500511aa19860fa806cd Author: Paul Eggert Date: Fri Nov 1 17:24:02 2019 -0700 Omit edition numbers and dates in manuals These seem to cause more confusion than they cure; e.g., https://shop.fsf.org/books/gnu-emacs-manual-18th-edition-v-261 currently advertises "18th edition" even as it points to https://www.gnu.org/software/emacs/manual/pdf/emacs.pdf which says "Seventeenth Edition". It is simpler and less confusing to stick to one version number like "26.3". If we need a separate edition number for each printed manual for some reason (marketing?) we can put “@ifset printed-edition” around anything specific to the printed editions. (as opposed to online PDF copies). * doc/emacs/emacs.texi (EDITION): * doc/lispintro/emacs-lisp-intro.texi (edition-number, update-date): * doc/lispref/elisp.texi (VERSION, DATE): Remove, and remove uses. diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index a7967ecaee..678ccb9ba5 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -3,28 +3,10 @@ @setfilename ../../info/emacs.info @settitle GNU Emacs Manual @include docstyle.texi - -@c The edition number appears in more than one place in this file -@c I don't really know what it means... -@c For example, it has said "Sixteenth" since sometime in the Emacs 22 -@c series, all through 23, and into 24. So it is not very useful IMO, -@c and offers nothing that EMACSVER does not. I guess it relates -@c mainly to the published book sold by the FSF. Hence no longer -@c bother including it except iftex. Really, I think it should not be -@c here at all (since anyone can make a pdf version), but should just -@c be something added by the FSF during the publishing process. -@c Also, the lispref uses a float (3.0), whereas this uses an ordinal, -@c so the format is not even consistent. -@set EDITION Seventeenth @include emacsver.texi @copying -@iftex -This is the @value{EDITION} edition of the @cite{GNU Emacs Manual},@* -@end iftex -@ifnottex This is the @cite{GNU Emacs Manual}, -@end ifnottex updated for Emacs version @value{EMACSVER}. Copyright @copyright{} 1985--1987, 1993--2019 Free Software Foundation, Inc. @@ -82,7 +64,7 @@ developing GNU and promoting software freedom.'' @sp 6 @center @titlefont{GNU Emacs Manual} @sp 4 -@center @value{EDITION} Edition, Updated for Emacs Version @value{EMACSVER}. +@center Updated for Emacs Version @value{EMACSVER} @sp 5 @center Richard Stallman et al. @page diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 489ba8d6ef..9ad4cf102e 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi @@ -63,10 +63,6 @@ \global\hbadness=6666 % don't worry about not-too-underfull boxes @end tex -@c These refer to the printed book sold by the FSF. -@set edition-number 3.10 -@set update-date 28 October 2009 - @c For next or subsequent edition: @c create function using with-output-to-temp-buffer @c create a major mode, with keymaps @@ -106,9 +102,6 @@ This is @cite{An Introduction to Programming in Emacs Lisp}, for people who are not programmers. @sp 1 -@iftex -Edition @value{edition-number}, @value{update-date} -@end iftex @ifnottex Distributed with Emacs version @value{EMACSVER}. @end ifnottex diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index d667c51d78..652175c395 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi @@ -52,12 +52,7 @@ @end ifset @end tex - -@c Version of the manual and of Emacs. -@c (See comments for EDITION in emacs.texi) -@set VERSION 3.1 @include emacsver.texi -@set DATE October 2014 @c in general, keep the following line commented out, unless doing a @c copy of this manual that will be published. The manual should go @@ -91,12 +86,7 @@ @c @syncodeindex tp fn @copying -@iftex -This is edition @value{VERSION} of the @cite{GNU Emacs Lisp Reference Manual},@* -@end iftex -@ifnottex -This is the @cite{GNU Emacs Lisp Reference Manual} -@end ifnottex +This is the @cite{GNU Emacs Lisp Reference Manual}, corresponding to Emacs version @value{EMACSVER}. Copyright @copyright{} 1990--1996, 1998--2019 Free Software Foundation, Inc. @@ -127,7 +117,6 @@ developing GNU and promoting software freedom.'' @subtitle @value{voltitle} @end ifset @subtitle For Emacs Version @value{EMACSVER} -@subtitle Revision @value{VERSION}, @value{DATE} @author by Bil Lewis, Dan LaLiberte, Richard Stallman, @author the GNU Manual Group, et al. commit 9b1c00b3ca1a1f841cdcfd880536b0dc7669738a Author: Paul Eggert Date: Fri Nov 1 16:13:31 2019 -0700 Document limits on some time-conversion functions * doc/lispref/os.texi (Time of Day, Time Zone Rules) (Time Conversion, Time Parsing, Time Calculations): Document functions that limit the range of time values due to OS limits (Bug#37974). diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index d8d0ad7206..d3ddee251b 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -1307,7 +1307,14 @@ format, which can be a Lisp timestamp, @code{nil} for the current time, a single floating-point number for seconds, or a list @code{(@var{high} @var{low} @var{micro})} or @code{(@var{high} @var{low})} that is a truncated list timestamp with missing elements -taken to be zero. You can convert a time value into +taken to be zero. + +Time values can be converted to and from calendrical and other forms. +Some of these conversions rely on operating system functions that +limit the range of possible time values, and signal an error if the +limits are exceeded. For instance, a system may not support years +before 1970, or years before 1901, or years far in the future. +You can convert a time value into a human-readable string using @code{format-time-string}, into a Lisp timestamp using @code{time-convert}, and into other forms using @code{decode-time} and @code{float-time}. These functions are @@ -1328,11 +1335,12 @@ information may some day be added at the end. The argument @var{time}, if given, specifies a time to format, instead of the current time. The optional argument @var{zone} defaults to the current time zone rule. @xref{Time Zone Rules}. +The operating system limits the range of time and zone values. @example @group (current-time-string) - @result{} "Wed Oct 14 22:21:05 1987" + @result{} "Fri Nov @ 1 15:59:49 2019" @end group @end example @end defun @@ -1416,6 +1424,7 @@ compute the value, the unknown elements of the list are @code{nil}. The argument @var{time}, if given, specifies a time value to analyze instead of the current time. The optional argument @var{zone} defaults to the current time zone rule. +The operating system limits the range of time and zone values. @end defun @node Time Conversion @@ -1498,6 +1507,8 @@ Although @code{(time-convert nil nil)} is equivalent to This function converts a time value into calendrical information. If you don't specify @var{time}, it decodes the current time, and similarly @var{zone} defaults to the current time zone rule. @xref{Time Zone Rules}. +The operating system limits the range of time and zone values. + The @var{form} argument controls the form of the returned @var{seconds} element, as described below. The return value is a list of nine elements, as follows: @@ -1631,6 +1642,7 @@ convention, @var{zone} defaults to the current time zone rule Year numbers less than 100 are not treated specially. If you want them to stand for years above 1900, or years above 2000, you must alter them yourself before you call @code{encode-time}. +The operating system limits the range of time values. The @code{encode-time} function acts as a rough inverse to @code{decode-time}. For example, you can pass the output of @@ -1643,11 +1655,6 @@ the latter to the former as follows: You can perform simple date arithmetic by using out-of-range values for @var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month}; for example, day 0 means the day preceding the given month. - -The operating system puts limits on the range of possible time values; -if the limits are exceeded while encoding the time, an error results. -For instance, years before 1970 do not work on some systems; -on others, years as early as 1901 do work. @end defun @node Time Parsing @@ -1666,6 +1673,7 @@ corresponding Lisp timestamp. The argument @var{string} should represent a date-time, and should be in one of the forms recognized by @code{parse-time-string} (see below). This function assumes the GMT timezone if @var{string} lacks an explicit timezone information. +The operating system limits the range of time values. @end defun @defun parse-time-string string @@ -1847,10 +1855,12 @@ behavior, as future versions of Emacs may recognize new This function uses the C library function @code{strftime} (@pxref{Formatting Calendar Time,,, libc, The GNU C Library Reference Manual}) to do most of the work. In order to communicate with that -function, it first encodes its argument using the coding system +function, it first converts @var{time} and @var{zone} to internal form; +the operating system limits the range of time and zone values. +This function also encodes @var{format-string} using the coding system specified by @code{locale-coding-system} (@pxref{Locales}); after @code{strftime} returns the resulting string, -@code{format-time-string} decodes the string using that same coding +this function decodes the string using that same coding system. @end defun @@ -1990,10 +2000,12 @@ Here is how to add a number of seconds to a time value: @defun time-to-days time-value This function returns the number of days between the beginning of year 1 and @var{time-value}. +The operating system limits the range of time values. @end defun @defun time-to-day-in-year time-value This returns the day number within the year corresponding to @var{time-value}. +The operating system limits the range of time values. @end defun @defun date-leap-year-p year @@ -2002,7 +2014,7 @@ This function returns @code{t} if @var{year} is a leap year. @defun date-days-in-month year month Return the number of days in @var{month} in @var{year}. For instance, -there's 29 days in February 2004. +February 2020 has 29 days. @end defun @defun date-ordinal-to-time year ordinal commit a8b87446656af0395864b7aaa697a4e04bcc1218 Author: Lars Ingebrigtsen Date: Fri Nov 1 18:32:29 2019 +0100 set-face-font doc string update * lisp/faces.el (set-face-font): Mention what the string formats are (bug#14647). diff --git a/lisp/faces.el b/lisp/faces.el index 2779197804..75753ecefc 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -888,6 +888,10 @@ Use `set-face-attribute' for finer control of font weight and slant." (defun set-face-font (face font &optional frame) "Change font-related attributes of FACE to those of FONT (a string). +The format of the font varies based on the font system in used, +but it can commonly be an X logical font description (XLFD) +string, or a simpler XFD string like \"courier:size=10\". + FRAME nil or not specified means change face on all frames. This sets the attributes `:family', `:foundry', `:width', `:height', `:weight', and `:slant'. When called interactively, commit eda98211e31ed969823c1048b3cde635e08eebe5 Author: Lars Ingebrigtsen Date: Fri Nov 1 18:27:17 2019 +0100 Fix documentation of set-face-font in the manual * doc/lispref/display.texi (Attribute Functions): Describe more precisely what set-face-font does (bug#14647). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 492104ddf0..29abc0a9f2 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2833,7 +2833,11 @@ This sets the @code{:stipple} attribute of @var{face} to @end deffn @deffn Command set-face-font face font &optional frame -This sets the @code{:font} attribute of @var{face} to @var{font}. +Change the font-related attributes of @var{face} to those of +@var{font} (a string). This sets the attributes @code{:family}, +@code{:foundry}, @code{:width}, @code{:height}, @code{:weight}, and +@code{:slant}. If @var{frame} is non-@code{nil}, only change the +attributes on the specified frame. @end deffn @defun set-face-bold face bold-p &optional frame commit fd29402180394d9f7efabee82daaa60d7cdb8b06 Author: Lars Ingebrigtsen Date: Fri Nov 1 18:14:17 2019 +0100 Low-Level Font documentation fix * doc/lispref/display.texi (Low-Level Font): Mention what the data types the font attributes are (bug#14634). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 23758f6be9..492104ddf0 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3660,7 +3660,10 @@ The font name (a string), in either XLFD, Fontconfig, or GTK+ format. @itemx :slant @itemx :width These have the same meanings as the face attributes of the same name. -@xref{Face Attributes}. +@xref{Face Attributes}. @code{:family} and @code{:foundry} are +strings, while the other three are symbols. As example values, +@code{:slant} may be @code{italic}, @code{:weight} may be @code{bold} +and @code{:width} may be @code{normal}. @item :size The font size---either a non-negative integer that specifies the pixel commit 0714d6664cd2e836d425d00951bbe599af553952 Author: Lars Ingebrigtsen Date: Fri Nov 1 17:42:22 2019 +0100 Really enable setting a breakpoint without instrumenting first * lisp/emacs-lisp/edebug.el (edebug-set-breakpoint): Really enable setting a breakpoint without instrumenting first (bug#23469). diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 237d93922f..d81052318c 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3276,7 +3276,9 @@ With prefix argument, make it a temporary breakpoint." (interactive "P") ;; If the form hasn't been instrumented yet, do it now. (when (and (not edebug-active) - (let ((data (get (edebug-form-data-symbol) 'edebug))) + (let ((data (get (edebug--form-data-name + (edebug-get-form-data-entry (point))) + 'edebug))) (or (null data) (markerp data)))) (edebug-defun)) (edebug-modify-breakpoint t nil arg)) commit 64a1541175ffac58eeba0b4811b1d20d3434c5bf Author: Glenn Morris Date: Fri Nov 1 06:27:08 2019 -0700 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index ea111f2d3f..b6b0c894be 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -512,9 +512,9 @@ Return t if `allout-mode' is active in current buffer." nil t) Toggle Allout outline mode. If called interactively, enable Allout mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\ Allout outline mode is a minor mode that provides extensive @@ -826,10 +826,10 @@ See `allout-widgets-mode' for allout widgets mode features.") (autoload 'allout-widgets-mode "allout-widgets" "\ Toggle Allout Widgets mode. -If called interactively, enable Allout-Widgets mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Allout-Widgets mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Allout Widgets mode is an extension of Allout mode that provides graphical decoration of outline structure. It is meant to @@ -1233,9 +1233,9 @@ Entering array mode calls the function `array-mode-hook'. Toggle Artist mode. If called interactively, enable Artist mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard. @@ -1564,10 +1564,10 @@ or call the function `autoarg-kp-mode'.") (autoload 'autoarg-kp-mode "autoarg" "\ Toggle Autoarg-KP mode, a global minor mode. -If called interactively, enable Autoarg-Kp mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Autoarg-Kp mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\ This is similar to `autoarg-mode' but rebinds the keypad keys @@ -1620,10 +1620,10 @@ or call the function `auto-insert-mode'.") (autoload 'auto-insert-mode "autoinsert" "\ Toggle Auto-insert mode, a global minor mode. -If called interactively, enable Auto-Insert mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Auto-Insert mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Auto-insert mode is enabled, when new files are created you can insert a template for the file depending on the mode of the buffer. @@ -1692,10 +1692,10 @@ should be non-nil)." nil nil) (autoload 'auto-revert-mode "autorevert" "\ Toggle reverting buffer when the file changes (Auto-Revert Mode). -If called interactively, enable Auto-Revert mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Auto-Revert mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Auto-Revert Mode is a minor mode that affects only the current buffer. When enabled, it reverts the buffer when the file on @@ -1719,10 +1719,10 @@ This function is designed to be added to hooks, for example: (autoload 'auto-revert-tail-mode "autorevert" "\ Toggle reverting tail of buffer when the file grows. -If called interactively, enable Auto-Revert-Tail mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Auto-Revert-Tail mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. When Auto-Revert Tail Mode is enabled, the tail of the file is constantly followed, as with the shell command `tail -f'. This @@ -1760,10 +1760,10 @@ or call the function `global-auto-revert-mode'.") (autoload 'global-auto-revert-mode "autorevert" "\ Toggle Global Auto-Revert Mode. -If called interactively, enable Global Auto-Revert mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Auto-Revert mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Global Auto-Revert Mode is a global minor mode that reverts any buffer associated with a file when the file changes on disk. Use @@ -1891,10 +1891,10 @@ or call the function `display-battery-mode'.") (autoload 'display-battery-mode "battery" "\ Toggle battery status display in mode line (Display Battery mode). -If called interactively, enable Display-Battery mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Display-Battery mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. The text displayed in the mode line is controlled by `battery-mode-line-format' and `battery-status-function'. @@ -1943,6 +1943,14 @@ For non-interactive use see also `benchmark-run' and \(fn REPETITIONS FORM)" t nil) +(autoload 'benchmark-progn "benchmark" "\ +Evaluate BODY and message the time taken. +The return value is the value of the final form in BODY. + +\(fn &rest BODY)" nil t) + +(function-put 'benchmark-progn 'lisp-indent-function '0) + (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "benchmark" '("benchmark-elapse"))) ;;;*** @@ -2857,20 +2865,20 @@ columns on its right towards the left. (autoload 'bug-reference-mode "bug-reference" "\ Toggle hyperlinking bug references in the buffer (Bug Reference mode). -If called interactively, enable Bug-Reference mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Bug-Reference mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) (autoload 'bug-reference-prog-mode "bug-reference" "\ Like `bug-reference-mode', but only buttonize in comments and strings. -If called interactively, enable Bug-Reference-Prog mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Bug-Reference-Prog mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -4637,10 +4645,10 @@ Prefix argument is the same as for `checkdoc-defun'." t nil) (autoload 'checkdoc-minor-mode "checkdoc" "\ Toggle automatic docstring checking (Checkdoc minor mode). -If called interactively, enable Checkdoc minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Checkdoc minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. In Checkdoc minor mode, the usual bindings for `eval-defun' which is bound to \\\\[checkdoc-eval-defun] and `checkdoc-eval-current-buffer' are overridden to include @@ -4870,10 +4878,10 @@ This can be needed when using code byte-compiled using the old macro-expansion of `cl-defstruct' that used vectors objects instead of record objects. -If called interactively, enable Cl-Old-Struct-Compat mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Cl-Old-Struct-Compat mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -5319,10 +5327,10 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see). (autoload 'compilation-shell-minor-mode "compile" "\ Toggle Compilation Shell minor mode. -If called interactively, enable Compilation-Shell minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Compilation-Shell minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. When Compilation Shell minor mode is enabled, all the error-parsing commands of the Compilation major mode are @@ -5334,10 +5342,10 @@ See `compilation-mode'. (autoload 'compilation-minor-mode "compile" "\ Toggle Compilation minor mode. -If called interactively, enable Compilation minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Compilation minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. When Compilation minor mode is enabled, all the error-parsing commands of Compilation major mode are available. See @@ -5371,10 +5379,10 @@ or call the function `dynamic-completion-mode'.") (autoload 'dynamic-completion-mode "completion" "\ Toggle dynamic word-completion on or off. -If called interactively, enable Dynamic-Completion mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Dynamic-Completion mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -5931,9 +5939,9 @@ or call the function `cua-mode'.") Toggle Common User Access style editing (CUA mode). If called interactively, enable Cua mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. CUA mode is a global minor mode. When enabled, typed text replaces the active selection, and you can use C-z, C-x, C-c, and @@ -5978,10 +5986,10 @@ Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings. Toggle the region as rectangular. Activates the region if needed. Only lasts until the region is deactivated. -If called interactively, enable Cua-Rectangle-Mark mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Cua-Rectangle-Mark mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -6001,10 +6009,10 @@ By convention, this is a list of symbols where each symbol stands for the (autoload 'cursor-intangible-mode "cursor-sensor" "\ Keep cursor outside of any `cursor-intangible' text property. -If called interactively, enable Cursor-Intangible mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Cursor-Intangible mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -6016,10 +6024,10 @@ where WINDOW is the affected window, OLDPOS is the last known position of the cursor and DIR can be `entered' or `left' depending on whether the cursor is entering the area covered by the text-property property or leaving it. -If called interactively, enable Cursor-Sensor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Cursor-Sensor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -6398,9 +6406,9 @@ Mode used for cvs status output. Minor mode that highlights suspicious C and C++ constructions. If called interactively, enable Cwarn mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Suspicious constructs are highlighted using `font-lock-warning-face'. @@ -6412,6 +6420,8 @@ C++ modes are included. (define-obsolete-function-alias 'turn-on-cwarn-mode 'cwarn-mode "24.1") +(put 'global-cwarn-mode 'globalized-minor-mode t) + (defvar global-cwarn-mode nil "\ Non-nil if Global Cwarn mode is enabled. See the `global-cwarn-mode' command @@ -6844,10 +6854,10 @@ or call the function `delete-selection-mode'.") (autoload 'delete-selection-mode "delsel" "\ Toggle Delete Selection mode. -If called interactively, enable Delete-Selection mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Delete-Selection mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. When Delete Selection mode is enabled, typed text replaces the selection if the selection is active. Otherwise, typed text is just inserted at @@ -7011,10 +7021,10 @@ or call the function `desktop-save-mode'.") (autoload 'desktop-save-mode "desktop" "\ Toggle desktop saving (Desktop Save mode). -If called interactively, enable Desktop-Save mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Desktop-Save mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Desktop Save mode is enabled, the state of Emacs is saved from one session to another. In particular, Emacs will save the desktop when @@ -7301,7 +7311,12 @@ Major mode for editing the diary file. ;;; Generated autoloads from vc/diff.el (defvar diff-switches (purecopy "-u") "\ -A string or list of strings specifying switches to be passed to diff.") +A string or list of strings specifying switches to be passed to diff. + +This variable is also used in the `vc-diff' command (and related +commands) if the backend-specific diff switch variable isn't +set (`vc-git-diff-switches' for git, for instance), and +`vc-diff-switches' isn't set.") (custom-autoload 'diff-switches "diff" t) @@ -7370,10 +7385,10 @@ a diff with \\[diff-reverse-direction]. (autoload 'diff-minor-mode "diff-mode" "\ Toggle Diff minor mode. -If called interactively, enable Diff minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Diff minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\{diff-minor-mode-map} @@ -7453,6 +7468,12 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh. (autoload 'dired-other-frame "dired" "\ \"Edit\" directory DIRNAME. Like `dired' but makes a new frame. +\(fn DIRNAME &optional SWITCHES)" t nil) + (define-key tab-prefix-map "d" 'dired-other-tab) + +(autoload 'dired-other-tab "dired" "\ +\"Edit\" directory DIRNAME. Like `dired' but makes a new tab. + \(fn DIRNAME &optional SWITCHES)" t nil) (autoload 'dired-noselect "dired" "\ @@ -7551,9 +7572,9 @@ Keybindings: Toggle directory tracking in shell buffers (Dirtrack mode). If called interactively, enable Dirtrack mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. This method requires that your shell prompt contain the current working directory at all times, and that you set the variable @@ -7721,10 +7742,10 @@ in `.emacs'. Toggle display of fill-column indicator. This uses `display-fill-column-indicator' internally. -If called interactively, enable Display-Fill-Column-Indicator mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Display-Fill-Column-Indicator mode if +ARG is positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and toggle +it if ARG is `toggle'; disable the mode otherwise. To change the position of the column displayed by default customize `display-fill-column-indicator-column'. You can change the @@ -7732,6 +7753,8 @@ character for the indicator setting `display-fill-column-indicator-character'. \(fn &optional ARG)" t nil) +(put 'global-display-fill-column-indicator-mode 'globalized-minor-mode t) + (defvar global-display-fill-column-indicator-mode nil "\ Non-nil if Global Display-Fill-Column-Indicator mode is enabled. See the `global-display-fill-column-indicator-mode' command @@ -7766,10 +7789,10 @@ See `display-fill-column-indicator-mode' for more information on Display-Fill-Co Toggle display of line numbers in the buffer. This uses `display-line-numbers' internally. -If called interactively, enable Display-Line-Numbers mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Display-Line-Numbers mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. To change the type of line numbers displayed by default, customize `display-line-numbers-type'. To change the type while @@ -7777,6 +7800,8 @@ the mode is on, set `display-line-numbers' directly. \(fn &optional ARG)" t nil) +(put 'global-display-line-numbers-mode 'globalized-minor-mode t) + (defvar global-display-line-numbers-mode nil "\ Non-nil if Global Display-Line-Numbers mode is enabled. See the `global-display-line-numbers-mode' command @@ -7899,10 +7924,10 @@ to the next best mode." nil nil) (autoload 'doc-view-minor-mode "doc-view" "\ Toggle displaying buffer via Doc View (Doc View minor mode). -If called interactively, enable Doc-View minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Doc-View minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. See the command `doc-view-mode' for more information on this mode. @@ -7962,9 +7987,9 @@ Switch to *doctor* buffer and start giving psychotherapy." t nil) Toggle special insertion on double keypresses (Double mode). If called interactively, enable Double mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Double mode is enabled, some keys will insert different strings when pressed twice. See `double-map' for details. @@ -8802,10 +8827,10 @@ or call the function `global-ede-mode'.") (autoload 'global-ede-mode "ede" "\ Toggle global EDE (Emacs Development Environment) mode. -If called interactively, enable Global Ede mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Ede mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. This global minor mode enables `ede-minor-mode' in all buffers in an EDE controlled project. @@ -9781,10 +9806,10 @@ or call the function `electric-pair-mode'.") (autoload 'electric-pair-mode "elec-pair" "\ Toggle automatic parens pairing (Electric Pair mode). -If called interactively, enable Electric-Pair mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Electric-Pair mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Electric Pair mode is a global minor mode. When enabled, typing an open parenthesis automatically inserts the corresponding @@ -9799,10 +9824,10 @@ To toggle the mode in a single buffer, use `electric-pair-local-mode'. (autoload 'electric-pair-local-mode "elec-pair" "\ Toggle `electric-pair-mode' only in this buffer. -If called interactively, enable Electric-Pair-Local mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Electric-Pair-Local mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -10141,9 +10166,9 @@ These are files with embedded formatting information in the MIME standard text/enriched format. If called interactively, enable Enriched mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Turning the mode on or off runs `enriched-mode-hook'. @@ -10400,9 +10425,9 @@ Encrypt marked files." t nil) A minor-mode for composing encrypted/clearsigned mails. If called interactively, enable epa-mail mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -10460,10 +10485,10 @@ or call the function `epa-global-mail-mode'.") (autoload 'epa-global-mail-mode "epa-mail" "\ Minor mode to hook EasyPG into Mail mode. -If called interactively, enable Epa-Global-Mail mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Epa-Global-Mail mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -10734,9 +10759,9 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL. ;;; Generated autoloads from erc/erc-networks.el (autoload 'erc-determine-network "erc-networks" "\ -Return the name of the network or \"Unknown\" as a symbol. Use the -server parameter NETWORK if provided, otherwise parse the server name and -search for a match in `erc-networks-alist'." nil nil) +Return the name of the network or \"Unknown\" as a symbol. +Use the server parameter NETWORK if provided, otherwise parse the +server name and search for a match in `erc-networks-alist'." nil nil) (autoload 'erc-server-select "erc-networks" "\ Interactively select a server to connect to using `erc-server-alist'." t nil) @@ -10867,6 +10892,10 @@ Tests that are expected to fail can be marked as such using :expected-result. See `ert-test-result-type-p' for a description of valid values for RESULT-TYPE. +Macros in BODY are expanded when the test is defined, not when it +is run. If a macro (possibly with side effects) is to be tested, +it has to be wrapped in `(eval (quote ...))'. + \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] [:tags \\='(TAG...)] BODY...)" nil t) (function-put 'ert-deftest 'doc-string-elt '3) @@ -11014,13 +11043,20 @@ Emacs shell interactive mode. (autoload 'eshell "eshell" "\ Create an interactive Eshell buffer. -The buffer used for Eshell sessions is determined by the value of -`eshell-buffer-name'. If there is already an Eshell session active in -that buffer, Emacs will simply switch to it. Otherwise, a new session -will begin. A numeric prefix arg (as in `C-u 42 M-x eshell RET') -switches to the session with that number, creating it if necessary. A -nonnumeric prefix arg means to create a new session. Returns the -buffer selected (or created). +Start a new Eshell session, or switch to an already active +session. Return the buffer selected (or created). + +With a nonnumeric prefix arg, create a new session. + +With a numeric prefix arg (as in `C-u 42 M-x eshell RET'), switch +to the session with that number, or create it if it doesn't +already exist. + +The buffer name used for Eshell sessions is determined by the +value of `eshell-buffer-name', which see. + +Eshell is a shell-like command interpreter. For more +information on Eshell, see Info node `(eshell)Top'. \(fn &optional ARG)" t nil) @@ -11317,9 +11353,11 @@ For non-interactive use, superceded by `fileloop-initialize-replace'. (autoload 'list-tags "etags" "\ Display list of tags in file FILE. -This searches only the first table in the list, and no included tables. -FILE should be as it appeared in the `etags' command, usually without a -directory specification. +This searches only the first table in the list, and no included +tables. FILE should be as it appeared in the `etags' command, +usually without a directory specification. If called +interactively, FILE defaults to the file name of the current +buffer. \(fn FILE &optional NEXT-MATCH)" t nil) @@ -11715,7 +11753,19 @@ Mode for browsing the web. \(fn)" t nil) (autoload 'eww-browse-url "eww" "\ +Ask the EWW browser to load URL. + +Interactively, if the variable `browse-url-new-window-flag' is non-nil, +loads the document in a new buffer tab on the window tab-line. A non-nil +prefix argument reverses the effect of `browse-url-new-window-flag'. + +If `tab-bar-mode' is enabled, then whenever a document would +otherwise be loaded in a new buffer, it is loaded in a new tab +in the tab-bar on an existing frame. See more options in +`eww-browse-url-new-window-is-tab'. +Non-interactively, this uses the optional second argument NEW-WINDOW +instead of `browse-url-new-window-flag'. \(fn URL &optional NEW-WINDOW)" nil nil) @@ -11817,7 +11867,7 @@ This is used only in conjunction with `expand-add-abbrevs'." t nil) ;;;### (autoloads nil "ezimage" "ezimage.el" (0 0 0 0)) ;;; Generated autoloads from ezimage.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ezimage" '("ezimage-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ezimage" '("defezimage" "ezimage-"))) ;;;*** @@ -12004,10 +12054,10 @@ a top-level keymap, `text-scale-increase' or (autoload 'buffer-face-mode "face-remap" "\ Minor mode for a buffer-specific default face. -If called interactively, enable Buffer-Face mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Buffer-Face mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When enabled, the face specified by the variable `buffer-face-mode-face' is used to display the buffer text. @@ -12905,9 +12955,9 @@ region is invalid. Toggle Flymake mode on or off. If called interactively, enable Flymake mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Flymake is an Emacs minor mode for on-the-fly syntax checking. Flymake collects diagnostic information from multiple sources, @@ -12987,9 +13037,9 @@ Turn on `flyspell-mode' for comments and strings." t nil) Toggle on-the-fly spell checking (Flyspell mode). If called interactively, enable Flyspell mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Flyspell mode is a buffer-local minor mode. When enabled, it spawns a single Ispell process and checks each word. The default @@ -13064,9 +13114,9 @@ Turn off Follow mode. Please see the function `follow-mode'." nil nil) Toggle Follow mode. If called interactively, enable Follow mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Follow mode is a minor mode that combines windows into one tall virtual window. This is accomplished by two main techniques: @@ -13189,9 +13239,9 @@ selected if the original window is the first one in the frame. Toggle Footnote mode. If called interactively, enable Footnote mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Footnote mode is a buffer-local minor mode. If enabled, it provides footnote support for `message-mode'. To get started, @@ -13603,10 +13653,10 @@ being transferred. This list may grow up to a size of `gdb-debug-log-max' after which the oldest element (at the end of the list) is deleted every time a new one is added (at the front). -If called interactively, enable Gdb-Enable-Debug mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Gdb-Enable-Debug mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -13778,9 +13828,9 @@ regular expression that can be used as an element of Minor mode for making identifiers likeThis readable. If called interactively, enable Glasses mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When this mode is active, it tries to add virtual separators (like underscores) at places they belong to. @@ -14361,10 +14411,10 @@ If FORCE is non-nil, replace the old ones. (autoload 'gnus-mailing-list-mode "gnus-ml" "\ Minor mode for providing mailing-list commands. -If called interactively, enable Gnus-Mailing-List mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Gnus-Mailing-List mode if ARG is +positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and +toggle it if ARG is `toggle'; disable the mode otherwise. \\{gnus-mailing-list-mode-map} @@ -14815,20 +14865,20 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and (autoload 'goto-address-mode "goto-addr" "\ Minor mode to buttonize URLs and e-mail addresses in the current buffer. -If called interactively, enable Goto-Address mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Goto-Address mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) (autoload 'goto-address-prog-mode "goto-addr" "\ Like `goto-address-mode', but only for comments and strings. -If called interactively, enable Goto-Address-Prog mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Goto-Address-Prog mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -14874,7 +14924,7 @@ include it when specifying `grep-command'. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'.") +\\[customize] or call the function `grep-apply-setting'.") (custom-autoload 'grep-command "grep" nil) @@ -14882,7 +14932,7 @@ Customize or call the function `grep-apply-setting'.") The default find command for \\[grep-find]. In interactive usage, the actual value of this variable is set up by `grep-compute-defaults'; to change the default value, use -Customize or call the function `grep-apply-setting'.") +\\[customize] or call the function `grep-apply-setting'.") (custom-autoload 'grep-find-command "grep" nil) @@ -14931,7 +14981,12 @@ History list for grep-find.") Setup compilation variables and buffer for `grep'. Set up `compilation-exit-message-function' and run `grep-setup-hook'." nil nil) -(autoload 'grep-compute-defaults "grep" nil nil nil) +(autoload 'grep-compute-defaults "grep" "\ +Compute the defaults for the `grep' command. +The value depends on `grep-command', `grep-template', +`grep-use-null-device', `grep-find-command', `grep-find-template', +`grep-use-null-filename-separator', `grep-find-use-xargs' and +`grep-highlight-matches'." nil nil) (autoload 'grep-mode "grep" "\ Sets `grep-last-buffer' and `compilation-window-height'. @@ -14939,7 +14994,9 @@ Sets `grep-last-buffer' and `compilation-window-height'. \(fn)" nil nil) (autoload 'grep "grep" "\ -Run Grep with user-specified COMMAND-ARGS, collect output in a buffer. +Run Grep with user-specified COMMAND-ARGS. +The output from the command goes to the \"*grep*\" buffer. + While Grep runs asynchronously, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] in the *grep* buffer, to go to the lines where Grep found matches. To kill the Grep job before it finishes, type \\[kill-compilation]. @@ -14962,7 +15019,7 @@ list is empty). (autoload 'grep-find "grep" "\ Run grep via find, with user-specified args COMMAND-ARGS. -Collect output in a buffer. +Collect output in the \"*grep*\" buffer. While find runs asynchronously, you can use the \\[next-error] command to find the text that grep hits refer to. @@ -14985,12 +15042,15 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l before it is executed. With two \\[universal-argument] prefixes, directly edit and run `grep-command'. -Collect output in a buffer. While grep runs asynchronously, you +Collect output in the \"*grep*\" buffer. While grep runs asynchronously, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] in the grep output buffer, to go to the lines where grep found matches. This command shares argument histories with \\[rgrep] and \\[grep]. +If CONFIRM is non-nil, the user will be given an opportunity to edit the +command before it's run. + \(fn REGEXP &optional FILES DIR CONFIRM)" t nil) (autoload 'rgrep "grep" "\ @@ -15005,7 +15065,7 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l before it is executed. With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. -Collect output in a buffer. While the recursive grep is running, +Collect output in the \"*grep*\" buffer. While the recursive grep is running, you can use \\[next-error] (M-x next-error), or \\\\[compile-goto-error] in the grep output buffer, to visit the lines where matches were found. To kill the job before it finishes, type \\[kill-compilation]. @@ -15015,6 +15075,9 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]. When called programmatically and FILES is nil, REGEXP is expected to specify a command to run. +If CONFIRM is non-nil, the user will be given an opportunity to edit the +command before it's run. + \(fn REGEXP &optional FILES DIR CONFIRM)" t nil) (autoload 'zrgrep "grep" "\ @@ -15022,6 +15085,9 @@ Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. Like `rgrep' but uses `zgrep' for `grep-program', sets the default file name to `*.gz', and sets `grep-highlight-matches' to `always'. +If CONFIRM is non-nil, the user will be given an opportunity to edit the +command before it's run. + \(fn REGEXP &optional FILES DIR CONFIRM TEMPLATE)" t nil) (defalias 'rzgrep 'zrgrep) @@ -15138,10 +15204,10 @@ or call the function `gud-tooltip-mode'.") (autoload 'gud-tooltip-mode "gud" "\ Toggle the display of GUD tooltips. -If called interactively, enable Gud-Tooltip mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Gud-Tooltip mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -15814,9 +15880,9 @@ This discards the buffer's undo information." t nil) Toggle selective highlighting of patterns (Hi Lock mode). If called interactively, enable Hi-Lock mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Hi Lock mode is automatically enabled when you invoke any of the highlighting commands listed below, such as \\[highlight-regexp]. @@ -15877,6 +15943,8 @@ Hi-lock: end is found. A mode is excluded if it's in the list \(fn &optional ARG)" t nil) +(put 'global-hi-lock-mode 'globalized-minor-mode t) + (defvar global-hi-lock-mode nil "\ Non-nil if Global Hi-Lock mode is enabled. See the `global-hi-lock-mode' command @@ -15987,10 +16055,10 @@ be found in variable `hi-lock-interactive-patterns'." t nil) (autoload 'hide-ifdef-mode "hideif" "\ Toggle features to hide/show #ifdef blocks (Hide-Ifdef mode). -If called interactively, enable Hide-Ifdef mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Hide-Ifdef mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Hide-Ifdef mode is a buffer-local minor mode for use with C and C-like major modes. When enabled, code within #ifdef constructs @@ -16067,9 +16135,9 @@ whitespace. Case does not matter.") Minor mode to selectively hide/show code and comment blocks. If called interactively, enable Hs minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When hideshow minor mode is on, the menu bar is augmented with hideshow commands and the hideshow commands are enabled. @@ -16102,10 +16170,10 @@ Unconditionally turn off `hs-minor-mode'." nil nil) (autoload 'highlight-changes-mode "hilit-chg" "\ Toggle highlighting changes in this buffer (Highlight Changes mode). -If called interactively, enable Highlight-Changes mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Highlight-Changes mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. When Highlight Changes is enabled, changes are marked with a text property. Normally they are displayed in a distinctive face, but @@ -16127,10 +16195,10 @@ buffer with the contents of a file (autoload 'highlight-changes-visible-mode "hilit-chg" "\ Toggle visibility of highlighting due to Highlight Changes mode. -If called interactively, enable Highlight-Changes-Visible mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Highlight-Changes-Visible mode if ARG +is positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and toggle +it if ARG is `toggle'; disable the mode otherwise. Highlight Changes Visible mode only has an effect when Highlight Changes mode is on. When enabled, the changed text is displayed @@ -16202,6 +16270,8 @@ changes are made, so \\[highlight-changes-next-change] and \(fn FILE-B)" t nil) +(put 'global-highlight-changes-mode 'globalized-minor-mode t) + (defvar global-highlight-changes-mode nil "\ Non-nil if Global Highlight-Changes mode is enabled. See the `global-highlight-changes-mode' command @@ -16269,9 +16339,9 @@ argument VERBOSE non-nil makes the function verbose. Toggle highlighting of the current line (Hl-Line mode). If called interactively, enable Hl-Line mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Hl-Line mode is a buffer-local minor mode. If `hl-line-sticky-flag' is non-nil, Hl-Line mode highlights the @@ -16300,10 +16370,10 @@ or call the function `global-hl-line-mode'.") (autoload 'global-hl-line-mode "hl-line" "\ Toggle line highlighting in all buffers (Global Hl-Line mode). -If called interactively, enable Global Hl-Line mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Hl-Line mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. If `global-hl-line-sticky-flag' is non-nil, Global Hl-Line mode highlights the line about the current buffer's point in all live @@ -16722,9 +16792,9 @@ or call the function `icomplete-mode'.") Toggle incremental minibuffer completion (Icomplete mode). If called interactively, enable Icomplete mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When this global minor mode is enabled, typing in the minibuffer continuously displays a list of possible completions that match @@ -17043,8 +17113,15 @@ For details of keybindings, see `ido-switch-buffer'." t nil) (autoload 'ido-display-buffer "ido" "\ Display a buffer in another window but don't select it. + +If ACTION (the prefix argument interactively), display the buffer +in another windown even if it's already displayed in the current +window. + The buffer name is selected interactively by typing a substring. -For details of keybindings, see `ido-switch-buffer'." t nil) +For details of keybindings, see `ido-switch-buffer'. + +\(fn &optional ACTION)" t nil) (autoload 'ido-display-buffer-other-frame "ido" "\ Display a buffer preferably in another frame. @@ -17258,9 +17335,9 @@ See `inferior-emacs-lisp-mode' for details. Toggle Iimage mode on or off. If called interactively, enable Iimage mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\{iimage-mode-map} @@ -17311,7 +17388,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data. \(fn SOURCE &optional TYPE DATA-P)" nil nil) (autoload 'image-type-available-p "image" "\ -Return non-nil if image type TYPE is available. +Return t if image type TYPE is available. Image types are symbols like `xbm' or `jpeg'. \(fn TYPE)" nil nil) @@ -17462,7 +17539,7 @@ recognizes these files as having image type `imagemagick'. If Emacs is compiled without ImageMagick support, this does nothing." nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "image" '("image"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "image" '("image" "unknown-image-type"))) ;;;*** @@ -17561,10 +17638,10 @@ Setup easy-to-use keybindings for the commands to be used in dired mode. Note that n, p and and will be hijacked and bound to `image-dired-dired-x-line'. -If called interactively, enable Image-Dired minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Image-Dired minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -17657,10 +17734,10 @@ or call the function `auto-image-file-mode'.") (autoload 'auto-image-file-mode "image-file" "\ Toggle visiting of image files as images (Auto Image File mode). -If called interactively, enable Auto-Image-File mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Auto-Image-File mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. An image file is one whose name has an extension in `image-file-name-extensions', or matches a regexp in @@ -17686,10 +17763,10 @@ Key bindings: (autoload 'image-minor-mode "image-mode" "\ Toggle Image minor mode in this buffer. -If called interactively, enable Image minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Image minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Image minor mode provides the key \\\\[image-toggle-display], to switch back to `image-mode' and display an image file as the @@ -18631,10 +18708,10 @@ available on the net." t nil) (autoload 'ispell-minor-mode "ispell" "\ Toggle last-word spell checking (Ispell minor mode). -If called interactively, enable ISpell minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable ISpell minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Ispell minor mode is a buffer-local minor mode. When enabled, typing SPC or RET warns you if the previous word is incorrectly @@ -19318,14 +19395,16 @@ generations (this defaults to 1). Toggle display of line numbers in the left margin (Linum mode). If called interactively, enable Linum mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Linum mode is a buffer-local minor mode. \(fn &optional ARG)" t nil) +(put 'global-linum-mode 'globalized-minor-mode t) + (defvar global-linum-mode nil "\ Non-nil if Global Linum mode is enabled. See the `global-linum-mode' command @@ -19888,10 +19967,10 @@ or call the function `mail-abbrevs-mode'.") (autoload 'mail-abbrevs-mode "mailabbrev" "\ Toggle abbrev expansion of mail aliases (Mail Abbrevs mode). -If called interactively, enable Mail-Abbrevs mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Mail-Abbrevs mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Mail Abbrevs mode is a global minor mode. When enabled, abbrev-like expansion is performed when editing certain mail @@ -20222,9 +20301,9 @@ Default bookmark handler for Man buffers. Toggle Master mode. If called interactively, enable Master mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Master mode is enabled, you can scroll the slave buffer using the following commands: @@ -20257,10 +20336,10 @@ or call the function `minibuffer-depth-indicate-mode'.") (autoload 'minibuffer-depth-indicate-mode "mb-depth" "\ Toggle Minibuffer Depth Indication mode. -If called interactively, enable Minibuffer-Depth-Indicate mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Minibuffer-Depth-Indicate mode if ARG +is positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and toggle +it if ARG is `toggle'; disable the mode otherwise. Minibuffer Depth Indication mode is a global minor mode. When enabled, any recursive use of the minibuffer will show the @@ -20837,9 +20916,9 @@ or call the function `midnight-mode'.") Non-nil means run `midnight-hook' at midnight. If called interactively, enable Midnight mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -20882,10 +20961,10 @@ or call the function `minibuffer-electric-default-mode'.") (autoload 'minibuffer-electric-default-mode "minibuf-eldef" "\ Toggle Minibuffer Electric Default mode. -If called interactively, enable Minibuffer-Electric-Default mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Minibuffer-Electric-Default mode if +ARG is positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and toggle +it if ARG is `toggle'; disable the mode otherwise. Minibuffer Electric Default mode is a global minor mode. When enabled, minibuffer prompts that show a default value only show @@ -21294,7 +21373,7 @@ will be computed and used. (put 'define-overloadable-function 'doc-string-elt 3) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mode-local" '("activate-mode-local-bindings" "deactivate-mode-local-bindings" "def" "describe-mode-local-" "fetch-overload" "function-overload-p" "get-mode-local-parent" "make-obsolete-overload" "mode-local-" "new-mode-local-bindings" "overload-" "set" "with-mode-local" "xref-mode-local-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "mode-local" '("def" "describe-mode-local-bindings" "fetch-overload" "get-mode-local-parent" "make-obsolete-overload" "mode-local-" "setq-mode-local" "with-mode-local" "xref-mode-local-"))) ;;;*** @@ -21453,9 +21532,9 @@ or call the function `msb-mode'.") Toggle Msb mode. If called interactively, enable Msb mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. This mode overrides the binding(s) of `mouse-buffer-menu' to provide a different buffer menu using the function `msb'. @@ -21631,7 +21710,11 @@ unless the display width of STR is equal to or less than the display width of ELLIPSIS. If it is non-nil and not a string, then ELLIPSIS defaults to `truncate-string-ellipsis'. -\(fn STR END-COLUMN &optional START-COLUMN PADDING ELLIPSIS)" nil nil) +If ELLIPSIS-TEXT-PROPERTY in non-nil, a too-long string will not +be truncated, but instead the elided parts will be covered by a +`display' text property showing the ellipsis. + +\(fn STR END-COLUMN &optional START-COLUMN PADDING ELLIPSIS ELLIPSIS-TEXT-PROPERTY)" nil nil) (defsubst nested-alist-p (obj) "\ Return t if OBJ is a nested alist. @@ -23104,9 +23187,9 @@ the cursor is on a headline, or on a plain list item (both as defined by Org mode). If called interactively, enable OrgStruct mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -23986,10 +24069,10 @@ Turning on outline mode calls the value of `text-mode-hook' and then of (autoload 'outline-minor-mode "outline" "\ Toggle Outline minor mode. -If called interactively, enable Outline minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Outline minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. See the command `outline-mode' for more information on this mode. @@ -24157,12 +24240,17 @@ downloads in the background. (autoload 'package-install "package" "\ Install the package PKG. -PKG can be a `package-desc' or a symbol naming one of the available packages -in an archive in `package-archives'. Interactively, prompt for its name. +PKG can be a `package-desc' or a symbol naming one of the +available packages in an archive in `package-archives'. When +called interactively, prompt for the package name. -If called interactively or if DONT-SELECT nil, add PKG to +Mark the installed package as selected by adding it to `package-selected-packages'. +When called from Lisp and optional argument DONT-SELECT is +non-nil, install the package but do not add it to +`package-select-packages'. + If PKG is a `package-desc' and it is already installed, don't try to install it but still mark it as selected. @@ -24280,10 +24368,10 @@ or call the function `show-paren-mode'.") (autoload 'show-paren-mode "paren" "\ Toggle visualization of matching parens (Show Paren mode). -If called interactively, enable Show-Paren mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Show-Paren mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Show Paren mode is a global minor mode. When enabled, any matching parenthesis is highlighted in `show-paren-style' after @@ -24654,6 +24742,8 @@ completion functions list (it should occur fairly early in the list). \(fn &optional INTERACTIVELY)" t nil) +(make-obsolete 'pcomplete '"use completion-at-point and pcomplete-completions-at-point" '"27.1") + (autoload 'pcomplete-reverse "pcomplete" "\ If cycling completion is in use, cycle backwards." t nil) @@ -24671,6 +24761,8 @@ This will modify the current buffer." t nil) (autoload 'pcomplete-help "pcomplete" "\ Display any help information relative to the current argument." t nil) +(make-obsolete 'pcomplete-help '"use completion-help-at-point and pcomplete-completions-at-point" '"27.1") + (autoload 'pcomplete-list "pcomplete" "\ Show the list of possible completions for the current argument." t nil) @@ -24972,10 +25064,10 @@ or call the function `pixel-scroll-mode'.") (autoload 'pixel-scroll-mode "pixel-scroll" "\ A minor mode to scroll text pixel-by-pixel. -If called interactively, enable Pixel-Scroll mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Pixel-Scroll mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -26580,10 +26672,10 @@ or call the function `rcirc-track-minor-mode'.") (autoload 'rcirc-track-minor-mode "rcirc" "\ Global minor mode for tracking activity in rcirc buffers. -If called interactively, enable Rcirc-Track minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Rcirc-Track minor mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -26627,13 +26719,13 @@ or call the function `recentf-mode'.") Toggle \"Open Recent\" menu (Recentf mode). If called interactively, enable Recentf mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Recentf mode is enabled, a \"Open Recent\" submenu is displayed in the \"File\" menu, containing a list of files that -were operated on recently. +were operated on recently, in the most-recently-used order. \(fn &optional ARG)" t nil) @@ -26778,10 +26870,10 @@ with a prefix argument, prompt for START-AT and FORMAT. (autoload 'rectangle-mark-mode "rect" "\ Toggle the region as rectangular. -If called interactively, enable Rectangle-Mark mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Rectangle-Mark mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Activates the region if needed. Only lasts until the region is deactivated. @@ -26812,9 +26904,9 @@ Activates the region if needed. Only lasts until the region is deactivated. Toggle automatic refilling (Refill mode). If called interactively, enable Refill mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Refill mode is a buffer-local minor mode. When enabled, the current paragraph is refilled as you edit. Self-inserting @@ -26843,9 +26935,9 @@ Turn on RefTeX mode." nil nil) Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX. If called interactively, enable Reftex mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\A Table of Contents of the entire (multifile) document with browsing capabilities is available with `\\[reftex-toc]'. @@ -27196,9 +27288,9 @@ first comment line visible (if point is in a comment). Toggle uncloaking of invisible text near point (Reveal mode). If called interactively, enable Reveal mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Reveal mode is a buffer-local minor mode. When enabled, it reveals invisible text around point. @@ -27219,10 +27311,10 @@ or call the function `global-reveal-mode'.") Toggle Reveal mode in all buffers (Global Reveal mode). Reveal mode renders invisible text around point visible again. -If called interactively, enable Global Reveal mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Reveal mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -27787,10 +27879,10 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' is non-nil." t nil) (autoload 'rng-validate-mode "rng-valid" "\ Minor mode performing continual validation against a RELAX NG schema. -If called interactively, enable Rng-Validate mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Rng-Validate mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Checks whether the buffer is a well-formed XML 1.0 document, conforming to the XML Namespaces Recommendation and valid against a @@ -27824,7 +27916,7 @@ to use for finding the schema. (put 'http://www\.w3\.org/2001/XMLSchema-datatypes 'rng-dt-compile #'rng-xsd-compile) (autoload 'rng-xsd-compile "rng-xsd" "\ -Provides W3C XML Schema as a RELAX NG datatypes library. +Provide W3C XML Schema as a RELAX NG datatypes library. NAME is a symbol giving the local name of the datatype. PARAMS is a list of pairs (PARAM-NAME . PARAM-VALUE) where PARAM-NAME is a symbol giving the name of the parameter and PARAM-VALUE is a string giving @@ -27939,9 +28031,9 @@ highlighting. Toggle ReST minor mode. If called interactively, enable Rst minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When ReST minor mode is enabled, the ReST mode keybindings are installed on top of the major mode bindings. Use this @@ -27990,9 +28082,9 @@ Use the command `ruler-mode' to change this variable.") Toggle display of ruler in header line (Ruler mode). If called interactively, enable Ruler mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -28017,7 +28109,7 @@ For extending the `rx' notation in FORM, use `rx-define' or `rx-let-eval'. (autoload 'rx "rx" "\ Translate regular expressions REGEXPS in sexp form to a regexp string. Each argument is one of the forms below; RX is a subform, and RX... stands -for one or more RXs. For details, see Info node `(elisp) Rx Notation'. +for zero or more RXs. For details, see Info node `(elisp) Rx Notation'. See `rx-to-string' for the corresponding function. STRING Match a literal string. @@ -28050,7 +28142,8 @@ CHAR Match a literal character. can be (any ...), (syntax ...), (category ...), or a character class. not-newline Match any character except a newline. Alias: nonl. -anything Match any character. +anychar Match any character. Alias: anything. +unmatchable Never match anything at all. CHARCLASS Match a character from a character class. One of: alpha, alphabetic, letter Alphabetic characters (defined by Unicode). @@ -28098,8 +28191,8 @@ Zero-width assertions: these all match the empty string in specific places. string-end At the end of the string or buffer. Alias: buffer-end, eos, eot. point At point. - word-start At the beginning of a word. - word-end At the end of a word. + word-start At the beginning of a word. Alias: bow. + word-end At the end of a word. Alias: eow. word-boundary At the beginning or end of a word. not-word-boundary Not at the beginning or end of a word. symbol-start At the beginning of a symbol. @@ -28244,9 +28337,9 @@ or call the function `savehist-mode'.") Toggle saving of minibuffer history (Savehist mode). If called interactively, enable Savehist mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Savehist mode is enabled, minibuffer history is saved to `savehist-file' periodically and when exiting Emacs. When @@ -28298,10 +28391,10 @@ Non-nil means automatically save place in each file. This means when you visit a file, point goes to the last place where it was when you previously visited the same file. -If called interactively, enable Save-Place mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Save-Place mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -28311,10 +28404,10 @@ If this mode is enabled, point is recorded when you kill the buffer or exit Emacs. Visiting this file again will go to that position, even in a later Emacs session. -If called interactively, enable Save-Place-Local mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Save-Place-Local mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. To save places automatically in all files, put this in your init file: @@ -28406,10 +28499,10 @@ or call the function `scroll-all-mode'.") (autoload 'scroll-all-mode "scroll-all" "\ Toggle shared scrolling in same-frame windows (Scroll-All mode). -If called interactively, enable Scroll-All mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Scroll-All mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Scroll-All mode is enabled, scrolling commands invoked in one window apply to all visible windows in the same frame. @@ -28433,16 +28526,19 @@ one window apply to all visible windows in the same frame. (autoload 'scroll-lock-mode "scroll-lock" "\ Buffer-local minor mode for pager-like scrolling. -If called interactively, enable Scroll-Lock mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Scroll-Lock mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When enabled, keys that normally move point by line or paragraph will scroll the buffer by the respective amount of lines instead and point will be kept vertically fixed relative to window boundaries during scrolling. +Note that the default key binding to Scroll_Lock will not work on +MS-Windows systems if `w32-scroll-lock-modifier' is non-nil. + \(fn &optional ARG)" t nil) (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "scroll-lock" '("scroll-lock-"))) @@ -28502,9 +28598,9 @@ or call the function `semantic-mode'.") Toggle parser features (Semantic mode). If called interactively, enable Semantic mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. In Semantic mode, Emacs parses the buffers you visit for their semantic content. This information is used by a variety of @@ -28572,7 +28668,7 @@ Semantic mode. ;;;;;; "cedet/semantic/bovine/c.el" (0 0 0 0)) ;;; Generated autoloads from cedet/semantic/bovine/c.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/bovine/c" '("c++-mode" "c-mode" "semantic"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/bovine/c" '("c-mode" "semantic"))) ;;;*** @@ -28588,7 +28684,7 @@ Semantic mode. ;;;;;; "cedet/semantic/bovine/el.el" (0 0 0 0)) ;;; Generated autoloads from cedet/semantic/bovine/el.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/bovine/el" '("emacs-lisp-mode" "lisp-mode" "semantic-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/bovine/el" '("emacs-lisp-mode" "semantic-"))) ;;;*** @@ -28849,7 +28945,7 @@ Major mode for editing Bovine grammars. ;;;;;; "cedet/semantic/html.el" (0 0 0 0)) ;;; Generated autoloads from cedet/semantic/html.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/html" '("html-helper-mode" "semantic-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/html" '("semantic-"))) ;;;*** @@ -29102,7 +29198,7 @@ Major mode for editing Wisent grammars. ;;;;;; "cedet/semantic/wisent/javascript.el" (0 0 0 0)) ;;; Generated autoloads from cedet/semantic/wisent/javascript.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/wisent/javascript" '("js-mode" "semantic-" "wisent-javascript-jv-expand-tag"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/wisent/javascript" '("semantic-" "wisent-javascript-jv-expand-tag"))) ;;;*** @@ -29110,7 +29206,7 @@ Major mode for editing Wisent grammars. ;;;;;; "cedet/semantic/wisent/python.el" (0 0 0 0)) ;;; Generated autoloads from cedet/semantic/wisent/python.el -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/wisent/python" '("python-" "semantic-" "wisent-python-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "semantic/wisent/python" '("semantic-" "wisent-python-"))) ;;;*** @@ -29408,6 +29504,48 @@ Like `mail' command, but display mail buffer in another frame. ;;; Generated autoloads from emacs-lisp/seq.el (push (purecopy '(seq 2 21)) package--builtin-versions) +(autoload 'seq-take "seq" "\ +Take the first N elements of SEQUENCE and return the result. +The result is a sequence of the same type as SEQUENCE. + +If N is a negative integer or zero, an empty sequence is +returned. + +\(fn SEQUENCE N)" nil nil) + +(autoload 'seq-sort-by "seq" "\ +Sort SEQUENCE using PRED as a comparison function. +Elements of SEQUENCE are transformed by FUNCTION before being +sorted. FUNCTION must be a function of one argument. + +\(fn FUNCTION PRED SEQUENCE)" nil nil) + +(autoload 'seq-filter "seq" "\ +Return a list of all the elements for which (PRED element) is non-nil in SEQUENCE. + +\(fn PRED SEQUENCE)" nil nil) + +(autoload 'seq-remove "seq" "\ +Return a list of all the elements for which (PRED element) is nil in SEQUENCE. + +\(fn PRED SEQUENCE)" nil nil) + +(autoload 'seq-find "seq" "\ +Return the first element for which (PRED element) is non-nil in SEQUENCE. +If no element is found, return DEFAULT. + +Note that `seq-find' has an ambiguity if the found element is +identical to DEFAULT, as it cannot be known if an element was +found or not. + +\(fn PRED SEQUENCE &optional DEFAULT)" nil nil) + +(autoload 'seq-position "seq" "\ +Return the index of the first element in SEQUENCE that is equal to ELT. +Equality is defined by TESTFN if non-nil or by `equal' if nil. + +\(fn SEQUENCE ELT &optional TESTFN)" nil nil) + (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "seq" '("seq-"))) ;;;*** @@ -29464,9 +29602,9 @@ or call the function `server-mode'.") Toggle Server mode. If called interactively, enable Server mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Server mode runs a process that accepts commands from the `emacsclient' program. See Info node `Emacs server' and @@ -29782,7 +29920,7 @@ The buffer is put in Shell mode, giving commands for sending input and controlling the subjobs of the shell. See `shell-mode'. See also the variable `shell-prompt-pattern'. -To specify a coding system for converting non-ASCII characters +\\To specify a coding system for converting non-ASCII characters in the input and output to the shell, use \\[universal-coding-system-argument] before \\[shell]. You can also specify this with \\[set-buffer-process-coding-system] in the shell buffer, after you start the shell. @@ -29794,6 +29932,8 @@ such as `explicit-csh-args'. If that symbol is a variable, its value is used as a list of arguments when invoking the shell. Otherwise, one argument `-i' is passed to the shell. +Make the shell buffer the current buffer, and return it. + \(Type \\[describe-mode] in the shell buffer for a list of commands.) \(fn &optional BUFFER)" t nil) @@ -30083,9 +30223,9 @@ buffer names. Minor mode to simplify editing output from the diff3 program. If called interactively, enable Smerge mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\{smerge-mode-map} @@ -30207,10 +30347,10 @@ Open the so-long `customize' group." t nil) (autoload 'so-long-minor-mode "so-long" "\ This is the minor mode equivalent of `so-long-mode'. -If called interactively, enable So-Long minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable So-Long minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Any active minor modes listed in `so-long-minor-modes' are disabled for the current buffer, and buffer-local values are assigned to variables in accordance @@ -30244,7 +30384,7 @@ values), despite potential performance issues, type \\[so-long-revert]. Use \\[so-long-commentary] for more information. -Use \\[so-long-customize] to configure the behaviour. +Use \\[so-long-customize] to configure the behavior. \(fn)" t nil) @@ -30279,10 +30419,10 @@ or call the function `global-so-long-mode'.") (autoload 'global-so-long-mode "so-long" "\ Toggle automated performance mitigations for files with long lines. -If called interactively, enable Global So-Long mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global So-Long mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Many Emacs modes struggle with buffers which contain excessively long lines, and may consequently cause unacceptable performance issues. @@ -31483,9 +31623,9 @@ or call the function `strokes-mode'.") Toggle Strokes mode, a global minor mode. If called interactively, enable Strokes mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \\ Strokes are pictographic mouse gestures which invoke commands. @@ -31561,9 +31701,9 @@ The variable list SPEC is the same as in `if-let'. Toggle subword movement and editing (Subword mode). If called interactively, enable Subword mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Subword mode is a buffer-local minor mode. Enabling it changes the definition of a word so that word-based commands stop inside @@ -31585,6 +31725,8 @@ treat nomenclature boundaries as word boundaries. \(fn &optional ARG)" t nil) +(put 'global-subword-mode 'globalized-minor-mode t) + (defvar global-subword-mode nil "\ Non-nil if Global Subword mode is enabled. See the `global-subword-mode' command @@ -31611,9 +31753,9 @@ See `subword-mode' for more information on Subword mode. Toggle superword movement and editing (Superword mode). If called interactively, enable Superword mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Superword mode is a buffer-local minor mode. Enabling it changes the definition of words such that symbols characters are treated @@ -31624,6 +31766,8 @@ as parts of words: e.g., in `superword-mode', \(fn &optional ARG)" t nil) +(put 'global-superword-mode 'globalized-minor-mode t) + (defvar global-superword-mode nil "\ Non-nil if Global Superword mode is enabled. See the `global-superword-mode' command @@ -31709,9 +31853,9 @@ or call the function `gpm-mouse-mode'.") Toggle mouse support in GNU/Linux consoles (GPM Mouse mode). If called interactively, enable Gpm-Mouse mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. This allows the use of the mouse when operating on a GNU/Linux console, in the same way as you can use the mouse under X11. @@ -31725,6 +31869,51 @@ GPM. This is due to limitations in GPM and the Linux kernel. (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "t-mouse" '("gpm-mouse-"))) +;;;*** + +;;;### (autoloads nil "tab-line" "tab-line.el" (0 0 0 0)) +;;; Generated autoloads from tab-line.el + +(autoload 'tab-line-mode "tab-line" "\ +Toggle display of window tab line in the buffer. + +If called interactively, enable Tab-Line mode if ARG is positive, and +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. + +\(fn &optional ARG)" t nil) + +(defvar tab-line-exclude nil) + +(make-variable-buffer-local 'tab-line-exclude) + +(put 'global-tab-line-mode 'globalized-minor-mode t) + +(defvar global-tab-line-mode nil "\ +Non-nil if Global Tab-Line mode is enabled. +See the `global-tab-line-mode' command +for a description of this minor mode. +Setting this variable directly does not take effect; +either customize it (see the info node `Easy Customization') +or call the function `global-tab-line-mode'.") + +(custom-autoload 'global-tab-line-mode "tab-line" nil) + +(autoload 'global-tab-line-mode "tab-line" "\ +Toggle Tab-Line mode in all buffers. +With prefix ARG, enable Global Tab-Line mode if ARG is positive; +otherwise, disable it. If called from Lisp, enable the mode if +ARG is omitted or nil. + +Tab-Line mode is enabled in all buffers where +`tab-line-mode--turn-on' would do it. +See `tab-line-mode' for more information on Tab-Line mode. + +\(fn &optional ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "tab-line" '("tab-line-"))) + ;;;*** ;;;### (autoloads nil "tabify" "tabify.el" (0 0 0 0)) @@ -32096,10 +32285,10 @@ location is indicated by `table-word-continuation-char'. This variable's value can be toggled by \\[table-fixed-width-mode] at run-time. -If called interactively, enable Table-Fixed-Width mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Table-Fixed-Width mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -33286,9 +33475,9 @@ This function is meant to be used as a `post-self-insert-hook'." t nil) Adds electric behavior to space character. If called interactively, enable Tildify mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When space is inserted into a buffer in a position where hard space is required instead (determined by `tildify-space-pattern' and `tildify-space-predicates'), @@ -33334,10 +33523,10 @@ or call the function `display-time-mode'.") (autoload 'display-time-mode "time" "\ Toggle display of time, load level, and mail flag in mode lines. -If called interactively, enable Display-Time mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Display-Time mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When Display Time mode is enabled, it updates every minute (you can control the number of seconds between updates by customizing @@ -33395,8 +33584,9 @@ TIME should be either a time value or a date-time string. (define-obsolete-function-alias 'subtract-time 'time-subtract "26.1") (autoload 'date-to-day "time-date" "\ -Return the number of days between year 1 and DATE. -DATE should be a date-time string. +Return the absolute date of DATE, a date-time string. +The absolute date is the number of days elapsed since the imaginary +Gregorian date Sunday, December 31, 1 BC. \(fn DATE)" nil nil) @@ -33417,9 +33607,9 @@ Return the day number within the year corresponding to TIME. \(fn TIME)" nil nil) (autoload 'time-to-days "time-date" "\ -The number of days between the Gregorian date 0001-12-31bce and TIME. -TIME should be a time value. -The Gregorian date Sunday, December 31, 1bce is imaginary. +The absolute date corresponding to TIME, a time value. +The absolute date is the number of days elapsed since the imaginary +Gregorian date Sunday, December 31, 1 BC. \(fn TIME)" nil nil) @@ -33465,7 +33655,13 @@ Convert the time interval in seconds to a short string. ;;;### (autoloads nil "time-stamp" "time-stamp.el" (0 0 0 0)) ;;; Generated autoloads from time-stamp.el (put 'time-stamp-format 'safe-local-variable 'stringp) -(put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p) +(put 'time-stamp-time-zone 'safe-local-variable 'time-stamp-zone-type-p) + +(autoload 'time-stamp-zone-type-p "time-stamp" "\ +Return whether or not ZONE is of the correct type for a timezone rule. +Valid ZONE values are described in the documentation of `format-time-string'. + +\(fn ZONE)" nil nil) (put 'time-stamp-line-limit 'safe-local-variable 'integerp) (put 'time-stamp-start 'safe-local-variable 'stringp) (put 'time-stamp-end 'safe-local-variable 'stringp) @@ -33485,12 +33681,14 @@ look like one of the following: Time-stamp: \" \" The time stamp is written between the brackets or quotes: Time-stamp: <2001-02-18 10:20:51 gildea> -The time stamp is updated only if the variable `time-stamp-active' is non-nil. -The format of the time stamp is set by the variable `time-stamp-pattern' or -`time-stamp-format'. The variables `time-stamp-pattern', -`time-stamp-line-limit', `time-stamp-start', `time-stamp-end', -`time-stamp-count', and `time-stamp-inserts-lines' control finding -the template." t nil) + +The time stamp is updated only if the variable +`time-stamp-active' is non-nil. +The format of the time stamp is set by the variable +`time-stamp-pattern' or `time-stamp-format'. +The variables `time-stamp-pattern', `time-stamp-line-limit', +`time-stamp-start', `time-stamp-end', `time-stamp-count', and +`time-stamp-inserts-lines' control finding the template." t nil) (autoload 'time-stamp-toggle-active "time-stamp" "\ Toggle `time-stamp-active', setting whether \\[time-stamp] updates a buffer. @@ -34199,10 +34397,10 @@ or call the function `type-break-mode'.") Enable or disable typing-break mode. This is a minor mode, but it is global to all buffers by default. -If called interactively, enable Type-Break mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Type-Break mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When this mode is enabled, the user is encouraged to take typing breaks at appropriate intervals; either after a specified amount of time or when the @@ -34732,10 +34930,10 @@ or call the function `url-handler-mode'.") (autoload 'url-handler-mode "url-handlers" "\ Toggle using `url' library for URL filenames (URL Handler mode). -If called interactively, enable Url-Handler mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Url-Handler mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -34912,48 +35110,6 @@ Fetch a data URL (RFC 2397). (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "url-nfs" '("url-nfs"))) -;;;*** - -;;;### (autoloads nil "url-ns" "url/url-ns.el" (0 0 0 0)) -;;; Generated autoloads from url/url-ns.el - -(autoload 'isPlainHostName "url-ns" "\ - - -\(fn HOST)" nil nil) - -(autoload 'dnsDomainIs "url-ns" "\ - - -\(fn HOST DOM)" nil nil) - -(autoload 'dnsResolve "url-ns" "\ - - -\(fn HOST)" nil nil) - -(autoload 'isResolvable "url-ns" "\ - - -\(fn HOST)" nil nil) - -(autoload 'isInNet "url-ns" "\ - - -\(fn IP NET MASK)" nil nil) - -(autoload 'url-ns-prefs "url-ns" "\ - - -\(fn &optional FILE)" nil nil) - -(autoload 'url-ns-user-pref "url-ns" "\ - - -\(fn KEY &optional DEFAULT)" nil nil) - -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "url-ns" '("url-ns-"))) - ;;;*** ;;;### (autoloads nil "url-parse" "url/url-parse.el" (0 0 0 0)) @@ -35192,8 +35348,9 @@ string: \"%\" followed by two upper-case hex digits. The allowed characters are specified by ALLOWED-CHARS. If this argument is nil, the list `url-unreserved-chars' determines the -allowed characters. Otherwise, ALLOWED-CHARS should be a vector -whose Nth element is non-nil if character N is allowed. +allowed characters. Otherwise, ALLOWED-CHARS should be either a +list of allowed chars, or a vector whose Nth element is non-nil +if character N is allowed. \(fn STRING &optional ALLOWED-CHARS)" nil nil) @@ -35251,6 +35408,8 @@ is \"www.fsf.co.uk\". ;;;### (autoloads nil "userlock" "userlock.el" (0 0 0 0)) ;;; Generated autoloads from userlock.el +(put 'create-lockfiles 'safe-local-variable 'booleanp) + (autoload 'ask-user-about-lock "userlock" "\ Ask user what to do when he wants to edit FILE but it is locked by OPPONENT. This function has a choice of three things to do: @@ -36910,9 +37069,9 @@ own View-like bindings. Toggle View mode, a minor mode for viewing text but not editing it. If called interactively, enable View mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. When View mode is enabled, commands that do not change the buffer contents are available as usual. Kill commands save text but @@ -37278,10 +37437,10 @@ or call the function `which-function-mode'.") (autoload 'which-function-mode "which-func" "\ Toggle mode line display of current function (Which Function mode). -If called interactively, enable Which-Function mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Which-Function mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Which Function mode is a global minor mode. When enabled, the current function name is continuously displayed in the mode line, @@ -37300,10 +37459,10 @@ in certain major modes. (autoload 'whitespace-mode "whitespace" "\ Toggle whitespace visualization (Whitespace mode). -If called interactively, enable Whitespace mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Whitespace mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. See also `whitespace-style', `whitespace-newline' and `whitespace-display-mappings'. @@ -37313,10 +37472,10 @@ See also `whitespace-style', `whitespace-newline' and (autoload 'whitespace-newline-mode "whitespace" "\ Toggle newline visualization (Whitespace Newline mode). -If called interactively, enable Whitespace-Newline mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Whitespace-Newline mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. Use `whitespace-newline-mode' only for NEWLINE visualization exclusively. For other visualizations, including NEWLINE @@ -37340,10 +37499,10 @@ or call the function `global-whitespace-mode'.") (autoload 'global-whitespace-mode "whitespace" "\ Toggle whitespace visualization globally (Global Whitespace mode). -If called interactively, enable Global Whitespace mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Whitespace mode if ARG is +positive, and disable it if ARG is zero or negative. If called from +Lisp, also enable the mode if ARG is omitted or nil, and toggle it if +ARG is `toggle'; disable the mode otherwise. See also `whitespace-style', `whitespace-newline' and `whitespace-display-mappings'. @@ -37363,10 +37522,10 @@ or call the function `global-whitespace-newline-mode'.") (autoload 'global-whitespace-newline-mode "whitespace" "\ Toggle global newline visualization (Global Whitespace Newline mode). -If called interactively, enable Global Whitespace-Newline mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Global Whitespace-Newline mode if ARG +is positive, and disable it if ARG is zero or negative. If called +from Lisp, also enable the mode if ARG is omitted or nil, and toggle +it if ARG is `toggle'; disable the mode otherwise. Use `global-whitespace-newline-mode' only for NEWLINE visualization exclusively. For other visualizations, including @@ -37687,10 +37846,10 @@ Show widget browser for WIDGET in other window. (autoload 'widget-minor-mode "wid-browse" "\ Minor mode for traversing widgets. -If called interactively, enable Widget minor mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Widget minor mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. \(fn &optional ARG)" t nil) @@ -37912,9 +38071,9 @@ or call the function `winner-mode'.") Toggle Winner mode on or off. If called interactively, enable Winner mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Winner mode is a global minor mode that records the changes in the window configuration (i.e. how the frames are partitioned @@ -38178,10 +38337,10 @@ or call the function `xterm-mouse-mode'.") (autoload 'xterm-mouse-mode "xt-mouse" "\ Toggle XTerm mouse mode. -If called interactively, enable Xterm-Mouse mode if ARG is positive, and -disable it if ARG is zero or negative. If called from Lisp, -also enable the mode if ARG is omitted or nil, and toggle it -if ARG is `toggle'; disable the mode otherwise. +If called interactively, enable Xterm-Mouse mode if ARG is positive, +and disable it if ARG is zero or negative. If called from Lisp, also +enable the mode if ARG is omitted or nil, and toggle it if ARG is +`toggle'; disable the mode otherwise. Turn it on to use Emacs mouse commands, and off to use xterm mouse commands. This works in terminal emulators compatible with xterm. It only @@ -38360,13 +38519,13 @@ Zone out, completely." t nil) ;;;;;; "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el" "org/ox.el" ;;;;;; "progmodes/elisp-mode.el" "progmodes/prog-mode.el" "ps-mule.el" ;;;;;; "register.el" "replace.el" "rfn-eshadow.el" "select.el" "simple.el" -;;;;;; "startup.el" "subdirs.el" "subr.el" "textmodes/fill.el" "textmodes/page.el" -;;;;;; "textmodes/paragraphs.el" "textmodes/reftex-auc.el" "textmodes/reftex-cite.el" -;;;;;; "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" "textmodes/reftex-index.el" -;;;;;; "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" -;;;;;; "textmodes/reftex-toc.el" "textmodes/text-mode.el" "uniquify.el" -;;;;;; "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" "widget.el" -;;;;;; "window.el") (0 0 0 0)) +;;;;;; "startup.el" "subdirs.el" "subr.el" "tab-bar.el" "textmodes/fill.el" +;;;;;; "textmodes/page.el" "textmodes/paragraphs.el" "textmodes/reftex-auc.el" +;;;;;; "textmodes/reftex-cite.el" "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" +;;;;;; "textmodes/reftex-index.el" "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" +;;;;;; "textmodes/reftex-sel.el" "textmodes/reftex-toc.el" "textmodes/text-mode.el" +;;;;;; "uniquify.el" "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" +;;;;;; "widget.el" "window.el") (0 0 0 0)) ;;;*** commit f301513a46809d0638487c2065847b5fa3f017e5 Author: Lars Ingebrigtsen Date: Fri Nov 1 14:17:17 2019 +0100 Don't claim that anonymous face can't be used in font-lock * doc/lispref/display.texi (Faces): Anonymous functions can be used when font locking, so adjust the injunction against them (bug#35005). diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 6290c89cdc..23758f6be9 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2248,11 +2248,10 @@ is equivalent to a Lisp symbol with the same name.}. Named faces are defined using the @code{defface} macro (@pxref{Defining Faces}). Emacs comes with several standard named faces (@pxref{Basic Faces}). - Many parts of Emacs require named faces, and do not accept -anonymous faces. These include the functions documented in -@ref{Attribute Functions}, and the variable @code{font-lock-keywords} -(@pxref{Search-based Fontification}). Unless otherwise stated, we -will use the term @dfn{face} to refer only to named faces. + Many parts of Emacs require named faces, but some do not accept +anonymous faces (e.g., the functions documented in @ref{Attribute +Functions}). Unless otherwise stated, we will use the term @dfn{face} +to refer only to named faces. @defun facep object This function returns a non-@code{nil} value if @var{object} is a commit eec934385044ede84976f76a7689b6db7a38739b Author: Cecilio Pardo Date: Fri Nov 1 13:54:41 2019 +0100 Remove an unfunny joke from DEVEL.HUMOR * etc/DEVEL.HUMOR: Remove unfunny joke (bug#38002). Copyright-paperwork-exempt: yes diff --git a/etc/DEVEL.HUMOR b/etc/DEVEL.HUMOR index 58b6cb323a..6db69bb4b5 100644 --- a/etc/DEVEL.HUMOR +++ b/etc/DEVEL.HUMOR @@ -126,20 +126,6 @@ course we all know that Emacs was there before Word, but this might have escaped John's notice." -- David Kastrup and RMS ----------------------------------------------------------------------- - -Re: patch for woman (woman-topic-at-point) - - "Sorry for the long message. I wanted to make the problem clear -also for people not familiar with 'woman'." - "Most hackers, I take? - For a moment there I thought you had a patch that you could put on -a woman, and it would make her come right to the topic at point -without attempting any course of action that requires an advance -course in divination. - There'd be quite a sensational market for that, you know." - -- Emilio Lopes and David Kastrup - ---------------------------------------------------------------------- "[T]here may be a good reason since the code explicitly checks for commit 0bffb3e69d4f45b4f4bc553af3ed6e78cfd6bd49 Author: Filipp Gunbin Date: Thu Oct 31 21:39:01 2019 +0300 Make ant regexp in compilation-error-regexp-alist-alist more lax * lisp/progmodes/compile.el: Make ant regexp accept filenames that may occur on Cygwin (like c:/test) and optional additional severity level after task name. * etc/compilation.txt: Add sample. diff --git a/etc/compilation.txt b/etc/compilation.txt index 4a4a318d03..7cd33bbd7a 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -49,10 +49,11 @@ The regexps found on http://ant.apache.org/faq.html, and since integrated in both Emacsen, were hairy. The extra two numbers for jikes are the ending line and ending column. - [javac] /src/DataBaseTestCase.java:27: unreported exception ... - [javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally - [jikes] foo.java:3:5:7:9: blah blah - [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math + [javac] /src/DataBaseTestCase.java:27: unreported exception ... + [javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally + [jikes] foo.java:3:5:7:9: blah blah + [javadoc] c:\MyProject\Polynomial.java:560: error: unknown tag: math + [checkstyle] [ERROR] /src/Test.java:38: warning: foo: bar * Bash v2 diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index b0bb728de0..f412dbcd54 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -181,9 +181,12 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) (aix " in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1) + ;; Checkstyle task may report its own severity level: "[checkstyle] [ERROR] ..." + ;; (see AuditEventDefaultFormatter.java in checkstyle sources). (ant - "^[ \t]*\\[[^] \n]+\\][ \t]*\\(\\(?:[A-Za-z]:\\\\\\)?[^: \n]+\\):\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\ -\\( warning\\)?" 1 (2 . 4) (3 . 5) (6)) + "^[ \t]*\\(?:\\[[^] \n]+\\][ \t]*\\)\\{1,2\\}\\(\\(?:[A-Za-z]:\\)?[^: \n]+\\):\ +\\([0-9]+\\):\\(?:\\([0-9]+\\):\\([0-9]+\\):\\([0-9]+\\):\\)?\\( warning\\)?" + 1 (2 . 4) (3 . 5) (6)) (bash "^\\([^: \n\t]+\\): line \\([0-9]+\\):" 1 2) diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index e38c31dd0a..4c2ce83dde 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -55,11 +55,19 @@ 25 nil 8 "errors.c") ;; ant ("[javac] /src/DataBaseTestCase.java:27: unreported exception ..." - 13 nil 27 "/src/DataBaseTestCase.java") + 13 nil 27 "/src/DataBaseTestCase.java" 2) ("[javac] /src/DataBaseTestCase.java:49: warning: finally clause cannot complete normally" - 13 nil 49 "/src/DataBaseTestCase.java") + 13 nil 49 "/src/DataBaseTestCase.java" 1) ("[jikes] foo.java:3:5:7:9: blah blah" - 14 (5 . 10) (3 . 7) "foo.java") + 14 (5 . 10) (3 . 7) "foo.java" 2) + ("[javac] c:/cygwin/Test.java:12: error: foo: bar" + 9 nil 12 "c:/cygwin/Test.java" 2) + ("[javac] c:\\cygwin\\Test.java:87: error: foo: bar" + 9 nil 87 "c:\\cygwin\\Test.java" 2) + ;; Checkstyle error, but ant reports a warning (note additional + ;; severity level after task name) + ("[checkstyle] [ERROR] /src/Test.java:38: warning: foo" + 22 nil 38 "/src/Test.java" 1) ;; bash ("a.sh: line 1: ls-l: command not found" 1 nil 1 "a.sh") @@ -420,8 +428,8 @@ The test data is in `compile-tests--test-regexps-data'." (compilation-num-warnings-found 0) (compilation-num-infos-found 0)) (mapc #'compile--test-error-line compile-tests--test-regexps-data) - (should (eq compilation-num-errors-found 90)) - (should (eq compilation-num-warnings-found 35)) + (should (eq compilation-num-errors-found 92)) + (should (eq compilation-num-warnings-found 36)) (should (eq compilation-num-infos-found 26))))) (ert-deftest compile-test-grep-regexps () commit 8758c96dc7f252944eb97b95c92081b157084477 Author: Richard Stallman Date: Sat Oct 26 22:02:57 2019 -0400 Minor wording change in ELisp manual * doc/lispref/functions.texi (Advising Named Functions): Improve and clarify wording of the advice to avoid advising functions in released code. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index eced3a2447..12112508b0 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -1811,9 +1811,15 @@ possible to do the same thing via a hook, that is preferable (@pxref{Hooks}). If you simply want to change what a particular key does, it may be better to write a new command, and remap the old command's key bindings to the new one (@pxref{Remapping Commands}). -In particular, Emacs's own source files should not put advice on -functions in Emacs. (There are currently a few exceptions to this -convention, but we aim to correct them.) + + If you are writing code for release, for others to use, try to avoid +including advice in it. If the function you want to advise has no +hook to do the job, please talk with the Emacs developers about adding +a suitable hook. Especially, Emacs's own source files should not put +advice on functions in Emacs. (There are currently a few exceptions +to this convention, but we aim to correct them.) It is generally +cleaner to create a new hook in @code{foo}, and make @code{bar} use +the hook, than to have @code{bar} put advice in @code{foo}. Special forms (@pxref{Special Forms}) cannot be advised, however macros can be advised, in much the same way as functions. Of course, this will not affect commit 2448cebf7620169b2a2bf27b5147b9a38defc8e4 Author: Michael Albinus Date: Fri Nov 1 10:36:26 2019 +0100 ; Add @cindex in files.texi for "temporary file on a remote host" * doc/lispref/files.texi (Unique File Names): Add @cindex for "temporary file on a remote host". (Bug#38010) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 32297e9875..f02da1b474 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -2683,6 +2683,7 @@ the file, which in some cases may cause a security hole. Sometimes, it is necessary to create a temporary file on a remote host or a mounted directory. The following two functions support this. +@cindex temporary file on a remote host @defun make-nearby-temp-file prefix &optional dir-flag suffix This function is similar to @code{make-temp-file}, but it creates a temporary file as close as possible to @code{default-directory}. If commit 3a1e7624ed234bb434cdafed59515cadd037cafa Author: Paul Eggert Date: Thu Oct 31 23:31:17 2019 -0700 Fix insert-file-contents file error regression Problem reported for dired-view-file (Bug#37950). * src/fileio.c (Finsert_file_contents): When visiting, signal an error if the file could not be opened for any reason, rather than signaling an error only for nonexistent files, fixing a bug introduced in 2019-09-16T03:17:43!eggert@cs.ucla.edu. diff --git a/src/fileio.c b/src/fileio.c index a3121a26da..01f8a04e5d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4806,10 +4806,9 @@ by calling `format-decode', which see. */) unbind_to (count1, Qnil); } - if (!NILP (visit) - && current_buffer->modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS) + if (!NILP (visit) && current_buffer->modtime.tv_nsec < 0) { - /* If visiting nonexistent file, return nil. */ + /* Signal an error if visiting a file that could not be opened. */ report_file_errno ("Opening input file", orig_filename, save_errno); } commit 9d209c90345df6c39310912ba04ca02473a24bed Author: Eric Ludlam Date: Thu Oct 31 19:10:58 2019 -0400 * lisp/cedet/ (semantic-analyze-possible-completions): Add `flags` arg * lisp/cedet/semantic/texi.el (semantic-analyze-possible-completions), lisp/cedet/srecode/srt-mode.el (semantic-analyze-possible-completions), lisp/cedet/semantic/bovine/make.el (semantic-analyze-possible-completions): Add `flags` arg. * lisp/cedet/semantic/grammar.el (semantic-analyze-possible-completions): Add `flags` arg. Reverse the found prefix. (semantic-ctxt-current-class-list): Include token tags as things to appear in non-lisp context. diff --git a/lisp/cedet/semantic/bovine/make.el b/lisp/cedet/semantic/bovine/make.el index 3676c6972f..01a15b8232 100644 --- a/lisp/cedet/semantic/bovine/make.el +++ b/lisp/cedet/semantic/bovine/make.el @@ -175,7 +175,7 @@ This is the same as a regular prototype." (semantic-format-tag-prototype tag parent color)) (define-mode-local-override semantic-analyze-possible-completions - makefile-mode (context) + makefile-mode (context &rest flags) "Return a list of possible completions in a Makefile. Uses default implementation, and also gets a list of filenames." (require 'semantic/analyze/complete) diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el index 813580ba6c..53b5ea61f2 100644 --- a/lisp/cedet/semantic/grammar.el +++ b/lisp/cedet/semantic/grammar.el @@ -1777,7 +1777,7 @@ Only tags of type 'nonterminal will be so marked." (if (semantic-grammar-in-lisp-p) (with-mode-local emacs-lisp-mode (semantic-ctxt-current-class-list)) - '(nonterminal keyword)))) + '(nonterminal token keyword)))) (define-mode-local-override semantic-ctxt-current-mode semantic-grammar-mode (&optional point) @@ -1915,14 +1915,14 @@ Optional argument COLOR determines if color is added to the text." context-return))) (define-mode-local-override semantic-analyze-possible-completions - semantic-grammar-mode (context) + semantic-grammar-mode (context &rest flags) "Return a list of possible completions based on CONTEXT." (require 'semantic/analyze/complete) (if (semantic-grammar-in-lisp-p) (with-mode-local emacs-lisp-mode (semantic-analyze-possible-completions context)) (with-current-buffer (oref context buffer) - (let* ((prefix (car (oref context prefix))) + (let* ((prefix (car (reverse (oref context prefix)))) (completetext (cond ((semantic-tag-p prefix) (semantic-tag-name prefix)) ((stringp prefix) diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index d0e6ad83b2..7d663f3e3a 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -408,7 +408,7 @@ Optional argument POINT is where to look for the environment." "List of commands that we might bother completing.") (define-mode-local-override semantic-analyze-possible-completions - texinfo-mode (context) + texinfo-mode (context &rest flags) "List smart completions at point. Since texinfo is not a programming language the default version is not useful. Instead, look at the current symbol. If it is a command diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el index 5e7c7c111a..ac74949627 100644 --- a/lisp/cedet/srecode/srt-mode.el +++ b/lisp/cedet/srecode/srt-mode.el @@ -627,7 +627,7 @@ section or ? for an ask variable." context-return))) (define-mode-local-override semantic-analyze-possible-completions - srecode-template-mode (context) + srecode-template-mode (context &rest flags) "Return a list of possible completions based on NONTEXT." (with-current-buffer (oref context buffer) (let* ((prefix (car (last (oref context prefix)))) commit cf59afb7e1403365a9cea4655e1c0c92fade2304 Author: Eric Ludlam Date: Sun Oct 27 21:01:54 2019 -0400 * test/lisp/cedet/semantic-utest-ia.el: Update from upstream Merge content from CEDET on SF to bring in additional test points and support more types of languages. (semantic-utest-ia-struct.cpp, semantic-utest-ia-templates.cpp) (semantic-utest-ia-using.cpp, semantic-utest-ia-nsp.cpp) (semantic-utest-ia-localvars.cpp, semantic-utest-ia-varnamse.java) (semantic-utest-ia-wisent.wy, semantic-utest-ia-texi) (semantic-utest-ia-make, semantic-utest-ia-srecoder): New test points (semantic-ia-utest-buffer): Use comment-start-skip when looking for test point tokens. Capture errors ignoring debugger to enable test for empty results. Improve output from test diagnostics. (semantic-ia-utest-buffer-refs): Use comment-start-skip to find test point tokens. Author: Eric Ludlam diff --git a/test/lisp/cedet/semantic-utest-ia.el b/test/lisp/cedet/semantic-utest-ia.el index f83a89a868..61d7ea370e 100644 --- a/test/lisp/cedet/semantic-utest-ia.el +++ b/test/lisp/cedet/semantic-utest-ia.el @@ -27,6 +27,7 @@ ;; Each file has cursor keys in them of the form: ;; // -#- ("ans1" "ans2" ) ;; where # is 1, 2, 3, etc, and some sort of answer list. +;; (Replace // with contents of comment-start for the language being tested.) ;;; Code: (require 'semantic) @@ -59,8 +60,38 @@ (should (file-exists-p tst)) (should-not (semantic-ia-utest tst)))) -(ert-deftest semantic-utest-ia-friends.cpp () - (let ((tst (expand-file-name "testfriends.cpp" semantic-utest-test-directory))) +(ert-deftest semantic-utest-ia-struct.cpp () + (let ((tst (expand-file-name "teststruct.cpp" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +;;(ert-deftest semantic-utest-ia-union.cpp () +;; (let ((tst (expand-file-name "testunion.cpp" semantic-utest-test-directory))) +;; (should (file-exists-p tst)) +;; (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-templates.cpp () + (let ((tst (expand-file-name "testtemplates.cpp" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +;;(ert-deftest semantic-utest-ia-friends.cpp () +;; (let ((tst (expand-file-name "testfriends.cpp" semantic-utest-test-directory))) +;; (should (file-exists-p tst)) +;; (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-using.cpp () + (let ((tst (expand-file-name "testusing.cpp" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-nsp.cpp () + (let ((tst (expand-file-name "testnsp.cpp" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-localvars.cpp () + (let ((tst (expand-file-name "testlocalvars.cpp" semantic-utest-test-directory))) (should (file-exists-p tst)) (should-not (semantic-ia-utest tst)))) @@ -84,6 +115,36 @@ (should (file-exists-p tst)) (should-not (semantic-ia-utest tst)))) +(ert-deftest semantic-utest-ia-varnamse.java () + (let ((tst (expand-file-name "testvarnames.java" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +;;(ert-deftest semantic-utest-ia-f90.f90 () +;; (let ((tst (expand-file-name "testf90.f90" semantic-utest-test-directory))) +;; (should (file-exists-p tst)) +;; (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-wisent.wy () + (let ((tst (expand-file-name "testwisent.wy" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-texi () + (let ((tst (expand-file-name "test.texi" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-make () + (let ((tst (expand-file-name "test.mk" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + +(ert-deftest semantic-utest-ia-srecoder () + (let ((tst (expand-file-name "test.srt" semantic-utest-test-directory))) + (should (file-exists-p tst)) + (should-not (semantic-ia-utest tst)))) + ;;; Core testing utility (defun semantic-ia-utest (testfile) "Run the semantic ia unit test against stored sources." @@ -127,8 +188,10 @@ ;; Keep looking for test points until we run out. (while (save-excursion - (setq regex-p (concat "//\\s-*-" (number-to-string idx) "-" ) - regex-a (concat "//\\s-*#" (number-to-string idx) "#" )) + (setq regex-p (concat "\\(" comment-start-skip "\\)\\s-*-" + (number-to-string idx) "-" ) + regex-a (concat "\\(" comment-start-skip "\\)\\s-*#" + (number-to-string idx) "#" )) (goto-char (point-min)) (save-match-data (when (re-search-forward regex-p nil t) @@ -141,13 +204,18 @@ (save-excursion (goto-char p) + (skip-chars-backward " ") ;; some languages need a space. (let* ((ctxt (semantic-analyze-current-context)) + ;; TODO - fix the NOTFOUND case to be nil and not an error when finding + ;; completions, then remove the below debug-on-error setting. + (debug-on-error nil) (acomp - (condition-case nil + (condition-case err (semantic-analyze-possible-completions ctxt) - (error nil)))) - (setq actual (mapcar 'semantic-tag-name acomp))) + ((error user-error) nil)) + )) + (setq actual (mapcar 'semantic-format-tag-name acomp))) (goto-char a) @@ -157,8 +225,14 @@ (error (setq desired (format " FAILED TO PARSE: %S" bss))))) + (setq actual (sort actual 'string<)) + (setq desired (sort desired 'string<)) + (if (equal actual desired) - (setq pass (cons idx pass)) + (prog1 + (setq pass (cons idx pass)) + ;;(message "PASS: %S" actual) + ) (setq fail (cons (list (format "Failed %d. Desired: %S Actual %S" @@ -171,7 +245,7 @@ ) (when fail - (cons "COMPLETION SUBTEST" fail)) + (cons "COMPLETION SUBTEST" (reverse fail))) )) (defun semantic-ia-utest-buffer-refs () @@ -189,7 +263,8 @@ ) ;; Keep looking for test points until we run out. (while (save-excursion - (setq regex-p (concat "//\\s-*\\^" (number-to-string idx) "^" ) + (setq regex-p (concat "\\(" comment-start-skip + "\\)\\s-*\\^" (number-to-string idx) "^" ) ) (goto-char (point-min)) (save-match-data @@ -295,7 +370,8 @@ ) ;; Keep looking for test points until we run out. (while (save-excursion - (setq regex-p (concat "//\\s-*\\%" (number-to-string idx) "%" ) + (setq regex-p (concat "\\(" comment-start-skip "\\)\\s-*\\%" + (number-to-string idx) "%" ) ) (goto-char (point-min)) (save-match-data @@ -307,7 +383,7 @@ tag) (setq actual-result (semantic-symref-find-references-by-name - (semantic-tag-name tag) 'target + (semantic-format-tag-name tag) 'target 'symref-tool-used)) (if (not actual-result) @@ -393,13 +469,14 @@ tag that contains point, and return that." ) ;; Keep looking for test points until we run out. (while (save-excursion - (setq regex-p (concat "//\\s-*@" + (setq regex-p (concat "\\(" comment-start-skip "\\)\\s-*@" (number-to-string idx) - "@\\s-+\\(\\w+\\)" )) + "@\\s-+\\w+" )) (goto-char (point-min)) (save-match-data (when (re-search-forward regex-p nil t) - (goto-char (match-beginning 1)) + (goto-char (match-end 0)) + (skip-syntax-backward "w") (setq desired (read (buffer-substring (point) (point-at-eol)))) (setq start (match-beginning 0)) (goto-char start) commit f69e2aa104209090d5487a7382473ec38b43e9c7 Author: Eric Ludlam Date: Sun Oct 27 20:51:54 2019 -0400 * test/manual/cedet/tests/test*: More updates from upstream * test/manual/cedet/tests/testjavacomp.java, test/manual/cedet/tests/testnsp.cpp, test/manual/cedet/tests/testsppcomplete.c, test/manual/cedet/tests/testtypedefs.cpp, test/manual/cedet/tests/testvarnames.c: Merge content from CEDET on SF with extended test points for use with test/lisp/cedet/semantic-utest-ia.el Author: Eric Ludlam diff --git a/test/manual/cedet/tests/testjavacomp.java b/test/manual/cedet/tests/testjavacomp.java index 1102e51891..d2f20f6f0c 100644 --- a/test/manual/cedet/tests/testjavacomp.java +++ b/test/manual/cedet/tests/testjavacomp.java @@ -24,6 +24,10 @@ class secondClass { private void scFuncOne() { } public void scFuncOne() { } + + int package_protected_field; + public int public_protected_field; + private int private_protected_field; } @@ -52,15 +56,21 @@ public void publicFunc() { secondClass SC; - SC.//-3- + SC.s//-3- // #3# ( "scFuncOne" ) ; + // @TODO - to make this test complete, we need an import + // with a package protected field that is excluded + // from the completion list. + SC.p//-4- + // #4# ( "package_protected_field" "public_protected_field" ) + nestedClass NC; // @todo - need to fix this? I don't know if this is legal java. - NC.// - 4- - // #4# ( "ncFuncOne" ) + NC.// - 5- + // #5# ( "ncFuncOne" ) ; } diff --git a/test/manual/cedet/tests/testnsp.cpp b/test/manual/cedet/tests/testnsp.cpp index 012dc66060..e6ffd4aacb 100644 --- a/test/manual/cedet/tests/testnsp.cpp +++ b/test/manual/cedet/tests/testnsp.cpp @@ -1,8 +1,24 @@ -// Test NSP (Name space parent) -// -// Test dereferencing parents based on local parent scope. -// -// Derived from data David Engster provided. +/* testnsp.cpp --- semantic-ia-utest completion engine unit tests + + Copyright (C) 2008-2019 Free Software Foundation, Inc. + + Author: Eric M. Ludlam + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see . +*/ namespace nsp { @@ -27,3 +43,80 @@ void myfcn_not_in_ns (void) { ; // #1# ( "fromchild" "fromroot" ) } +// Test a class declared in a class, where the contents +// are in a qualified name. +// +// Thanks Michael Reiher for the concise example. + +class AAA +{ +public: + AAA(); + + void aaa(); + +private: + class Private; + Private * const d; +}; + +class AAA::Private +{ + Private() : bbb(0) { + } + + BBB* bbb; +}; + +void AAA::aaa() +{ + d->// -2- + ; // #2# ( "bbb" ) +} + +// #include files inside a namespace +// David Engster +// See revisions 8034-8037 which implement this. + +namespace another { + #include "testdoublens.hpp" +} + +void foo(void) { + + another::// -3- + ; // #3# ( "Name1" "a" "stage3_Foo" ) + + another::Name1::Name2::Foo a; + + a.// -4- + ; // #4# ( "Mumble" "get" ) +} + +// What happens if a type your looking for is scoped withing a type, +// but you are one level into the completion so the originating scope +// excludes the type of the variable you are completing through? +// Thanks Martin Stein for this nice example. + +namespace ms_structs +{ + struct ms_aaa + { + int xx; + }; + + struct ms_bbb + { + struct ms_aaa yy; + }; +}; + +int fun() +{ + using namespace ms_structs; + struct ms_bbb mszz; + int uu = mszz.// -5- + ; // #5# ( "yy" ) + int kk = mszz.yy.// - 6- @TODO - bring in patch from SF + ; // #6# ( "xx" ) +} diff --git a/test/manual/cedet/tests/testsppcomplete.c b/test/manual/cedet/tests/testsppcomplete.c index d789994228..e6780767cd 100644 --- a/test/manual/cedet/tests/testsppcomplete.c +++ b/test/manual/cedet/tests/testsppcomplete.c @@ -1,3 +1,25 @@ +/* testesppcomplete.cpp --- semantic-ia-utest completion engine unit tests + + Copyright (C) 2008-2019 Free Software Foundation, Inc. + + Author: Eric M. Ludlam + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see . +*/ + /* Example provided by Hannes Janetzek */ struct Test { int test; }; @@ -28,3 +50,17 @@ int main(int argc, char *argv[]) { ; // #3# ( "test" ) } +/* Test symref and macros together. */ + +// This function exists only so we can have a comment in a tag with this name. +void function_with_macro_name () +// %1% ( ( "testsppcomplete.c" ) ( "function_with_macro_name" "function_with_macro_name" "use_macro") ) +// Note: fwmn is in twice, once for function, and once for the constant macro below. +{ +} + +#define function_with_macro_name 1 + +int use_macro () { + int a = function_with_macro_name; +} diff --git a/test/manual/cedet/tests/testtypedefs.cpp b/test/manual/cedet/tests/testtypedefs.cpp index 6c6628ddf4..171086e5a4 100644 --- a/test/manual/cedet/tests/testtypedefs.cpp +++ b/test/manual/cedet/tests/testtypedefs.cpp @@ -76,5 +76,80 @@ int main() ntb.// -4- ; // #4# ("otherFunc") + + return 0; +} + +// ------------------ +// Example from Yupeng. + +typedef struct epd_info { + int a; +} epd_info_t; + +static int epd_probe(struct platform_device *pdev) +{ + struct epd_info *db; + epd_info_t db1; + + db.// -5- + ; // #5# ("a") + db1.// -6- + ;// #6# ("a") + + return 1; +} + +// ------------------ +// Example from Michel LAFON-PUYO + +typedef enum +{ + ENUM1, + ENUM2 +} e_toto; + +typedef struct +{ + int field_a; + int field_b; +} t_toto; + +// Note: Error condition from anonymous types in a typedef +// was that the first (ie - the enum) would be used in +// place of the struct. +int func(void) +{ + t_toto t; + t. // -7- + ; // #7# ( "field_a" "field_b" ) + return 0; +} + + +// ------------------ +// Example from Dixon Ryan + + +namespace NS2 { + class MyClass { + + public: + void myFunction() { } + }; +} + +typedef class NS2::MyClass* MyClassHandle; + +int dixon ( void ) { + MyClassHandle mch = getMyClassHandle(); + NS2::MyClass* mcptr = getMyClassHandle(); + + mcptr-> // -8- + ; // #8# ( "myFunction" ) + mch-> // - 9- TODO bring over patch from SF + ; // #9# ( "myFunction" ) + deleteMyClassHandle(mch); + return 0; } diff --git a/test/manual/cedet/tests/testvarnames.c b/test/manual/cedet/tests/testvarnames.c index 1cbf3c02c4..a7d3d3cb19 100644 --- a/test/manual/cedet/tests/testvarnames.c +++ b/test/manual/cedet/tests/testvarnames.c @@ -1,5 +1,4 @@ -/* testvarnames.cpp - Test variable and function names, lists of variables on one line, etc. +/* testvarnames.cpp --- semantic-ia-utest completion engine unit tests Copyright (C) 2008-2019 Free Software Foundation, Inc. @@ -19,6 +18,7 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . + */ struct independent { @@ -56,6 +56,17 @@ struct inline2struct { struct inlinestruct in_var1; struct inline2struct in_var2; +/* + * Structures (or any types) could have the same name as a variable. + * Make sure we complete vars over types. + * + * See cedet-devel mailing list Dec 23, 2013 for details. + */ +struct varorstruct {}; +int varorstruct; + +int assigntovarorstruct; + int test_1(int var_arg1) { var_// -1- @@ -87,4 +98,7 @@ int test_1(int var_arg1) { ; // #10# ( "named_1" "named_2") in_var2.// -11- ; // #11# ( "named_3" "named_4") + + varorstruct = assign// -12- + ; // #12# ( "assigntovarorstruct" ) } commit 31ed03020c458daabdd8feac741e276a1b7f723b Author: Eric Ludlam Date: Sun Oct 27 20:36:17 2019 -0400 * test/manual/cedet/tests/testdoublens.cpp: Update from upstream * test/manual/cedet/tests/testdoublens.hpp: Merge content from CEDET on SF with extended test points for use with test/lisp/cedet/semantic-utest-ia.el Author: Eric Ludlam diff --git a/test/manual/cedet/tests/testdoublens.cpp b/test/manual/cedet/tests/testdoublens.cpp index 4d10644e44..9449f97110 100644 --- a/test/manual/cedet/tests/testdoublens.cpp +++ b/test/manual/cedet/tests/testdoublens.cpp @@ -39,12 +39,27 @@ namespace Name1 { return 0; } - void Foo::publishStuff(int /* a */, int /* b */) // ^2^ + void Foo::publishStuff(int a, int b) // ^2^ { + int foo = a; + int bar = b; } - void Foo::sendStuff(int /* a */, int /* b */) // ^3^ + // Test polymorphism on arg types. Note that order is + // mixed to maximize failure cases + void Foo::publishStuff(char a, char b) // ^4^ { + int foo = a; + int bar = b; + } + + void Foo::sendStuff(int a, int b) // ^3^ + { + int foo = a; + int bar = b; + + Foo::publishStuff(1,2) + } } // namespace Name2 @@ -163,3 +178,37 @@ namespace d { } // namespace f } // namespace d + +// Fully qualified const struct function arguments +class ContainsStruct +{ + struct TheStruct + { + int memberOne; + int memberTwo; + }; +}; + +void someFunc(const struct ContainsStruct::TheStruct *foo) +{ + foo->// -9- + // #9# ("memberOne" "memberTwo") +} + +// Class with structure tag +class ContainsNamedStruct +{ + struct _fooStruct + { + int memberOne; + int memberTwo; + } member; +}; + +void someOtherFunc(void) +{ + ContainsNamedStruct *someClass; + // This has to find ContainsNamedStruct::_fooStruct + someClass->member.// -10- + // #10# ("memberOne" "memberTwo") +} diff --git a/test/manual/cedet/tests/testdoublens.hpp b/test/manual/cedet/tests/testdoublens.hpp index 507c8342b4..907c4cbffc 100644 --- a/test/manual/cedet/tests/testdoublens.hpp +++ b/test/manual/cedet/tests/testdoublens.hpp @@ -31,7 +31,9 @@ namespace Name1 { int get(); private: - void publishStuff(int a, int b); + void publishStuff(char /* a */, char /* b */); + + void publishStuff(int q, int r); // Purposely different names. void sendStuff(int a, int b); @@ -58,7 +60,7 @@ namespace a { class Foo { struct Dum { - int diDum; + int diDum; }; protected: commit 0f7163ab89cc6158dbb7a382b67da5ce200f42f1 Author: Eric Ludlam Date: Sun Oct 27 20:31:34 2019 -0400 * test/manual/cedet/tests/: New files for semantic-utest-ia.el * test/manual/cedet/tests/test.mk, test/manual/cedet/tests/test.srt, test/manual/cedet/tests/test.texi, test/manual/cedet/tests/testlocalvars.cpp, test/manual/cedet/tests/teststruct.cpp, test/manual/cedet/tests/testtemplates.cpp, test/manual/cedet/tests/testusing.cpp, test/manual/cedet/tests/testusing.hh, test/manual/cedet/tests/testvarnames.java. test/manual/cedet/tests/testwisent.wy: New files to be used by test/lisp/cedet/semantic-utest-ia.el. Author: Eric Ludlam diff --git a/test/manual/cedet/tests/test.mk b/test/manual/cedet/tests/test.mk new file mode 100644 index 0000000000..edea97e7b9 --- /dev/null +++ b/test/manual/cedet/tests/test.mk @@ -0,0 +1,18 @@ +# A Test Makefile. -*-makefile-*- + +# This test is for a file in this test directory. Just a random one. +FILES=testdoub # -1- +# #1# ("testdoublens.cpp" "testdoublens.hpp" ) + +all: optional + +# This one completes on a variable name. +optional: $FIL # -2- + # #2# ("FILES") + compile $@ + +notoptional: opt # -3- + # #3# ("optional") + echo "Done." + +#end diff --git a/test/manual/cedet/tests/test.srt b/test/manual/cedet/tests/test.srt new file mode 100644 index 0000000000..b77cd4fbe2 --- /dev/null +++ b/test/manual/cedet/tests/test.srt @@ -0,0 +1,64 @@ +;; test.srt --- unit test support file for semantic-utest-ia + +;; Copyright (C) 2008-2019 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . +;; + +set mode "c++-mode" +set escape_start "{{" +set escape_end "}}" + +context file + +template class :blank +"A test template for emacs lisp" +---- +---- + +template classic :blank +"A test template for emacs lisp" +---- +---- + +template variable :blank +"A test template for emacs lisp" +---- +---- + +template function :blank +"A test template for emacs lisp" +---- +---- + +template testarea :blank +"A test template for emacs lisp" +---- +{{ + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + + +class foo { + foo *member; + char anArray[10]; +}; + +void func() +{ + foo local1; + foo* local2 = localvar.member; + foo* local3 = new foo(); + foo local4[10]; + char local5[5] = {'1','2','3','4','5'}; + char *local6 = "12345"; + char local7 = local.anArray[0]; + char local8 = true ? 10 : 11 ; + + // Check that all of the above was parsed + local//-1- + ; //#1# ("local1" "local2" "local3" "local4" "local5" "local6" "local7" "local8" ) + + local1.//-2- + ; //#2# ("anArray" "member") + + local2->//-3- + ; //#3# ("anArray" "member") + + local3->//-4- + ; //#4# ("anArray" "member") + + local4[0].//-5- + ; //#5# ("anArray" "member") +} diff --git a/test/manual/cedet/tests/teststruct.cpp b/test/manual/cedet/tests/teststruct.cpp new file mode 100644 index 0000000000..041483d119 --- /dev/null +++ b/test/manual/cedet/tests/teststruct.cpp @@ -0,0 +1,86 @@ +// teststruct.cpp --- semantic-ia-utest completion engine unit tests + +// Copyright (C) 2008-2019 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + + +// Note: initially provided by by Alex Ott. + +template +struct grammar { +public: + typedef grammar self_t; + typedef DerivedT const& embed_t; + grammar() {} + ~grammar() { } + void use_parser() const { } + void test1() { } +}; + +struct PDFbool_parser : public grammar { + PDFbool_parser() {} + template struct definition { + typedef typename scannerT::iterator_t iterator_t; + int top; + definition(const PDFbool_parser& /*self*/) { + return ; + } + const int start() const { + return top; + } + }; +}; + +int main(void) { + PDFbool_parser PDFbool_p = PDFbool_parser(); + PDFbool_p.//-1- + ; + // #1# ("definition" "embed_t" "self_t" "test1" "use_parser") +} + +// ---------------------------------------------------------------------- + +template struct Base { +public: + void interface() + { + // ... + static_cast(this)->implementation(); + // ... + } + + static void static_func() + { + // ... + Derived::static_sub_func(); + // ... + } +}; + +struct Derived : Base { + void implementation() { } + static void static_sub_func() { } +}; + +int foo () { + Derived d; + d.//-2- + ; + // #2# ("implementation" "interface" "static_func" "static_sub_func") +} diff --git a/test/manual/cedet/tests/testtemplates.cpp b/test/manual/cedet/tests/testtemplates.cpp new file mode 100644 index 0000000000..18ee9ec10b --- /dev/null +++ b/test/manual/cedet/tests/testtemplates.cpp @@ -0,0 +1,149 @@ +// testtemplates.cpp --- semantic-ia-utest completion engine unit tests + +// Copyright (C) 2008-2019 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + + +// TODO - this probably means can't be part of emacs, as I don't know who this guy is. +// Written by 'Raf' + +template +class read_ref { +public: + const T* read_ref_member_one( T); + const V* read_ref_member_two(); +}; + +namespace NS { + template + class ref { + public: + read_ref operator->() { + m_// -1- + ; + // #1# ( "m_datas" ) + } + + private: + T m_datas[U]; + }; + +} + +class FooOne { +public: + int fooOneMember(); +}; + +class FooTwo { +public: + int fooTwoMember(); +}; + +class FooThree { +public: + int fooThreeMember(); + + FooOne * operator->(); +}; + +typedef ref Test; + +using NS; + +void +main(void) { + ref v; + + v->read_ref_member_one()-> // -2- + ; + // #2# ( "fooOneMember" ) + + v->read_ref_member_two()-> // -3- + ; + // #3# ( "fooTwoMember" ) + + v-> // -4- + ; + // #4# ( "read_ref_member_one" "read_ref_member_two" ) + + Test t; + + t->read_ref_member_two()-> // -5- + ; + // #5# ( "fooTwoMember" ) + + ref v2; + + v2->read_ref_member_two()-> // -6- + ; + // #6# ( "fooOneMember" ) + + /* Try all these things by also specifying the namespace in the name. */ + NS::ref v3; + + v3->read_ref_member_one()-> // -7- + ; + // #7# ( "fooOneMember" ) + + v3->read_ref_member_two()-> // -8- + ; + // #8# ( "fooTwoMember" ) + + v3->read_ref_member_two// @1@ 5 + ; + +} + +// More Namespace Magic using member constants. + +template +struct isFooLike { + static const bool value = false; +}; + +template <> +struct isFooLike { + static const bool value = true; +}; + + +template +class A { +public: + A(); + void foo() {}; +}; + + +template +class FooFour : public A::value> { +public: + bool bar() {} +}; + + +int main2() { + + FooFour ff; + + ff.// - 9- @ TODO - bring over patch from SF + ; // #9# ( "bar" "foo" ); + +} diff --git a/test/manual/cedet/tests/testusing.cpp b/test/manual/cedet/tests/testusing.cpp new file mode 100644 index 0000000000..1208c81fc3 --- /dev/null +++ b/test/manual/cedet/tests/testusing.cpp @@ -0,0 +1,265 @@ +// testusing.cpp --- semantic-ia-utest completion engine unit tests + +// Copyright (C) 2008-2019 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + + +#include + +#include + +namespace moose { + + class MyClass; + class Point; + + typedef MyClass snerk; +} + +namespace moose { + + class Point; + class MyClass; + +} + +namespace { + + int global_variable = 0; + +}; + +using moose::MyClass; + +void someFcn() { + + MyClass f; + + f.//-1- + ; //#1# ( "getVal" "setVal" ) + +} + +// Code from Zhiqiu Kong + +namespace panda { + + using namespace bread_name; + + int func() + { + bread test; + test.//-2- + ;// #2# ( "geta" ) + return 0; + } +} + +namespace togglemoose { + + MyOtherClass::testToggle1() { //^1^ + // Impl for testToggle1 + } +} + +togglemoose::MyOtherClass::testToggle2() { //^3^ + // Impl for testToggle2 +} + +using togglemoose; + +MyOtherClass::testToggle3() { //^3^ + // Impl for testToggle3 +} + +// Local using statements and aliased types +// Code from David Engster + +void func2() +{ + using namespace somestuff; + OneClass f; + f.//-3- + ; //#3# ( "aFunc" "anInt" ) +} + +void func3() +{ + using somestuff::OneClass; + OneClass f; + f.//-4- + ; //#4# ( "aFunc" "anInt" ) +} + +// Dereferencing alias types created through 'using' statements + +// Alias with fully qualified name +void func4() +{ + otherstuff::OneClass f; + f. //-5- + ; //#5# ( "aFunc" "anInt" ) +} + +// Alias through namespace directive +void func5() +{ + using namespace otherstuff; + OneClass f; + f. //-6- + ; //#6# ( "aFunc" "anInt" ) +} + +// Check name hiding +void func6() +{ + using namespace morestuff; + OneClass f; // Alias for somestuff::OneClass + f. //-7- + ; //#7# ( "aFunc" "anInt" ) + aStruct g; // This however is morestuff::aStruct ! + g. //-8- + ; //#8# ( "anotherBar" "anotherFoo" ) +} + +// Alias of an alias +// Currently doesn't work interactively for some reason. +void func6() +{ + using namespace evenmorestuff; + OneClass f; + f. //-7- + ; //#7# ( "aFunc" "anInt" ) +} + +// Alias for struct in nested namespace, fully qualified +void func7() +{ + outer::StructNested f; + f.//-8- + ; //#8# ( "one" "two" ) +} + +// Alias for nested namespace +void func8() +{ + using namespace outerinner; + StructNested f; + AnotherStruct g; + f.//-9- + ; //#9# ( "one" "two" ) + g.//-10- + ; //#10# ( "four" "three" ) +} + +// Check convetional namespace aliases +// - fully qualified - +void func9() +{ + alias_for_somestuff::OneClass c; + c.//-11- + ; //#11# ( "aFunc" "anInt" ) + alias_for_outerinner::AnotherStruct s; + s. //-12- + ; //#12# ( "four" "three" ) +} + +// - unqualified - +void func10() +{ + using namespace alias_for_somestuff; + OneClass c2; + c2.//-13- + ; //#13# ( "aFunc" "anInt" ) + using namespace alias_for_outerinner; + AnotherStruct s2; + s2.//-14- + ; //#14# ( "four" "three" ) +} + +// Completion on namespace aliases +void func11() +{ + alias_for_somestuff:://-15- + ; //#15# ( "OneClass" "aStruct") + alias_for_outerinner:://-16- + ; //#16# ( "AnotherStruct" "StructNested" ) +} + +// make sure unfound using statements don't crash stuff. +using something::cantbe::Found; + +void unfoundfunc() +{ + NotFound notfound; // Variable can't be found. + + notfound.//-17- + ; //#17# ( ) Nothing here since this is an undefined class + +} + +// Using statements can depend on previous ones... + +void acc_using() +{ + using namespace outer; + // This is effectively like 'using namespace outer::inner' + using namespace inner; + + StructNested sn; + sn.//-18- + ; //#18# ( "one" "two" ) +} + +// Check the same outside of function scope + +using namespace outer; +using namespace inner; + +void acc_using2() +{ + StructNested sn; + sn.//-19- + ; //#19# ( "one" "two" ) +} + +// Check if scope gets correctly generated, i.e., without us providing any +// hints in the form of an existing type + +void check_scope() +{ + using namespace first; + AAA//-20- + ; //#20# ( "AAA1" "AAA2" ) +} + +void check_scope2() +{ + using namespace third; + AAA//-21- + ; //#21# ( "AAA1" "AAA2" "AAA3" ) +} + +// Make sure this also works not only in functions + +namespace check_scope3 { + using namespace first; + AAA//-22- + ; //#22# ( "AAA1" "AAA2" ) +} diff --git a/test/manual/cedet/tests/testusing.hh b/test/manual/cedet/tests/testusing.hh new file mode 100644 index 0000000000..18a33dac46 --- /dev/null +++ b/test/manual/cedet/tests/testusing.hh @@ -0,0 +1,176 @@ +// testusing.hh --- semantic-ia-utest completion engine unit tests + +// Copyright (C) 2008-2019 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + +namespace moose { + + class Point; + + class MyClass; + +} + + +namespace moose { + + class Point; + + class MyClass { + public: + MyClass() : fVal(0) { + } + + ~MyClass() {}; + + /** + * fVal Accessors + * @{ + */ + int getVal() const { + return fVal; + } + void setVal(int Val) const { + fVal = Val; + } + /** + * @} + */ + + private: + int fVal; + }; + +} + +namespace togglemoose { + + class MyOtherClass { + public: + int testToggle1(); + int testToggle2(); + int testToggle3(); + }; +} + +namespace deer { + + class Pickle; + +}; + +// Code from Zhiqiu Kong + +#ifndef BREAD_H +#define BREAD_H + +namespace bread_name { + class bread + { + public: + void geta(); + private: + int m_a; + int m_b; + }; +} + +#endif + +// Code from David Engster +// Creating alias types through 'using' trickery + +namespace somestuff { + class OneClass { + public: + void aFunc(); + int anInt; + }; + struct aStruct { + int foo; + int bar; + }; +} + +namespace otherstuff { + // make otherstuff::OneClass an alias for somestuff::OneClass + using somestuff::OneClass; +} + +namespace morestuff { + // make morestuff an alias namespace for somestuff + using namespace somestuff; + // but hide aStruct with own type + struct aStruct { + int anotherFoo; + int anotherBar; + }; +} + +// We can also create an alias for an alias +namespace evenmorestuff { + using otherstuff::OneClass; +} + +// Now with nested namespaces +namespace outer { + namespace inner { + struct StructNested { + int one; + int two; + }; + struct AnotherStruct { + int three; + int four; + }; + } +} + +// Namespace which pulls in one of its own nested namespaces +namespace first { + class AAA1; + namespace second { + class AAA2; + } + // Elevate nested namespace into first one + using namespace second; +} + +namespace third { + using namespace first; + class AAA3; +} + + +// Elevate the first struct into 'outer' +// so that we can access it via 'outer::StructNested' +namespace outer { + using outer::inner::StructNested; +} + +// Create an alias for a nested namespace +namespace outerinner { + // equivalent to 'namespace outerinner = outer::inner;' + using namespace outer::inner; +} + +// Create namespace alias +namespace alias_for_somestuff = somestuff; +// Same for nested namespace +namespace alias_for_outerinner = outer::inner; diff --git a/test/manual/cedet/tests/testvarnames.java b/test/manual/cedet/tests/testvarnames.java new file mode 100644 index 0000000000..217a10d53e --- /dev/null +++ b/test/manual/cedet/tests/testvarnames.java @@ -0,0 +1,60 @@ +// testvarnames.java --- Semantic unit test for Java + +// Copyright (C) 2009-2019 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see . + +package tests; + +/** + * + * + * Created: 02/17/14 + * + * @author Eric M. Ludlam + * @version + * @since + */ +public class testvarnames { + + public class varorclass { + public static long misclongvalue; + }; + + public static varorclass varoftypevarorclass = NULL; + + public static long varorclass = 1; + + public static long assignintovar = 1; + + public static varorclass classassign = NULL; + + static public void main(String [] args) { + + varorclass = assign// -1- + // #1# ( "assignintovar" ) + ; + + varoftypevarorclass = clas// -2- + // #2# ( "classassign" ) + + varoftypevarorclass.misc//-3- + // #3# ( "misclongvalue" ) + } + +} // testvarnames diff --git a/test/manual/cedet/tests/testwisent.wy b/test/manual/cedet/tests/testwisent.wy new file mode 100644 index 0000000000..07f8637a65 --- /dev/null +++ b/test/manual/cedet/tests/testwisent.wy @@ -0,0 +1,85 @@ +;; testwisent.wy --- unit test support file for semantic-utest-ia + +;; Copyright (C) 2008-2019 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; Parser for nothing in particular mode + +%languagemode nothing-mode +%parsetable wisent-nothing-parser-tables +%keywordtable wisent-nothing-keywords +%tokentable wisent-nothing-tokens +%languagemode nothing-mode +%setupfunction wisent-nothing-default-setup + +%start goal + +;;; Punctuation +%type ;;syntax "\\(\\s.\\|\\s$\\|\\s'\\)+" matchdatatype string + +%token DOT "." +%token COMA "," +%token COLONCOLON "::" +%token COLON ":" +%token SEMICOLON ";" + +;;; KEYWORDS +%type + +%keyword COLONOSCOPY "colonoscopy" +%keyword SEMISOMETHING "semisomething" + +%% + +goal + ;; Misc + : COLON ;; -1- + ;; #1# ( "COLONCOLON" "COLON" "COLONOSCOPY" ) + | SEMI ;; -2- + ;; #2# ( "SEMI_useless_rule" "SEMICOLON" "SEMISOMETHING" ) + | thing ;; -3- + ;; #3# ( "thing_term_1" "thing_term_2" ) + ; + +SEMI_useless_rule + : + ; + +thing_term_1 + : + ; + +thing_term_2 + : + ; + +%% +(define-lex wisent-nothing-lexer + "Lexical analyzer to handle nothing in particular buffers." + ;; semantic-lex-newline + semantic-lex-ignore-whitespace + semantic-lex-ignore-newline + semantic-lex-ignore-comments + + semantic-lex-default-action + ) + +;; testwisent.wy ends here \ No newline at end of file commit fd1b720028064c2566ff4dcc3ad898346a0f6b77 Author: Alan Third Date: Mon Oct 28 11:21:29 2019 +0000 Prevent text flicker with macOS input methods (bug#23412) * src/nsterm.m ([EmacsView setMarkedText:selectedRange:]): Don't always delete the working text as ns-put-working-text does that. diff --git a/src/nsterm.m b/src/nsterm.m index 5583c6105c..afe7069aae 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6435,15 +6435,17 @@ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange (unsigned long)selRange.length, (unsigned long)selRange.location); - if (workingText != nil) - [self deleteWorkingText]; if ([str length] == 0) - return; + { + [self deleteWorkingText]; + return; + } if (!emacs_event) return; processingCompose = YES; + [workingText release]; workingText = [str copy]; ns_working_text = build_string ([workingText UTF8String]); commit d75794fd5c168fb76406b88e231d8749160f934a Author: Mattias Engdegård Date: Thu Oct 31 10:31:27 2019 +0100 Inhibit undo-in-region for mouse-drag-region (bug#37700) 'mouse-drag-region' leaves the region active around the dragged text, so a straight undo did not revert the entire operation. To remedy this, inhibit undo-in-region when the last command was mouse-drag-region. (Method suggested by Stefan Monnier.) * lisp/mouse.el (undo-drag-region): Set the undo-inhibit-region property. * lisp/simple.el (undo): Inhibit undo-in-region if the last command had the undo-inhibit-region property set. * doc/lispref/symbols.texi (Standard Properties): * doc/lispref/text.texi (Undo): Document undo-inhibit-region. * etc/NEWS: Announce the property. diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 5d71fb39a2..936bda9b36 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -590,6 +590,11 @@ ignore a call whose value is unused. If the property's value is calls. In addition to byte compiler optimizations, this property is also used for determining function safety (@pxref{Function Safety}). +@item undo-inhibit-region +If non-@code{nil}, the named function prevents the @code{undo} operation +from being restricted to the active region, if @code{undo} is invoked +immediately after the function. @xref{Undo}. + @item variable-documentation If non-@code{nil}, this specifies the named variable's documentation string. This is set automatically by @code{defvar} and related diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ac444f6afe..9bc6213f3a 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1451,6 +1451,12 @@ continuing to undo. This function does not bind @code{undo-in-progress}. @end defun +Some commands leave the region active after execution in such a way that +it interferes with selective undo of that command. To make @code{undo} +ignore the active region when invoked immediately after such a command, +set the property @code{undo-inhibit-region} of the command's function +symbol to a non-nil value. @xref{Standard Properties}. + @node Maintaining Undo @section Maintaining Undo Lists diff --git a/etc/NEWS b/etc/NEWS index ee73d2414b..7a76d90ed5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3102,6 +3102,12 @@ in other packages are now obsolete aliases of 'xor'. Setting this on the first character of a help string disables conversions via 'substitute-command-keys'. ++++ +** 'undo' can be made to ignore the active region for a command +by setting 'undo-inhibit-region' symbol property of that command to +non-nil. This is used by 'mouse-drag-region' to make the effect +easier to undo immediately afterwards. + * Changes in Emacs 27.1 on Non-Free Operating Systems diff --git a/lisp/mouse.el b/lisp/mouse.el index 76fec507e7..4a351f7be2 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1104,6 +1104,12 @@ is dragged over to." (run-hooks 'mouse-leave-buffer-hook) (mouse-drag-track start-event))) +;; Inhibit the region-confinement when undoing mouse-drag-region +;; immediately after the command. Otherwise, the selection left +;; active around the dragged text would prevent an undo of the whole +;; operation. +(put 'mouse-drag-region 'undo-inhibit-region t) + (defun mouse-posn-property (pos property) "Look for a property at click position. POS may be either a buffer position or a click position like diff --git a/lisp/simple.el b/lisp/simple.el index 29e195bca6..10aecd651f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2508,6 +2508,10 @@ as an argument limits undo to changes within the current region." (base-buffer (or (buffer-base-buffer) (current-buffer))) (recent-save (with-current-buffer base-buffer (recent-auto-save-p))) + ;; Allow certain commands to inhibit an immediately following + ;; undo-in-region. + (inhibit-region (and (symbolp last-command) + (get last-command 'undo-inhibit-region))) message) ;; If we get an error in undo-start, ;; the next command should not be a "consecutive undo". @@ -2525,7 +2529,8 @@ as an argument limits undo to changes within the current region." ;; it shows nothing else happened in between. (gethash list undo-equiv-table)))) (setq undo-in-region - (or (region-active-p) (and arg (not (numberp arg))))) + (and (or (region-active-p) (and arg (not (numberp arg)))) + (not inhibit-region))) (if undo-in-region (undo-start (region-beginning) (region-end)) (undo-start)) commit 111a95fe6d209aff6e7f26cb6777fbdf02aae15d Author: Lars Ingebrigtsen Date: Thu Oct 31 14:06:08 2019 +0100 Ensure that font-local variables are buffer-local * lisp/font-lock.el (font-lock-set-defaults): Ensure that the font lock variables are buffer-local even when nil, so that they're copied correctly by mhtml mode when changing sub-modes (bug#33937). diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 4eb7bb8c2d..875f5b0592 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1902,18 +1902,13 @@ Sets various variables using `font-lock-defaults' and (removed-keywords (cdr-safe (assq major-mode font-lock-removed-keywords-alist)))) ;; Syntactic fontification? - (if (nth 1 defaults) - (set (make-local-variable 'font-lock-keywords-only) t) - (kill-local-variable 'font-lock-keywords-only)) + (setq-local font-lock-keywords-only (nth 1 defaults)) ;; Case fold during regexp fontification? - (if (nth 2 defaults) - (set (make-local-variable 'font-lock-keywords-case-fold-search) t) - (kill-local-variable 'font-lock-keywords-case-fold-search)) + (setq-local font-lock-keywords-case-fold-search (nth 2 defaults)) ;; Syntax table for regexp and syntactic fontification? (if (null (nth 3 defaults)) - (kill-local-variable 'font-lock-syntax-table) - (set (make-local-variable 'font-lock-syntax-table) - (copy-syntax-table (syntax-table))) + (setq-local font-lock-syntax-table nil) + (setq-local font-lock-syntax-table (copy-syntax-table (syntax-table))) (dolist (selem (nth 3 defaults)) ;; The character to modify may be a single CHAR or a STRING. (let ((syntax (cdr selem))) commit 60ad3d63cf6100f30801eb9c0256a84907da1dca Author: Lars Ingebrigtsen Date: Thu Oct 31 13:26:19 2019 +0100 Clean up font-lock-refontify slightly * lisp/font-lock.el (font-lock-refontify): Use syntax-ppss-flush-cache instead of internal variable. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ef0e2dc045..4eb7bb8c2d 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1106,8 +1106,10 @@ This functions is a convenience functions when developing font locking for a mode, and is not meant to be called from lisp functions." (interactive) (declare (interactive-only t)) - (setq font-lock-major-mode nil - syntax-propertize--done -1) + ;; Make font-lock recalculate all the mode-specific data. + (setq font-lock-major-mode nil) + ;; Make the syntax machinery discard all information. + (syntax-ppss-flush-cache -1) (font-lock-set-defaults) (save-excursion (font-lock-fontify-region (point-min) (point-max)))) commit d630a047bbba8bf0ab07250a7f750eefb3a48eae Author: Lars Ingebrigtsen Date: Thu Oct 31 13:07:37 2019 +0100 Further tweaks to sh-script \ #foo font locking * lisp/progmodes/sh-script.el (sh-syntax-propertize-function): Tweak previous \ #foo change to work on all quoted characters, but check that the backslash itself is not backslashed. Regexp from Stefan Monnier. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index b2f896ecab..6ec131980b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1140,8 +1140,10 @@ subshells can nest." ;; beginning of a word. In the shell, words are separated by ;; metacharacters. The list of special chars is taken from ;; the single-unix spec of the shell command language (under - ;; `quoting') but with `$' removed. - ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\\\ \\)\\(#+\\)" (1 "_")) + ;; `quoting') but with `$' removed. Also -- if there's something like + ;; \ #foo, then that's not a comment, unless the backslash itself + ;; is backslashed. + ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\(?:[^\\]\\|^\\)\\\\\\(?:\\\\\\\\\\)*.\\)\\(#+\\)" (1 "_")) ;; In addition, `#' at the beginning of closed parentheses ;; does not start a comment if the parentheses are not isolated ;; by metacharacters, excluding [()]. commit bdb33af39d32cfb0bb23f18eb34775a30e2ff62d Author: Michael Albinus Date: Thu Oct 31 11:13:13 2019 +0100 Fix some minor Tramp problems * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection): Check, that `tramp-password-save-function' is a function. * lisp/net/tramp-smb.el (tramp-smb-handle-file-system-info): Check, that there is a share. * lisp/net/tramp.el (outline-regexp): Declare. (tramp-get-debug-buffer): Let-bind `signal-hook-function'. * test/lisp/net/tramp-tests.el (tramp-test04-substitute-in-file-name): Skip some tests for Emacs 24 and 25; they let Emacs crash. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 4843c63cb8..c08c7194cc 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1911,7 +1911,9 @@ connection if a previous connection has died for some reason." (tramp-error vec 'file-error "FUSE mount denied")) ;; Save the password. - (ignore-errors (funcall tramp-password-save-function)) + (ignore-errors + (and (functionp tramp-password-save-function) + (funcall tramp-password-save-function))) ;; Set connection-local variables. (tramp-set-connection-local-variables vec) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 27c321bb9c..5e52b26e7c 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -946,29 +946,31 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (unless (file-directory-p filename) (setq filename (file-name-directory filename))) (with-parsed-tramp-file-name (expand-file-name filename) nil - (tramp-message v 5 "file system info: %s" localname) - (tramp-smb-send-command v (format "du %s/*" (tramp-smb-get-localname v))) - (with-current-buffer (tramp-get-connection-buffer v) - (let (total avail blocksize) - (goto-char (point-min)) - (forward-line) - (when (looking-at - (eval-when-compile - (concat "[[:space:]]*\\([[:digit:]]+\\)" - " blocks of size \\([[:digit:]]+\\)" - "\\. \\([[:digit:]]+\\) blocks available"))) - (setq blocksize (string-to-number (match-string 2)) - total (* blocksize (string-to-number (match-string 1))) - avail (* blocksize (string-to-number (match-string 3))))) - (forward-line) - (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)") - ;; The used number of bytes is not part of the result. As - ;; side effect, we store it as file property. - (tramp-set-file-property - v localname "used-bytes" (string-to-number (match-string 1)))) - ;; Result. - (when (and total avail) - (list total (- total avail) avail))))))) + (when (tramp-smb-get-share v) + (tramp-message v 5 "file system info: %s" localname) + (tramp-smb-send-command + v (format "du %s/*" (tramp-smb-get-localname v))) + (with-current-buffer (tramp-get-connection-buffer v) + (let (total avail blocksize) + (goto-char (point-min)) + (forward-line) + (when (looking-at + (eval-when-compile + (concat "[[:space:]]*\\([[:digit:]]+\\)" + " blocks of size \\([[:digit:]]+\\)" + "\\. \\([[:digit:]]+\\) blocks available"))) + (setq blocksize (string-to-number (match-string 2)) + total (* blocksize (string-to-number (match-string 1))) + avail (* blocksize (string-to-number (match-string 3))))) + (forward-line) + (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)") + ;; The used number of bytes is not part of the result. + ;; As side effect, we store it as file property. + (tramp-set-file-property + v localname "used-bytes" (string-to-number (match-string 1)))) + ;; Result. + (when (and total avail) + (list total (- total avail) avail)))))))) (defun tramp-smb-handle-file-writable-p (filename) "Like `file-writable-p' for Tramp files." diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index adcc2a336f..21b6f0070f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -64,6 +64,7 @@ (require 'cl-lib) (declare-function netrc-parse "netrc") (defvar auto-save-file-name-transforms) +(defvar outline-regexp) ;;; User Customizable Internal Variables: @@ -1650,7 +1651,8 @@ The outline level is equal to the verbosity of the Tramp message." ;; Furthermore, `outline-regexp' must have the correct value ;; already, because it is used by `font-lock-compile-keywords'. (let ((default-directory (tramp-compat-temporary-file-directory)) - (outline-regexp tramp-debug-outline-regexp)) + (outline-regexp tramp-debug-outline-regexp) + signal-hook-function) (outline-mode)) (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) (set (make-local-variable 'outline-level) 'tramp-debug-outline-level) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index c56c7dbbca..baebae17e1 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -1956,36 +1956,40 @@ properly. BODY shall not contain a timeout." (substitute-in-file-name "/method:host:/:/path//foo") "/method:host:/:/path//foo")) - (should - (string-equal (substitute-in-file-name "/method:host://~foo") "/~foo")) - (should - (string-equal - (substitute-in-file-name "/method:host:/~foo") "/method:host:/~foo")) - (should - (string-equal - (substitute-in-file-name "/method:host:/path//~foo") "/~foo")) - ;; (substitute-in-file-name "/path/~foo") expands only for a local - ;; user "foo" to "/~foo"". Otherwise, it doesn't expand. - (should - (string-equal - (substitute-in-file-name - "/method:host:/path/~foo") "/method:host:/path/~foo")) - ;; Quoting local part. - (should - (string-equal - (substitute-in-file-name "/method:host:/://~foo") - "/method:host:/://~foo")) - (should - (string-equal - (substitute-in-file-name "/method:host:/:/~foo") "/method:host:/:/~foo")) - (should - (string-equal - (substitute-in-file-name - "/method:host:/:/path//~foo") "/method:host:/:/path//~foo")) - (should - (string-equal - (substitute-in-file-name - "/method:host:/:/path/~foo") "/method:host:/:/path/~foo")) + ;; Forwhatever reasons, the following tests let Emacs crash for + ;; Emacs 24 and Emacs 25, occasionally. No idea what's up. + (when (or (tramp--test-emacs26-p) (tramp--test-emacs27-p)) + (should + (string-equal (substitute-in-file-name "/method:host://~foo") "/~foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/~foo") "/method:host:/~foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path//~foo") "/~foo")) + ;; (substitute-in-file-name "/path/~foo") expands only for a local + ;; user "foo" to "/~foo"". Otherwise, it doesn't expand. + (should + (string-equal + (substitute-in-file-name + "/method:host:/path/~foo") "/method:host:/path/~foo")) + ;; Quoting local part. + (should + (string-equal + (substitute-in-file-name "/method:host:/://~foo") + "/method:host:/://~foo")) + (should + (string-equal + (substitute-in-file-name + "/method:host:/:/~foo") "/method:host:/:/~foo")) + (should + (string-equal + (substitute-in-file-name + "/method:host:/:/path//~foo") "/method:host:/:/path//~foo")) + (should + (string-equal + (substitute-in-file-name + "/method:host:/:/path/~foo") "/method:host:/:/path/~foo"))) (let (process-environment) (should commit e168bb73865f64cc67f80f8b2599c826cbf9e957 Author: Robert Pluim Date: Thu Oct 31 10:52:20 2019 +0100 Rework vc stash bindings This adds create/snapshot bindings to the stash button even when there are no stashes, and extends the stash menu bindings. * etc/NEWS: Announce the bindings. * lisp/vc/vc-git.el (vc-git-stash-shared-map): New keymap. Holds shared bindings between stash button and stash list. (vc-git-stash-map): Inherit from vc-git-stash-shared-map. (vc-git-stash-button-map): New keymap. Holds button bindings, inherit from vc-git-stash-shared-map. (vc-git-stash-shared-help, vc-git-stash-list-help): New defconsts. Abstract out list/button help texts. (vc-git--make-button-text): Set keymap property to vc-git-stash-button-map. (vc-git-make-stash-button): Use vc-git-stash-shared-help. (vc-git-stash-menu-map): Add items for vc-git-stash and vc-git-stash-snapshot. (vc-git-dir-extra-headers): Use vc-git-stash-list-help and vc-git-stash-shared-help. Add vc-git-stash and vc-git-stash-snapshot bindings to text shown when there are no stashes. diff --git a/etc/NEWS b/etc/NEWS index cd1e46bb87..ee73d2414b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -879,6 +879,10 @@ When no files are marked, all modified files are stashed, as before. *** 'vc-git-stash' has now been bound to the 'C' keystroke in the stash headers. +*** Some stash keybindings are now available in the stash button. +'vc-git-stash' and 'vc-git-stash-snapshot' can now be run using 'C' +and 'S' respectively, including when there are no stashes. + *** The new hook 'vc-retrieve-tag-hook' runs after retrieving a tag. --- diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index e0b3b09462..3960f725cf 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -636,8 +636,15 @@ or an empty string if none." :files files :update-function update-function))) +(defvar vc-git-stash-shared-map + (let ((map (make-sparse-keymap))) + (define-key map "S" 'vc-git-stash-snapshot) + (define-key map "C" 'vc-git-stash) + map)) + (defvar vc-git-stash-map (let ((map (make-sparse-keymap))) + (set-keymap-parent map vc-git-stash-shared-map) ;; Turn off vc-dir marking (define-key map [mouse-2] 'ignore) @@ -647,16 +654,29 @@ or an empty string if none." (define-key map "\C-m" 'vc-git-stash-show-at-point) (define-key map "A" 'vc-git-stash-apply-at-point) (define-key map "P" 'vc-git-stash-pop-at-point) - (define-key map "S" 'vc-git-stash-snapshot) - (define-key map "C" 'vc-git-stash) map)) +(defvar vc-git-stash-button-map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map vc-git-stash-shared-map) + (define-key map [mouse-2] 'push-button) + (define-key map "\C-m" 'push-button) + map)) + +(defconst vc-git-stash-shared-help + "\\\\[vc-git-stash]: Create named stash\n\\[vc-git-stash-snapshot]: Snapshot stash") + +(defconst vc-git-stash-list-help (concat "\\mouse-3: Show stash menu\n\\[vc-git-stash-show-at-point], =: Show stash\n\\[vc-git-stash-apply-at-point]: Apply stash\n\\[vc-git-stash-pop-at-point]: Apply and remove stash (pop)\n\\[vc-git-stash-delete-at-point]: Delete stash\n" + vc-git-stash-shared-help)) + (defun vc-git--make-button-text (show count1 count2) - (if show - (format "Show all stashes (%s)" count2) - (if (= count1 count2) - (format "Hide all stashes (%s)" count2) - (format "Show %s stash%s (of %s)" count1 (if (= count1 1) "" "es") count2)))) + (propertize + (if show + (format "Show all stashes (%s)" count2) + (if (= count1 count2) + (format "Hide all stashes (%s)" count2) + (format "Show %s stash%s (of %s)" count1 (if (= count1 1) "" "es") count2))) + 'keymap vc-git-stash-button-map)) (defun vc-git-make-stash-button (show count1 count2) (let ((orig-text (vc-git--make-button-text show count1 count2))) @@ -678,10 +698,16 @@ or an empty string if none." (insert (vc-git-make-stash-button (not state) (car counts) (cdr counts)))))) 'button-data (cons count1 count2) - 'help-echo "mouse-2, RET: Show/hide stashes"))) + 'help-echo (concat "mouse-2, RET: Show/hide stashes\n" vc-git-stash-shared-help)))) (defvar vc-git-stash-menu-map (let ((map (make-sparse-keymap "Git Stash"))) + (define-key map [sn] + '(menu-item "Snapshot Stash" vc-git-stash-snapshot + :help "Snapshot stash")) + (define-key map [cr] + '(menu-item "Create Samed Stash" vc-git-stash + :help "Create named stash")) (define-key map [de] '(menu-item "Delete Stash" vc-git-stash-delete-at-point :help "Delete the current stash")) @@ -701,8 +727,6 @@ or an empty string if none." (with-current-buffer standard-output (vc-git--out-ok "symbolic-ref" "HEAD")))) (stash-list (vc-git-stash-list)) - (stash-help-echo "Use M-x vc-git-stash to create stashes.") - (stash-list-help-echo "mouse-3: Show stash menu\nRET: Show stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash") branch remote remote-url stash-button stash-string) (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) @@ -749,7 +773,7 @@ or an empty string if none." 'face 'font-lock-variable-name-face 'mouse-face 'highlight 'vc-git-hideable all-hideable - 'help-echo stash-list-help-echo + 'help-echo vc-git-stash-list-help 'keymap vc-git-stash-map)) shown-stashes (propertize "\n" @@ -766,7 +790,7 @@ or an empty string if none." 'mouse-face 'highlight 'invisible t 'vc-git-hideable t - 'help-echo stash-list-help-echo + 'help-echo vc-git-stash-list-help 'keymap vc-git-stash-map)) hidden-stashes (propertize "\n" @@ -790,15 +814,14 @@ or an empty string if none." (propertize "\nRebase : in progress" 'face 'font-lock-warning-face)) (if stash-list (concat - (propertize "\nStash : " 'face 'font-lock-type-face - 'help-echo stash-help-echo) + (propertize "\nStash : " 'face 'font-lock-type-face) stash-button stash-string) (concat - (propertize "\nStash : " 'face 'font-lock-type-face - 'help-echo stash-help-echo) + (propertize "\nStash : " 'face 'font-lock-type-face) (propertize "Nothing stashed" - 'help-echo stash-help-echo + 'help-echo vc-git-stash-shared-help + 'keymap vc-git-stash-shared-map 'face 'font-lock-variable-name-face)))))) (defun vc-git-branches () commit e65be8cc5b623385ebe31aa0a1089e0de2b075b5 Author: Paul Eggert Date: Wed Oct 30 18:15:14 2019 -0700 Fix bug with lock file on nonstandard filesystem * src/filelock.c (create_lock_file): Don’t disable user write access to the lock file (Bug#37884). diff --git a/src/filelock.c b/src/filelock.c index ff25d6475d..2077287345 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -402,9 +402,15 @@ create_lock_file (char *lfname, char *lock_info_str, bool force) ptrdiff_t lock_info_len; lock_info_len = strlen (lock_info_str); err = 0; + + /* Make the lock file readable to others, so that others' sessions + can read it. Even though nobody should write to the lock file, + keep it user-writable to work around problems on nonstandard file + systems that prohibit unlinking readonly files (Bug#37884). */ if (emacs_write (fd, lock_info_str, lock_info_len) != lock_info_len - || fchmod (fd, S_IRUSR | S_IRGRP | S_IROTH) != 0) + || fchmod (fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) != 0) err = errno; + /* There is no need to call fsync here, as the contents of the lock file need not survive system crashes. */ if (emacs_close (fd) != 0) commit 48fdfd8b939654e5bde0ef5448e17e4336cdb229 Author: Lars Ingebrigtsen Date: Thu Oct 31 00:31:32 2019 +0100 Font-lock symlinks in dired buffers better * lisp/dired.el (dired-font-lock-keywords): Font-lock symlinks differently based on whether they point at a directory or not (bug#17064). Based on code from Michael Heerdegen. diff --git a/lisp/dired.el b/lisp/dired.el index d1ec3f36b1..05789a3516 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -517,9 +517,31 @@ Subexpression 2 must end right before the \\n.") (list dired-re-dir '(".+" (dired-move-to-filename) nil (0 dired-directory-face))) ;; - ;; Symbolic links. + ;; Symbolic link to a directory. (list dired-re-sym - '(".+" (dired-move-to-filename) nil (0 dired-symlink-face))) + (list (lambda (end) + (when-let* ((file (dired-file-name-at-point)) + (truename (ignore-errors (file-truename file)))) + (and (file-directory-p truename) + (search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" end t)))) + '(dired-move-to-filename) + nil + '(1 dired-symlink-face) + '(2 dired-directory-face))) + ;; + ;; Symbolic link to a non-directory. + (list dired-re-sym + (list (lambda (end) + (when-let ((file (dired-file-name-at-point))) + (let ((truename (ignore-errors (file-truename file)))) + (and (or (not truename) + (not (file-directory-p truename))) + (search-forward-regexp "\\(.+-> ?\\)\\(.+\\)" + end t))))) + '(dired-move-to-filename) + nil + '(1 dired-symlink-face) + '(2 'default))) ;; ;; Sockets, pipes, block devices, char devices. (list dired-re-special commit 390dd2cff9d69b3527229fa5752e42a410d06508 Author: Juri Linkov Date: Thu Oct 31 01:11:05 2019 +0200 * lisp/tab-bar.el (tab-bar-select-tab): Use set-frame-parameter. (tab-bar-list-noselect, tab-bar-list-mode): Rearrange buffer-read-only. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index c9829e94ff..ef58e9060b 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -538,13 +538,12 @@ to the numeric argument. ARG counts from 1." ;; window-configuration restores point to global point ;; in this dired buffer, not to its window point, ;; but this is slightly better than 1. + ;; Maybe better to save dired-filename in each window? (not (eq 1 (marker-position wc-point)))) (goto-char wc-point)) - (when wc-bl (modify-frame-parameters - nil (list (cons 'buffer-list wc-bl)))) - (when wc-bbl (modify-frame-parameters - nil (list (cons 'buried-buffer-list wc-bbl)))) + (when wc-bl (set-frame-parameter nil 'buffer-list wc-bl)) + (when wc-bbl (set-frame-parameter nil 'buried-buffer-list wc-bbl)) (puthash (selected-frame) (and (window-configuration-p (cdr (assq 'wc (car wc-history-back)))) @@ -562,10 +561,8 @@ to the numeric argument. ARG counts from 1." (mapcar #'get-buffer (cdr (assq 'ws-bl to-tab))))) (ws-bbl (seq-filter #'buffer-live-p (mapcar #'get-buffer (cdr (assq 'ws-bbl to-tab)))))) - (when ws-bl (modify-frame-parameters - nil (list (cons 'buffer-list ws-bl)))) - (when ws-bbl (modify-frame-parameters - nil (list (cons 'buried-buffer-list ws-bbl))))))) + (when ws-bl (set-frame-parameter nil 'buffer-list ws-bl)) + (when ws-bbl (set-frame-parameter nil 'buried-buffer-list ws-bbl))))) (setq tab-bar-history-omit t) @@ -1066,9 +1063,9 @@ For more information, see the function `tab-bar-list'." (with-current-buffer (get-buffer-create (format " *Tabs*<%s>" (or (frame-parameter nil 'window-id) (frame-parameter nil 'name)))) + (setq buffer-read-only nil) (erase-buffer) (tab-bar-list-mode) - (setq buffer-read-only nil) ;; Vertical alignment to the center of the frame (insert-char ?\n (/ (- (frame-height) (length tabs) 1) 2)) ;; Horizontal alignment to the center of the frame @@ -1088,6 +1085,7 @@ For more information, see the function `tab-bar-list'." (tab-bar-list-next-line)) (move-to-column tab-bar-list-column) (set-buffer-modified-p nil) + (setq buffer-read-only t) (current-buffer)))) (defvar tab-bar-list-column 3) @@ -1127,8 +1125,7 @@ Letters do not insert themselves; instead, they are commands. \\[tab-bar-list-unmark] -- remove all kinds of marks from current line. With prefix argument, also move up one line. \\[tab-bar-list-backup-unmark] -- back up a line and remove marks." - (setq truncate-lines t) - (setq buffer-read-only t)) + (setq truncate-lines t)) (defun tab-bar-list-current-tab (error-if-non-existent-p) "Return window configuration described by this line of the list." commit f2a72bb8ed29223dd1197492d4270c171db5e443 Author: Paul Eggert Date: Wed Oct 30 14:40:06 2019 -0700 Fix print.c infloop on circular lists Fix infinite loops in print.c when a circular list is passed to command-error-default-function or to error-message-string. * src/print.c (print_error_message): Use FOR_EACH_TAIL to avoid infloop on circular lists. (print_object): Use FOR_EACH_TAIL_SAFE, as it uses Brent’s teleporting tortoise-hare algorithm which is asymptotically better than the classic tortoise-hare algorithm that the code wsas using. * test/src/print-tests.el (print-circle-2): When print-circle is nil, do not insist on a particular cycle-detection heuristic. (error-message-string-circular): New test. diff --git a/src/print.c b/src/print.c index 77ddd93efb..a2c199c14a 100644 --- a/src/print.c +++ b/src/print.c @@ -966,13 +966,12 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, else sep = NULL; - for (; CONSP (tail); tail = XCDR (tail), sep = ", ") + FOR_EACH_TAIL (tail) { - Lisp_Object obj; - if (sep) write_string (sep, stream); - obj = XCAR (tail); + sep = ", "; + Lisp_Object obj = XCAR (tail); if (!NILP (file_error) || EQ (errname, Qend_of_file) || EQ (errname, Quser_error)) Fprinc (obj, stream); @@ -2087,46 +2086,33 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) { printchar ('(', printcharfun); - Lisp_Object halftail = obj; - /* Negative values of print-length are invalid in CL. Treat them like nil, as CMUCL does. */ intmax_t print_length = (FIXNATP (Vprint_length) ? XFIXNAT (Vprint_length) : INTMAX_MAX); - + Lisp_Object objtail = Qnil; intmax_t i = 0; - while (CONSP (obj)) + FOR_EACH_TAIL_SAFE (obj) { - /* Detect circular list. */ - if (NILP (Vprint_circle)) - { - /* Simple but incomplete way. */ - if (i != 0 && EQ (obj, halftail)) - { - int len = sprintf (buf, " . #%"PRIdMAX, i >> 1); - strout (buf, len, len, printcharfun); - goto end_of_list; - } - } - else + if (i != 0) { - /* With the print-circle feature. */ - if (i != 0) + printchar (' ', printcharfun); + + if (!NILP (Vprint_circle)) { - Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil); + /* With the print-circle feature. */ + Lisp_Object num = Fgethash (obj, Vprint_number_table, + Qnil); if (FIXNUMP (num)) { - print_c_string (" . ", printcharfun); + print_c_string (". ", printcharfun); print_object (obj, printcharfun, escapeflag); goto end_of_list; } } } - if (i) - printchar (' ', printcharfun); - if (print_length <= i) { print_c_string ("...", printcharfun); @@ -2135,17 +2121,23 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) i++; print_object (XCAR (obj), printcharfun, escapeflag); + objtail = XCDR (obj); + } - obj = XCDR (obj); - if (!(i & 1)) - halftail = XCDR (halftail); - } - - /* OBJ non-nil here means it's the end of a dotted list. */ - if (!NILP (obj)) + /* OBJTAIL non-nil here means it's the end of a dotted list + or FOR_EACH_TAIL_SAFE detected a circular list. */ + if (!NILP (objtail)) { print_c_string (" . ", printcharfun); - print_object (obj, printcharfun, escapeflag); + + if (CONSP (objtail) && NILP (Vprint_circle)) + { + int len = sprintf (buf, "#%"PRIdMAX, i >> 1); + strout (buf, len, len, printcharfun); + goto end_of_list; + } + + print_object (objtail, printcharfun, escapeflag); } end_of_list: diff --git a/test/src/print-tests.el b/test/src/print-tests.el index 26d49a5ffb..77371a1b4c 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el @@ -345,11 +345,15 @@ otherwise, use a different charset." ;; Bug#31146. (let ((x '(0 . #1=(0 . #1#)))) (let ((print-circle nil)) - (should (string-match "\\`(0 0 . #[0-9])\\'" + (should (string-match "\\`(0\\( 0\\)* . #[0-9]+)\\'" (print-tests--prin1-to-string x)))) (let ((print-circle t)) (should (equal "(0 . #1=(0 . #1#))" (print-tests--prin1-to-string x)))))) +(print-tests--deftest error-message-string-circular () + (let ((err (list 'error))) + (setcdr err err) + (should-error (error-message-string err) :type 'circular-list))) (provide 'print-tests) ;;; print-tests.el ends here commit 581601e650cc8bdcf3ed83c6ae36744601c12ce9 Author: Paul Eggert Date: Wed Oct 30 14:24:29 2019 -0700 Fix keyboard.c infloops on circular lists Fix infinite loops in keyboard.c when a circular list is found in a hook, or in help-event-list, or in the argument of event-convert-list, or in a keymap where a Lucid event type list is expected, or in a menu or tab spec. * src/keyboard.c (safe_run_hooks_error, menu_bar_items) (parse_menu_item, parse_tab_bar_item, parse_tool_bar_item): Use FOR_EACH_TAIL to avoid infloop on circular lists. (help_char_p, Fevent_convert_list, lucid_event_type_list_p): Use FOR_EACH_TAIL_SAFE to avoid infloop on circular lists, when the action is idempotent so a circular list can be treated as a noncircular one. diff --git a/src/keyboard.c b/src/keyboard.c index 0eab8fdfae..7d3b0244b2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1784,10 +1784,10 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) if (SYMBOLP (hook)) { - Lisp_Object val; bool found = false; Lisp_Object newval = Qnil; - for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val)) + Lisp_Object val = find_symbol_value (hook); + FOR_EACH_TAIL (val) if (EQ (fun, XCAR (val))) found = true; else @@ -1797,9 +1797,8 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) /* Not found in the local part of the hook. Let's look at the global part. */ newval = Qnil; - for (val = (NILP (Fdefault_boundp (hook)) ? Qnil - : Fdefault_value (hook)); - CONSP (val); val = XCDR (val)) + val = NILP (Fdefault_boundp (hook)) ? Qnil : Fdefault_value (hook); + FOR_EACH_TAIL (val) if (EQ (fun, XCAR (val))) found = true; else @@ -3196,14 +3195,13 @@ record_menu_key (Lisp_Object c) static bool help_char_p (Lisp_Object c) { - Lisp_Object tail; - if (EQ (c, Vhelp_char)) - return 1; - for (tail = Vhelp_event_list; CONSP (tail); tail = XCDR (tail)) + return true; + Lisp_Object tail = Vhelp_event_list; + FOR_EACH_TAIL_SAFE (tail) if (EQ (c, XCAR (tail))) - return 1; - return 0; + return true; + return false; } /* Record the input event C in various ways. */ @@ -6581,22 +6579,16 @@ The return value is an event type (a character or symbol) which has the same base event type and all the specified modifiers. */) (Lisp_Object event_desc) { - Lisp_Object base; + Lisp_Object base = Qnil; int modifiers = 0; - Lisp_Object rest; - base = Qnil; - rest = event_desc; - while (CONSP (rest)) + FOR_EACH_TAIL_SAFE (event_desc) { - Lisp_Object elt; + Lisp_Object elt = XCAR (event_desc); int this = 0; - elt = XCAR (rest); - rest = XCDR (rest); - /* Given a symbol, see if it is a modifier name. */ - if (SYMBOLP (elt) && CONSP (rest)) + if (SYMBOLP (elt) && CONSP (XCDR (event_desc))) this = parse_solitary_modifier (elt); if (this != 0) @@ -6605,7 +6597,6 @@ has the same base event type and all the specified modifiers. */) error ("Two bases given in one event"); else base = elt; - } /* Let the symbol A refer to the character A. */ @@ -6755,24 +6746,23 @@ parse_solitary_modifier (Lisp_Object symbol) bool lucid_event_type_list_p (Lisp_Object object) { - Lisp_Object tail; - if (! CONSP (object)) - return 0; + return false; if (EQ (XCAR (object), Qhelp_echo) || EQ (XCAR (object), Qvertical_line) || EQ (XCAR (object), Qmode_line) || EQ (XCAR (object), Qtab_line) || EQ (XCAR (object), Qheader_line)) - return 0; + return false; - for (tail = object; CONSP (tail); tail = XCDR (tail)) + Lisp_Object tail = object; + FOR_EACH_TAIL_SAFE (object) { - Lisp_Object elt; - elt = XCAR (tail); + Lisp_Object elt = XCAR (object); if (! (FIXNUMP (elt) || SYMBOLP (elt))) - return 0; + return false; + tail = XCDR (object); } return NILP (tail); @@ -7401,7 +7391,7 @@ menu_bar_items (Lisp_Object old) Lisp_Object *maps; Lisp_Object mapsbuf[3]; - Lisp_Object def, tail; + Lisp_Object def; ptrdiff_t mapno; Lisp_Object oquit; @@ -7484,12 +7474,12 @@ menu_bar_items (Lisp_Object old) /* Move to the end those items that should be at the end. */ - for (tail = Vmenu_bar_final_items; CONSP (tail); tail = XCDR (tail)) + Lisp_Object tail = Vmenu_bar_final_items; + FOR_EACH_TAIL (tail) { - int i; int end = menu_bar_items_index; - for (i = 0; i < end; i += 4) + for (int i = 0; i < end; i += 4) if (EQ (XCAR (tail), AREF (menu_bar_items_vector, i))) { Lisp_Object tem0, tem1, tem2, tem3; @@ -7726,10 +7716,12 @@ parse_menu_item (Lisp_Object item, int inmenubar) item = XCDR (item); /* Parse properties. */ - while (CONSP (item) && CONSP (XCDR (item))) + FOR_EACH_TAIL (item) { tem = XCAR (item); item = XCDR (item); + if (!CONSP (item)) + break; if (EQ (tem, QCenable)) { @@ -7780,7 +7772,6 @@ parse_menu_item (Lisp_Object item, int inmenubar) ASET (item_properties, ITEM_PROPERTY_TYPE, type); } } - item = XCDR (item); } } else if (inmenubar || !NILP (start)) @@ -8198,12 +8189,13 @@ parse_tab_bar_item (Lisp_Object key, Lisp_Object item) item = XCDR (item); /* Process the rest of the properties. */ - for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) + FOR_EACH_TAIL (item) { - Lisp_Object ikey, value; - - ikey = XCAR (item); - value = XCAR (XCDR (item)); + Lisp_Object ikey = XCAR (item); + item = XCDR (item); + if (!CONSP (item)) + break; + Lisp_Object value = XCAR (item); if (EQ (ikey, QCenable)) { @@ -8590,12 +8582,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) item = XCDR (item); /* Process the rest of the properties. */ - for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) + FOR_EACH_TAIL (item) { - Lisp_Object ikey, value; - - ikey = XCAR (item); - value = XCAR (XCDR (item)); + Lisp_Object ikey = XCAR (item); + item = XCDR (item); + if (!CONSP (item)) + break; + Lisp_Object value = XCAR (item); if (EQ (ikey, QCenable)) { commit 40ae02ff50a8f05660a7f9f234320875b6358c9d Author: Paul Eggert Date: Wed Oct 30 14:17:40 2019 -0700 Fix fileio.c infloops on circular lists Fix infinite loops in fileio.c when a circular list is the value of after_insert_file_functions, buffer-auto-save-file-format, buffer-file-format, or write-region-annotate-functions. * src/fileio.c (Finsert_file_contents, build_annotations): Use FOR_EACH_TAIL to avoid infloop on circular lists. (build_annotations): Use an EMACS_INT, not an int, to count nesting level. * test/src/fileio-tests.el: (fileio-tests--circular-after-insert-file-functions): New test. diff --git a/src/fileio.c b/src/fileio.c index f1860e8a93..a3121a26da 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4742,7 +4742,7 @@ by calling `format-decode', which see. */) /* For consistency with format-decode call these now iff inserted > 0 (martin 2007-06-28). */ p = Vafter_insert_file_functions; - while (CONSP (p)) + FOR_EACH_TAIL (p) { if (NILP (replace)) { @@ -4782,9 +4782,6 @@ by calling `format-decode', which see. */) inserted = XFIXNAT (insval); } } - - maybe_quit (); - p = XCDR (p); } if (!empty_undo_list_p) @@ -5375,14 +5372,14 @@ build_annotations (Lisp_Object start, Lisp_Object end) Lisp_Object annotations; Lisp_Object p, res; Lisp_Object original_buffer; - int i; bool used_global = false; XSETBUFFER (original_buffer, current_buffer); annotations = Qnil; p = Vwrite_region_annotate_functions; - while (CONSP (p)) + loop_over_p: + FOR_EACH_TAIL (p) { struct buffer *given_buffer = current_buffer; if (EQ (Qt, XCAR (p)) && !used_global) @@ -5391,7 +5388,7 @@ build_annotations (Lisp_Object start, Lisp_Object end) p = CALLN (Fappend, Fdefault_value (Qwrite_region_annotate_functions), XCDR (p)); - continue; + goto loop_over_p; } Vwrite_region_annotations_so_far = annotations; res = call2 (XCAR (p), start, end); @@ -5411,7 +5408,6 @@ build_annotations (Lisp_Object start, Lisp_Object end) } Flength (res); /* Check basic validity of return value */ annotations = merge (annotations, res, Qcar_less_than_car); - p = XCDR (p); } /* Now do the same for annotation functions implied by the file-format */ @@ -5419,7 +5415,8 @@ build_annotations (Lisp_Object start, Lisp_Object end) p = BVAR (current_buffer, auto_save_file_format); else p = BVAR (current_buffer, file_format); - for (i = 0; CONSP (p); p = XCDR (p), ++i) + EMACS_INT i = 0; + FOR_EACH_TAIL (p) { struct buffer *given_buffer = current_buffer; @@ -5429,7 +5426,7 @@ build_annotations (Lisp_Object start, Lisp_Object end) has written annotations to a temporary buffer, which is now current. */ res = call5 (Qformat_annotate_function, XCAR (p), start, end, - original_buffer, make_fixnum (i)); + original_buffer, make_fixnum (i++)); if (current_buffer != given_buffer) { XSETFASTINT (start, BEGV); diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 98d3d6be76..2225897af8 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -147,3 +147,12 @@ Also check that an encoding error can appear in a symlink." (should (file-name-absolute-p (concat "~" user-login-name suffix)))) (unless (user-full-name "nosuchuser") (should (not (file-name-absolute-p (concat "~nosuchuser" suffix))))))) + +(ert-deftest fileio-tests--circular-after-insert-file-functions () + "Test after-insert-file-functions as a circular list." + (let ((f (make-temp-file "fileio")) + (after-insert-file-functions (list 'identity))) + (setcdr after-insert-file-functions after-insert-file-functions) + (write-region "hello\n" nil f nil 'silent) + (should-error (insert-file-contents f) :type 'circular-list) + (delete-file f))) commit 94b8153eaa78e376e6ed8c2b04602edf3dadc007 Author: Kevin Ryde Date: Wed Oct 30 22:32:45 2019 +0100 Support \pagebreak[0] for paragraph-separate in latex-mode * textmodes/tex-mode.el (latex-mode): In 'paragraph-separate' allow optional argument ('[0]', etc.) for '\pagebreak[0]'. (Bug#19039) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 3d7cc62e26..9b92a2fc60 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -1139,6 +1139,7 @@ subshell is initiated, `tex-shell-hook' is run." ;; A line containing just $$ is treated as a paragraph separator. ;; A line starting with $$ starts a paragraph, ;; but does not separate paragraphs if it has more stuff on it. + ;; For \pagebreak allow latex optional arg like \pagebreak[2] (setq paragraph-start (concat "[ \t]*\\(\\$\\$\\|" "\\\\[][]\\|" @@ -1162,7 +1163,7 @@ subshell is initiated, `tex-shell-hook' is run." "noindent" "newpage" "footnote" "marginpar" "parbox" "caption")) "\\|\\$\\$\\|[a-z]*\\(space\\|skip\\|page[a-z]*\\)" - "\\>\\)[ \t]*\\($\\|%\\)\\)")) + "\\>\\)[][0-9 \t]*\\($\\|%\\)\\)")) (setq-local imenu-create-index-function #'latex-imenu-create-index) (setq-local tex-face-alist tex-latex-face-alist) (add-hook 'fill-nobreak-predicate #'latex-fill-nobreak-predicate nil t) commit 772f1c4189361c136a921201f40d2350ee3dcae4 Author: Tom Tromey Date: Wed Oct 30 22:25:23 2019 +0100 Send -enable-frame-filters to gdb * lisp/progmodes/gdb-mi.el (gdb-init-1): Send -enable-frame-filters to gdb. diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 60852e4ad6..40263205e7 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -955,6 +955,7 @@ detailed description of this mode. (gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler)) (gdb-input "-enable-pretty-printing" 'ignore) + (gdb-input "-enable-frame-filters" 'ignore) ;; Find source file and compilation directory here. (if gdb-create-source-file-list commit f9ffb81fb82bba25cb464f05ca971acc0f86da53 Author: Lars Ingebrigtsen Date: Wed Oct 30 22:06:18 2019 +0100 Fix previous sh-script.el font-lock #comment change * lisp/progmodes/sh-script.el (sh-syntax-propertize-function): We want to match "\ " before a comment; not a space character. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 62e4e5c49e..b2f896ecab 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1141,7 +1141,7 @@ subshells can nest." ;; metacharacters. The list of special chars is taken from ;; the single-unix spec of the shell command language (under ;; `quoting') but with `$' removed. - ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\ \\)\\(#+\\)" (1 "_")) + ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\\\ \\)\\(#+\\)" (1 "_")) ;; In addition, `#' at the beginning of closed parentheses ;; does not start a comment if the parentheses are not isolated ;; by metacharacters, excluding [()]. commit 77d4491391be50bb88c3b45a2dda30a0a3addd2b Author: Lars Ingebrigtsen Date: Wed Oct 30 21:26:22 2019 +0100 Revert "Move description of value to syntax-ppss function." This reverts commit 305dbc7e2be05748039aacb1a3d697f6f64bed4c. Both of the functions in question are used a lot in the sources, so move it back to the more basic function. diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 9dde325923..16a76da518 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -510,26 +510,6 @@ run from `point-min' to POS except that values at positions 2 and 6 in the returned list (counting from 0) cannot be relied upon. Point is at POS when this function returns. -Value is a list of elements describing final state of parsing: - 0. depth in parens. - 1. character address of start of innermost containing list; nil if none. - 2. character address of start of last complete sexp terminated. - 3. non-nil if inside a string. - (it is the character that will terminate the string, - or t if the string should be terminated by a generic string delimiter.) - 4. nil if outside a comment, t if inside a non-nestable comment, - else an integer (the current comment nesting). - 5. t if following a quote character. - 6. the minimum paren-depth encountered during this scan. - 7. style of comment, if any. - 8. character address of start of comment or string; nil if not in one. - 9. List of positions of currently open parens, outermost first. -10. When the last position scanned holds the first character of a - (potential) two character construct, the syntax of that position, - otherwise nil. That construct can be a two character comment - delimiter or an Escaped or Char-quoted character. -11..... Possible further internal information used by ‘parse-partial-sexp’. - It is necessary to call `syntax-ppss-flush-cache' explicitly if this function is called while `before-change-functions' is temporarily let-bound, or if the buffer is modified without diff --git a/src/syntax.c b/src/syntax.c index 850921353d..edfdae2259 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3530,7 +3530,25 @@ Parsing stops at TO or when certain criteria are met; If fifth arg OLDSTATE is omitted or nil, parsing assumes that FROM is the beginning of a function. -See `syntax-ppss' for a description of the return value. +Value is a list of elements describing final state of parsing: + 0. depth in parens. + 1. character address of start of innermost containing list; nil if none. + 2. character address of start of last complete sexp terminated. + 3. non-nil if inside a string. + (it is the character that will terminate the string, + or t if the string should be terminated by a generic string delimiter.) + 4. nil if outside a comment, t if inside a non-nestable comment, + else an integer (the current comment nesting). + 5. t if following a quote character. + 6. the minimum paren-depth encountered during this scan. + 7. style of comment, if any. + 8. character address of start of comment or string; nil if not in one. + 9. List of positions of currently open parens, outermost first. +10. When the last position scanned holds the first character of a + (potential) two character construct, the syntax of that position, + otherwise nil. That construct can be a two character comment + delimiter or an Escaped or Char-quoted character. +11..... Possible further internal information used by `parse-partial-sexp'. If third arg TARGETDEPTH is non-nil, parsing stops if the depth in parentheses becomes equal to TARGETDEPTH. commit f7673c147c8c31564dcc19eda12d9c759acee93e Author: Lars Ingebrigtsen Date: Wed Oct 30 21:25:23 2019 +0100 Add a new ppss structure for syntax-ppss data * lisp/emacs-lisp/syntax.el (ppss): Add a new structure to provide accessors to the syntax-ppss data. diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 913e34d513..9dde325923 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -85,6 +85,40 @@ Put first the functions more likely to cause a change and cheaper to compute.") ;; (i.e. doesn't obey the element t in the buffer-local value). (make-variable-buffer-local 'syntax-propertize-extend-region-functions) +(cl-defstruct (ppss + (:constructor make-ppss) + (:copier nil) + (:type list)) + (depth nil :documentation "depth in parens") + (innermost-start + nil :documentation + "character address of start of innermost containing list; nil if none.") + (last-complete-sexp-start + nil :documentation + "character address of start of last complete sexp terminated.") + (string-terminator nil :documentation "\ +non-nil if inside a string. +(it is the character that will terminate the string, or t if the +string should be terminated by a generic string delimiter.)") + (comment-nesting nil :documentation "\ +nil if outside a comment, t if inside a non-nestable comment, +else an integer (the current comment nesting).") + (after-quote-p nil :documentation "t if following a quote character.") + (minimum-paren-depth + nil :documentation "the minimum paren-depth encountered during this scan.") + (comment-style nil :documentation "style of comment, if any.") + (comment-or-string-start + nil :documentation + "character address of start of comment or string; nil if not in one.") + (open-paren-positions + nil :documentation + "List of positions of currently open parens, outermost first.") + (two-character-syntax nil :documentation "\ +When the last position scanned holds the first character of a +(potential) two character construct, the syntax of that position, +otherwise nil. That construct can be a two character comment +delimiter or an Escaped or Char-quoted character.")) + (defun syntax-propertize-wholelines (start end) (goto-char start) (cons (line-beginning-position) commit b21ea56edc38112f5ae71d67f335a93b4cc8e3e9 Author: Lars Ingebrigtsen Date: Wed Oct 30 21:06:47 2019 +0100 Tweak fontification of \url{http://foo.org/bar%zot} in (la)tex-mode * lisp/textmodes/tex-mode.el (tex-font-lock-keywords-1): \url{http://foo.org/bar%zot} shouldn't be fontified as having a comment, so make the tex-verbatim face overwrite the already-applied syntactical comment bits (bug#37134). diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index f277defecf..3d7cc62e26 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -546,7 +546,7 @@ An alternative value is \" . \", if you use a font with a narrow period." ;; Include args. (,(concat slash includes opt arg) 3 font-lock-builtin-face) ;; Verbatim-like args. - (,(concat slash verbish opt arg) 3 'tex-verbatim) + (,(concat slash verbish opt arg) 3 'tex-verbatim t) ;; Definitions. I think. ("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)" 1 font-lock-function-name-face)))) commit 4650aa3523068b83c3d9e6276fe89eb3955ca1e3 Author: Lars Ingebrigtsen Date: Wed Oct 30 20:54:44 2019 +0100 Bind vc-git-stash to a key * lisp/vc/vc-git.el (vc-git-stash-map): Give `vc-git-stash' a keystroke, because it's a useful command. When there are no stashes, there's no way to use that keystroke (since it's only bound on the stash lines), so perhaps that should also be fixed somehow. diff --git a/etc/NEWS b/etc/NEWS index 3df50154e3..cd1e46bb87 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -876,6 +876,9 @@ This new user option allows customizing the default arguments passed to When some files are marked, only those are stashed. When no files are marked, all modified files are stashed, as before. +*** 'vc-git-stash' has now been bound to the 'C' keystroke in the +stash headers. + *** The new hook 'vc-retrieve-tag-hook' runs after retrieving a tag. --- diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ce8e57df76..e0b3b09462 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -648,6 +648,7 @@ or an empty string if none." (define-key map "A" 'vc-git-stash-apply-at-point) (define-key map "P" 'vc-git-stash-pop-at-point) (define-key map "S" 'vc-git-stash-snapshot) + (define-key map "C" 'vc-git-stash) map)) (defun vc-git--make-button-text (show count1 count2) @@ -1596,7 +1597,7 @@ This command shares argument histories with \\[rgrep] and \\[grep]." (autoload 'vc-dir-marked-files "vc-dir") (defun vc-git-stash (name) - "Create a stash." + "Create a stash given the name NAME." (interactive "sStash name: ") (let ((root (vc-git-root default-directory))) (when root commit f8134d2753e4abb7a12d87af731d2ad213bb5bd1 Author: Lars Ingebrigtsen Date: Wed Oct 30 15:39:44 2019 +0100 Clear more data in font-lock-refontify to ensure refontifying * lisp/font-lock.el (font-lock-refontify): Clear out even more data. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 2c91586c99..ef0e2dc045 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1106,7 +1106,8 @@ This functions is a convenience functions when developing font locking for a mode, and is not meant to be called from lisp functions." (interactive) (declare (interactive-only t)) - (setq font-lock-major-mode nil) + (setq font-lock-major-mode nil + syntax-propertize--done -1) (font-lock-set-defaults) (save-excursion (font-lock-fontify-region (point-min) (point-max)))) commit b996117fe5d561d86665c23f7012871e345a6e77 Author: Lars Ingebrigtsen Date: Wed Oct 30 15:39:15 2019 +0100 font-lock \ #foo in shell mode more correctly * lisp/progmodes/sh-script.el (sh-syntax-propertize-function): \ #foo isn't a comment -- it's a symbol that starts with a space character (bug#17538). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8177329f32..62e4e5c49e 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1141,7 +1141,7 @@ subshells can nest." ;; metacharacters. The list of special chars is taken from ;; the single-unix spec of the shell command language (under ;; `quoting') but with `$' removed. - ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\)\\(#+\\)" (1 "_")) + ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\ \\)\\(#+\\)" (1 "_")) ;; In addition, `#' at the beginning of closed parentheses ;; does not start a comment if the parentheses are not isolated ;; by metacharacters, excluding [()]. commit 9df254119c4de577f273cf1ec1a5892a3509da20 Author: Lars Ingebrigtsen Date: Wed Oct 30 15:04:17 2019 +0100 Make font-lock-refontify try even harder to refontify * lisp/font-lock.el (font-lock-refontify): Make this command work even after switching global font lock mode on and then off again. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 971e37309e..2c91586c99 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1107,7 +1107,9 @@ locking for a mode, and is not meant to be called from lisp functions." (interactive) (declare (interactive-only t)) (setq font-lock-major-mode nil) - (font-lock-ensure)) + (font-lock-set-defaults) + (save-excursion + (font-lock-fontify-region (point-min) (point-max)))) (defun font-lock-ensure (&optional beg end) "Make sure the region BEG...END has been fontified. commit 1fc8bf71d99bf966111cfccabef8e8e1cb0321f2 Author: Lars Ingebrigtsen Date: Wed Oct 30 13:30:47 2019 +0100 Fix setgid fontification in dired on some OS-es * lisp/dired.el (dired-font-lock-keywords): Apparently some versions of ls use "S" for setgid and other use "s" (bug#8186). diff --git a/lisp/dired.el b/lisp/dired.el index e50108fdb9..d1ec3f36b1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -510,7 +510,7 @@ Subexpression 2 must end right before the \\n.") "[-d]..\\(s\\)......") ; suid '(1 'dired-set-id)) (list (concat dired-re-maybe-mark dired-re-inode-size - "[-d].....\\(S\\)...") ; guid + "[-d].....\\([sS]\\)...") ; guid '(1 'dired-set-id)) ;; ;; Subdirectories. commit 66efb2f3a636868ada730c2f472f070a51f3c6b2 Author: Lars Ingebrigtsen Date: Wed Oct 30 13:16:07 2019 +0100 Fix "dnl" highlights in m4-mode * lisp/progmodes/m4-mode.el (m4-font-lock-keywords): "dnl" comments should override any previous syntax-based highlighting (37132). This makes "dnl foo#bar" be highlighted correctly. diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el index 98b812f52f..15461a9ac9 100644 --- a/lisp/progmodes/m4-mode.el +++ b/lisp/progmodes/m4-mode.el @@ -63,7 +63,7 @@ If m4 is not in your PATH, set this to an absolute file name." ;;(defconst m4-program-options '("--prefix-builtins")) (defvar m4-font-lock-keywords - '(("\\(\\_<\\(m4_\\)?dnl\\_>\\).*$" . font-lock-comment-face) + '(("\\(\\_<\\(m4_\\)?dnl\\_>\\).*$" (0 font-lock-comment-face t)) ("\\$[*#@0-9]" . font-lock-variable-name-face) ("\\$@" . font-lock-variable-name-face) ("\\$\\*" . font-lock-variable-name-face) commit e1409379f7ce60eb845a0b9c3a614af4f5fac694 Author: Lars Ingebrigtsen Date: Wed Oct 30 13:08:55 2019 +0100 Add a convenience function to be used when working on font locking * doc/lispref/modes.texi (Font Lock Basics): Document it. * lisp/font-lock.el (font-lock-refontify): New convenience command. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 2e0c9e4655..fda5a106bb 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -2737,6 +2737,12 @@ This function should make sure the region between @var{beg} and @var{end} default to the beginning and the end of the buffer's accessible portion. Calls the function specified by @code{font-lock-ensure-function}. + +@item font-lock-refontify +This is a convenience command meant to be used when developing font +locking for a mode, and should not be called from Lisp code. It +recomputes all the relevant variables and then calls +@code{font-lock-ensure} on the entire buffer. @end ftable There are several variables that control how Font Lock mode highlights diff --git a/etc/NEWS b/etc/NEWS index daf9e0e1f0..3df50154e3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -575,6 +575,12 @@ current and the previous or the next line, as before. * Changes in Specialized Modes and Packages in Emacs 27.1 ++++ +** New command 'font-lock-refontify'. +This is an interactive convenience function to be used when developing +font locking for a mode. It recomputes the font locking data and then +re-fontifies the buffer. + --- ** The 'C' command in 'tar-mode' will now preserve the timestamp of the extracted file if the new user option 'tar-copy-preserve-time' is diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 9ae082736c..971e37309e 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1100,6 +1100,15 @@ accessible portion of the current buffer." "Function to make sure a region has been fontified. Called with two arguments BEG and END.") +(defun font-lock-refontify () + "Reinitialise the font-lock machinery and re-fontify the buffer. +This functions is a convenience functions when developing font +locking for a mode, and is not meant to be called from lisp functions." + (interactive) + (declare (interactive-only t)) + (setq font-lock-major-mode nil) + (font-lock-ensure)) + (defun font-lock-ensure (&optional beg end) "Make sure the region BEG...END has been fontified. If the region is not specified, it defaults to the entire accessible commit 305dbc7e2be05748039aacb1a3d697f6f64bed4c Author: Lars Ingebrigtsen Date: Wed Oct 30 12:39:14 2019 +0100 Move description of value to syntax-ppss function. * lisp/emacs-lisp/syntax.el (syntax-ppss): Move the description of the return value from... * src/syntax.c (Fparse_partial_sexp): ... here because `syntax-ppss' is what's called over the place, and jumping through an indirection to get to the value description is inconvenient. diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 3861b160cc..913e34d513 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -476,6 +476,26 @@ run from `point-min' to POS except that values at positions 2 and 6 in the returned list (counting from 0) cannot be relied upon. Point is at POS when this function returns. +Value is a list of elements describing final state of parsing: + 0. depth in parens. + 1. character address of start of innermost containing list; nil if none. + 2. character address of start of last complete sexp terminated. + 3. non-nil if inside a string. + (it is the character that will terminate the string, + or t if the string should be terminated by a generic string delimiter.) + 4. nil if outside a comment, t if inside a non-nestable comment, + else an integer (the current comment nesting). + 5. t if following a quote character. + 6. the minimum paren-depth encountered during this scan. + 7. style of comment, if any. + 8. character address of start of comment or string; nil if not in one. + 9. List of positions of currently open parens, outermost first. +10. When the last position scanned holds the first character of a + (potential) two character construct, the syntax of that position, + otherwise nil. That construct can be a two character comment + delimiter or an Escaped or Char-quoted character. +11..... Possible further internal information used by ‘parse-partial-sexp’. + It is necessary to call `syntax-ppss-flush-cache' explicitly if this function is called while `before-change-functions' is temporarily let-bound, or if the buffer is modified without diff --git a/src/syntax.c b/src/syntax.c index edfdae2259..850921353d 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3530,25 +3530,7 @@ Parsing stops at TO or when certain criteria are met; If fifth arg OLDSTATE is omitted or nil, parsing assumes that FROM is the beginning of a function. -Value is a list of elements describing final state of parsing: - 0. depth in parens. - 1. character address of start of innermost containing list; nil if none. - 2. character address of start of last complete sexp terminated. - 3. non-nil if inside a string. - (it is the character that will terminate the string, - or t if the string should be terminated by a generic string delimiter.) - 4. nil if outside a comment, t if inside a non-nestable comment, - else an integer (the current comment nesting). - 5. t if following a quote character. - 6. the minimum paren-depth encountered during this scan. - 7. style of comment, if any. - 8. character address of start of comment or string; nil if not in one. - 9. List of positions of currently open parens, outermost first. -10. When the last position scanned holds the first character of a - (potential) two character construct, the syntax of that position, - otherwise nil. That construct can be a two character comment - delimiter or an Escaped or Char-quoted character. -11..... Possible further internal information used by `parse-partial-sexp'. +See `syntax-ppss' for a description of the return value. If third arg TARGETDEPTH is non-nil, parsing stops if the depth in parentheses becomes equal to TARGETDEPTH. commit 40c787ff4e9162d6f1a9a0abac3c83f1d0389810 Author: Lars Ingebrigtsen Date: Wed Oct 30 12:32:20 2019 +0100 Indent font-lock-fontify-syntactically-region * lisp/font-lock.el (font-lock-fontify-syntactically-region): Indent function. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3991a4ee8e..9ae082736c 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1590,41 +1590,41 @@ START should be at the beginning of a line." START should be at the beginning of a line." (syntax-propertize end) ; Apply any needed syntax-table properties. (with-syntax-table (or syntax-ppss-table (syntax-table)) - (let ((comment-end-regexp - (or font-lock-comment-end-skip - (regexp-quote - (replace-regexp-in-string "^ *" "" comment-end)))) - ;; Find the `start' state. - (state (syntax-ppss start)) - face beg) - (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) - ;; - ;; Find each interesting place between here and `end'. - (while - (progn - (when (or (nth 3 state) (nth 4 state)) - (setq face (funcall font-lock-syntactic-face-function state)) - (setq beg (max (nth 8 state) start)) - (setq state (parse-partial-sexp (point) end nil nil state - 'syntax-table)) - (when face (put-text-property beg (point) 'face face)) - (when (and (eq face 'font-lock-comment-face) - (or font-lock-comment-start-skip - comment-start-skip)) - ;; Find the comment delimiters - ;; and use font-lock-comment-delimiter-face for them. - (save-excursion - (goto-char beg) - (if (looking-at (or font-lock-comment-start-skip - comment-start-skip)) - (put-text-property beg (match-end 0) 'face - font-lock-comment-delimiter-face))) - (if (looking-back comment-end-regexp (point-at-bol) t) - (put-text-property (match-beginning 0) (point) 'face - font-lock-comment-delimiter-face)))) - (< (point) end)) - (setq state (parse-partial-sexp (point) end nil nil state - 'syntax-table)))))) + (let ((comment-end-regexp + (or font-lock-comment-end-skip + (regexp-quote + (replace-regexp-in-string "^ *" "" comment-end)))) + ;; Find the `start' state. + (state (syntax-ppss start)) + face beg) + (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) + ;; + ;; Find each interesting place between here and `end'. + (while + (progn + (when (or (nth 3 state) (nth 4 state)) + (setq face (funcall font-lock-syntactic-face-function state)) + (setq beg (max (nth 8 state) start)) + (setq state (parse-partial-sexp (point) end nil nil state + 'syntax-table)) + (when face (put-text-property beg (point) 'face face)) + (when (and (eq face 'font-lock-comment-face) + (or font-lock-comment-start-skip + comment-start-skip)) + ;; Find the comment delimiters + ;; and use font-lock-comment-delimiter-face for them. + (save-excursion + (goto-char beg) + (if (looking-at (or font-lock-comment-start-skip + comment-start-skip)) + (put-text-property beg (match-end 0) 'face + font-lock-comment-delimiter-face))) + (if (looking-back comment-end-regexp (point-at-bol) t) + (put-text-property (match-beginning 0) (point) 'face + font-lock-comment-delimiter-face)))) + (< (point) end)) + (setq state (parse-partial-sexp (point) end nil nil state + 'syntax-table)))))) ;;; End of Syntactic fontification functions. commit fc05708248e1af96d638debc08879008efaca1af Author: Michael Albinus Date: Wed Oct 30 09:44:24 2019 +0100 * lisp/net/tramp.el (outline-regexp): Remove declaration. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0dfde734f1..adcc2a336f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -64,7 +64,6 @@ (require 'cl-lib) (declare-function netrc-parse "netrc") (defvar auto-save-file-name-transforms) -(defvar outline-regexp) ;;; User Customizable Internal Variables: commit 9e10ee754c8ffbe715879b7bba37a4523c8ee59d Author: Juri Linkov Date: Wed Oct 30 02:08:55 2019 +0200 * etc/NEWS: Update renamed function read-char-from-minibuffer. diff --git a/etc/NEWS b/etc/NEWS index 5e412f2b55..daf9e0e1f0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -476,7 +476,7 @@ bind it. +++ ** 'zap-to-char' now uses history of characters you used to zap to. -'zap-to-char' uses the new 'read-char-with-history' function to allow +'zap-to-char' uses the new 'read-char-from-minibuffer' function to allow navigating through the history of characters that have been input. This is mostly useful for characters that have complex input methods where inputting the character again may involve many keystrokes. @@ -2480,9 +2480,10 @@ This macro works like 'progn', but messages how long it takes to evaluate the body forms. The value of the last form is the return value. -** New function 'read-char-with-history'. -This function works like 'read-char', but maintains a history that can -be navigated via the 'M-p'/'M-n' keystrokes. +** New function 'read-char-from-minibuffer'. +This function works like 'read-char', but uses 'read-from-minibuffer' +to read a character, so it maintains a history that can be navigated +via usual minibuffer keystrokes 'M-p'/'M-n'. ** 'setq-local' can now set an arbitrary number of variables, which makes the syntax more like 'setq'. commit 7ce00e9a8bf9dc3793348d2c6f4762e90f45c11b Author: Lars Ingebrigtsen Date: Wed Oct 30 01:02:43 2019 +0100 Fix image-converter probes * lisp/image/image-converter.el (image-converter--probe): Check that the executable exists before trying to call it. diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index f046529fd5..2e09976c01 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -100,9 +100,10 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) - (when (zerop (apply #'call-process (car command) nil '(t nil) nil - (append (cdr command) - (image-converter--value type :probe)))) + (when (and (executable-find (car command)) + (zerop (apply #'call-process (car command) nil '(t nil) nil + (append (cdr command) + (image-converter--value type :probe))))) (goto-char (point-min)) (when (re-search-forward "^-" nil t) (forward-line 1) @@ -119,8 +120,9 @@ where created with DATA-P nil (i.e., it has to refer to a file)." formats) ;; Can't check return value; ImageMagick convert usually returns ;; a non-zero result on "-list format". - (apply #'call-process (car command) nil '(t nil) nil - (append (cdr command) (image-converter--value type :probe))) + (when (executable-find (car command)) + (apply #'call-process (car command) nil '(t nil) nil + (append (cdr command) (image-converter--value type :probe)))) (goto-char (point-min)) (when (re-search-forward "^-" nil t) (forward-line 1) @@ -135,9 +137,10 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (with-temp-buffer (let ((command (image-converter--value type :command)) formats) - (when (zerop (apply #'call-process (car command) nil '(t nil) nil - (append (cdr command) - (image-converter--value type :probe)))) + (when (and (executable-find (car command)) + (zerop (apply #'call-process (car command) nil '(t nil) nil + (append (cdr command) + (image-converter--value type :probe))))) (goto-char (point-min)) (when (re-search-forward "^ *-" nil t) (forward-line 1) commit ba7755bfb78884fd57e2506bcaebb51b5ff1ba1b Author: Juri Linkov Date: Wed Oct 30 02:00:02 2019 +0200 Rename read-char-with-history to read-char-from-minibuffer (bug#10477) * lisp/simple.el (read-char-from-minibuffer-history): Rename from read-char-with-history--history. (read-char-from-minibuffer-map): Rename from read-char-with-history--map. (read-char-from-minibuffer): Rename from read-char-with-history. (read-char-from-minibuffer-self-insert): New command. (zap-to-char): Use read-char-from-minibuffer. diff --git a/lisp/simple.el b/lisp/simple.el index 5b84c3ea57..29e195bca6 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5166,36 +5166,38 @@ and KILLP is t if a prefix arg was specified." ;; Avoid warning about delete-backward-char (with-no-warnings (delete-backward-char n killp)))) -(defvar read-char-with-history--history nil - "The default history for the `read-char-with-history' function.") +(defvar read-char-from-minibuffer-history nil + "The default history for the `read-char-from-minibuffer' function.") -(defvar read-char-with-history--map +(defvar read-char-from-minibuffer-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) (define-key map [remap self-insert-command] - (lambda () - (interactive) - (delete-minibuffer-contents) - (insert (event-basic-type last-command-event)) - (exit-minibuffer))) + 'read-char-from-minibuffer-self-insert) map) - "Keymap for the `read-char-with-history' function.") - -(defun read-char-with-history (prompt) - "Like `read-char', but allows navigating in a history. -HISTORY is like HIST in `read-from-minibuffer'. + "Keymap for the `read-char-from-minibuffer' function.") -The navigation commands are `M-p' and `M-n', with `RET' to select -a character from history." +(defun read-char-from-minibuffer-self-insert () + "Insert the character you type in the minibuffer." + (interactive) + (delete-minibuffer-contents) + (insert (event-basic-type last-command-event)) + (exit-minibuffer)) + +(defun read-char-from-minibuffer (prompt) + "Read a character from the minibuffer, prompting with string PROMPT. +Like `read-char', but allows navigating in a history. The navigation +commands are `M-p' and `M-n', with `RET' to select a character from +history." (let ((result (read-from-minibuffer prompt nil - read-char-with-history--map nil - 'read-char-with-history--history))) + read-char-from-minibuffer-map nil + 'read-char-from-minibuffer-history))) (if (> (length result) 0) ;; We have a string (with one character), so return the first one. (elt result 0) ;; The default value is RET. - (push "\r" read-char-with-history--history) + (push "\r" read-char-from-minibuffer-history) ?\r))) (defun zap-to-char (arg char) @@ -5203,7 +5205,7 @@ a character from history." Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found." (interactive (list (prefix-numeric-value current-prefix-arg) - (read-char-with-history "Zap to char: "))) + (read-char-from-minibuffer "Zap to char: "))) ;; Avoid "obsolete" warnings for translation-table-for-input. (with-no-warnings (if (char-table-p translation-table-for-input) commit 682eae776efa9d57842345de67becf5c56cafc91 Author: Lars Ingebrigtsen Date: Wed Oct 30 00:17:57 2019 +0100 Make the debbugs groups also include robot messages * lisp/gnus/gnus-group.el (gnus-bug-group-download-format-alist): Change the URL to also include robot messages. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 742f8f4be5..8f5f5d66e4 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2390,7 +2390,7 @@ Valid input formats include: (gnus-read-ephemeral-gmane-group group start range))) (defcustom gnus-bug-group-download-format-alist - '((emacs . "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=%s;mboxmaint=yes;mboxstat=yes") + '((emacs . "https://debbugs.gnu.org/cgi/bugreport.cgi?mboxstat=yes;bug=%s") (debian . "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s&mbox=yes;mboxmaint=yes")) "Alist of symbols for bug trackers and the corresponding URL format string. commit bafcef87c33e3e549bd76852aec6e5073c4ad388 Author: Juri Linkov Date: Wed Oct 30 00:01:11 2019 +0100 Reimplement read-char-with-history based on read-from-minibuffer * lisp/simple.el (read-char-with-history): Reimplement based on read-from-minibuffer. * lisp/simple.el (read-char-with-history--map): New variable (bug#10477). diff --git a/lisp/simple.el b/lisp/simple.el index fca90690a5..5b84c3ea57 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5167,83 +5167,43 @@ and KILLP is t if a prefix arg was specified." (with-no-warnings (delete-backward-char n killp)))) (defvar read-char-with-history--history nil - "The default history for `read-char-with-history'.") + "The default history for the `read-char-with-history' function.") -(defun read-char-with-history (prompt &optional inherit-input-method seconds - history) +(defvar read-char-with-history--map + (let ((map (make-sparse-keymap))) + (set-keymap-parent map minibuffer-local-map) + (define-key map [remap self-insert-command] + (lambda () + (interactive) + (delete-minibuffer-contents) + (insert (event-basic-type last-command-event)) + (exit-minibuffer))) + map) + "Keymap for the `read-char-with-history' function.") + +(defun read-char-with-history (prompt) "Like `read-char', but allows navigating in a history. HISTORY is like HIST in `read-from-minibuffer'. The navigation commands are `M-p' and `M-n', with `RET' to select a character from history." - (let* ((result nil) - (real-prompt prompt) - (hist-format - (lambda (char) - (if (string-match ": *\\'" real-prompt) - (format "%s (default %c): " - (substring real-prompt 0 (match-beginning 0)) - char) - (format "%s (default %c) " real-prompt char)))) - (index 0) - histvar) - ;; Use the same history interface as `read-from-minibuffer'. - (cond - ((null history) - (setq histvar 'read-char-with-history--history)) - ((consp history) - (setq histvar (car history) - index (cdr history))) - ((symbolp history) - (setq histvar history)) - (t - (error "Invalid history: %s" history))) - (while (not result) - (setq result (read-event prompt inherit-input-method seconds)) - ;; Go back in history. - (cond - ((memq result '(?\M-p up)) - (if (>= index (length (symbol-value histvar))) - (progn - (message "Beginning of history; no preceding item") - (ding) - (sit-for 2)) - (setq index (1+ index) - prompt (funcall hist-format - (elt (symbol-value histvar) (1- index))))) - (setq result nil)) - ;; Go forward in history. - ((memq result '(?\M-n down)) - (if (zerop index) - (progn - (message "End of history; no next item") - (ding) - (sit-for 2)) - (setq index (1- index) - prompt (if (zerop index) - real-prompt - (funcall hist-format - (elt (symbol-value histvar) (1- index)))))) - (setq result nil)) - ;; The user hits RET to either select a history item or to - ;; return RET. - ((eq result 'return) - (if (zerop index) - (setq result ?\r) - (setq result (elt (symbol-value histvar) (1- index))))) - ;; The user has entered some non-character event. - ((not (characterp result)) - (user-error "Non-character input event")))) - ;; Record the chosen key. - (set histvar (cons result (symbol-value histvar))) - result)) + (let ((result + (read-from-minibuffer prompt nil + read-char-with-history--map nil + 'read-char-with-history--history))) + (if (> (length result) 0) + ;; We have a string (with one character), so return the first one. + (elt result 0) + ;; The default value is RET. + (push "\r" read-char-with-history--history) + ?\r))) (defun zap-to-char (arg char) "Kill up to and including ARGth occurrence of CHAR. Case is ignored if `case-fold-search' is non-nil in the current buffer. Goes backward if ARG is negative; error if CHAR not found." (interactive (list (prefix-numeric-value current-prefix-arg) - (read-char-with-history "Zap to char: " t))) + (read-char-with-history "Zap to char: "))) ;; Avoid "obsolete" warnings for translation-table-for-input. (with-no-warnings (if (char-table-p translation-table-for-input) commit d7f62ce0cd58f6275bbf88925f3abbbd1db212a8 Author: Juri Linkov Date: Wed Oct 30 00:31:11 2019 +0200 * lisp/tab-bar.el: Store point position and frame buffer-lists in tab. * lisp/tab-bar.el (tab-bar--tab): Store additionally point-marker, frame parameters buffer-list and buried-buffer-list, both for wc and ws. Use seq-filter. (tab-bar-select-tab): Restore point-marker after restoring window-configuration. Also restore frame parameters buffer-list and buried-buffer-list both for window-configuration and window-state. (tab-bar-history-limit, tab-bar-history--minibuffer-depth): New variables. (tab-bar-history-current): Rename from tab-bar-history--pre-change. (tab-bar-history--pre-change): Set tab-bar-history-current. (tab-bar--history-change): Use seq-take for tab-bar-history-limit. (tab-bar-history-back, tab-bar-history-forward): Restore point-marker. (tab-bar-list-noselect): Use seq-remove. * lisp/emacs-lisp/seq.el (seq-take, seq-filter): Add autoload cookie. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 9a5872c094..810b4792b2 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -223,6 +223,7 @@ If N is a negative integer or zero, SEQUENCE is returned." (let ((length (seq-length sequence))) (seq-subseq sequence (min n length) length)))) +;;;###autoload (cl-defgeneric seq-take (sequence n) "Take the first N elements of SEQUENCE and return the result. The result is a sequence of the same type as SEQUENCE. @@ -306,6 +307,7 @@ list." (`list (seq--into-list sequence)) (_ (error "Not a sequence type name: %S" type)))) +;;;###autoload (cl-defgeneric seq-filter (pred sequence) "Return a list of all the elements for which (PRED element) is non-nil in SEQUENCE." (let ((exclude (make-symbol "exclude"))) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index c4763337a2..c9829e94ff 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -438,7 +438,9 @@ Return its existing value or a new value." (defun tab-bar--tab () (let* ((tab (assq 'current-tab (frame-parameter nil 'tabs))) - (tab-explicit-name (cdr (assq 'explicit-name tab)))) + (tab-explicit-name (cdr (assq 'explicit-name tab))) + (bl (seq-filter #'buffer-live-p (frame-parameter nil 'buffer-list))) + (bbl (seq-filter #'buffer-live-p (frame-parameter nil 'buried-buffer-list)))) `(tab (name . ,(if tab-explicit-name (cdr (assq 'name tab)) @@ -446,10 +448,15 @@ Return its existing value or a new value." (explicit-name . ,tab-explicit-name) (time . ,(time-convert nil 'integer)) (wc . ,(current-window-configuration)) + (wc-point . ,(point-marker)) + (wc-bl . ,bl) + (wc-bbl . ,bbl) + (wc-history-back . ,(gethash (selected-frame) tab-bar-history-back)) + (wc-history-forward . ,(gethash (selected-frame) tab-bar-history-forward)) (ws . ,(window-state-get (frame-root-window (selected-frame)) 'writable)) - (history-back . ,(gethash (selected-frame) tab-bar-history-back)) - (history-forward . ,(gethash (selected-frame) tab-bar-history-forward))))) + (ws-bl . ,(mapcar #'buffer-name bl)) + (ws-bbl . ,(mapcar #'buffer-name bbl))))) (defun tab-bar--current-tab (&optional tab) ;; `tab` here is an argument meaning 'use tab as template'. This is @@ -505,9 +512,7 @@ to the numeric argument. ARG counts from 1." (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) (wc (cdr (assq 'wc to-tab))) - (ws (cdr (assq 'ws to-tab))) - (history-back (cdr (assq 'history-back to-tab))) - (history-forward (cdr (assq 'history-forward to-tab)))) + (ws (cdr (assq 'ws to-tab)))) ;; During the same session, use window-configuration to switch ;; tabs, because window-configurations are more reliable @@ -515,18 +520,54 @@ to the numeric argument. ARG counts from 1." ;; But after restoring tabs from a previously saved session, ;; its value of window-configuration is unreadable, ;; so restore its saved window-state. - (if (window-configuration-p wc) + (cond + ((window-configuration-p wc) + (let ((wc-point (cdr (assq 'wc-point to-tab))) + (wc-bl (seq-filter #'buffer-live-p (cdr (assq 'wc-bl to-tab)))) + (wc-bbl (seq-filter #'buffer-live-p (cdr (assq 'wc-bbl to-tab)))) + (wc-history-back (cdr (assq 'wc-history-back to-tab))) + (wc-history-forward (cdr (assq 'wc-history-forward to-tab)))) + (set-window-configuration wc) - (if ws (window-state-put ws (frame-root-window (selected-frame)) - 'safe))) + + ;; set-window-configuration does not restore the value of + ;; point in the current buffer, so restore it separately. + (when (and (markerp wc-point) + (marker-buffer wc-point) + ;; FIXME: After dired-revert, marker relocates to 1. + ;; window-configuration restores point to global point + ;; in this dired buffer, not to its window point, + ;; but this is slightly better than 1. + (not (eq 1 (marker-position wc-point)))) + (goto-char wc-point)) + + (when wc-bl (modify-frame-parameters + nil (list (cons 'buffer-list wc-bl)))) + (when wc-bbl (modify-frame-parameters + nil (list (cons 'buried-buffer-list wc-bbl)))) + + (puthash (selected-frame) + (and (window-configuration-p (cdr (assq 'wc (car wc-history-back)))) + wc-history-back) + tab-bar-history-back) + (puthash (selected-frame) + (and (window-configuration-p (cdr (assq 'wc (car wc-history-forward)))) + wc-history-forward) + tab-bar-history-forward))) + + (ws + (window-state-put ws (frame-root-window (selected-frame)) 'safe) + + (let ((ws-bl (seq-filter #'buffer-live-p + (mapcar #'get-buffer (cdr (assq 'ws-bl to-tab))))) + (ws-bbl (seq-filter #'buffer-live-p + (mapcar #'get-buffer (cdr (assq 'ws-bbl to-tab)))))) + (when ws-bl (modify-frame-parameters + nil (list (cons 'buffer-list ws-bl)))) + (when ws-bbl (modify-frame-parameters + nil (list (cons 'buried-buffer-list ws-bbl))))))) (setq tab-bar-history-omit t) - (puthash (selected-frame) - (and (window-configuration-p (car history-back)) history-back) - tab-bar-history-back) - (puthash (selected-frame) - (and (window-configuration-p (car history-forward)) history-forward) - tab-bar-history-forward) (when from-index (setf (nth from-index tabs) from-tab)) @@ -861,6 +902,9 @@ function `tab-bar-tab-name-function'." ;;; Tab history mode +(defvar tab-bar-history-limit 3 + "The number of history elements to keep.") + (defvar tab-bar-history-omit nil "When non-nil, omit window-configuration changes from the current command.") @@ -870,52 +914,65 @@ function `tab-bar-tab-name-function'." (defvar tab-bar-history-forward (make-hash-table) "History of forward changes in every tab per frame.") -(defvar tab-bar-history--pre-change nil - "Window configuration and minibuffer depth before the current command.") +(defvar tab-bar-history-current nil + "Window configuration before the current command.") + +(defvar tab-bar-history--minibuffer-depth 0 + "Minibuffer depth before the current command.") (defun tab-bar-history--pre-change () - (setq tab-bar-history--pre-change - (list (current-window-configuration) - (minibuffer-depth)))) + (setq tab-bar-history--minibuffer-depth (minibuffer-depth) + tab-bar-history-current + `((wc . ,(current-window-configuration)) + (wc-point . ,(point-marker))))) (defun tab-bar--history-change () (when (and (not tab-bar-history-omit) - tab-bar-history--pre-change + tab-bar-history-current ;; Entering the minibuffer - (zerop (nth 1 tab-bar-history--pre-change)) + (zerop tab-bar-history--minibuffer-depth) ;; Exiting the minibuffer (zerop (minibuffer-depth))) (puthash (selected-frame) - (cons (nth 0 tab-bar-history--pre-change) - (gethash (selected-frame) tab-bar-history-back)) - tab-bar-history-back)) + (seq-take (cons tab-bar-history-current + (gethash (selected-frame) tab-bar-history-back)) + tab-bar-history-limit) + tab-bar-history-back)) (when tab-bar-history-omit (setq tab-bar-history-omit nil))) (defun tab-bar-history-back () (interactive) (setq tab-bar-history-omit t) - (let ((wc (pop (gethash (selected-frame) tab-bar-history-back)))) + (let* ((history (pop (gethash (selected-frame) tab-bar-history-back))) + (wc (cdr (assq 'wc history))) + (wc-point (cdr (assq 'wc-point history)))) (if (window-configuration-p wc) (progn (puthash (selected-frame) - (cons (current-window-configuration) + (cons tab-bar-history-current (gethash (selected-frame) tab-bar-history-forward)) - tab-bar-history-forward) - (set-window-configuration wc)) + tab-bar-history-forward) + (set-window-configuration wc) + (when (and (markerp wc-point) (marker-buffer wc-point)) + (goto-char wc-point))) (message "No more tab back history")))) (defun tab-bar-history-forward () (interactive) (setq tab-bar-history-omit t) - (let ((wc (pop (gethash (selected-frame) tab-bar-history-forward)))) + (let* ((history (pop (gethash (selected-frame) tab-bar-history-forward))) + (wc (cdr (assq 'wc history))) + (wc-point (cdr (assq 'wc-point history)))) (if (window-configuration-p wc) (progn (puthash (selected-frame) - (cons (current-window-configuration) + (cons tab-bar-history-current (gethash (selected-frame) tab-bar-history-back)) - tab-bar-history-back) - (set-window-configuration wc)) + tab-bar-history-back) + (set-window-configuration wc) + (when (and (markerp wc-point) (marker-buffer wc-point)) + (goto-char wc-point))) (message "No more tab forward history")))) (define-minor-mode tab-bar-history-mode @@ -1000,10 +1057,9 @@ marked for deletion." The list is displayed in a buffer named `*Tabs*'. For more information, see the function `tab-bar-list'." - (let* ((tabs (delq nil (mapcar (lambda (tab) ; remove current tab - (unless (eq (car tab) 'current-tab) - tab)) - (funcall tab-bar-tabs-function)))) + (let* ((tabs (seq-remove (lambda (tab) + (eq (car tab) 'current-tab)) + (funcall tab-bar-tabs-function))) ;; Sort by recency (tabs (sort tabs (lambda (a b) (< (cdr (assq 'time b)) (cdr (assq 'time a))))))) commit d3517de4b472ede7abaf3a552c5064be979e6eff Author: Lars Ingebrigtsen Date: Tue Oct 29 22:53:00 2019 +0100 Make url-cookie.el be more resistant against bogus data * lisp/url/url-cookie.el (url-cookie-handle-set-cookie): Don't bug out on large max-age values (bug#37974). diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index 31fc3e7266..740a43fa16 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el @@ -304,9 +304,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead." (url-filename url-current-object)))) (expires nil)) (if (and max-age (string-match "\\`-?[0-9]+\\'" max-age)) - (setq expires (format-time-string "%a %b %d %H:%M:%S %Y GMT" - (time-add nil (read max-age)) - t)) + (setq expires (ignore-errors + (format-time-string "%a %b %d %H:%M:%S %Y GMT" + (time-add nil (read max-age)) + t))) (setq expires (cdr-safe (assoc-string "expires" args t)))) (while (consp trusted) (if (string-match (car trusted) current-url) commit 6f7e99fb1896b1414187d98b4b1459d04ac94823 Author: Lars Ingebrigtsen Date: Tue Oct 29 22:22:25 2019 +0100 Document run-with-timer * doc/lispref/os.texi (Timers): Mention run-with-timer (bug#37875). diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 93551cab0e..d8d0ad7206 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -2107,6 +2107,13 @@ functions like @code{display-time}. The function @code{run-at-time} returns a timer value that identifies the particular scheduled future action. You can use this value to call @code{cancel-timer} (see below). +@end deffn + +@deffn Command run-with-timer secs repeat function &rest args +This is exactly the same as @code{run-at-time} (so see that definition +for an explanation of the parameters; @var{secs} is passed as +@var{time} to that function), but is meant to be used when the delay +is specified in seconds. @end deffn A repeating timer nominally ought to run every @var{repeat} seconds, commit 19c98f762092adab01bf35d4b0c958af7d4ea59e Author: Lars Ingebrigtsen Date: Tue Oct 29 21:42:33 2019 +0100 Default exotic image formats (like .webp) to image-mode * doc/lispref/errors.texi (Standard Errors): Mention the new error. * lisp/files.el (auto-mode-alist): Add a bunch of image suffixes to the list (bug#37972) based on the output from "gm convert -list format" (i.e., graphicsmagick). * lisp/image-mode.el (image-mode): Rewrite to possibly notify the user about image-use-external-converter. (image-mode--setup-mode): Factor out into own function and don't run under `condition-case' as there's nothing here that should error. * lisp/image.el (unknown-image-type): New error. (image-type): Signal that error so that image-mode can offer sensible feedback to the user. diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index 45e7acbaa6..cf9b67c80d 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -215,6 +215,9 @@ The message is @samp{Wrong number of arguments}. @xref{Argument List}. @item wrong-type-argument The message is @samp{Wrong type argument}. @xref{Type Predicates}. + +@item unknown-image-type +The message is @samp{Cannot determine image type}. @xref{Images}. @end table @ignore The following seem to be unused now. diff --git a/etc/NEWS b/etc/NEWS index bfcb7cf325..5e412f2b55 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2933,6 +2933,9 @@ data about creation times and orientation and the like. 'exif-parse-file' and 'exif-parse-buffer' are the main interface functions. +*** 'image-mode' now uses this library to automatically rotate images +according to the orientation in the Exif data, if any. + *** New library image-converter. If you need to view exotic image formats for which Emacs doesn't have native support, customize the new user option @@ -2940,8 +2943,9 @@ native support, customize the new user option GraphicsMagick, ImageMagick or 'ffmpeg' installed, they will then be used to convert images automatically before displaying them. -*** 'image-mode' now uses this library to automatically rotate images -according to the orientation in the Exif data, if any. +*** 'auto-mode-alist' now includes many of the types typically +supported by the external image converters, like WEPB, BMP and ICO. +These now default to using 'image-mode'. *** 'imagemagick-types-inhibit' disables using ImageMagick by default. 'image-mode' started using ImageMagick by default for all images diff --git a/lisp/files.el b/lisp/files.el index 4b364b49d8..f6dc4baa7f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2847,7 +2847,51 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\)\\'" . archive-mo ;; The following should come after the ChangeLog pattern ;; for the sake of ChangeLog.1, etc. ;; and after the .scm.[0-9] and CVS' . patterns too. - ("\\.[1-9]\\'" . nroff-mode))) + ("\\.[1-9]\\'" . nroff-mode) + ;; Image file types probably supported by `image-convert'. + ("\\.art\\'" . image-mode) + ("\\.avs\\'" . image-mode) + ("\\.bmp\\'" . image-mode) + ("\\.cmyk\\'" . image-mode) + ("\\.cmyka\\'" . image-mode) + ("\\.crw\\'" . image-mode) + ("\\.dcr\\'" . image-mode) + ("\\.dcx\\'" . image-mode) + ("\\.dng\\'" . image-mode) + ("\\.dpx\\'" . image-mode) + ("\\.fax\\'" . image-mode) + ("\\.hrz\\'" . image-mode) + ("\\.icb\\'" . image-mode) + ("\\.icc\\'" . image-mode) + ("\\.icm\\'" . image-mode) + ("\\.ico\\'" . image-mode) + ("\\.icon\\'" . image-mode) + ("\\.jbg\\'" . image-mode) + ("\\.jbig\\'" . image-mode) + ("\\.jng\\'" . image-mode) + ("\\.jnx\\'" . image-mode) + ("\\.miff\\'" . image-mode) + ("\\.mng\\'" . image-mode) + ("\\.mvg\\'" . image-mode) + ("\\.otb\\'" . image-mode) + ("\\.p7\\'" . image-mode) + ("\\.pcx\\'" . image-mode) + ("\\.pdb\\'" . image-mode) + ("\\.pfa\\'" . image-mode) + ("\\.pfb\\'" . image-mode) + ("\\.picon\\'" . image-mode) + ("\\.pict\\'" . image-mode) + ("\\.rgb\\'" . image-mode) + ("\\.rgba\\'" . image-mode) + ("\\.tga\\'" . image-mode) + ("\\.wbmp\\'" . image-mode) + ("\\.webp\\'" . image-mode) + ("\\.wmf\\'" . image-mode) + ("\\.wpg\\'" . image-mode) + ("\\.xcf\\'" . image-mode) + ("\\.xmp\\'" . image-mode) + ("\\.xwd\\'" . image-mode) + ("\\.yuv\\'" . image-mode))) "Alist of filename patterns vs corresponding major mode functions. Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). \(NON-NIL stands for anything that is not nil; the value does not matter.) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 342102568c..db6864649d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -552,76 +552,82 @@ to toggle between display as an image and display as text or hex. Key bindings: \\{image-mode-map}" (interactive) - (condition-case err + (unless (display-images-p) + (error "Display does not support images")) + + (major-mode-suspend) + (setq major-mode 'image-mode) + + (if (not (image-get-display-property)) (progn - (unless (display-images-p) - (error "Display does not support images")) - - (major-mode-suspend) - (setq major-mode 'image-mode) - - (if (not (image-get-display-property)) - (progn - (image-toggle-display-image) - ;; If attempt to display the image fails. - (if (not (image-get-display-property)) - (error "Invalid image"))) - ;; Set next vars when image is already displayed but local - ;; variables were cleared by kill-all-local-variables - (setq cursor-type nil truncate-lines t - image-type (plist-get (cdr (image-get-display-property)) :type))) - - (setq mode-name (if image-type (format "Image[%s]" image-type) "Image")) - (use-local-map image-mode-map) - - ;; Use our own bookmarking function for images. - (setq-local bookmark-make-record-function - #'image-bookmark-make-record) - - ;; Keep track of [vh]scroll when switching buffers - (image-mode-setup-winprops) - - (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t) - (add-hook 'after-revert-hook #'image-after-revert-hook nil t) - (run-mode-hooks 'image-mode-hook) - (let ((image (image-get-display-property)) - (msg1 (substitute-command-keys - "Type \\[image-toggle-display] or \\[image-toggle-hex-display] to view the image as ")) - animated) - (cond - ((null image) - (message "%s" (concat msg1 "an image."))) - ((setq animated (image-multi-frame-p image)) - (setq image-multi-frame t - mode-line-process - `(:eval - (concat " " - (propertize - (format "[%s/%s]" - (1+ (image-current-frame ',image)) - ,(car animated)) - 'help-echo "Frames -mouse-1: Next frame -mouse-3: Previous frame" - 'mouse-face 'mode-line-highlight - 'local-map - '(keymap - (mode-line - keymap - (down-mouse-1 . image-next-frame) - (down-mouse-3 . image-previous-frame))))))) - (message "%s" - (concat msg1 "text. This image has multiple frames."))) -;;; (substitute-command-keys -;;; "\\[image-toggle-animation] to animate.")))) - (t - (message "%s" (concat msg1 "text or hex.")))))) - - (error - (image-mode-as-text) - (funcall - (if (called-interactively-p 'any) 'error 'message) - "Cannot display image: %s" (cdr err))))) + (when (condition-case err + (progn + (image-toggle-display-image) + t) + (unknown-image-type + (image-mode-as-text) + (funcall + (if (called-interactively-p 'any) 'error 'message) + "Unknown image type; consider switching `image-use-external-converter' on") + nil) + (error + (image-mode-as-text) + (funcall + (if (called-interactively-p 'any) 'error 'message) + "Cannot display image: %s" (cdr err)) + nil)) + ;; If attempt to display the image fails. + (if (not (image-get-display-property)) + (error "Invalid image")) + (image-mode--setup-mode))) + ;; Set next vars when image is already displayed but local + ;; variables were cleared by kill-all-local-variables + (setq cursor-type nil truncate-lines t + image-type (plist-get (cdr (image-get-display-property)) :type)) + (image-mode--setup-mode))) + +(defun image-mode--setup-mode () + (setq mode-name (if image-type (format "Image[%s]" image-type) "Image")) + (use-local-map image-mode-map) + + ;; Use our own bookmarking function for images. + (setq-local bookmark-make-record-function + #'image-bookmark-make-record) + + ;; Keep track of [vh]scroll when switching buffers + (image-mode-setup-winprops) + + (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t) + (add-hook 'after-revert-hook #'image-after-revert-hook nil t) + (run-mode-hooks 'image-mode-hook) + (let ((image (image-get-display-property)) + (msg1 (substitute-command-keys + "Type \\[image-toggle-display] or \\[image-toggle-hex-display] to view the image as ")) + animated) + (cond + ((null image) + (message "%s" (concat msg1 "an image."))) + ((setq animated (image-multi-frame-p image)) + (setq image-multi-frame t + mode-line-process + `(:eval + (concat " " + (propertize + (format "[%s/%s]" + (1+ (image-current-frame ',image)) + ,(car animated)) + 'help-echo "Frames\nmouse-1: Next frame\nmouse-3: Previous frame" + 'mouse-face 'mode-line-highlight + 'local-map + '(keymap + (mode-line + keymap + (down-mouse-1 . image-next-frame) + (down-mouse-3 . image-previous-frame))))))) + (message "%s" + (concat msg1 "text. This image has multiple frames."))) + (t + (message "%s" (concat msg1 "text or hex.")))))) ;;;###autoload (define-minor-mode image-minor-mode diff --git a/lisp/image.el b/lisp/image.el index 66fb5fa5fc..ad2ee6c607 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -151,6 +151,8 @@ or \"ffmpeg\") is installed." :type 'boolean :version "27.1") +(define-error 'unknown-image-type "Unknown image type") + ;; Map put into text properties on images. (defvar image-map (let ((map (make-sparse-keymap))) @@ -391,7 +393,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data." (require 'image-converter) (image-convert-p source)))))) (unless type - (error "Cannot determine image type"))) + (signal 'unknown-image-type "Cannot determine image type"))) (when (and (not (eq type 'image-convert)) (not (memq type (and (boundp 'image-types) image-types)))) (error "Invalid image type `%s'" type)) commit 1997e3b80f1046d789c4120d50e0f1dde05e7a74 Author: Lars Ingebrigtsen Date: Tue Oct 29 21:16:40 2019 +0100 Fix image-converter probing * lisp/image/image-converter.el (image-converter--find-converter): Stop probing on the first successful probe. diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index f251d5ca59..f046529fd5 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -149,10 +149,12 @@ where created with DATA-P nil (i.e., it has to refer to a file)." (defun image-converter--find-converter () "Find an installed image converter." - (dolist (elem image-converter--converters) - (when-let ((formats (image-converter--probe (car elem)))) - (setq image-converter (car elem) - image-converter-regexp (concat "\\." (regexp-opt formats) "\\'"))))) + (catch 'done + (dolist (elem image-converter--converters) + (when-let ((formats (image-converter--probe (car elem)))) + (setq image-converter (car elem) + image-converter-regexp (concat "\\." (regexp-opt formats) "\\'")) + (throw 'done image-converter))))) (cl-defmethod image-converter--convert ((type (eql graphicsmagick)) file) "Convert using GraphicsMagick." commit 7208c4f8c930a7d91f89fab154fff8a9df0aeeeb Author: Stefan Monnier Date: Tue Oct 29 16:17:14 2019 -0400 * lisp/minibuffer.el: Tweak and undo parts of recent changes (completion-metadata): Always return a fresh new cons cell. (completion--nth-completion): Don't bother calling adjust-metadata if the result won't be used. (completion-pcm--hilit-commonality): Revert recent change which had removed support for `completions-first-difference` in `substring` and `partial-completion` styles. (completion--flex-adjust-metadata): Treat the arg as immutable. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 9a8db07819..43dd277a2e 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -129,9 +129,9 @@ This metadata is an alist. Currently understood keys are: The metadata of a completion table should be constant between two boundaries." (let ((metadata (if (functionp table) (funcall table string pred 'metadata)))) - (if (eq (car-safe metadata) 'metadata) - metadata - '(metadata)))) + (cons 'metadata + (if (eq (car-safe metadata) 'metadata) + (cdr metadata))))) (defun completion--field-metadata (field-start) (completion-metadata (buffer-substring-no-properties field-start (point)) @@ -909,9 +909,6 @@ This overrides the defaults specified in `completion-category-defaults'." (defun completion--nth-completion (n string table pred point metadata) "Call the Nth method of completion styles." - (unless metadata - (setq metadata - (completion-metadata (substring string 0 point) table pred))) ;; We provide special support for quoting/unquoting here because it cannot ;; reliably be done within the normal completion-table routines: Completion ;; styles such as `substring' or `partial-completion' need to match the @@ -922,13 +919,16 @@ This overrides the defaults specified in `completion-category-defaults'." ;; The quote/unquote function needs to come from the completion table (rather ;; than from completion-extra-properties) because it may apply only to some ;; part of the string (e.g. substitute-in-file-name). - (let* ((requote + (let* ((md (or metadata + (completion-metadata (substring string 0 point) table pred))) + (requote (when (and - (completion-metadata-get metadata 'completion--unquote-requote) + (completion-metadata-get md 'completion--unquote-requote) ;; Sometimes a table's metadata is used on another ;; table (typically that other table is just a list taken - ;; from the output of `all-completions' or something equivalent, - ;; for progressive refinement). See bug#28898 and bug#16274. + ;; from the output of `all-completions' or something + ;; equivalent, for progressive refinement). + ;; See bug#28898 and bug#16274. ;; FIXME: Rather than do nothing, we should somehow call ;; the original table, in that case! (functionp table)) @@ -945,9 +945,9 @@ This overrides the defaults specified in `completion-category-defaults'." completion-styles-alist)) string table pred point))) (and probe (cons probe style)))) - (completion--styles metadata))) + (completion--styles md))) (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata))) - (when adjust-fn + (when (and adjust-fn metadata) (setcdr metadata (cdr (funcall adjust-fn metadata)))) (if requote (funcall requote (car result-and-style) n) @@ -1684,14 +1684,11 @@ See also `display-completion-list'.") (defface completions-first-difference '((t (:inherit bold))) - "Face for the first uncommon character in prefix completions. + "Face for the first character after point in completions. See also the face `completions-common-part'.") (defface completions-common-part '((t nil)) - "Face for the common prefix substring in completions. -The idea of this face is that you can use it to make the common parts -less visible than normal, so that the differing parts are emphasized -by contrast. + "Face for the parts of completions which matched the pattern. See also the face `completions-first-difference'.") (defun completion-hilit-commonality (completions prefix-len &optional base-size) @@ -3078,6 +3075,7 @@ one-letter-long matches).") (defun completion-pcm--hilit-commonality (pattern completions) (when completions (let* ((re (completion-pcm--pattern->regex pattern 'group)) + (point-idx (completion-pcm--pattern-point-idx pattern)) (case-fold-search completion-ignore-case)) (mapcar (lambda (str) @@ -3085,7 +3083,8 @@ one-letter-long matches).") (setq str (copy-sequence str)) (unless (string-match re str) (error "Internal error: %s does not match %s" re str)) - (let* ((md (match-data)) + (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0))) + (md (match-data)) (start (pop md)) (end (pop md)) (len (length str)) @@ -3153,6 +3152,10 @@ one-letter-long matches).") (put-text-property start end 'font-lock-face 'completions-common-part str) + (if (> (length str) pos) + (put-text-property pos (1+ pos) + 'font-lock-face 'completions-first-difference + str)) (unless (zerop (length str)) (put-text-property 0 1 'completion-score @@ -3495,12 +3498,14 @@ that is non-nil." (or (equal c1 minibuffer-default) (> (get-text-property 0 'completion-score c1) (get-text-property 0 'completion-score c2))))))))) - (let ((alist (cdr metadata))) - (setf (alist-get 'display-sort-function alist) - (compose-flex-sort-fn (alist-get 'display-sort-function alist))) - (setf (alist-get 'cycle-sort-function alist) - (compose-flex-sort-fn (alist-get 'cycle-sort-function alist))) - `(metadata . ,alist)))) + `(metadata + (display-sort-function + . ,(compose-flex-sort-fn + (completion-metadata-get metadata 'display-sort-function))) + (cycle-sort-function + . ,(compose-flex-sort-fn + (completion-metadata-get metadata 'cycle-sort-function))) + ,@(cdr metadata)))) (defun completion-flex--make-flex-pattern (pattern) "Convert PCM-style PATTERN into PCM-style flex pattern. commit 6d2c73e8c725863db5d4fbbf1a59e35ebaa5f6b4 Author: Filipp Gunbin Date: Tue Oct 29 23:06:20 2019 +0300 Add gradle-kotlin to compilation-error-regexp-alist-alist * lisp/progmodes/compile.el: Add gradle-kotlin to compilation-error-regexp-alist-alist. * etc/compilation.txt: Add samples for it. diff --git a/etc/compilation.txt b/etc/compilation.txt index 0e39ab5e4a..4a4a318d03 100644 --- a/etc/compilation.txt +++ b/etc/compilation.txt @@ -185,6 +185,14 @@ Warning near line 10 file arrayclash.f: Module contains no executable Nonportable usage near line 31 col 9 file assign.f: mixed default and explicit +* Gradle with kotlin-gradle-plugin + +symbol: gradle-kotlin + +e: /src/Test.kt: (34, 15): foo: bar +w: /src/Test.kt: (34, 15): foo: bar + + * IAR Systems C Compiler symbol: iar diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index cd7a5dc677..b0bb728de0 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -236,6 +236,16 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) "\\(^Warning .*\\)? line[ \n]\\([0-9]+\\)[ \n]\\(?:col \\([0-9]+\\)[ \n]\\)?file \\([^ :;\n]+\\)" 4 2 3 (1)) + ;; Gradle with kotlin-gradle-plugin (see + ;; GradleStyleMessagerRenderer.kt in kotlin sources, see + ;; https://youtrack.jetbrains.com/issue/KT-34683). + (gradle-kotlin + ,(concat + "^\\(?:\\(w\\)\\|.\\): *" ;type + "\\(\\(?:[A-Za-z]:\\)?[^:\n]+\\): *" ;file + "(\\([0-9]+\\), *\\([0-9]+\\))") ;line, column + 2 3 4 (1)) + (iar "^\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[0-9]+\\]:" 1 2 nil (3)) diff --git a/test/lisp/progmodes/compile-tests.el b/test/lisp/progmodes/compile-tests.el index 08a369e7b5..e38c31dd0a 100644 --- a/test/lisp/progmodes/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -212,6 +212,13 @@ 1 nil 27041 "{standard input}") ("boost/container/detail/flat_tree.hpp:589:25: [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]" 1 25 589 "boost/container/detail/flat_tree.hpp" 0) + ;; gradle-kotlin + ("e: /src/Test.kt: (34, 15): foo: bar" 4 15 34 "/src/Test.kt" 2) + ("w: /src/Test.kt: (11, 98): foo: bar" 4 98 11 "/src/Test.kt" 1) + ("e: e:/cygwin/src/Test.kt: (34, 15): foo: bar" 4 15 34 "e:/cygwin/src/Test.kt" 2) + ("w: e:/cygwin/src/Test.kt: (11, 98): foo: bar" 4 98 11 "e:/cygwin/src/Test.kt" 1) + ("e: e:\\src\\Test.kt: (34, 15): foo: bar" 4 15 34 "e:\\src\\Test.kt" 2) + ("w: e:\\src\\Test.kt: (11, 98): foo: bar" 4 98 11 "e:\\src\\Test.kt" 1) ;; Guile ("In foo.scm:\n" 1 nil nil "foo.scm") (" 63:4 [call-with-prompt prompt0 ...]" 1 4 63 nil) @@ -413,8 +420,8 @@ The test data is in `compile-tests--test-regexps-data'." (compilation-num-warnings-found 0) (compilation-num-infos-found 0)) (mapc #'compile--test-error-line compile-tests--test-regexps-data) - (should (eq compilation-num-errors-found 87)) - (should (eq compilation-num-warnings-found 32)) + (should (eq compilation-num-errors-found 90)) + (should (eq compilation-num-warnings-found 35)) (should (eq compilation-num-infos-found 26))))) (ert-deftest compile-test-grep-regexps () commit dafc87efd0b8ef941aa4e11986095a98fce536e1 Author: Jimmy Aguilar Mena Date: Sun Oct 27 02:43:11 2019 +0100 Optimize conditional recursive merge face. * src/xfaces.c (merge_face_vectors) : Pass ATTR_FILTER to merge_face_ref to stop recursion merging in advance when possible. (merge_named_face) : add more conditions to potentially reduce calls to merge_face_vectors in more unneeded situations. diff --git a/src/xfaces.c b/src/xfaces.c index e4d19440bc..3806fa90e2 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2085,7 +2085,7 @@ merge_face_vectors (struct window *w, struct frame *f, memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof *tmp); merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], - tmp, false, named_merge_points, 0); + tmp, false, named_merge_points, attr_filter); if (NILP (tmp[attr_filter]) || UNSPECIFIEDP (tmp[attr_filter])) @@ -2172,7 +2172,12 @@ merge_named_face (struct window *w, bool ok = get_lface_attributes (w, f, face_name, from, false, named_merge_points); - if (ok && (attr_filter == 0 || !NILP(from[attr_filter]))) + if (ok && (attr_filter == 0 /* No filter. */ + || (!NILP(from[attr_filter]) /* Filter, but specified. */ + && !UNSPECIFIEDP(from[attr_filter])) + || (!NILP(from[attr_filter]) /* Filter, unspecified, but inherited. */ + && UNSPECIFIEDP(from[attr_filter]) + && !NILP (from[LFACE_INHERIT_INDEX])))) merge_face_vectors (w, f, from, to, named_merge_points, attr_filter); return ok; commit e0bcc25f64da44e3b5e68b66f361cfa73c0f79b2 Author: Jimmy Aguilar Mena Date: Fri Oct 25 02:57:28 2019 +0200 Fix extend face in gui interfaces. * src/xdisp.c (extend_face_to_end_of_line) : Change call to PRODUCE_GLYPHS with append_stretch_glyph to fill until the windows border. diff --git a/src/xdisp.c b/src/xdisp.c index 987c760c74..8aefab964a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -21657,10 +21657,6 @@ extend_face_to_end_of_line (struct it *it) it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; } - /* Display fill column indicator if not in modeline or - toolbar and display fill column indicator mode is - active. */ - struct font *font = (default_face->font ? default_face->font : FRAME_FONT (f)); @@ -21683,14 +21679,17 @@ extend_face_to_end_of_line (struct it *it) it->avoid_cursor_p = true; it->object = Qnil; + const int stretch_ascent = (((it->ascent + it->descent) + * FONT_BASE (font)) / FONT_HEIGHT (font)); + if (indicator_column >= 0 && indicator_column > it->current_x && indicator_column < it->last_visible_x) - { + { /* Here we substract char_width because we want the - column indicator in the column INDICATOR_COLUMN, not - after it. */ + column indicator in the column INDICATOR_COLUMN, + not after it. */ const int stretch_width = indicator_column - it->current_x - char_width; @@ -21700,8 +21699,6 @@ extend_face_to_end_of_line (struct it *it) between current_x and the indicator position. */ if (stretch_width > 0) { - int stretch_ascent = (((it->ascent + it->descent) - * FONT_BASE (font)) / FONT_HEIGHT (font)); append_stretch_glyph (it, Qnil, stretch_width, it->ascent + it->descent, stretch_ascent); @@ -21720,13 +21717,15 @@ extend_face_to_end_of_line (struct it *it) PRODUCE_GLYPHS (it); it->face_id = save_face_id; } - } + } - /* If there is space after the indicator generate an - extra empty glyph to restore the face. Issue was - observed in X systems. */ - it->char_to_display = ' '; - PRODUCE_GLYPHS (it); + /* Fill space until window edge with the merged face. */ + const int stretch_width = it->last_visible_x - it->current_x; + + if (stretch_width > 0) + append_stretch_glyph (it, Qnil, stretch_width, + it->ascent + it->descent, + stretch_ascent); it->char_to_display = saved_char; it->position = saved_pos; @@ -21734,7 +21733,6 @@ extend_face_to_end_of_line (struct it *it) it->start_of_box_run_p = saved_box_start; it->object = save_object; it->face_id = saved_face_id; - } if (it->glyph_row->reversed_p) { commit 8ae2a3a46b9c4cd2126f3c6504c619892ffff6ce Author: Jimmy Aguilar Mena Date: Fri Oct 25 01:52:16 2019 +0200 Fix inherited :extend attribute in faces. * src/xfaces.c (merge_face_vectors) : Add extra parameter ATTR_FILTER with the same functionality than in merge_named_face. Update all occurrences. (merge_named_face): Remove condition to avoid call `merge_face_vectors`. diff --git a/src/xfaces.c b/src/xfaces.c index 5a741ae8cc..e4d19440bc 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2052,23 +2052,48 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) be 0 when called from other places. If window W is non-NULL, use W to interpret face specifications. */ static void -merge_face_vectors (struct window *w, - struct frame *f, Lisp_Object *from, Lisp_Object *to, - struct named_merge_point *named_merge_points) +merge_face_vectors (struct window *w, struct frame *f, + const Lisp_Object *from, Lisp_Object *to, + struct named_merge_point *named_merge_points, + enum lface_attribute_index attr_filter) { int i; Lisp_Object font = Qnil; + eassert (attr_filter < LFACE_VECTOR_SIZE); + + /* When FROM sets attr_filter to nil explicitly we don't merge it. */ + if (attr_filter > 0 && NILP(from[attr_filter])) + return; + /* If FROM inherits from some other faces, merge their attributes into TO before merging FROM's direct attributes. Note that an :inherit attribute of `unspecified' is the same as one of nil; we never merge :inherit attributes, so nil is more correct, but lots of - other code uses `unspecified' as a generic value for face attributes. */ - if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) - && !NILP (from[LFACE_INHERIT_INDEX])) - merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], - to, false, named_merge_points, - 0); + other code uses `unspecified' as a generic value for face + attributes. */ + if (!NILP (from[LFACE_INHERIT_INDEX]) + && !UNSPECIFIEDP (from[LFACE_INHERIT_INDEX])) + { + if (attr_filter == 0 /* No Filter */ + || !UNSPECIFIEDP (from[attr_filter])) /* FROM specifies filter */ + merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], + to, false, named_merge_points, 0); + else if (UNSPECIFIEDP (from[attr_filter])) /* FROM don't specify filter */ + { + Lisp_Object tmp[LFACE_VECTOR_SIZE]; + memcpy (tmp, to, LFACE_VECTOR_SIZE * sizeof *tmp); + + merge_face_ref (w, f, from[LFACE_INHERIT_INDEX], + tmp, false, named_merge_points, 0); + + if (NILP (tmp[attr_filter]) + || UNSPECIFIEDP (tmp[attr_filter])) + return; + + memcpy (to, tmp, LFACE_VECTOR_SIZE * sizeof *to); + } + } if (FONT_SPEC_P (from[LFACE_FONT_INDEX])) { @@ -2092,8 +2117,8 @@ merge_face_vectors (struct window *w, to[i] = from[i]; if (i >= LFACE_FAMILY_INDEX && i <=LFACE_SLANT_INDEX) font_clear_prop (to, - (i == LFACE_FAMILY_INDEX ? FONT_FAMILY_INDEX - : i == LFACE_FOUNDRY_INDEX ? FONT_FOUNDRY_INDEX + (i == LFACE_FAMILY_INDEX ? FONT_FAMILY_INDEX + : i == LFACE_FOUNDRY_INDEX ? FONT_FOUNDRY_INDEX : i == LFACE_SWIDTH_INDEX ? FONT_WIDTH_INDEX : i == LFACE_HEIGHT_INDEX ? FONT_SIZE_INDEX : i == LFACE_WEIGHT_INDEX ? FONT_WEIGHT_INDEX @@ -2140,19 +2165,15 @@ merge_named_face (struct window *w, struct named_merge_point named_merge_point; if (push_named_merge_point (&named_merge_point, - face_name, NAMED_MERGE_POINT_NORMAL, - &named_merge_points)) + face_name, NAMED_MERGE_POINT_NORMAL, + &named_merge_points)) { Lisp_Object from[LFACE_VECTOR_SIZE]; bool ok = get_lface_attributes (w, f, face_name, from, false, named_merge_points); - eassert (attr_filter < LFACE_VECTOR_SIZE); - - if (ok && (attr_filter == 0 - || (!NILP (from[attr_filter]) - && !UNSPECIFIEDP (from[attr_filter])))) - merge_face_vectors (w, f, from, to, named_merge_points); + if (ok && (attr_filter == 0 || !NILP(from[attr_filter]))) + merge_face_vectors (w, f, from, to, named_merge_points, attr_filter); return ok; } @@ -3851,7 +3872,7 @@ Default face attributes override any local face attributes. */) /* Ensure that the face vector is fully specified by merging the previously-cached vector. */ memcpy (attrs, oldface->lface, sizeof attrs); - merge_face_vectors (NULL, f, lvec, attrs, 0); + merge_face_vectors (NULL, f, lvec, attrs, 0, 0); vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE); newface = realize_face (c, lvec, DEFAULT_FACE_ID); @@ -4607,7 +4628,7 @@ lookup_named_face (struct window *w, struct frame *f, return -1; memcpy (attrs, default_face->lface, sizeof attrs); - merge_face_vectors (w, f, symbol_attrs, attrs, 0); + merge_face_vectors (w, f, symbol_attrs, attrs, 0, 0); return lookup_face (f, attrs); } @@ -4776,7 +4797,7 @@ lookup_derived_face (struct window *w, default_face = FACE_FROM_ID (f, face_id); memcpy (attrs, default_face->lface, sizeof attrs); - merge_face_vectors (w, f, symbol_attrs, attrs, 0); + merge_face_vectors (w, f, symbol_attrs, attrs, 0, 0); return lookup_face (f, attrs); } @@ -4874,7 +4895,7 @@ gui_supports_face_attributes_p (struct frame *f, memcpy (merged_attrs, def_attrs, sizeof merged_attrs); - merge_face_vectors (NULL, f, attrs, merged_attrs, 0); + merge_face_vectors (NULL, f, attrs, merged_attrs, 0, 0); face_id = lookup_face (f, merged_attrs); face = FACE_FROM_ID_OR_NULL (f, face_id); @@ -5519,7 +5540,7 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id) /* Merge SYMBOL's face with the default face. */ get_lface_attributes_no_remap (f, symbol, symbol_attrs, true); - merge_face_vectors (NULL, f, symbol_attrs, attrs, 0); + merge_face_vectors (NULL, f, symbol_attrs, attrs, 0, 0); /* Realize the face. */ realize_face (c, attrs, id); @@ -6386,7 +6407,7 @@ merge_faces (struct window *w, Lisp_Object face_name, int face_id, if (!face) return base_face_id; - merge_face_vectors (w, f, face->lface, attrs, 0); + merge_face_vectors (w, f, face->lface, attrs, 0, 0); } /* Look up a realized face with the given face attributes, commit 0956a65e6f46a04f8fb2bce6e909ff6a10a1c016 Author: Lars Ingebrigtsen Date: Tue Oct 29 13:56:49 2019 +0100 Make shr scale images on all frames * lisp/net/shr.el (shr-rescale-image): Rescale images even if the window isn't on the current frame. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 93408840ab..22d4cde34a 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1121,7 +1121,7 @@ WIDTH and HEIGHT are the sizes given in the HTML data, if any. The size of the displayed image will not exceed MAX-WIDTH/MAX-HEIGHT. If not given, use the current window width/height instead." - (if (not (get-buffer-window (current-buffer))) + (if (not (get-buffer-window (current-buffer) t)) (create-image data nil t :ascent 100) (let* ((edges (window-inside-pixel-edges (get-buffer-window (current-buffer)))) commit 5860fd3123635af3c2e419bfde53e26fde85930b Author: João Távora Date: Tue Oct 29 00:18:55 2019 +0000 Make icomplete-exhibit actually work when navigating up directories Sometimes, when finding files with icomplete-mode, backward-deleting the previous word or sexp (to move up a directory) doesn't actually refresh the file list of the new directory. Forcing redisplay in icomplete-exhibit misteriously fixes the problem. * lisp/icomplete.el (icomplete-exhibit): Add call to redisplay. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index f2745fb30a..02eae55a19 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -399,6 +399,8 @@ Should be run via minibuffer `post-command-hook'. See `icomplete-mode' and `minibuffer-setup-hook'." (when (and icomplete-mode (icomplete-simple-completing-p)) ;Shouldn't be necessary. + (redisplay) ; FIXME: why is this sometimes needed when moving + ; up dirs in a file-finding table? (save-excursion (goto-char (point-max)) ; Insert the match-status information: commit 7373d6eae807af9f0557b28b30e2864f17114c40 Author: João Távora Date: Tue Oct 29 00:12:16 2019 +0000 New commands for making icomplete behave more like ido This tries (not particularly hard) to emulate Ido's magic C-k, C-d, RET and DEL. For now, the new commands have to be explicitly added to an active map by the user, using something like this: (let ((imap icomplete-minibuffer-map)) (define-key imap (kbd "C-k") 'icomplete-magic-ido-kill) (define-key imap (kbd "C-d") 'icomplete-magic-ido-delete-char) (define-key imap (kbd "RET") 'icomplete-magic-ido-ret) (define-key imap (kbd "DEL") 'icomplete-magic-ido-backward-updir)) * lisp/icomplete.el (icomplete-magic-ido-kill) (icomplete-magic-ido-delete-char, icomplete-magic-ido-ret) (icomplete-magic-ido-backward-updir): New commands. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 5cd11b125d..f2745fb30a 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -195,6 +195,91 @@ Last entry becomes the first and can be selected with (push (car last) comps) (completion--cache-all-sorted-completions beg end comps)))) +;;; `ido-mode' emulation +;;; +;;; The following "magic-ido" commands can be bound in +;;; `icomplete-mode-map' to make `icomplete-mode' behave more like +;;; `ido-mode'. Evaluate this to try it out. +;;; +;;; (let ((imap icomplete-minibuffer-map)) +;;; (define-key imap (kbd "C-k") 'icomplete-magic-ido-kill) +;;; (define-key imap (kbd "C-d") 'icomplete-magic-ido-delete-char) +;;; (define-key imap (kbd "RET") 'icomplete-magic-ido-ret) +;;; (define-key imap (kbd "DEL") 'icomplete-magic-ido-backward-updir)) + +(defun icomplete-magic-ido-kill () + "Kill line or current completion, like `ido-mode'. +If killing to the end of line make sense, call `kill-line', +otherwise kill the currently selected completion candidate. +Exactly what killing entails is dependent on the things being +completed. If completing files, it means delete the file. If +completing buffers it means kill the buffer. Both actions +require user confirmation." + (interactive) + (let ((beg (icomplete--field-beg)) (end (icomplete--field-end))) + (if (< (point) end) + (call-interactively 'kill-line) + (let* ((md (completion--field-metadata beg)) + (category (alist-get 'category (cdr md))) + (all (completion-all-sorted-completions)) + (thing (car all)) + (action + (pcase category + (`buffer + (lambda () + (when (yes-or-no-p (concat "Kill buffer " thing "? ")) + (kill-buffer thing)))) + (`file + (lambda () + (let* ((dir (file-name-directory (icomplete--field-string))) + (path (expand-file-name thing dir))) + (when (yes-or-no-p (concat "Delete file " path "? ")) + (delete-file path) t))))))) + (when (funcall action) + (completion--cache-all-sorted-completions + (icomplete--field-beg) + (icomplete--field-end) + (cdr all))) + (message nil))))) + +(defun icomplete-magic-ido-delete-char () + "Delete char or maybe call `dired', like `ido-mode'." + (interactive) + (let* ((beg (icomplete--field-beg)) + (end (icomplete--field-end)) + (md (completion--field-metadata beg)) + (category (alist-get 'category (cdr md)))) + (if (or (< (point) end) (not (eq category 'file))) + (call-interactively 'delete-char) + (dired (file-name-directory (icomplete--field-string))) + (exit-minibuffer)))) + +(defun icomplete-magic-ido-ret () + "Exit forcing completion or enter directory, like `ido-mode'." + (interactive) + (let* ((beg (icomplete--field-beg)) + (md (completion--field-metadata beg)) + (category (alist-get 'category (cdr md))) + (dir (and (eq category 'file) + (file-name-directory (icomplete--field-string)))) + (current (and dir + (car (completion-all-sorted-completions)))) + (probe (and current + (expand-file-name (directory-file-name current) dir)))) + (if (and probe (file-directory-p probe) (not (string= current "./"))) + (icomplete-force-complete) + (icomplete-force-complete-and-exit)))) + +(defun icomplete-magic-ido-backward-updir () + "Delete char before or go up directory, like `ido-mode'." + (interactive) + (let* ((beg (icomplete--field-beg)) + (md (completion--field-metadata beg)) + (category (alist-get 'category (cdr md)))) + (if (and (eq (char-before) ?/) (eq category 'file)) + (backward-kill-sexp 1) + (call-interactively 'backward-delete-char)))) + ;;;_ > icomplete-mode (&optional prefix) ;;;###autoload (define-minor-mode icomplete-mode commit 4e3676726a64018cd4688d2669657878a2975f2c Author: Juri Linkov Date: Mon Oct 28 23:55:16 2019 +0200 * lisp/tab-bar.el: Check for minibuffer-depth in tab-bar-history-mode. * lisp/tab-bar.el (tab-bar-history--pre-change): Store also minibuffer-depth. (tab-bar-history-change): Check stored minibuffer-depth for zero. (tab-bar-history-mode): Use prefix -- for internal functions. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 1151df923b..c4763337a2 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -870,17 +870,23 @@ function `tab-bar-tab-name-function'." (defvar tab-bar-history-forward (make-hash-table) "History of forward changes in every tab per frame.") -(defvar tab-bar-history-pre-change nil - "Window configuration before the current command.") +(defvar tab-bar-history--pre-change nil + "Window configuration and minibuffer depth before the current command.") -(defun tab-bar-history-pre-change () - (setq tab-bar-history-pre-change (current-window-configuration))) +(defun tab-bar-history--pre-change () + (setq tab-bar-history--pre-change + (list (current-window-configuration) + (minibuffer-depth)))) -(defun tab-bar-history-change () +(defun tab-bar--history-change () (when (and (not tab-bar-history-omit) + tab-bar-history--pre-change + ;; Entering the minibuffer + (zerop (nth 1 tab-bar-history--pre-change)) + ;; Exiting the minibuffer (zerop (minibuffer-depth))) (puthash (selected-frame) - (cons tab-bar-history-pre-change + (cons (nth 0 tab-bar-history--pre-change) (gethash (selected-frame) tab-bar-history-back)) tab-bar-history-back)) (when tab-bar-history-omit @@ -934,10 +940,10 @@ function `tab-bar-tab-name-function'." :ascent center)) tab-bar-forward-button)) - (add-hook 'pre-command-hook 'tab-bar-history-pre-change) - (add-hook 'window-configuration-change-hook 'tab-bar-history-change)) - (remove-hook 'pre-command-hook 'tab-bar-history-pre-change) - (remove-hook 'window-configuration-change-hook 'tab-bar-history-change))) + (add-hook 'pre-command-hook 'tab-bar-history--pre-change) + (add-hook 'window-configuration-change-hook 'tab-bar--history-change)) + (remove-hook 'pre-command-hook 'tab-bar-history--pre-change) + (remove-hook 'window-configuration-change-hook 'tab-bar--history-change))) ;;; Short aliases commit 2aed0430c7cbcab793782c6e24623f9a0a23fafa Author: Mattias Engdegård Date: Sun Oct 27 21:39:58 2019 +0100 Use new-style rx extensions in python.el * lisp/progmodes/python.el (python-rx): Use `rx-let' instead of `rx-constituents'. This allows for some slight redundancy reduction, since `rx-let' definitions are expanded inside `not' (bug#37849). Reorder some `or' forms for more efficient matching. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 634c297957..bdc0f1cd96 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -388,80 +388,71 @@ It returns a file name which can be used directly as argument of ;;; Python specialized rx -(eval-and-compile - (defconst python-rx-constituents - `((block-start . ,(rx symbol-start - (or "def" "class" "if" "elif" "else" "try" - "except" "finally" "for" "while" "with" - ;; Python 3.5+ PEP492 - (and "async" (+ space) - (or "def" "for" "with"))) - symbol-end)) - (dedenter . ,(rx symbol-start - (or "elif" "else" "except" "finally") - symbol-end)) - (block-ender . ,(rx symbol-start - (or - "break" "continue" "pass" "raise" "return") - symbol-end)) - (decorator . ,(rx line-start (* space) ?@ (any letter ?_) - (* (any word ?_)))) - (defun . ,(rx symbol-start - (or "def" "class" - ;; Python 3.5+ PEP492 - (and "async" (+ space) "def")) - symbol-end)) - (if-name-main . ,(rx line-start "if" (+ space) "__name__" - (+ space) "==" (+ space) - (any ?' ?\") "__main__" (any ?' ?\") - (* space) ?:)) - (symbol-name . ,(rx (any letter ?_) (* (any word ?_)))) - (open-paren . ,(rx (or "{" "[" "("))) - (close-paren . ,(rx (or "}" "]" ")"))) - (simple-operator . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))) - ;; FIXME: rx should support (not simple-operator). - (not-simple-operator . ,(rx - (not - (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))) - ;; FIXME: Use regexp-opt. - (operator . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" - "=" "%" "**" "//" "<<" ">>" "<=" "!=" - "==" ">=" "is" "not"))) - ;; FIXME: Use regexp-opt. - (assignment-operator . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" - ">>=" "<<=" "&=" "^=" "|="))) - (string-delimiter . ,(rx (and +(defmacro python-rx (&rest regexps) + "Python mode specialized rx macro. +This variant of `rx' supports common Python named REGEXPS." + `(rx-let ((block-start (seq symbol-start + (or "def" "class" "if" "elif" "else" "try" + "except" "finally" "for" "while" "with" + ;; Python 3.5+ PEP492 + (and "async" (+ space) + (or "def" "for" "with"))) + symbol-end)) + (dedenter (seq symbol-start + (or "elif" "else" "except" "finally") + symbol-end)) + (block-ender (seq symbol-start + (or + "break" "continue" "pass" "raise" "return") + symbol-end)) + (decorator (seq line-start (* space) ?@ (any letter ?_) + (* (any word ?_)))) + (defun (seq symbol-start + (or "def" "class" + ;; Python 3.5+ PEP492 + (and "async" (+ space) "def")) + symbol-end)) + (if-name-main (seq line-start "if" (+ space) "__name__" + (+ space) "==" (+ space) + (any ?' ?\") "__main__" (any ?' ?\") + (* space) ?:)) + (symbol-name (seq (any letter ?_) (* (any word ?_)))) + (open-paren (or "{" "[" "(")) + (close-paren (or "}" "]" ")")) + (simple-operator (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)) + (not-simple-operator (not simple-operator)) + (operator (or "==" ">=" "is" "not" + "**" "//" "<<" ">>" "<=" "!=" + "+" "-" "/" "&" "^" "~" "|" "*" "<" ">" + "=" "%")) + (assignment-operator (or "+=" "-=" "*=" "/=" "//=" "%=" "**=" + ">>=" "<<=" "&=" "^=" "|=" + "=")) + (string-delimiter (seq ;; Match even number of backslashes. (or (not (any ?\\ ?\' ?\")) point - ;; Quotes might be preceded by an escaped quote. + ;; Quotes might be preceded by an + ;; escaped quote. (and (or (not (any ?\\)) point) ?\\ (* ?\\ ?\\) (any ?\' ?\"))) (* ?\\ ?\\) ;; Match single or triple quotes of any kind. - (group (or "\"\"\"" "\"" "'''" "'"))))) - (coding-cookie . ,(rx line-start ?# (* space) - (or - ;; # coding= - (: "coding" (or ?: ?=) (* space) (group-n 1 (+ (or word ?-)))) - ;; # -*- coding: -*- - (: "-*-" (* space) "coding:" (* space) - (group-n 1 (+ (or word ?-))) (* space) "-*-") - ;; # vim: set fileencoding= : - (: "vim:" (* space) "set" (+ space) - "fileencoding" (* space) ?= (* space) - (group-n 1 (+ (or word ?-))) (* space) ":"))))) - "Additional Python specific sexps for `python-rx'") - - (defmacro python-rx (&rest regexps) - "Python mode specialized rx macro. -This variant of `rx' supports common Python named REGEXPS." - (let ((rx-constituents (append python-rx-constituents rx-constituents))) - (cond ((null regexps) - (error "No regexp")) - ((cdr regexps) - (rx-to-string `(and ,@regexps) t)) - (t - (rx-to-string (car regexps) t)))))) + (group (or "\"\"\"" "\"" "'''" "'")))) + (coding-cookie (seq line-start ?# (* space) + (or + ;; # coding= + (: "coding" (or ?: ?=) (* space) + (group-n 1 (+ (or word ?-)))) + ;; # -*- coding: -*- + (: "-*-" (* space) "coding:" (* space) + (group-n 1 (+ (or word ?-))) + (* space) "-*-") + ;; # vim: set fileencoding= : + (: "vim:" (* space) "set" (+ space) + "fileencoding" (* space) ?= (* space) + (group-n 1 (+ (or word ?-))) + (* space) ":"))))) + (rx ,@regexps))) ;;; Font-lock and syntax commit 0c3e3a82aa1e8339ad59eec833d2a4d93429d8d5 Author: Eli Zaretskii Date: Mon Oct 28 17:52:16 2019 +0200 ; Fix recent change in docs * doc/lispref/minibuf.texi (Minibuffer Commands): Fix wording and markup. (Bug#37948) diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index d5a1601405..d36babd698 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2335,10 +2335,10 @@ contents of the minibuffer before the point. @end deffn @deffn Command goto-history-element nabs -Puts element of the minibuffer history in the minibuffer. The -argument @var{nabs} specifies the absolute history position in -descending order, where 0 means the current element and a positive -number N means the Nth previous element. +This function puts element of the minibuffer history in the +minibuffer. The argument @var{nabs} specifies the absolute history +position in descending order, where 0 means the current element and a +positive number @var{n} means the @var{n}th previous element. @end deffn @node Minibuffer Windows commit 70578e077765825980d4dbffc0e1542f01df15ef Author: Hong Xu Date: Mon Oct 28 16:20:43 2019 +0100 Add doc for goto-history-element * doc/lispref/minibuf.texi (Minibuffer Commands): Add goto-history-element (bug#37948). * lisp/simple.el (goto-history-element): Clarify NABS. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index dd51181db0..d5a1601405 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -2334,6 +2334,12 @@ This command replaces the minibuffer contents with the value of the contents of the minibuffer before the point. @end deffn +@deffn Command goto-history-element nabs +Puts element of the minibuffer history in the minibuffer. The +argument @var{nabs} specifies the absolute history position in +descending order, where 0 means the current element and a positive +number N means the Nth previous element. +@end deffn @node Minibuffer Windows @section Minibuffer Windows diff --git a/lisp/simple.el b/lisp/simple.el index 184d4eccdb..fca90690a5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2128,7 +2128,9 @@ the end of the list of defaults just after the default value." (defun goto-history-element (nabs) "Puts element of the minibuffer history in the minibuffer. -The argument NABS specifies the absolute history position." +The argument NABS specifies the absolute history position in +descending order, where 0 means the current element and a +positive number N means the Nth previous element." (interactive "p") (when (and (not minibuffer-default-add-done) (functionp minibuffer-default-add-function) commit 9ee2caac4ddf3e790216a0353debef65e4a12c80 Author: Stefan Kangas Date: Mon Oct 28 16:13:28 2019 +0100 * lisp/eshell/em-term.el: Remove commented out XEmacs compat code. diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index 06d59cfc5b..5c8cd4f0fa 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el @@ -258,17 +258,13 @@ the buffer." ; (defun eshell-term-mouse-paste (click arg) ; "Insert the last stretch of killed text at the position clicked on." ; (interactive "e\nP") -; (if (boundp 'xemacs-logo) -; (eshell-term-send-raw-string -; (or (condition-case () (x-get-selection) (error ())) -; (error "No selection available"))) -; ;; Give temporary modes such as isearch a chance to turn off. -; (run-hooks 'mouse-leave-buffer-hook) -; (setq this-command 'yank) -; (eshell-term-send-raw-string -; (current-kill (cond ((listp arg) 0) -; ((eq arg '-) -1) -; (t (1- arg))))))) +; ;; Give temporary modes such as isearch a chance to turn off. +; (run-hooks 'mouse-leave-buffer-hook) +; (setq this-command 'yank) +; (eshell-term-send-raw-string +; (current-kill (cond ((listp arg) 0) +; ((eq arg '-) -1) +; (t (1- arg)))))) ; ;; Which would be better: "\e[A" or "\eOA"? readline accepts either. ; ;; For my configuration it's definitely better \eOA but YMMV. -mm @@ -316,9 +312,7 @@ the buffer." ; (setq eshell-term-raw-map map) ; (setq eshell-term-raw-escape-map ; (copy-keymap (lookup-key (current-global-map) "\C-x"))) -; (if (boundp 'xemacs-logo) -; (define-key eshell-term-raw-map [button2] 'eshell-term-mouse-paste) -; (define-key eshell-term-raw-map [mouse-2] 'eshell-term-mouse-paste)) +; (define-key eshell-term-raw-map [mouse-2] 'eshell-term-mouse-paste) ; (define-key eshell-term-raw-map [up] 'eshell-term-send-up) ; (define-key eshell-term-raw-map [down] 'eshell-term-send-down) ; (define-key eshell-term-raw-map [right] 'eshell-term-send-right) commit 1f1ce5b3118abed0248f4a0bddd3f7538256dcac Author: Stefan Kangas Date: Mon Oct 28 16:05:39 2019 +0100 Remove more XEmacs compat code from CEDET * lisp/cedet/mode-local.el (mode-local-describe-bindings-1): * lisp/cedet/semantic/idle.el (semantic-idle-summary-out-of-context-faces): * lisp/cedet/semantic/imenu.el (semantic-imenu-rebuild-directory-indexes): * lisp/cedet/semantic/texi.el (semantic-texi-command-completion-list): Remove XEmacs compat code. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index c4e5280df3..9477f1bdd5 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -877,23 +877,13 @@ META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)." "Display mode local bindings active in BUFFER-OR-MODE. Optional argument INTERACTIVE-P is non-nil if the calling command was invoked interactively." - (if (fboundp 'with-displaying-help-buffer) - ;; XEmacs - (with-displaying-help-buffer - #'(lambda () - (with-current-buffer standard-output - (mode-local-describe-bindings-2 buffer-or-mode) - (when (fboundp 'frob-help-extents) - (goto-char (point-min)) - (frob-help-extents standard-output))))) - ;; GNU Emacs - (when (fboundp 'help-setup-xref) - (help-setup-xref - (list 'mode-local-describe-bindings-1 buffer-or-mode) - interactive-p)) - (with-output-to-temp-buffer (help-buffer) ; "*Help*" - (with-current-buffer standard-output - (mode-local-describe-bindings-2 buffer-or-mode))))) + (when (fboundp 'help-setup-xref) + (help-setup-xref + (list 'mode-local-describe-bindings-1 buffer-or-mode) + interactive-p)) + (with-output-to-temp-buffer (help-buffer) ; "*Help*" + (with-current-buffer standard-output + (mode-local-describe-bindings-2 buffer-or-mode)))) (defun describe-mode-local-bindings (buffer) "Display mode local bindings active in BUFFER." diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el index 35ec930469..78fd669ef6 100644 --- a/lisp/cedet/semantic/idle.el +++ b/lisp/cedet/semantic/idle.el @@ -703,8 +703,7 @@ by semanticdb as a time-saving measure." '( font-lock-comment-face font-lock-string-face - font-lock-doc-string-face ; XEmacs. - font-lock-doc-face ; Emacs 21 and later. + font-lock-doc-face ) "List of font-lock faces that indicate a useless summary context. Those are generally faces used to highlight comments. diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el index 7dcf75fefa..81efffaa60 100644 --- a/lisp/cedet/semantic/imenu.el +++ b/lisp/cedet/semantic/imenu.el @@ -438,12 +438,7 @@ Optional argument PARENT is a tag parent of STREAM." ;; Rebuild the imenu (imenu--cleanup) (setq imenu--index-alist nil) - (funcall - (if (fboundp 'imenu-menu-filter) - ;; XEmacs imenu - 'imenu-menu-filter - ;; Emacs imenu - 'imenu-update-menubar)))))))) + (imenu-update-menubar))))))) (defun semantic-imenu-semanticdb-hook () "Function to be called from `semanticdb-mode-hook'. diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 73f0e734f3..d0e6ad83b2 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -389,12 +389,7 @@ Optional argument POINT is where to look for the environment." (defvar semantic-texi-command-completion-list (append (mapcar (lambda (a) (car a)) texinfo-section-list) - (condition-case nil - texinfo-environments - (error - ;; XEmacs doesn't use the above. Split up its regexp - (split-string texinfo-environment-regexp "\\\\|\\|\\^@\\\\(\\|\\\\)") - )) + texinfo-environments ;; Is there a better list somewhere? Here are few ;; of the top of my head. "anchor" "asis" commit c515d4eeb2fe966923f0fef0c231945b6ad1df8f Author: Stefan Kangas Date: Mon Oct 28 15:55:10 2019 +0100 Remove obsolete doc references to XEmacs (Bug#37899) * doc/misc/edt.texi (Changes, Goals): * doc/misc/emacs-mime.texi (Charset Translation): * doc/misc/gnus-faq.texi (FAQ 4-15): * doc/misc/pcl-cvs.texi (Bugs): * doc/misc/srecode.texi (SRecode Minor Mode): * lisp/cedet/srecode/insert.el (srecode-insert-ask-variable-method): * lisp/follow.el: * lisp/leim/quail/ipa.el (ipa-x-sampa, ipa-kirshenbaum): * lisp/net/newsticker.el: * lisp/obsolete/iswitchb.el: * lisp/progmodes/hideshow.el: * lisp/savehist.el (savehist-file): * lisp/vc/ediff.el: Remove obsolete references to XEmacs in doc strings and comments. diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi index c34efb6937..acc6a8a71e 100644 --- a/doc/misc/edt.texi +++ b/doc/misc/edt.texi @@ -169,10 +169,6 @@ restore @code{query-replace} to @kbd{GOLD-Enter}, then use an EDT user customization file, @file{edt-user.el}, to do this (@pxref{Customizing}). -@item -EDT Emulation now also works in XEmacs, including the highlighting of -selected text. - @item If you access a workstation using an X Server, observe that the initialization file generated by @file{edt-mapper.el} will now contain @@ -237,9 +233,6 @@ Provide support for some TPU/EVE functions not supported in EDT. Provide an easy way to restore @strong{all} original Emacs key bindings, just as they existed before the EDT emulation was first invoked. -@item -Support Emacs and XEmacs 19 and higher. - @item Supports highlighting of marked text within the EDT emulation on all platforms on which Emacs supports highlighting of marked text. diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi index 53d0a62ac4..ef02ad5771 100644 --- a/doc/misc/emacs-mime.texi +++ b/doc/misc/emacs-mime.texi @@ -996,8 +996,7 @@ used, of course. Things are slightly more complicated when running Emacs with @sc{mule} support. In this case, a list of the @sc{mule} charsets used in the part is obtained, and the @sc{mule} charsets are translated to -@acronym{MIME} charsets by consulting the table provided by Emacs itself -or the variable @code{mm-mime-mule-charset-alist} for XEmacs. +@acronym{MIME} charsets by consulting the table provided by Emacs itself. If this results in a single @acronym{MIME} charset, this is used to encode the part. But if the resulting list of @acronym{MIME} charsets contains more than one element, two things can happen: If it is possible to encode the diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi index b0dc9c3ba3..105c8ea96c 100644 --- a/doc/misc/gnus-faq.texi +++ b/doc/misc/gnus-faq.texi @@ -1144,7 +1144,7 @@ from using them): @example (setq nnmail-split-methods '(("duplicates" "^Gnus-Warning:.*duplicate") - ("XEmacs-NT" "^\\(To:\\|Cc:\\).*localpart@@xemacs.invalid.*") + ("Emacs-devel" "^\\(To:\\|Cc:\\).*localpart@@gnu.invalid.*") ("Gnus-Tut" "^\\(To:\\|Cc:\\).*localpart@@socha.invalid.*") ("tcsh" "^\\(To:\\|Cc:\\).*localpart@@mx.gw.invalid.*") ("BAfH" "^\\(To:\\|Cc:\\).*localpart@@.*uni-muenchen.invalid.*") diff --git a/doc/misc/pcl-cvs.texi b/doc/misc/pcl-cvs.texi index 3379783f6c..ad6d383ad5 100644 --- a/doc/misc/pcl-cvs.texi +++ b/doc/misc/pcl-cvs.texi @@ -1384,10 +1384,7 @@ If you find a bug or misfeature, don't hesitate to tell us! Use @kbd{M-x report-emacs-bug} to send us a report. You can follow the same process for feature requests. We prefer discussing one thing at a time. If you find several unrelated -bugs, please report them separately. If you are running PCL-CVS under -XEmacs, you should also send a copy of bug reports to -the @url{http://lists.xemacs.org/mailman/listinfo/xemacs-beta, -XEmacs mailing list}. +bugs, please report them separately. If you have problems using PCL-CVS or other questions, send them to the @url{https://lists.gnu.org/mailman/listinfo/help-gnu-emacs, diff --git a/doc/misc/srecode.texi b/doc/misc/srecode.texi index 9df11b4b9f..33a6e8d81f 100644 --- a/doc/misc/srecode.texi +++ b/doc/misc/srecode.texi @@ -330,8 +330,6 @@ Prompt in the minibuffer as the value is inserted. Use the dictionary macro name as the inserted value, and place a field there. Matched fields change together. @end table - -@b{NOTE}: The field feature does not yet work with XEmacs. @end defun Field editing mode is supported in newer versions of Emacs. You diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el index 966cd485e8..4e25e1f5ca 100644 --- a/lisp/cedet/srecode/insert.el +++ b/lisp/cedet/srecode/insert.el @@ -44,9 +44,7 @@ Dictionary value references that ask begin with the ? character. Possible values are: `ask' - Prompt in the minibuffer as the value is inserted. `field' - Use the dictionary macro name as the inserted value, - and place a field there. Matched fields change together. - -NOTE: The field feature does not yet work with XEmacs." + and place a field there. Matched fields change together." :group 'srecode :type '(choice (const :tag "Ask" ask) (const :tag "Field" field))) diff --git a/lisp/follow.el b/lisp/follow.el index faac87986b..f80532ce3c 100644 --- a/lisp/follow.el +++ b/lisp/follow.el @@ -25,8 +25,8 @@ ;;; Commentary: -;; `Follow mode' is a minor mode for Emacs and XEmacs that -;; combines windows into one tall virtual window. +;; `Follow mode' is a minor mode that combines windows into one tall +;; virtual window. ;; ;; The feeling of a "virtual window" has been accomplished by the use ;; of two major techniques: diff --git a/lisp/leim/quail/ipa.el b/lisp/leim/quail/ipa.el index 3c4c914def..0949d097d6 100644 --- a/lisp/leim/quail/ipa.el +++ b/lisp/leim/quail/ipa.el @@ -122,11 +122,7 @@ allows you to type Kirshenbaum on your ASCII-capable keyboard, producing the corresponding actual IPA characters in your editor. See http://www.kirshenbaum.net/IPA/ascii-ipa.pdf for full details of the -transliteration. - -A caveat with regard to that document; while XEmacs currently preserves -Unicode diacritics on reading and emitting them, it displays them, -incorrectly, as separate from the modified glyphs.") +transliteration.") (quail-define-rules ("g" "ɡ") ;; Voiced velar plosive U+0261 @@ -341,9 +337,7 @@ uses this transliteration to allow you to produce the IPA in your editor with a keyboard that's limited to ASCII. See http://www.phon.ucl.ac.uk/home/sampa/ipasam-x.pdf for a full definition -of the mapping. A caveat with regard to that document; while XEmacs -currently preserves Unicode diacritics on reading and emitting them, it -displays them, incorrectly, as separate from the modified glyphs.") +of the mapping.") (quail-define-rules ;; Table taken from http://en.wikipedia.org/wiki/X-SAMPA, checked with @@ -446,10 +440,7 @@ displays them, incorrectly, as separate from the modified glyphs.") ("=\\" "ǂ") ;; Palatal click U+01C2 ("-\\" "̮") ;; Linking mark U+032E - ;; Diacritics. Note that XEmacs doesn't yet have composed characters, so we - ;; can input them, but they won't display properly. If you send email using - ;; them, and the recipient's client is capable, they will get through, - ;; though. + ;; Diacritics. ("_\"" "̈") ;; Centralized U+0308 ("_+" "̟") ;; Advanced U+031F diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el index e1f4c8f89f..b47dd1f864 100644 --- a/lisp/net/newsticker.el +++ b/lisp/net/newsticker.el @@ -71,11 +71,6 @@ ;; Requirements ;; ------------ -;; Newsticker can be used with GNU Emacs version 21.1 or later as well as -;; XEmacs. It requires an XML-parser (`xml.el') which is part of GNU -;; Emacs. If you are using XEmacs you want to get the `net-utils' package -;; which contains `xml.el' for XEmacs. - ;; Newsticker requires a program which can retrieve files via http and ;; prints them to stdout. By default Newsticker will use wget for this ;; task. diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el index ad2067fdef..f899c139ea 100644 --- a/lisp/obsolete/iswitchb.el +++ b/lisp/obsolete/iswitchb.el @@ -176,9 +176,6 @@ ;; iswitch for all buffer selections in Emacs, add: ;; (setq read-buffer-function #'iswitchb-read-buffer) ;; (This variable was introduced in Emacs 20.3.) -;; XEmacs users can get the same behavior by doing: -;; (defalias 'read-buffer #'iswitchb-read-buffer) -;; since `read-buffer' is defined in lisp. ;; Using iswitchb for other completion tasks. diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index c4c75a6c04..53235ea573 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -152,18 +152,11 @@ ;; * Bugs ;; -;; (1) Hideshow does not work w/ emacs 18 because emacs 18 lacks the -;; function `forward-comment' (among other things). If someone -;; writes this, please send me a copy. -;; -;; (2) Sometimes `hs-headline' can become out of sync. To reset, type +;; (1) Sometimes `hs-headline' can become out of sync. To reset, type ;; `M-x hs-minor-mode' twice (that is, deactivate then re-activate ;; hideshow). ;; -;; (3) Hideshow 5.x is developed and tested on GNU Emacs 20.7. -;; XEmacs compatibility may have bitrotted since 4.29. -;; -;; (4) Some buffers can't be `byte-compile-file'd properly. This is because +;; (2) Some buffers can't be `byte-compile-file'd properly. This is because ;; `byte-compile-file' inserts the file to be compiled in a temporary ;; buffer and switches `normal-mode' on. In the case where you have ;; `hs-hide-initial-comment-block' in `hs-minor-mode-hook', the hiding of @@ -178,7 +171,7 @@ ;; (let ((hs-minor-mode-hook nil)) ;; ad-do-it)) ;; -;; (5) Hideshow interacts badly with Ediff and `vc-diff'. At the moment, the +;; (3) Hideshow interacts badly with Ediff and `vc-diff'. At the moment, the ;; suggested workaround is to turn off hideshow entirely, for example: ;; ;; (add-hook 'ediff-prepare-buffer-hook #'turn-off-hideshow) diff --git a/lisp/savehist.el b/lisp/savehist.el index 8359131082..f00c5b19df 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -85,11 +85,7 @@ minibuffer histories, such as `compile-command' or `kill-ring'." "File name where minibuffer history is saved to and loaded from. The minibuffer history is a series of Lisp expressions loaded automatically when Savehist mode is turned on. See `savehist-mode' -for more details. - -If you want your minibuffer history shared between Emacs and XEmacs, -customize this value and make sure that `savehist-coding-system' is -set to a coding system that exists in both emacsen." +for more details." :type 'file) (defcustom savehist-file-modes #o600 diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index fae694d522..d207d75a60 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el @@ -79,8 +79,7 @@ ;; 1. The undo command doesn't restore deleted regions well. That is, if ;; you delete all characters in a difference region and then invoke ;; `undo', the reinstated text will most likely be inserted outside of -;; what Ediff thinks is the current difference region. (This problem -;; doesn't seem to exist with XEmacs.) +;; what Ediff thinks is the current difference region. ;; ;; If at any point you feel that difference regions are no longer correct, ;; you can hit '!' to recompute the differences. commit 97cfb4f1e751a947105802d5c4b4f56c696ff75d Author: Michal Nowak Date: Mon Oct 28 15:38:34 2019 +0100 Add cert bundle path for OpenIndiana * lisp/net/gnutls.el (gnutls-trustfiles): Add cert bundle path for OpenIndiana (bug#37960). Copyright-paperwork-exempt: yes diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index ae15b3aecf..9b13adaefe 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -111,6 +111,7 @@ Security'." "/usr/ssl/certs/ca-bundle.crt" ; Cygwin "/usr/local/share/certs/ca-root-nss.crt" ; FreeBSD "/etc/ssl/cert.pem" ; macOS + "/etc/certs/ca-certificates.crt" ; OpenIndiana ) "List of CA bundle location filenames or a function returning said list. If a file path contains glob wildcards, they will be expanded. commit 925872ee7b2f56d643a57a160517c2c27e71879e Author: Lars Ingebrigtsen Date: Mon Oct 28 15:31:39 2019 +0100 Make ERC respect erc-channel-hide-list * lisp/erc/erc.el (erc-hide-current-message-p): Make erc-channel-hide-list work (bug#37879) by getting matching on the channel name instead of the ERC client name. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 1c5ecf99c6..daf93f1cc9 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2693,7 +2693,7 @@ is a member of `erc-lurker-hide-list' are hidden if `erc-lurker-p' returns non-nil." (let* ((command (erc-response.command parsed)) (sender (car (erc-parse-user (erc-response.sender parsed)))) - (channel (nth 1 (erc-response.command-args parsed))) + (channel (car (erc-response.command-args parsed))) (network (or (and (fboundp 'erc-network-name) (erc-network-name)) (erc-shorten-server-name (or erc-server-announced-name @@ -2702,9 +2702,9 @@ returns non-nil." (when erc-network-hide-list (erc-add-targets network erc-network-hide-list))) (current-hide-list - (apply 'append current-hide-list - (when erc-channel-hide-list - (erc-add-targets channel erc-channel-hide-list))))) + (append current-hide-list + (when erc-channel-hide-list + (erc-add-targets channel erc-channel-hide-list))))) (or (member command erc-hide-list) (member command current-hide-list) (and (member command erc-lurker-hide-list) (erc-lurker-p sender))))) commit 4367c296cead5540acf7804b1b7423d7fe649e53 Author: Lars Ingebrigtsen Date: Mon Oct 28 15:10:51 2019 +0100 Fix `G c' in Gnus group buffers for non-ASCII text * lisp/gnus/gnus-cus.el (gnus-group-customize): Decoding is superfluous here -- everything is utf-8 already. (gnus-group-customize-done): Don't double-encode the text (bug#37901). diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index 2e3fbfe9d4..5291d1d64d 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -421,11 +421,6 @@ category.")) (delq elem tmp)) (setq tmp (cdr tmp)))) - ;; Decode values posting-style holds. - (dolist (style (cdr (assq 'posting-style values))) - (when (stringp (cadr style)) - (setcdr style (list (decode-coding-string (cadr style) 'utf-8))))) - (setq gnus-custom-params (apply 'widget-create 'group :value values @@ -497,10 +492,6 @@ form, but who cares?" "Apply changes and bury the buffer." (interactive) (let ((params (widget-value gnus-custom-params))) - ;; Encode values posting-style holds. - (dolist (style (cdr (assq 'posting-style params))) - (when (stringp (cadr style)) - (setcdr style (list (encode-coding-string (cadr style) 'utf-8))))) (if gnus-custom-topic (gnus-topic-set-parameters gnus-custom-topic params) (gnus-group-edit-group-done 'params gnus-custom-group params) commit 2864c5201d5c4ddfcfe1e8f2fca4168077c7f44f Author: Lars Ingebrigtsen Date: Mon Oct 28 13:31:37 2019 +0100 Be more permissive when interpreting IMAP mail headers * lisp/gnus/nnimap.el (nnimap-transform-headers): Some mail doesn't have space after the colon of the header name. Don't ignore these. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 1ec5522831..856ac75cd6 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -271,8 +271,8 @@ textual parts.") (save-excursion (forward-line) (null (looking-at-p - ;; We're expecting a mail header. - "^[!-9;-~]+:[[:space:]]")))) + ;; We're expecting a mail-ish header. + "^[!-9;-~]+:[[:space:]]?")))) (delete-region (line-beginning-position) (1+ (line-end-position))) (setq lines nil) commit 3478f2f3d6ccd8c9921b03870261b13d5b6c8ba2 Author: Lars Ingebrigtsen Date: Mon Oct 28 12:11:46 2019 +0100 Make work in read-char-with-history * lisp/simple.el (read-char-with-history): Tweak to make / also traverse the history (bug#10477). diff --git a/lisp/simple.el b/lisp/simple.el index 5502cd49aa..184d4eccdb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5197,10 +5197,10 @@ a character from history." (t (error "Invalid history: %s" history))) (while (not result) - (setq result (read-char prompt inherit-input-method seconds)) + (setq result (read-event prompt inherit-input-method seconds)) ;; Go back in history. (cond - ((eq result ?\M-p) + ((memq result '(?\M-p up)) (if (>= index (length (symbol-value histvar))) (progn (message "Beginning of history; no preceding item") @@ -5211,7 +5211,7 @@ a character from history." (elt (symbol-value histvar) (1- index))))) (setq result nil)) ;; Go forward in history. - ((eq result ?\M-n) + ((memq result '(?\M-n down)) (if (zerop index) (progn (message "End of history; no next item") @@ -5225,9 +5225,13 @@ a character from history." (setq result nil)) ;; The user hits RET to either select a history item or to ;; return RET. - ((eq result ?\r) - (unless (zerop index) - (setq result (elt (symbol-value histvar) (1- index))))))) + ((eq result 'return) + (if (zerop index) + (setq result ?\r) + (setq result (elt (symbol-value histvar) (1- index))))) + ;; The user has entered some non-character event. + ((not (characterp result)) + (user-error "Non-character input event")))) ;; Record the chosen key. (set histvar (cons result (symbol-value histvar))) result)) commit 098873b4f25922cd79850e0a985d30ba4c0f780a Author: Koichi Arakawa Date: Mon Oct 28 09:49:59 2019 +0100 Reorder command-line switches in Tramp * lisp/net/tramp-sh.el (tramp-maybe-open-connection): `tramp-encoding-command-interactive' must be the last command-line switch, at least for bash. (Bug#37953) Copyright-paperwork-exempt: yes diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 26254f87fe..3c80c58309 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4877,9 +4877,9 @@ connection if a previous connection has died for some reason." (tramp-get-connection-buffer vec) (append (list tramp-encoding-shell) + (and extra-args (split-string extra-args)) (and tramp-encoding-command-interactive - (list tramp-encoding-command-interactive)) - (and extra-args (split-string extra-args))))))) + (list tramp-encoding-command-interactive))))))) ;; Set sentinel and query flag. Initialize variables. (set-process-sentinel p #'tramp-process-sentinel) commit 7e30076225cebe85f7e60802f471b421a369abd7 Author: Juri Linkov Date: Mon Oct 28 01:04:47 2019 +0200 * lisp/tab-bar.el: Add tab-bar-history-mode with arrow buttons for navigation. * lisp/tab-bar.el (tab-bar-back-button, tab-bar-forward-button): New variables. (tab-bar-make-keymap-1): Show these buttons in tab-bar-history-mode. (tab-bar--tab): Add history-back and history-forward. (tab-bar-select-tab): Restore history-back and history-forward. (tab-bar-history-omit, tab-bar-history-back) (tab-bar-history-forward, tab-bar-history-pre-change): New variables. (tab-bar-history-pre-change, tab-bar-history-change) (tab-bar-history-back, tab-bar-history-forward) (tab-bar-history-mode): New functions. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 2b71bf8b2c..1151df923b 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -284,6 +284,12 @@ If nil, don't show it at all." :help "Click to close tab") "Button for closing the clicked tab.") +(defvar tab-bar-back-button " < " + "Button for going back in tab history.") + +(defvar tab-bar-forward-button " > " + "Button for going forward in tab history.") + (defcustom tab-bar-tab-hints nil "Show absolute numbers on tabs in the tab bar before the tab name. This helps to select the tab by its number using `tab-bar-select-tab'." @@ -373,6 +379,15 @@ Return its existing value or a new value." (tabs (funcall tab-bar-tabs-function))) (append '(keymap (mouse-1 . tab-bar-handle-mouse)) + (when tab-bar-history-mode + `((sep-history-back menu-item ,separator ignore) + (history-back + menu-item ,tab-bar-back-button tab-bar-history-back + :help "Click to go back in tab history") + (sep-history-forward menu-item ,separator ignore) + (history-forward + menu-item ,tab-bar-forward-button tab-bar-history-forward + :help "Click to go forward in tab history"))) (mapcan (lambda (tab) (setq i (1+ i)) @@ -432,7 +447,9 @@ Return its existing value or a new value." (time . ,(time-convert nil 'integer)) (wc . ,(current-window-configuration)) (ws . ,(window-state-get - (frame-root-window (selected-frame)) 'writable))))) + (frame-root-window (selected-frame)) 'writable)) + (history-back . ,(gethash (selected-frame) tab-bar-history-back)) + (history-forward . ,(gethash (selected-frame) tab-bar-history-forward))))) (defun tab-bar--current-tab (&optional tab) ;; `tab` here is an argument meaning 'use tab as template'. This is @@ -488,7 +505,9 @@ to the numeric argument. ARG counts from 1." (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) (wc (cdr (assq 'wc to-tab))) - (ws (cdr (assq 'ws to-tab)))) + (ws (cdr (assq 'ws to-tab))) + (history-back (cdr (assq 'history-back to-tab))) + (history-forward (cdr (assq 'history-forward to-tab)))) ;; During the same session, use window-configuration to switch ;; tabs, because window-configurations are more reliable @@ -501,6 +520,14 @@ to the numeric argument. ARG counts from 1." (if ws (window-state-put ws (frame-root-window (selected-frame)) 'safe))) + (setq tab-bar-history-omit t) + (puthash (selected-frame) + (and (window-configuration-p (car history-back)) history-back) + tab-bar-history-back) + (puthash (selected-frame) + (and (window-configuration-p (car history-forward)) history-forward) + tab-bar-history-forward) + (when from-index (setf (nth from-index tabs) from-tab)) (setf (nth to-index tabs) (tab-bar--current-tab (nth to-index tabs)))) @@ -831,6 +858,87 @@ function `tab-bar-tab-name-function'." nil nil nil nil tab-name)))) (tab-bar-rename-tab new-name (1+ (tab-bar--tab-index-by-name tab-name)))) + +;;; Tab history mode + +(defvar tab-bar-history-omit nil + "When non-nil, omit window-configuration changes from the current command.") + +(defvar tab-bar-history-back (make-hash-table) + "History of back changes in every tab per frame.") + +(defvar tab-bar-history-forward (make-hash-table) + "History of forward changes in every tab per frame.") + +(defvar tab-bar-history-pre-change nil + "Window configuration before the current command.") + +(defun tab-bar-history-pre-change () + (setq tab-bar-history-pre-change (current-window-configuration))) + +(defun tab-bar-history-change () + (when (and (not tab-bar-history-omit) + (zerop (minibuffer-depth))) + (puthash (selected-frame) + (cons tab-bar-history-pre-change + (gethash (selected-frame) tab-bar-history-back)) + tab-bar-history-back)) + (when tab-bar-history-omit + (setq tab-bar-history-omit nil))) + +(defun tab-bar-history-back () + (interactive) + (setq tab-bar-history-omit t) + (let ((wc (pop (gethash (selected-frame) tab-bar-history-back)))) + (if (window-configuration-p wc) + (progn + (puthash (selected-frame) + (cons (current-window-configuration) + (gethash (selected-frame) tab-bar-history-forward)) + tab-bar-history-forward) + (set-window-configuration wc)) + (message "No more tab back history")))) + +(defun tab-bar-history-forward () + (interactive) + (setq tab-bar-history-omit t) + (let ((wc (pop (gethash (selected-frame) tab-bar-history-forward)))) + (if (window-configuration-p wc) + (progn + (puthash (selected-frame) + (cons (current-window-configuration) + (gethash (selected-frame) tab-bar-history-back)) + tab-bar-history-back) + (set-window-configuration wc)) + (message "No more tab forward history")))) + +(define-minor-mode tab-bar-history-mode + "Toggle tab history mode for the tab bar." + :global t + (if tab-bar-history-mode + (progn + (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-back-button))) + ;; This file is pre-loaded so only here we can use the right data-directory: + (add-text-properties 0 (length tab-bar-back-button) + `(display (image :type xpm + :file "tabs/left-arrow.xpm" + :margin (2 . 0) + :ascent center)) + tab-bar-back-button)) + (when (and tab-bar-mode (not (get-text-property 0 'display tab-bar-forward-button))) + ;; This file is pre-loaded so only here we can use the right data-directory: + (add-text-properties 0 (length tab-bar-forward-button) + `(display (image :type xpm + :file "tabs/right-arrow.xpm" + :margin (2 . 0) + :ascent center)) + tab-bar-forward-button)) + + (add-hook 'pre-command-hook 'tab-bar-history-pre-change) + (add-hook 'window-configuration-change-hook 'tab-bar-history-change)) + (remove-hook 'pre-command-hook 'tab-bar-history-pre-change) + (remove-hook 'window-configuration-change-hook 'tab-bar-history-change))) + ;;; Short aliases commit 38ec422a35ab6e6e295b56500bb11493cd39a10e Author: Eric Ludlam Date: Sun Oct 27 17:02:59 2019 -0400 * test/lisp/cedet/semantic-utest: silence compiler warnings * test/lisp/cedet/semantic-utest-c.el (semantic-test-c-preprocessor-simulation): Use with-current-buffer. * test/lisp/cedet/semantic-utest.el (semantic-utest-makebuffer): Use read-only-mode. (semantic-utest-verify-names-jave, semantic-utest-verify-names-2): Remove functions, unused. diff --git a/test/lisp/cedet/semantic-utest-c.el b/test/lisp/cedet/semantic-utest-c.el index a6a5fd1625..05f8491746 100644 --- a/test/lisp/cedet/semantic-utest-c.el +++ b/test/lisp/cedet/semantic-utest-c.el @@ -49,13 +49,12 @@ (dolist (fp semantic-utest-c-comparisons) (let* ((semantic-lex-c-nested-namespace-ignore-second nil) (tags-actual - (save-excursion - (set-buffer (find-file-noselect (expand-file-name (car fp) semantic-utest-c-test-directory))) + (with-current-buffer + (find-file-noselect (expand-file-name (car fp) semantic-utest-c-test-directory)) (semantic-clear-toplevel-cache) (semantic-fetch-tags))) (tags-expected - (save-excursion - (set-buffer (find-file-noselect (expand-file-name (cdr fp) semantic-utest-c-test-directory))) + (with-current-buffer (find-file-noselect (expand-file-name (cdr fp) semantic-utest-c-test-directory)) (semantic-clear-toplevel-cache) (semantic-fetch-tags)))) (when (or (not tags-expected) (not tags-actual)) diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el index 7303c0ef09..2423e89175 100644 --- a/test/lisp/cedet/semantic-utest.el +++ b/test/lisp/cedet/semantic-utest.el @@ -492,7 +492,7 @@ Pre-fill the buffer with CONTENTS." (set-buffer buff) (setq buffer-offer-save nil) (font-lock-mode -1) ;; Font lock has issues in Emacs 23 - (toggle-read-only -1) ;; In case /tmp doesn't exist. + (read-only-mode -1) ;; In case /tmp doesn't exist (erase-buffer) (insert contents) ;(semantic-fetch-tags) ;JAVE could this go here? @@ -724,29 +724,6 @@ JAVE this thing would need to be recursive to handle java and csharp" (semantic-utest-taglists-equivalent-p table names skipnames) )) -;;;;;;;;;;;;;;;;;;;;;;;; -; JAVE redefine a new validation function -; is not quite as good as the old one yet -(defun semantic-utest-verify-names-jave (name-contents &optional skipnames) - "JAVE version of `semantic-utest-verify-names'. -NAME-CONTENTS is a sample of the tags buffer to test against. -SKIPNAMES is a list of names to remove from NAME-CONTENTS" - (assert (semantic-utest-verify-names-2 name-contents (semantic-fetch-tags)) - nil "failed test") -) - -(defun semantic-utest-verify-names-2 (l1 l2) - (cond ( (and (consp l1) (equal (car l1) 'overlay)) - (overlayp l2)) - ((not (consp l1)) - (equal l1 l2)) - ((consp l1) - (and (semantic-utest-verify-names-2 (car l1) (car l2)) (semantic-utest-verify-names-2 (cdr l1) (cdr l2)))) - (t (error "internal error")))) - - - - ;;; Kill indicator line ;; commit 7446e75b8b6c09e80af3b6b02f44e69e0d2e250d Author: Stefan Monnier Date: Sun Oct 27 17:00:55 2019 -0400 * .gitignore: Don't ignore .rej files Left over rejected hunks that we forgot to merge by hand should not be silently ignored. Better explicitly remove/rename .rej files when done with them. diff --git a/.gitignore b/.gitignore index e75df8b8b6..389fb450d8 100644 --- a/.gitignore +++ b/.gitignore @@ -251,7 +251,6 @@ gnustmp* # Version control and locks. *.orig -*.rej *.swp *~ .#* commit 0e4dd67aae8b10032317a29a6bd99d2d4a64c897 Author: Stefan Monnier Date: Sun Oct 27 13:25:00 2019 -0400 * lisp/emacs-lisp/seq.el: Don't require cl-lib. (seq-subseq): Move cl-subseq's code here instyead of calling it. * lisp/emacs-lisp/cl-extra.el (cl-subseq): Use seq-subseq. diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 3a6def733f..91034de539 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -38,6 +38,7 @@ ;;; Code: (require 'cl-lib) +(require 'seq) ;;; Type coercion. @@ -549,26 +550,7 @@ too large if positive or too small if negative)." (macroexp-let2 nil new new `(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end) ,new))))) - (cond ((or (stringp seq) (vectorp seq)) (substring seq start end)) - ((listp seq) - (let (len - (errtext (format "Bad bounding indices: %s, %s" start end))) - (and end (< end 0) (setq end (+ end (setq len (length seq))))) - (if (< start 0) (setq start (+ start (or len (setq len (length seq)))))) - (unless (>= start 0) - (error "%s" errtext)) - (when (> start 0) - (setq seq (nthcdr (1- start) seq)) - (or seq (error "%s" errtext)) - (setq seq (cdr seq))) - (if end - (let ((res nil)) - (while (and (>= (setq end (1- end)) start) seq) - (push (pop seq) res)) - (or (= (1+ end) start) (error "%s" errtext)) - (nreverse res)) - (copy-sequence seq)))) - (t (error "Unsupported sequence: %s" seq)))) + (seq-subseq seq start end)) ;;;###autoload (defun cl-concatenate (type &rest sequences) diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 918b0dcd39..9a5872c094 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -57,7 +57,6 @@ ;;; Code: (eval-when-compile (require 'cl-generic)) -(require 'cl-lib) ;; for cl-subseq (defmacro seq-doseq (spec &rest body) "Loop over a sequence. @@ -151,7 +150,27 @@ If END is omitted, it defaults to the length of the sequence. If START or END is negative, it counts from the end. Signal an error if START or END are outside of the sequence (i.e too large if positive or too small if negative)." - (cl-subseq sequence start end)) + (cond + ((or (stringp sequence) (vectorp sequence)) (substring sequence start end)) + ((listp sequence) + (let (len + (errtext (format "Bad bounding indices: %s, %s" start end))) + (and end (< end 0) (setq end (+ end (setq len (length sequence))))) + (if (< start 0) (setq start (+ start (or len (setq len (length sequence)))))) + (unless (>= start 0) + (error "%s" errtext)) + (when (> start 0) + (setq sequence (nthcdr (1- start) sequence)) + (or sequence (error "%s" errtext)) + (setq sequence (cdr sequence))) + (if end + (let ((res nil)) + (while (and (>= (setq end (1- end)) start) sequence) + (push (pop sequence) res)) + (or (= (1+ end) start) (error "%s" errtext)) + (nreverse res)) + (copy-sequence sequence)))) + (t (error "Unsupported sequence: %s" sequence)))) (cl-defgeneric seq-map (function sequence) commit 2aaced16866f8b17ee109a0c5682b3896e713f5c Author: Stefan Monnier Date: Sun Oct 27 13:21:21 2019 -0400 * lisp/loadup.el: Load minibuffer after cl-generic This is so minibuffer.el can make use of cl-generic * lisp/minibuffer.el (minibuffer-local-completion-map): Move switch-to-completions bindings here from... * lisp/simple.el (minibuffer-local-completion-map): ... here. diff --git a/lisp/loadup.el b/lisp/loadup.el index e60922e380..0246dc1026 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -195,7 +195,6 @@ (load "emacs-lisp/nadvice") (load "emacs-lisp/cl-preloaded") -(load "minibuffer") ;After loaddefs, for define-minor-mode. (load "obarray") ;abbrev.el is implemented in terms of obarrays. (load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table. (load "simple") @@ -247,6 +246,7 @@ (load "indent") (load "emacs-lisp/cl-generic") +(load "minibuffer") ;Needs cl-generic (and define-minor-mode). (load "frame") (load "startup") (load "term/tty-colors") @@ -390,10 +390,9 @@ lost after dumping"))) (let* ((base (concat "emacs-" emacs-version ".")) (exelen (if (eq system-type 'windows-nt) -4)) (files (file-name-all-completions base default-directory)) - (versions (mapcar (function - (lambda (name) - (string-to-number - (substring name (length base) exelen)))) + (versions (mapcar (lambda (name) + (string-to-number + (substring name (length base) exelen))) files))) (setq emacs-repository-version (ignore-errors (emacs-repository-get-version)) emacs-repository-branch (ignore-errors (emacs-repository-get-branch))) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c92a91e76c..9a8db07819 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2251,6 +2251,8 @@ The completion method is determined by `completion-at-point-functions'." ;; (define-key map "\e\t" 'minibuffer-force-complete) (define-key map " " 'minibuffer-complete-word) (define-key map "?" 'minibuffer-completion-help) + (define-key map [prior] 'switch-to-completions) + (define-key map "\M-v" 'switch-to-completions) map) "Local keymap for minibuffer input with completion.") diff --git a/lisp/simple.el b/lisp/simple.el index 338f3e3fd8..5502cd49aa 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3336,7 +3336,7 @@ to `shell-command-history'." (shell-completion-vars) (set (make-local-variable 'minibuffer-default-add-function) 'minibuffer-default-add-shell-commands)) - (apply 'read-from-minibuffer prompt initial-contents + (apply #'read-from-minibuffer prompt initial-contents minibuffer-local-shell-command-map nil (or hist 'shell-command-history) @@ -8494,10 +8494,7 @@ Called from `temp-buffer-show-hook'." "In this buffer, type \\[choose-completion] to \ select the completion near point.\n\n")))))) -(add-hook 'completion-setup-hook 'completion-setup-function) - -(define-key minibuffer-local-completion-map [prior] 'switch-to-completions) -(define-key minibuffer-local-completion-map "\M-v" 'switch-to-completions) +(add-hook 'completion-setup-hook #'completion-setup-function) (defun switch-to-completions () "Select the completion list window." commit 113ff954dbcd24325bd674b7294d54a7c8394d42 Author: Stephen Gildea Date: Sun Oct 27 08:20:13 2019 -0700 time-stamp-time-zone: update customization * time-stamp.el (time-stamp-time-zone): Support customization with an integer offset (a new possible value of the ZONE argument to format-time-string in Emacs 27). Update the safe-local-variable predicate from string-or-null-p (describing time-stamp-time-zone's domain before 2015) to new predicate time-stamp-zone-type-p (describing the current domain). * time-stamp-tests.el (time-stamp-test-helper-zone-type-p): New test. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 094ef91526..6b1ff3e618 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -109,10 +109,26 @@ Its format is that of the ZONE argument of the `format-time-string' function." :type '(choice (const :tag "Emacs local time" nil) (const :tag "Universal Time" t) (const :tag "system wall clock time" wall) - (string :tag "TZ environment variable value")) + (string :tag "TZ environment variable value") + (list :tag "Offset and name" + (integer :tag "Offset (seconds east of UTC)") + (string :tag "Time zone abbreviation")) + (integer :tag "Offset (seconds east of UTC)")) :group 'time-stamp :version "20.1") -;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p) +;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable 'time-stamp-zone-type-p) + +;;;###autoload +(defun time-stamp-zone-type-p (zone) + "Return whether or not ZONE is of the correct type for a timezone rule. +Valid ZONE values are described in the documentation of `format-time-string'." + (or (memq zone '(nil t wall)) + (stringp zone) + (and (consp zone) + (integerp (car zone)) + (consp (cdr zone)) + (stringp (cadr zone))) + (integerp zone))) ;;; Do not change time-stamp-line-limit, time-stamp-start, ;;; time-stamp-end, time-stamp-pattern, time-stamp-inserts-lines, diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 92df183935..ad2cb0ead7 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -57,6 +57,8 @@ ;;; Tests: +;;; Tests of time-stamp-string formatting + (ert-deftest time-stamp-test-format-day-of-week () "Test time-stamp formats for named day of week." (with-time-stamp-test-env @@ -360,4 +362,21 @@ (should (equal (time-stamp-string "%#3a" ref-time3) "SUN")) (should (equal (time-stamp-string "%#3b" ref-time2) "NOV")))) +;;; Tests of helper functions + +(ert-deftest time-stamp-test-helper-zone-type-p () + "Test time-stamp-zone-type-p." + (should (time-stamp-zone-type-p t)) + (should (time-stamp-zone-type-p nil)) + (should (time-stamp-zone-type-p 'wall)) + (should-not (time-stamp-zone-type-p 'floor)) + (should (time-stamp-zone-type-p "arbitrary string")) + (should (time-stamp-zone-type-p 0)) + (should-not (time-stamp-zone-type-p 3.14)) + (should-not (time-stamp-zone-type-p '(0))) + (should-not (time-stamp-zone-type-p '(0 . "A"))) + (should (time-stamp-zone-type-p '(0 "A"))) + (should-not (time-stamp-zone-type-p '(0 0))) + (should-not (time-stamp-zone-type-p '("A" "A")))) + ;;; time-stamp-tests.el ends here commit fc0f98a8a87ca48b4c3fb0e66d1bd1e2dcc9aa19 Author: Eli Zaretskii Date: Sun Oct 27 17:07:47 2019 +0200 Fix point position after revert-buffer in tabulated-list mode * lisp/emacs-lisp/tabulated-list.el (tabulated-list-print): Don't use count-screen-lines, as it is unreliable when lines are truncated and the region ends before a newline (the root cause is in vertical-motion, but is very hard to fix there). Instead, use vertical-motion directly, as the problems with counting/not counting the newline that ends the region are not relevant to what we need in this function, which is simply the number of the current window line. (Bug#37941) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 66a859f56c..88e79174bf 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -424,7 +424,12 @@ changing `tabulated-list-sort-key'." (setq saved-col (current-column)) (when (eq (window-buffer) (current-buffer)) (setq window-line - (count-screen-lines (window-start) (point))))) + (save-excursion + (save-restriction + (widen) + (narrow-to-region (window-start) (point)) + (goto-char (point-min)) + (vertical-motion (buffer-size))))))) ;; Sort the entries, if necessary. (when sorter (setq entries (sort entries sorter))) commit 1b687e171e542165a260a9416d103a0af201e0c7 Author: João Távora Date: Sun Oct 27 13:20:56 2019 +0000 Optimize lisp/icomplete.el when default completion available Often, when using icomplete with icomplete-show-matches-on-no-input and commands like C-h f, icomplete-exhibit will take a long time (like several seconds) to show all the completions. However, if there is a non-nil default value, like when the C-h f is performed exactly on a function name, the minibuffer prompt will reflect that immediately. If the user immediately presses RE (icomplete-force-complete-and-exit) we take that to mean "use the default" and avoid the long wait. As an extra performance tweak, this commit also removes an unneeded call to icomplete-exhibit in icomplete-minibuffer-setup. * lisp/icomplete.el (icomplete-force-complete-and-exit): Short-circuit possibility of non-nil minibuffer-default. (icomplete-minibuffer-setup): No need to explicitly icomplete-exhibit here since icomplete-post-command-hook will call it unconditionally. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 51f2611c6b..5cd11b125d 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -156,7 +156,7 @@ icompletion is occurring." Use the first of the matches if there are any displayed, and use the default otherwise." (interactive) - (if (or icomplete-show-matches-on-no-input + (if (or (and (not minibuffer-default) icomplete-show-matches-on-no-input) (> (icomplete--field-end) (icomplete--field-beg))) (minibuffer-force-complete-and-exit) (minibuffer-complete-and-exit))) @@ -269,9 +269,7 @@ Usually run by inclusion in `minibuffer-setup-hook'." (current-local-map))) (add-hook 'pre-command-hook #'icomplete-pre-command-hook nil t) (add-hook 'post-command-hook #'icomplete-post-command-hook nil t) - (run-hooks 'icomplete-minibuffer-setup-hook) - (when icomplete-show-matches-on-no-input - (icomplete-exhibit)))) + (run-hooks 'icomplete-minibuffer-setup-hook))) (defvar icomplete--in-region-buffer nil) commit cbd439e785cd1e72c3eae39ed987fda357014bf8 Author: Mattias Engdegård Date: Sun Oct 27 09:54:54 2019 +0100 Expand rx definitions inside (not ...) * lisp/emacs-lisp/rx.el (rx--translate-not): * test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-def-in-not): * doc/lispref/searching.texi (Rx Constructs, Extending Rx): Allow user-defined rx constructs to be expanded inside (not ...) forms, for better composability (bug#37849). diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 5178575a3b..74b15cfc7f 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1214,7 +1214,7 @@ Corresponding string regexp: @samp{[@dots{}]} @item @code{(not @var{charspec})} @cindex @code{not} in rx Match a character not included in @var{charspec}. @var{charspec} can -be an @code{any}, @code{syntax} or @code{category} form, or a +be an @code{any}, @code{not}, @code{syntax} or @code{category} form, or a character class.@* Corresponding string regexp: @samp{[^@dots{}]}, @samp{\S@var{code}}, @samp{\C@var{code}} @@ -1581,7 +1581,7 @@ when they are used, not when they are defined. User-defined forms are allowed wherever arbitrary @code{rx} expressions are expected; for example, in the body of a @code{zero-or-one} form, but not inside @code{any} or @code{category} -forms. +forms. They are also allowed inside @code{not} forms. @end itemize @defmac rx-define name [arglist] rx-form diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index d7677f1444..52a35ffa2a 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -477,6 +477,9 @@ If NEGATED, negate the sense (thus making it positive)." ((eq arg 'word-boundary) (rx--translate-symbol (if negated 'word-boundary 'not-word-boundary))) + ((let ((expanded (rx--expand-def arg))) + (and expanded + (rx--translate-not negated (list expanded))))) (t (error "Illegal argument to rx `not': %S" arg))))) (defun rx--atomic-regexp (item) diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index ef2541d83a..4ecc805aea 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -268,7 +268,9 @@ (should (equal (rx (not (syntax punctuation)) (not (syntax escape))) "\\S.\\S\\")) (should (equal (rx (not (category tone-mark)) (not (category lao))) - "\\C4\\Co"))) + "\\C4\\Co")) + (should (equal (rx (not (not ascii)) (not (not (not (any "a-z"))))) + "[[:ascii:]][^a-z]"))) (ert-deftest rx-group () (should (equal (rx (group nonl) (submatch "x") @@ -404,6 +406,19 @@ (should-error (rx-let-eval '((not-char () "x")) nil)) (should-error (rx-let-eval '((not-char "x")) nil))) +(ert-deftest rx-def-in-not () + "Test definition expansion inside (not ...)." + (rx-let ((a alpha) + (b (not hex)) + (c (not (category base))) + (d (x) (any ?a x ?z)) + (e (x) (syntax x)) + (f (not b))) + (should (equal (rx (not a) (not b) (not c) (not f)) + "[^[:alpha:]][[:xdigit:]]\\c.[^[:xdigit:]]")) + (should (equal (rx (not (d ?m)) (not (e symbol))) + "[^amz]\\S_")))) + (ert-deftest rx-constituents () (let ((rx-constituents (append '((beta . gamma) commit 6e66d9a95c49f867da26ca897635f5e57561d0c7 Author: Michael Albinus Date: Sun Oct 27 09:36:56 2019 +0100 Some Tramp trace improvements * lisp/net/tramp.el (tramp-call-process): `result' can also be nil. * test/lisp/net/tramp-tests.el (tramp--test-timeout-handler): Improve trace format. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 97fcf55301..0dfde734f1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4660,8 +4660,8 @@ are written with verbosity of 6." (setq error (error-message-string err) result 1))) (if (zerop (length error)) - (tramp-message vec 6 "%d\n%s" result output) - (tramp-message vec 6 "%d\n%s\n%s" result output error)) + (tramp-message vec 6 "%s\n%s" result output) + (tramp-message vec 6 "%s\n%s\n%s" result output error)) result)) (defun tramp-call-process-region diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 128d099ac2..c56c7dbbca 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4010,7 +4010,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (let ((proc (get-buffer-process (current-buffer)))) (when (processp proc) (tramp--test-message - "cmd: %s\n%s" (process-command proc) (buffer-string)))) + "cmd: %s\nbuf:\n%s\n---" (process-command proc) (buffer-string)))) (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test))))) (ert-deftest tramp-test29-start-file-process () commit 63fd71cd092de8daded15e32c268215b62c488b9 Author: João Távora Date: Sun Oct 27 01:33:54 2019 +0100 Improve scoring algorithm for flex-style completions The previous algorithm had two problems: it considered non-matches in the beginning and end of the string as matching "holes" and failed to penalize larger holes, making flex-score-match-tightness only effective in some corner cases. The new formula, which is described in code and in pseudo-code in the comments, fixes these problems. As a result, by default, C-h f flex now correctly bubbles up "company-search-flex-regexp" to the top, in front of "file-exists-p". With a flex-score-match-tightness smaller than 1.0, the situation is reversed. * lisp/minibuffer.el (flex-score-match-tightness): Adjust default value. Improve docstring example. (completion-pcm--hilit-commonality): Improve example. Remove unused variable. Improve algorithm. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 542e672400..c92a91e76c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3060,16 +3060,18 @@ PATTERN is as returned by `completion-pcm--string->pattern'." (when (string-match-p regex c) (push c poss))) (nreverse poss)))))) -(defvar flex-score-match-tightness 100 +(defvar flex-score-match-tightness 3 "Controls how the `flex' completion style scores its matches. -Value is a positive number. Values smaller than one make the -scoring formula value matches scattered along the string, while -values greater than one make the formula value tighter matches. -I.e \"foo\" matches both strings \"barbazfoo\" and \"fabrobazo\", -which are of equal length, but only a value greater than one will -score the former (which has one \"hole\") higher than the -latter (which has two).") +Value is a positive number. A number smaller than 1 makes the +scoring formula reward matches scattered along the string, while +a number greater than one make the formula reward matches that +are clumped together. I.e \"foo\" matches both strings +\"fbarbazoo\" and \"fabrobazo\", which are of equal length, but +only a value greater than one will score the former (which has +one large \"hole\" and a clumped-together \"oo\" match) higher +than the latter (which has two \"holes\" and three +one-letter-long matches).") (defun completion-pcm--hilit-commonality (pattern completions) (when completions @@ -3086,27 +3088,39 @@ latter (which has two).") (end (pop md)) (len (length str)) ;; To understand how this works, consider these bad - ;; ascii(tm) diagrams showing how the pattern \"foo\" - ;; flex-matches \"fabrobazo" and - ;; \"barfoobaz\": + ;; ascii(tm) diagrams showing how the pattern "foo" + ;; flex-matches "fabrobazo", "fbarbazoo" and + ;; "barfoobaz": ;; f abr o baz o ;; + --- + --- + + ;; f barbaz oo + ;; + ------ ++ + ;; bar foo baz - ;; --- +++ --- + ;; +++ - ;; Where + indicates parts where the pattern matched, - ;; - where it didn't match. The score is a number + ;; "+" indicates parts where the pattern matched. A + ;; "hole" in the middle of the string is indicated by + ;; "-". Note that there are no "holes" near the edges + ;; of the string. The completion score is a number ;; bound by ]0..1]: the higher the better and only a ;; perfect match (pattern equals string) will have ;; score 1. The formula takes the form of a quotient. ;; For the numerator, we use the number of +, i.e. the ;; length of the pattern. For the denominator, it - ;; sums (1+ (/ (grouplen - 1) - ;; flex-score-match-tightness)) across all groups of - ;; -, sums one to that total, and then multiples by - ;; the length of the string. + ;; first computes + ;; + ;; hole_i_contrib = 1 + (Li-1)^(1/tightness) + ;; + ;; , for each hole "i" of length "Li", where tightness + ;; is given by `flex-score-match-tightness'. The + ;; final value for the denominator is then given by: + ;; + ;; (SUM_across_i(hole_i_contrib) + 1) * len + ;; + ;; , where "len" is the string's length. (score-numerator 0) (score-denominator 0) (last-b 0) @@ -3115,13 +3129,15 @@ latter (which has two).") "Update score variables given match range (A B)." (setq score-numerator (+ score-numerator (- b a))) - (unless (= a last-b) + (unless (or (= a last-b) + (zerop last-b) + (= a (length str))) (setq score-denominator (+ score-denominator 1 - (/ (- a last-b 1) - flex-score-match-tightness - 1.0)))) + (expt (- a last-b 1) + (/ 1.0 + flex-score-match-tightness))))) (setq last-b b)))) (funcall update-score start start) commit f4ee7c83823b7a9369e79dafa70e4fd98633704a Author: Juanma Barranquero Date: Sun Oct 27 02:31:50 2019 +0200 minibuffer.el: Remove leftover code, unused after recent change * lisp/minibuffer.el (completion-pcm--hilit-commonality): Don't set point-idx. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 6a041d1b73..542e672400 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3074,7 +3074,6 @@ latter (which has two).") (defun completion-pcm--hilit-commonality (pattern completions) (when completions (let* ((re (completion-pcm--pattern->regex pattern 'group)) - (point-idx (completion-pcm--pattern-point-idx pattern)) (case-fold-search completion-ignore-case)) (mapcar (lambda (str) commit c6667cc6a958e06fd43fb1ee0e80753adfefa49d Author: Juri Linkov Date: Sun Oct 27 02:20:15 2019 +0300 dired-dwim-target uses most recently visited window instead of next window. * doc/emacs/dired.texi (Operating on Files): Document behavior change. * lisp/dired-aux.el (dired-dwim-target-directories): New function. (dired-dwim-target-directory, dired-dwim-target-defaults): Use it to get the most recently used window instead of the next window (bug#35385). * lisp/dired.el (dired-dwim-target): Doc fix. * test/lisp/dired-tests.el: Remove unnecessary require and pacify byte-compiler. diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 4ada2a8df4..c32255a86d 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -655,8 +655,9 @@ commands, use the same conventions to decide which files to work on. copy and rename files or create links for them, try to guess the default target directory for the operation. Normally, they suggest the Dired buffer's default directory, but if the variable @code{dired-dwim-target} -is non-@code{nil}, and if there is another Dired buffer displayed in the -next window, that other buffer's directory is suggested instead. +is non-@code{nil}, and if there is another Dired buffer displayed in one +of the most recently used windows, that other buffer's directory is +suggested instead. Here are the file-manipulating Dired commands that operate on files. diff --git a/etc/NEWS b/etc/NEWS index ba87496132..bfcb7cf325 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -810,6 +810,15 @@ command itself, not how many files are marked in total. *** A new face, 'dired-special', is used to highlight sockets, named pipes, block devices and character devices. ++++ +*** The new user option 'dired-create-destination-dirs' controls whether +'dired-do-copy' and 'dired-rename-file' should create non-existent +directories in the destination. + ++++ +*** The non-nil value of 'dired-dwim-target' uses one of the most recently +visited windows with a Dired buffer instead of the next window. + ** Find-Dired *** New user option 'find-dired-refine-function'. @@ -1367,13 +1376,6 @@ unescaping text. The maximum level is used by default; customize 'font-lock-maximum-decoration' to tone down the decoration. -** Dired - -+++ -*** The new user option 'dired-create-destination-dirs' controls whether -'dired-do-copy' and 'dired-rename-file' should create non-existent -directories in the destination. - ** Help --- diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index b3ff244362..b1521ecf01 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1977,6 +1977,18 @@ Optional arg HOW-TO determines how to treat the target. #'read-file-name (format prompt (dired-mark-prompt arg files)) dir default)) +(defun dired-dwim-target-directories () + ;; Return directories from all visible windows with dired-mode buffers + ;; ordered by most-recently-used. + (mapcar #'cdr (sort (mapcan (lambda (w) + (with-current-buffer (window-buffer w) + (when (eq major-mode 'dired-mode) + (list (cons (window-use-time w) + (dired-current-directory)))))) + (delq (selected-window) + (window-list-1 nil 'nomini 'visible))) + (lambda (a b) (> (car a) (car b)))))) + (defun dired-dwim-target-directory () ;; Try to guess which target directory the user may want. ;; If there is a dired buffer displayed in one of the next windows, @@ -1985,15 +1997,7 @@ Optional arg HOW-TO determines how to treat the target. (dired-current-directory)))) ;; non-dired buffer may want to profit from this function, e.g. vm-uudecode (if dired-dwim-target - (let* ((other-win (get-window-with-predicate - (lambda (window) - (with-current-buffer (window-buffer window) - (eq major-mode 'dired-mode))))) - (other-dir (and other-win - (with-current-buffer (window-buffer other-win) - (and (eq major-mode 'dired-mode) - (dired-current-directory)))))) - (or other-dir this-dir)) + (or (car (dired-dwim-target-directories)) this-dir) this-dir))) (defun dired-dwim-target-defaults (fn-list target-dir) @@ -2011,15 +2015,11 @@ Optional arg HOW-TO determines how to treat the target. (and (consp fn-list) (null (cdr fn-list)) (car fn-list))) (current-dir (and (eq major-mode 'dired-mode) (dired-current-directory))) - dired-dirs) - ;; Get a list of directories of visible buffers in dired-mode. - (walk-windows (lambda (w) - (with-current-buffer (window-buffer w) - (and (eq major-mode 'dired-mode) - (push (dired-current-directory) dired-dirs))))) + ;; Get a list of directories of visible buffers in dired-mode. + (dired-dirs (dired-dwim-target-directories))) ;; Force the current dir to be the first in the list. (setq dired-dirs - (delete-dups (delq nil (cons current-dir (nreverse dired-dirs))))) + (delete-dups (delq nil (cons current-dir dired-dirs)))) ;; Remove the target dir (if specified) or the current dir from ;; default values, because it should be already in initial input. (setq dired-dirs (delete (or target-dir current-dir) dired-dirs)) diff --git a/lisp/dired.el b/lisp/dired.el index 1d085e010f..e50108fdb9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -185,9 +185,9 @@ If a character, new links are unconditionally marked with that character." (defcustom dired-dwim-target nil "If non-nil, Dired tries to guess a default target directory. -This means: if there is a Dired buffer displayed in the next -window, use its current directory, instead of this Dired buffer's -current directory. +This means: if there is a Dired buffer displayed in one of the most +recently selected windows, use its current directory, instead of this +Dired buffer's current directory. The target is used in the prompt for file copy, rename etc." :type 'boolean diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 71ffcdd545..c4728e7a06 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -20,7 +20,6 @@ ;;; Code: (require 'ert) (require 'dired) -(require 'nadvice) (ert-deftest dired-autoload () "Tests to see whether dired-x has been autoloaded" @@ -54,7 +53,7 @@ (when (buffer-live-p buf) (kill-buffer buf))) (delete-directory dir 'recursive)))) -(defvar dired-dwim-target) +(defvar dired-query) (ert-deftest dired-test-bug25609 () "Test for https://debbugs.gnu.org/25609 ." (let* ((from (make-temp-file "foo" 'dir)) commit 1660f5875c6022ba4f342a53efadfc4d2deb150a Author: Juri Linkov Date: Sun Oct 27 01:38:32 2019 +0300 Customizable tab-line-tabs-function and new buffer-local tab-line-mode. * lisp/tab-line.el (tab-line-tabs-function): Turn defvar into defcustom with default of tab-line-tabs-window-buffers. (tab-line-tabs-mode-buffers): New function. (tab-line-tabs-window-buffers): Rename from tab-line-tabs. (tab-line-select-tab, tab-line-switch-to-prev-tab) (tab-line-switch-to-next-tab): Handle the value tab-line-tabs-window-buffers of tab-line-tabs-function specially. (tab-line-mode): Rename from global-tab-line-mode and change scope to buffer-local. (global-tab-line-mode): New globalized-minor-mode. (tab-line-mode--turn-on): New function. (tab-line-exclude-modes): New defcustom. (tab-line-exclude): New buffer-local variable. https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00988.html * lisp/dired.el (dired-mark-pop-up): Set tab-line-exclude to nil. Don't set tab-line-format. (Bug#37699) * lisp/speedbar.el (speedbar-mode): Set tab-line-exclude to nil. Don't set tab-line-format. diff --git a/lisp/dired.el b/lisp/dired.el index 75dfbc4b9a..1d085e010f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3437,7 +3437,7 @@ argument or confirmation)." (if (eq (car files) t) (cdr files) files)) (remove-text-properties (point-min) (point-max) '(mouse-face nil help-echo nil)) - (setq tab-line-format nil)))))) + (setq tab-line-exclude nil)))))) (defun dired-format-columns-of-files (files) (let ((beg (point))) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index c489d18ce1..961a1571c7 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -1080,7 +1080,7 @@ in the selected file. dframe-mouse-click-function #'speedbar-click dframe-mouse-position-function #'speedbar-position-cursor-on-line) (setq-local tab-bar-mode nil) - (setq-local tab-line-format nil)) + (setq tab-line-exclude nil)) speedbar-buffer) (define-obsolete-function-alias 'speedbar-message 'dframe-message "24.4") diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 7dc6e2b6d0..cfb4223bd2 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -247,13 +247,37 @@ Reduce tab width proportionally to space taken by other tabs." "Maximum number of buffer tabs displayed in the tab line. If nil, no limit.") -(defvar tab-line-tabs-function #'tab-line-tabs +(defcustom tab-line-tabs-function #'tab-line-tabs-window-buffers "Function to get a list of tabs to display in the tab line. This function should return either a list of buffers whose names will be displayed, or just a list of strings to display in the tab line. -By default, use function `tab-line-tabs'.") +By default, use function `tab-line-tabs-window-buffers' that +returns a list of buffers associated with the selected window. +When `tab-line-tabs-mode-buffers', return a list of buffers +with the same major mode as the current buffer." + :type '(choice (const :tag "Window buffers" + tab-line-tabs-window-buffers) + (const :tag "Same mode buffers" + tab-line-tabs-mode-buffers) + (function :tag "Function")) + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-line + :version "27.1") -(defun tab-line-tabs () +(defun tab-line-tabs-mode-buffers () + "Return a list of buffers with the same major mode with current buffer." + (let* ((window (selected-window)) + (buffer (window-buffer window)) + (mode (with-current-buffer buffer major-mode))) + (seq-sort-by #'buffer-name #'string< + (seq-filter (lambda (b) (with-current-buffer b + (derived-mode-p mode))) + (buffer-list))))) + +(defun tab-line-tabs-window-buffers () "Return a list of tabs that should be displayed in the tab line. By default returns a list of window buffers, i.e. buffers previously shown in the same window where the tab line is displayed. @@ -383,10 +407,12 @@ using the `previous-buffer' command." ;; Remove next-buffers from prev-buffers (prev-buffers (seq-difference prev-buffers next-buffers))) (cond - ((memq buffer next-buffers) + ((and (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (memq buffer next-buffers)) (dotimes (_ (1+ (seq-position next-buffers buffer))) (switch-to-next-buffer window))) - ((memq buffer prev-buffers) + ((and (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (memq buffer prev-buffers)) (dotimes (_ (1+ (seq-position prev-buffers buffer))) (switch-to-prev-buffer window))) (t @@ -398,16 +424,26 @@ using the `previous-buffer' command." Its effect is the same as using the `previous-buffer' command (\\[previous-buffer])." (interactive (list last-nonmenu-event)) - (switch-to-prev-buffer - (and (listp mouse-event) (posn-window (event-start mouse-event))))) + (let ((window (and (listp mouse-event) (posn-window (event-start mouse-event))))) + (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (switch-to-prev-buffer window) + (with-selected-window (or window (selected-window)) + (let ((buffer (cadr (memq (current-buffer) + (reverse (funcall tab-line-tabs-function)))))) + (when buffer (switch-to-buffer buffer))))))) (defun tab-line-switch-to-next-tab (&optional mouse-event) "Switch to the next tab. Its effect is the same as using the `next-buffer' command (\\[next-buffer])." (interactive (list last-nonmenu-event)) - (switch-to-next-buffer - (and (listp mouse-event) (posn-window (event-start mouse-event))))) + (let ((window (and (listp mouse-event) (posn-window (event-start mouse-event))))) + (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) + (switch-to-next-buffer window) + (with-selected-window (or window (selected-window)) + (let ((buffer (cadr (memq (current-buffer) + (funcall tab-line-tabs-function))))) + (when buffer (switch-to-buffer buffer))))))) (defcustom tab-line-close-tab-action 'bury-buffer @@ -443,14 +479,37 @@ from the tab line." ;;;###autoload -(define-minor-mode global-tab-line-mode - "Display window-local tab line." +(define-minor-mode tab-line-mode + "Toggle display of window tab line in the buffer." + :lighter nil + (setq tab-line-format (when tab-line-mode '(:eval (tab-line-format))))) + +(defcustom tab-line-exclude-modes + '(completion-list-mode) + "List of major modes in which the tab line is not enabled." + :type '(repeat symbol) + :group 'tab-line + :version "27.1") + +;;;###autoload +(defvar tab-line-exclude nil) +;;;###autoload +(make-variable-buffer-local 'tab-line-exclude) + +(defun tab-line-mode--turn-on () + "Turn on `tab-line-mode'." + (unless (or (minibufferp) + (string-match-p "\\` " (buffer-name)) + (memq major-mode tab-line-exclude-modes) + (get major-mode 'tab-line-exclude) + (buffer-local-value 'tab-line-exclude (current-buffer))) + (tab-line-mode 1))) + +;;;###autoload +(define-globalized-minor-mode global-tab-line-mode + tab-line-mode tab-line-mode--turn-on :group 'tab-line - :type 'boolean - :global t - :init-value nil - (setq-default tab-line-format (when global-tab-line-mode - '(:eval (tab-line-format))))) + :version "27.1") (global-set-key [tab-line mouse-4] 'tab-line-hscroll-left) commit 5a9a01797b4dad36b81ebfa83eebf96d27a2f395 Author: Juri Linkov Date: Sun Oct 27 01:16:10 2019 +0300 * lisp/tab-bar.el (tab-bar-switch-to-recent-tab): New command. (tab-recent): Alias to tab-bar-switch-to-recent-tab. (tab-bar--tab-index-recent): New internal function. (tab-bar-close-tab-select): Add new default option 'recent'. (tab-bar-close-tab): Handle it. * lisp/emacs-lisp/seq.el (seq-sort-by, seq-remove): Add autoload. diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 8d4093004a..918b0dcd39 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -237,6 +237,7 @@ The result is a sequence of the same type as SEQUENCE." (cl-defmethod seq-sort (pred (list list)) (sort (seq-copy list) pred)) +;;;###autoload (defun seq-sort-by (function pred sequence) "Sort SEQUENCE using PRED as a comparison function. Elements of SEQUENCE are transformed by FUNCTION before being @@ -295,6 +296,7 @@ list." exclude)) sequence)))) +;;;###autoload (cl-defgeneric seq-remove (pred sequence) "Return a list of all the elements for which (PRED element) is nil in SEQUENCE." (seq-filter (lambda (elt) (not (funcall pred elt))) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index f7b0f26113..2b71bf8b2c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -458,6 +458,16 @@ Return its existing value or a new value." (seq-position (or tabs (funcall tab-bar-tabs-function)) name (lambda (a b) (equal (cdr (assq 'name a)) b)))) +(defun tab-bar--tab-index-recent (nth &optional tabs) + (let* ((tabs (or tabs (funcall tab-bar-tabs-function))) + (sorted-tabs + (seq-sort-by (lambda (tab) (cdr (assq 'time tab))) #'> + (seq-remove (lambda (tab) + (eq (car tab) 'current-tab)) + tabs))) + (tab (nth (1- nth) sorted-tabs))) + (tab-bar--tab-index tab tabs))) + (defun tab-bar-select-tab (&optional arg) "Switch to the tab by its absolute position ARG in the tab bar. @@ -514,6 +524,16 @@ to the numeric argument. ARG counts from 1." (setq arg 1)) (tab-bar-switch-to-next-tab (- arg))) +(defun tab-bar-switch-to-recent-tab (&optional arg) + "Switch to ARGth most recently visited tab." + (interactive "p") + (unless (integerp arg) + (setq arg 1)) + (let ((tab-index (tab-bar--tab-index-recent arg))) + (if tab-index + (tab-bar-select-tab (1+ tab-index)) + (message "No more recent tabs")))) + (defun tab-bar-switch-to-tab (name) "Switch to the tab by NAME." (interactive (list (completing-read "Switch to tab by name: " @@ -626,12 +646,14 @@ If ARG is zero, create a new tab in place of the current tab." (defvar tab-bar-closed-tabs nil "A list of closed tabs to be able to undo their closing.") -(defcustom tab-bar-close-tab-select 'right +(defcustom tab-bar-close-tab-select 'recent "Defines what tab to select after closing the specified tab. If `left', select the adjacent left tab. -If `right', select the adjacent right tab." +If `right', select the adjacent right tab. +If `recent', select the most recently visited tab." :type '(choice (const :tag "Select left tab" left) - (const :tag "Select right tab" right)) + (const :tag "Select right tab" right) + (const :tag "Select recent tab" recent)) :group 'tab-bar :version "27.1") @@ -682,7 +704,8 @@ TO-INDEX counts from 1." ('left (1- current-index)) ('right (if (> (length tabs) (1+ current-index)) (1+ current-index) - (1- current-index))))))) + (1- current-index))) + ('recent (tab-bar--tab-index-recent 1 tabs)))))) (setq to-index (max 0 (min (or to-index 0) (1- (length tabs))))) (tab-bar-select-tab (1+ to-index)) ;; Re-read tabs after selecting another tab @@ -819,6 +842,7 @@ function `tab-bar-tab-name-function'." (defalias 'tab-select 'tab-bar-select-tab) (defalias 'tab-next 'tab-bar-switch-to-next-tab) (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) +(defalias 'tab-recent 'tab-bar-switch-to-recent-tab) (defalias 'tab-move 'tab-bar-move-tab) (defalias 'tab-move-to 'tab-bar-move-tab-to) (defalias 'tab-rename 'tab-bar-rename-tab) commit 802dc5d4dcf899371cd1bacd06eeef8c15129fd4 Author: Juri Linkov Date: Sun Oct 27 00:57:04 2019 +0300 * lisp/tab-bar.el (tab-bar-move-tab-to): Add force-mode-line-update. (tab-bar-close-last-tab-choice, tab-bar-close-tab): Adjust option names. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index d664774b6c..f7b0f26113 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -536,7 +536,8 @@ FROM-INDEX and TO-INDEX count from 1." (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) (setq tabs (delq from-tab tabs)) (cl-pushnew from-tab (nthcdr to-index tabs)) - (set-frame-parameter nil 'tabs tabs))) + (set-frame-parameter nil 'tabs tabs) + (force-mode-line-update))) (defun tab-bar-move-tab (&optional arg) "Move the current tab ARG positions to the right. @@ -637,12 +638,12 @@ If `right', select the adjacent right tab." (defcustom tab-bar-close-last-tab-choice nil "Defines what to do when the last tab is closed. If nil, do nothing and show a message, like closing the last window or frame. -If `close-frame', delete the containing frame, as a web browser would do. -If `disable-tab-bar', disable tab-bar-mode so that tabs no longer show in the frame. +If `delete-frame', delete the containing frame, as a web browser would do. +If `tab-bar-mode-disable', disable tab-bar-mode so that tabs no longer show in the frame. If the value is a function, call that function with the tab to be closed as an argument." :type '(choice (const :tag "Do nothing and show message" nil) - (const :tag "Delete the containing frame" close-frame) - (const :tag "Disable tab-bar-mode" disable-tab-bar) + (const :tag "Close the containing frame" delete-frame) + (const :tag "Disable tab-bar-mode" tab-bar-mode-disable) (function :tag "Function")) :group 'tab-bar :version "27.1") @@ -661,20 +662,21 @@ TO-INDEX counts from 1." (current-index (tab-bar--current-tab-index tabs)) (close-index (if (integerp arg) (1- arg) current-index))) (if (= 1 (length tabs)) - (pcase tab-bar-close-last-tab-choice - ('nil - (signal 'user-error '("Attempt to delete the sole tab in a frame"))) - ('close-frame - (delete-frame)) - ('disable-tab-bar - (tab-bar-mode -1)) - ((pred functionp) - ;; Give the handler function the full extent of the tab's - ;; data, not just it's name and explicit-name flag. - (funcall tab-bar-close-last-tab-choice (tab-bar--tab)))) - - ;;; More than one tab still open + (pcase tab-bar-close-last-tab-choice + ('nil + (signal 'user-error '("Attempt to delete the sole tab in a frame"))) + ('delete-frame + (delete-frame)) + ('tab-bar-mode-disable + (tab-bar-mode -1)) + ((pred functionp) + ;; Give the handler function the full extent of the tab's + ;; data, not just it's name and explicit-name flag. + (funcall tab-bar-close-last-tab-choice (tab-bar--tab)))) + + ;; More than one tab still open (when (eq current-index close-index) + ;; Select another tab before deleting the current tab (let ((to-index (or (if to-index (1- to-index)) (pcase tab-bar-close-tab-select ('left (1- current-index)) commit 6d2ea60ca874f04c37527b21355f81a2b140d405 Author: Robert Cochran Date: Wed Oct 23 17:34:24 2019 -0700 Add customization option for what do when the last tab is closed * lisp/tab-bar.el (tab-bar-close-last-tab-choice): New custom variable. (tab-bar-close-tab): Handle closing the last tab specially, referring to tab-bar-close-last-tab-choice. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 617057cf46..d664774b6c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -634,6 +634,19 @@ If `right', select the adjacent right tab." :group 'tab-bar :version "27.1") +(defcustom tab-bar-close-last-tab-choice nil + "Defines what to do when the last tab is closed. +If nil, do nothing and show a message, like closing the last window or frame. +If `close-frame', delete the containing frame, as a web browser would do. +If `disable-tab-bar', disable tab-bar-mode so that tabs no longer show in the frame. +If the value is a function, call that function with the tab to be closed as an argument." + :type '(choice (const :tag "Do nothing and show message" nil) + (const :tag "Delete the containing frame" close-frame) + (const :tag "Disable tab-bar-mode" disable-tab-bar) + (function :tag "Function")) + :group 'tab-bar + :version "27.1") + (defun tab-bar-close-tab (&optional arg to-index) "Close the tab specified by its absolute position ARG. If no ARG is specified, then close the current tab and switch @@ -647,38 +660,49 @@ TO-INDEX counts from 1." (let* ((tabs (funcall tab-bar-tabs-function)) (current-index (tab-bar--current-tab-index tabs)) (close-index (if (integerp arg) (1- arg) current-index))) + (if (= 1 (length tabs)) + (pcase tab-bar-close-last-tab-choice + ('nil + (signal 'user-error '("Attempt to delete the sole tab in a frame"))) + ('close-frame + (delete-frame)) + ('disable-tab-bar + (tab-bar-mode -1)) + ((pred functionp) + ;; Give the handler function the full extent of the tab's + ;; data, not just it's name and explicit-name flag. + (funcall tab-bar-close-last-tab-choice (tab-bar--tab)))) + + ;;; More than one tab still open + (when (eq current-index close-index) + (let ((to-index (or (if to-index (1- to-index)) + (pcase tab-bar-close-tab-select + ('left (1- current-index)) + ('right (if (> (length tabs) (1+ current-index)) + (1+ current-index) + (1- current-index))))))) + (setq to-index (max 0 (min (or to-index 0) (1- (length tabs))))) + (tab-bar-select-tab (1+ to-index)) + ;; Re-read tabs after selecting another tab + (setq tabs (funcall tab-bar-tabs-function)))) + + (let ((close-tab (nth close-index tabs))) + (push `((frame . ,(selected-frame)) + (index . ,close-index) + (tab . ,(if (eq (car close-tab) 'current-tab) + (tab-bar--tab) + close-tab))) + tab-bar-closed-tabs) + (set-frame-parameter nil 'tabs (delq close-tab tabs))) - ;; Select another tab before deleting the current tab - (when (eq current-index close-index) - (let ((to-index (or (if to-index (1- to-index)) - (pcase tab-bar-close-tab-select - ('left (1- current-index)) - ('right (if (> (length tabs) (1+ current-index)) - (1+ current-index) - (1- current-index))))))) - (setq to-index (max 0 (min (or to-index 0) (1- (length tabs))))) - (tab-bar-select-tab (1+ to-index)) - ;; Re-read tabs after selecting another tab - (setq tabs (funcall tab-bar-tabs-function)))) - - (let ((close-tab (nth close-index tabs))) - (push `((frame . ,(selected-frame)) - (index . ,close-index) - (tab . ,(if (eq (car close-tab) 'current-tab) - (tab-bar--tab) - close-tab))) - tab-bar-closed-tabs) - (set-frame-parameter nil 'tabs (delq close-tab tabs))) - - (when (and tab-bar-mode - (or (<= (length tabs) 1) ; closed the last tab - (and (natnump tab-bar-show) - (<= (length tabs) tab-bar-show)))) - (tab-bar-mode -1)) + (when (and tab-bar-mode + (and (natnump tab-bar-show) + (<= (length tabs) tab-bar-show))) + (tab-bar-mode -1)) - (force-mode-line-update) - (unless tab-bar-mode - (message "Deleted tab and switched to %s" tab-bar-close-tab-select)))) + (force-mode-line-update) + (unless tab-bar-mode + (message "Deleted tab and switched to %s" tab-bar-close-tab-select))))) (defun tab-bar-close-tab-by-name (name) "Close the tab by NAME." commit f247599e167d34be93badd693a8b4de15daa0a8e Author: Stephen Gildea Date: Sat Oct 26 14:31:22 2019 -0700 time-stamp-tests: add name prefix to tests of formatting * time-stamp-tests.el: rename all the time-stamp-string formatting tests to have the word "format" in their name, to make room in the namespace for other, future tests. diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index d01d37a664..92df183935 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -57,7 +57,7 @@ ;;; Tests: -(ert-deftest time-stamp-test-day-of-week () +(ert-deftest time-stamp-test-format-day-of-week () "Test time-stamp formats for named day of week." (with-time-stamp-test-env ;; implemented and documented since 1997 @@ -76,7 +76,7 @@ (should (equal (time-stamp-string "%^a" ref-time1) "MON")) (should (equal (time-stamp-string "%A" ref-time1) "Monday")))) -(ert-deftest time-stamp-test-month-name () +(ert-deftest time-stamp-test-format-month-name () "Test time-stamp formats for month name." (with-time-stamp-test-env ;; implemented and documented since 1997 @@ -95,7 +95,7 @@ (should (equal (time-stamp-string "%^b" ref-time1) "JAN")) (should (equal (time-stamp-string "%B" ref-time1) "January")))) -(ert-deftest time-stamp-test-day-of-month () +(ert-deftest time-stamp-test-format-day-of-month () "Test time-stamp formats for day of month." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -118,7 +118,7 @@ (should (equal (time-stamp-string "%d" ref-time1) "02")) (should (equal (time-stamp-string "%d" ref-time2) "18")))) -(ert-deftest time-stamp-test-hours-24 () +(ert-deftest time-stamp-test-format-hours-24 () "Test time-stamp formats for hour on a 24-hour clock." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -148,7 +148,7 @@ (should (equal (time-stamp-string "%H" ref-time2) "12")) (should (equal (time-stamp-string "%H" ref-time3) "06")))) -(ert-deftest time-stamp-test-hours-12 () +(ert-deftest time-stamp-test-format-hours-12 () "Test time-stamp formats for hour on a 12-hour clock." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -178,7 +178,7 @@ (should (equal (time-stamp-string "%I" ref-time2) "12")) (should (equal (time-stamp-string "%I" ref-time3) "06")))) -(ert-deftest time-stamp-test-month-number () +(ert-deftest time-stamp-test-format-month-number () "Test time-stamp formats for month number." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -201,7 +201,7 @@ (should (equal (time-stamp-string "%m" ref-time1) "01")) (should (equal (time-stamp-string "%m" ref-time2) "11")))) -(ert-deftest time-stamp-test-minute () +(ert-deftest time-stamp-test-format-minute () "Test time-stamp formats for minute." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -224,7 +224,7 @@ (should (equal (time-stamp-string "%M" ref-time1) "04")) (should (equal (time-stamp-string "%M" ref-time2) "14")))) -(ert-deftest time-stamp-test-second () +(ert-deftest time-stamp-test-format-second () "Test time-stamp formats for second." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -247,7 +247,7 @@ (should (equal (time-stamp-string "%S" ref-time1) "05")) (should (equal (time-stamp-string "%S" ref-time2) "15")))) -(ert-deftest time-stamp-test-year-2digit () +(ert-deftest time-stamp-test-format-year-2digit () "Test time-stamp formats for %y." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -272,13 +272,13 @@ (time-stamp-should-warn (equal (time-stamp-string "%4y" ref-time1) "2006")))) -(ert-deftest time-stamp-test-year-4digit () +(ert-deftest time-stamp-test-format-year-4digit () "Test time-stamp format %Y." (with-time-stamp-test-env ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%Y" ref-time1) "2006")))) -(ert-deftest time-stamp-test-am-pm () +(ert-deftest time-stamp-test-format-am-pm () "Test time-stamp formats for AM and PM strings." (with-time-stamp-test-env ;; implemented and documented since 1997 @@ -290,14 +290,14 @@ (should (equal (time-stamp-string "%p" ref-time1) "PM")) (should (equal (time-stamp-string "%p" ref-time3) "AM")))) -(ert-deftest time-stamp-test-day-number-in-week () +(ert-deftest time-stamp-test-format-day-number-in-week () "Test time-stamp formats for day number in week." (with-time-stamp-test-env (should (equal (time-stamp-string "%w" ref-time1) "1")) (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) -(ert-deftest time-stamp-test-time-zone () +(ert-deftest time-stamp-test-format-time-zone () "Test time-stamp formats for time zone." (with-time-stamp-test-env (let ((UTC-abbr (format-time-string "%Z" ref-time1 t)) @@ -309,7 +309,7 @@ ;; implemented since 1997, documented since 2019 (should (equal (time-stamp-string "%#Z" ref-time1) utc-abbr))))) -(ert-deftest time-stamp-test-non-date-conversions () +(ert-deftest time-stamp-test-format-non-date-conversions () "Test time-stamp formats for non-date items." (with-time-stamp-test-env ;; implemented and documented since 1995 @@ -333,7 +333,7 @@ (should (equal (time-stamp-string "%q" ref-time1) "test-system-name")))) -(ert-deftest time-stamp-test-ignored-modifiers () +(ert-deftest time-stamp-test-format-ignored-modifiers () "Test additional args allowed (but ignored) to allow for future expansion." (with-time-stamp-test-env ;; allowed modifiers @@ -341,12 +341,12 @@ ;; not all punctuation is allowed (should-not (equal (time-stamp-string "%&P" ref-time3) "AM")))) -(ert-deftest time-stamp-test-non-conversions () +(ert-deftest time-stamp-test-format-non-conversions () "Test that without a %, the text is copied literally." (with-time-stamp-test-env (should (equal (time-stamp-string "No percent" ref-time1) "No percent")))) -(ert-deftest time-stamp-test-string-width () +(ert-deftest time-stamp-test-format-string-width () "Test time-stamp string width modifiers." (with-time-stamp-test-env ;; strings truncate on the right or are blank-padded on the left commit 54477c6177a25c1c96b6de06c7049a3d204f276b Author: João Távora Date: Sat Oct 26 21:47:36 2019 +0100 Restore default value of face completions-common-part The previous commit titled "Rework face hints for partial-string completion styles" contained a potentially controversial backwards-incompatible change to this face's default value. * lisp/minibuffer.el (completions-common-part): Restore empty default value. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e7d081eaeb..6a041d1b73 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1687,11 +1687,12 @@ See also `display-completion-list'.") "Face for the first uncommon character in prefix completions. See also the face `completions-common-part'.") -(defface completions-common-part '((t (:inherit underline))) - "Face for parts of completions matching a pattern. -You can use it to make the common parts less visible than normal, -so that the differing parts are emphasized by contrast. See also -the face `completions-first-difference'.") +(defface completions-common-part '((t nil)) + "Face for the common prefix substring in completions. +The idea of this face is that you can use it to make the common parts +less visible than normal, so that the differing parts are emphasized +by contrast. +See also the face `completions-first-difference'.") (defun completion-hilit-commonality (completions prefix-len &optional base-size) "Apply font-lock highlighting to a list of completions, COMPLETIONS. commit 75b9f4652bad2f408a45a51bc1bbff8bc70d3552 Author: Arash Esbati Date: Sat Oct 26 13:29:14 2019 +0200 Improve support for biblatex and cleveref macros * lisp/textmodes/reftex-cite.el (reftex-figure-out-cite-format): Extend regexp to match additional cite commands from biblatex.sty. * lisp/textmodes/reftex-dcr.el (reftex-view-crossref): Extend regexp to match additional cite commands from biblatex.sty and reference commands from cleveref.sty. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 9d45f9aba7..79f1913c9f 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -763,7 +763,10 @@ in order to only add another reference in the same cite command." (setq format "%l")) ((and (stringp macro) - (string-match "\\`\\\\cite\\|cite\\'" macro)) + ;; Match also commands from biblatex ending with `s' + ;; (\parencites) or `*' (\parencite*) and `texts?' + ;; (\footcitetext and \footcitetexts). + (string-match "\\`\\\\cite\\|cite\\([s*]\\|texts?\\)?\\'" macro)) ;; We are already inside a cite macro (if (or (not arg) (not (listp arg))) (setq format diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el index 8973e5dc1a..95a33077c7 100644 --- a/lisp/textmodes/reftex-dcr.el +++ b/lisp/textmodes/reftex-dcr.el @@ -60,11 +60,15 @@ to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'." (setq reftex-call-back-to-this-buffer (current-buffer)) (cond - ((string-match "\\`\\\\cite\\|cite\\*?\\'\\|bibentry" macro) - ;; A citation macro: search for bibitems or BibTeX entries + ((string-match "\\`\\\\cite\\|cite\\([s*]\\|texts?\\)?\\'\\|bibentry" macro) + ;; A citation macro: search for bibitems or BibTeX entries. + ;; Match also commands from biblatex ending with `s' + ;; (\parencites) or `*' (\parencite*) and `texts?' + ;; (\footcitetext and \footcitetexts). (setq dw (reftex-view-cr-cite arg key auto-how))) - ((string-match "\\`\\\\ref\\|ref\\(range\\)?\\*?\\'" macro) - ;; A reference macro: search for labels + ((string-match "\\`\\\\ref\\|ref\\(range\\|s\\)?\\*?\\'" macro) + ;; A reference macro: search for labels. + ;; Match also commands from cleveref ending with `s' (\namecrefs). (setq dw (reftex-view-cr-ref arg key auto-how))) (auto-how nil) ;; No further action for automatic display (speed) ((or (equal macro "\\label") commit 368e88b8cbeceaac898f5d6793257378866c99c8 Author: Arash Esbati Date: Sat Oct 26 13:25:19 2019 +0200 Avoid infloop's by doing a case-sensitive match * lisp/textmodes/reftex-ref.el (reftex-format-special): Be case-sensitive when checking the actual reference macro against \ref. This avoids infloop when \Ref is chosen. diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index 3ec96aa67d..fd47514d69 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el @@ -841,7 +841,8 @@ Replace any occurrences of \"\\ref\" with REFSTYLE." ;; Replace instances of \ref in `fmt' with the special reference ;; style selected by the user. (cond - ((while (string-match "\\(\\\\ref\\)[ \t]*{" fmt) + ((while (let ((case-fold-search nil)) + (string-match "\\(\\\\ref\\)[ \t]*{" fmt)) (setq fmt (replace-match refstyle t t fmt 1)))) ((string-match "\\(\\\\[[:alpha:]]+\\)[ \t]*{" fmt) (setq fmt (replace-match refstyle t t fmt 1)))) commit 5fcb8d8ba08a3f153064cd1346662e716da41546 Author: Eli Zaretskii Date: Sat Oct 26 21:25:46 2019 +0300 ; * etc/NEWS: Fix entry about map.el's 'type' argument. (Bug#37936) diff --git a/etc/NEWS b/etc/NEWS index 2528c6161a..ba87496132 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -702,7 +702,7 @@ at the end of the active minibuffer. *** New generic function 'map-insert'. +++ -** The 'type' arg can be a list '(hash-table :key1 VAL1 :key2 VAL2 ...)' +*** The 'type' arg can be a list '(hash-table :key1 VAL1 :key2 VAL2 ...)' ** seq.el New convenience functions 'seq-first' and 'seq-rest' give easy access commit 8ea63ecdd9b76fbe074bcd6b97ee8400667455a4 Merge: 045bcdb7c4 55dcd32ad2 Author: Glenn Morris Date: Sat Oct 26 09:55:12 2019 -0700 Merge from origin/emacs-26 55dcd32 (origin/emacs-26) Fix rcirc not to interpret nil as nickname ... commit 045bcdb7c410d4ee7cda1766c76e8bf7df3bf82f Merge: 6624fc4bab bd0f173199 Author: Glenn Morris Date: Sat Oct 26 09:55:12 2019 -0700 ; Merge from origin/emacs-26 The following commit was skipped: bd0f173 Fix trig simplification crash (bug#33052) commit 6624fc4bab44728ca996e6939bd3627d5d509b73 Merge: 3d7d926e04 73e1727c40 Author: Glenn Morris Date: Sat Oct 26 09:55:12 2019 -0700 Merge from origin/emacs-26 73e1727 Fix linear equation system solving in Calc (bug#35374) # Conflicts: # test/lisp/calc/calc-tests.el commit 3d7d926e04ed1aa8ccd7f636194ee8cd27ea580a Merge: da0f8dbf8f bba9757a1f Author: Glenn Morris Date: Sat Oct 26 09:53:42 2019 -0700 ; Merge from origin/emacs-26 The following commit was skipped: bba9757 Backport: Fix an assignment to free variable warning commit da0f8dbf8fea53da65d1990b3f9f235e4fe3f9e0 Author: João Távora Date: Sat Oct 26 14:31:38 2019 +0100 Rework face hints for partial-string completion styles Don't use completions-first-difference for the 'substring', 'flex' and 'partial-completion' styles, since there can be really no reasonable definition of a "first" difference there. Make completions-common-part inherit from 'underline' so that it is useful by default for all completion styles. * lisp/minibuffer.el (completions-common-part): Adjust description and change default value. (completions-first-difference): Ajust docstring. (completion-pcm--hilit-commonality): Don't use completions-first-difference. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index b61b366a57..e7d081eaeb 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1684,15 +1684,14 @@ See also `display-completion-list'.") (defface completions-first-difference '((t (:inherit bold))) - "Face for the first uncommon character in completions. + "Face for the first uncommon character in prefix completions. See also the face `completions-common-part'.") -(defface completions-common-part '((t nil)) - "Face for the common prefix substring in completions. -The idea of this face is that you can use it to make the common parts -less visible than normal, so that the differing parts are emphasized -by contrast. -See also the face `completions-first-difference'.") +(defface completions-common-part '((t (:inherit underline))) + "Face for parts of completions matching a pattern. +You can use it to make the common parts less visible than normal, +so that the differing parts are emphasized by contrast. See also +the face `completions-first-difference'.") (defun completion-hilit-commonality (completions prefix-len &optional base-size) "Apply font-lock highlighting to a list of completions, COMPLETIONS. @@ -3082,8 +3081,7 @@ latter (which has two).") (setq str (copy-sequence str)) (unless (string-match re str) (error "Internal error: %s does not match %s" re str)) - (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0))) - (md (match-data)) + (let* ((md (match-data)) (start (pop md)) (end (pop md)) (len (length str)) @@ -3137,10 +3135,6 @@ latter (which has two).") (put-text-property start end 'font-lock-face 'completions-common-part str) - (if (> (length str) pos) - (put-text-property pos (1+ pos) - 'font-lock-face 'completions-first-difference - str)) (unless (zerop (length str)) (put-text-property 0 1 'completion-score commit e21a1da8dc14c1e54a12c669255cc5496983e54e Author: João Távora Date: Sat Oct 26 14:13:08 2019 +0100 Allow completion styles to adjust completion metadata This commit re-does the now-reverted commit with the same title. That version relied on generic functions, which cannot be used yet in files such as lisp/minibuffer.el. This version uses a symbol property completion--adjust-metadata instead. The new facility allows completion styles to have a say in metadata properties such as cycle-sort-function and display-sort-function. This is especially useful for completion styles such as 'flex', which generally produce many matches, including some potentially "obscure" ones. The default sorting strategy would often bubble the latter to the top of the list. The sorting function for 'flex' considers pre-computed matching scores and is thus much better than the default for this particular style. Additionally, it overrides the completion table's cycle-sort-function or display-sort-function properties if they exist, although it still uses them to pre-sort the result, so that they are still relevant for resolving ties. * lisp/minibuffer.el (completion--nth-completion) (completion--flex-adjust-metadata): New helper. (flex): Put completion--adjust-metadata property. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7227e83f87..b61b366a57 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -922,31 +922,36 @@ This overrides the defaults specified in `completion-category-defaults'." ;; The quote/unquote function needs to come from the completion table (rather ;; than from completion-extra-properties) because it may apply only to some ;; part of the string (e.g. substitute-in-file-name). - (let ((requote - (when (and - (completion-metadata-get metadata 'completion--unquote-requote) - ;; Sometimes a table's metadata is used on another - ;; table (typically that other table is just a list taken - ;; from the output of `all-completions' or something equivalent, - ;; for progressive refinement). See bug#28898 and bug#16274. - ;; FIXME: Rather than do nothing, we should somehow call - ;; the original table, in that case! - (functionp table)) - (let ((new (funcall table string point 'completion--unquote))) - (setq string (pop new)) - (setq table (pop new)) - (setq point (pop new)) - (cl-assert (<= point (length string))) - (pop new)))) - (result - (completion--some (lambda (style) - (funcall (nth n (assq style - completion-styles-alist)) - string table pred point)) - (completion--styles metadata)))) + (let* ((requote + (when (and + (completion-metadata-get metadata 'completion--unquote-requote) + ;; Sometimes a table's metadata is used on another + ;; table (typically that other table is just a list taken + ;; from the output of `all-completions' or something equivalent, + ;; for progressive refinement). See bug#28898 and bug#16274. + ;; FIXME: Rather than do nothing, we should somehow call + ;; the original table, in that case! + (functionp table)) + (let ((new (funcall table string point 'completion--unquote))) + (setq string (pop new)) + (setq table (pop new)) + (setq point (pop new)) + (cl-assert (<= point (length string))) + (pop new)))) + (result-and-style + (completion--some + (lambda (style) + (let ((probe (funcall (nth n (assq style + completion-styles-alist)) + string table pred point))) + (and probe (cons probe style)))) + (completion--styles metadata))) + (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata))) + (when adjust-fn + (setcdr metadata (cdr (funcall adjust-fn metadata)))) (if requote - (funcall requote result n) - result))) + (funcall requote (car result-and-style) n) + (car result-and-style)))) (defun completion-try-completion (string table pred point &optional metadata) "Try to complete STRING using completion table TABLE. @@ -3462,6 +3467,29 @@ that is non-nil." ;;; "flex" completion, also known as flx/fuzzy/scatter completion ;; Completes "foo" to "frodo" and "farfromsober" +(put 'flex 'completion--adjust-metadata 'completion--flex-adjust-metadata) + +(defun completion--flex-adjust-metadata (metadata) + (cl-flet ((compose-flex-sort-fn + (existing-sort-fn) ; wish `cl-flet' had proper indentation... + (lambda (completions) + (let ((res + (if existing-sort-fn + (funcall existing-sort-fn completions) + completions))) + (sort + res + (lambda (c1 c2) + (or (equal c1 minibuffer-default) + (> (get-text-property 0 'completion-score c1) + (get-text-property 0 'completion-score c2))))))))) + (let ((alist (cdr metadata))) + (setf (alist-get 'display-sort-function alist) + (compose-flex-sort-fn (alist-get 'display-sort-function alist))) + (setf (alist-get 'cycle-sort-function alist) + (compose-flex-sort-fn (alist-get 'cycle-sort-function alist))) + `(metadata . ,alist)))) + (defun completion-flex--make-flex-pattern (pattern) "Convert PCM-style PATTERN into PCM-style flex pattern. commit 878ea4d840880f7bdb2d0b0142a9409d34e53f88 Author: João Távora Date: Sat Oct 26 13:45:14 2019 +0100 Revert "Allow completion styles to adjust completion metadata" Unbreaks the build. This reverts commit 7fc0292f5c49d11fc39853f8bc25586d54221e6a. Unfortunately, cl-defgeneric has some problems when used in lisp/minibuffer.el. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 35de3fbb96..7227e83f87 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -907,31 +907,6 @@ This overrides the defaults specified in `completion-category-defaults'." (delete-dups (append (cdr over) (copy-sequence completion-styles))) completion-styles))) -(cl-defgeneric completion-adjust-metadata-for-style (style metadata) - "Adjust METADATA of current completion according to STYLE." - (:method (_style _metadata) nil) ; nop by default - (:method - ((_style (eql flex)) metadata) - (cl-flet ((compose-flex-sort-fn - (existing-sort-fn) ; wish `cl-flet' had proper indentation... - (lambda (completions) - (let ((res - (if existing-sort-fn - (funcall existing-sort-fn completions) - completions))) - (sort - res - (lambda (c1 c2) - (or (equal c1 minibuffer-default) - (> (get-text-property 0 'completion-score c1) - (get-text-property 0 'completion-score c2))))))))) - (let ((alist (cdr metadata))) - (setf (alist-get 'display-sort-function alist) - (compose-flex-sort-fn (alist-get 'display-sort-function alist))) - (setf (alist-get 'cycle-sort-function alist) - (compose-flex-sort-fn (alist-get 'cycle-sort-function alist))) - metadata)))) - (defun completion--nth-completion (n string table pred point metadata) "Call the Nth method of completion styles." (unless metadata @@ -961,20 +936,17 @@ This overrides the defaults specified in `completion-category-defaults'." (setq string (pop new)) (setq table (pop new)) (setq point (pop new)) - (cl-assert (<= point (length string))) + (cl-assert (<= point (length string))) (pop new)))) - (result-and-style - (completion--some - (lambda (style) - (let ((probe (funcall (nth n (assq style - completion-styles-alist)) - string table pred point))) - (and probe (cons probe style)))) - (completion--styles metadata)))) - (completion-adjust-metadata-for-style (cdr result-and-style) metadata) + (result + (completion--some (lambda (style) + (funcall (nth n (assq style + completion-styles-alist)) + string table pred point)) + (completion--styles metadata)))) (if requote - (funcall requote (car result-and-style) n) - (car result-and-style)))) + (funcall requote result n) + result))) (defun completion-try-completion (string table pred point &optional metadata) "Try to complete STRING using completion table TABLE. commit feae2de4242d7288f94c4bb41a9b7deed8679da0 Author: Stefan Monnier Date: Sat Oct 26 08:17:09 2019 -0400 subr.el (run-window-configuration-change-hook): Mark obsolete diff --git a/etc/NEWS b/etc/NEWS index 137d476c92..2528c6161a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2731,6 +2731,8 @@ during last redisplay. 'window-old-pixel-width' (renamed from 'window-old-body-pixel-width' and 'window-old-body-pixel-height' return the total and body sizes of any window during last redisplay. +Also 'run-window-configuration-change-hook' is declared obsolete. + See the section "(elisp) Window Hooks" in the Elisp manual for a detailed explanation of the new behavior. diff --git a/lisp/subr.el b/lisp/subr.el index 3ba4d2bd4e..b408ef0931 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1603,6 +1603,7 @@ be a list of the form returned by `event-start' and `event-end'." (make-obsolete 'window-redisplay-end-trigger nil "23.1") (make-obsolete 'set-window-redisplay-end-trigger nil "23.1") +(make-obsolete 'run-window-configuration-change-hook nil "27.1") (make-obsolete 'process-filter-multibyte-p nil "23.1") (make-obsolete 'set-process-filter-multibyte nil "23.1") commit 7fc0292f5c49d11fc39853f8bc25586d54221e6a Author: João Távora Date: Fri Oct 25 23:57:44 2019 +0100 Allow completion styles to adjust completion metadata The new facility, realized in the completion-adjust-metadata-for-style generic, allows completion styles to have a say in metadata properties such as cycle-sort-function and display-sort-function. This is especially useful for completion styles such as 'flex', which generally produce many matches, including some potentially "obscure" ones. The default sorting strategy would often bubble the latter to the top of the list. The sorting function for 'flex' considers pre-computed matching scores and is thus much better than the default for this particular style. Additionally, it overrides the completion table's cycle-sort-function or display-sort-function properties if they exist, although it still uses them to pre-sort the result, so that they are still relevant for resolving ties. * lisp/minibuffer.el (completion--nth-completion): Call completion-adjust-metadata-for-style. (completion-adjust-metadata-for-style): New generic. (completion-adjust-metadata-for-style 'flex): New method. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7227e83f87..35de3fbb96 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -907,6 +907,31 @@ This overrides the defaults specified in `completion-category-defaults'." (delete-dups (append (cdr over) (copy-sequence completion-styles))) completion-styles))) +(cl-defgeneric completion-adjust-metadata-for-style (style metadata) + "Adjust METADATA of current completion according to STYLE." + (:method (_style _metadata) nil) ; nop by default + (:method + ((_style (eql flex)) metadata) + (cl-flet ((compose-flex-sort-fn + (existing-sort-fn) ; wish `cl-flet' had proper indentation... + (lambda (completions) + (let ((res + (if existing-sort-fn + (funcall existing-sort-fn completions) + completions))) + (sort + res + (lambda (c1 c2) + (or (equal c1 minibuffer-default) + (> (get-text-property 0 'completion-score c1) + (get-text-property 0 'completion-score c2))))))))) + (let ((alist (cdr metadata))) + (setf (alist-get 'display-sort-function alist) + (compose-flex-sort-fn (alist-get 'display-sort-function alist))) + (setf (alist-get 'cycle-sort-function alist) + (compose-flex-sort-fn (alist-get 'cycle-sort-function alist))) + metadata)))) + (defun completion--nth-completion (n string table pred point metadata) "Call the Nth method of completion styles." (unless metadata @@ -936,17 +961,20 @@ This overrides the defaults specified in `completion-category-defaults'." (setq string (pop new)) (setq table (pop new)) (setq point (pop new)) - (cl-assert (<= point (length string))) + (cl-assert (<= point (length string))) (pop new)))) - (result - (completion--some (lambda (style) - (funcall (nth n (assq style - completion-styles-alist)) - string table pred point)) - (completion--styles metadata)))) + (result-and-style + (completion--some + (lambda (style) + (let ((probe (funcall (nth n (assq style + completion-styles-alist)) + string table pred point))) + (and probe (cons probe style)))) + (completion--styles metadata)))) + (completion-adjust-metadata-for-style (cdr result-and-style) metadata) (if requote - (funcall requote result n) - result))) + (funcall requote (car result-and-style) n) + (car result-and-style)))) (defun completion-try-completion (string table pred point &optional metadata) "Try to complete STRING using completion table TABLE. commit e3cebbb839fc94f314659bf667c6790edebf4297 Author: memeplex Date: Sat Oct 19 00:13:15 2019 -0300 Replay key if kboard is interrupted while initializing (Bug#37782) The problem with the original fix for bug#5095 is that it drops the current event, which is a valid character event and not -2. Thus, the first ESC character sent by the terminal after turning on focus tracking is lost and we get '[' and 'I' events separately inserted into the buffer afterwards. * src/keyboard.c (read_key_sequence): Add key as mock_input and replay sequence using new keyboard, when the key is not -2. diff --git a/src/keyboard.c b/src/keyboard.c index 56ab79068a..0eab8fdfae 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9596,7 +9596,16 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt, Fcons (make_lispy_switch_frame (frame), KVAR (interrupted_kboard, kbd_queue))); } - mock_input = 0; + if (FIXNUMP (key) && XFIXNUM (key) == -2) + mock_input = 0; + else + { + /* If interrupted while initializing terminal, we + need to replay the interrupting key. See + Bug#5095 and Bug#37782. */ + mock_input = 1; + keybuf[0] = key; + } goto replay_entire_sequence; } } commit 16372a5a04c1bf2028941dec6bbdbf75d1f61a62 Author: memeplex Date: Wed Oct 16 13:44:00 2019 -0300 Remove redundant initialization of fringe bitmap (Bug#37756) * src/fringe.c (Fdefine-fringe-bitmap): Remove redundant zeroing of fb.bits that only zeroed half of the array anyway. diff --git a/src/fringe.c b/src/fringe.c index 22f3bdc2ba..08bf271ed5 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1607,7 +1607,6 @@ If BITMAP already exists, the existing definition is replaced. */) fb.bits = b = ((unsigned short *) ptr_bounds_clip (xfb + 1, fb.height * BYTES_PER_BITMAP_ROW)); xfb = ptr_bounds_clip (xfb, sizeof *xfb); - memset (b, 0, fb.height); j = 0; while (j < fb.height) commit c3b0950639f847264d3d6558d065993fb743376c Author: Eli Zaretskii Date: Sat Oct 26 12:57:09 2019 +0300 Improve the documentation of 'vc-tor' * lisp/vc/vc-dispatcher.el (vc-tor): Add :version. Enhance the doc string. * etc/NEWS: Announce the new option. diff --git a/etc/NEWS b/etc/NEWS index 56127ba601..137d476c92 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -823,6 +823,12 @@ The default value is 'find-dired-sort-by-filename'. ** Change Logs and VC +--- +*** New user option 'vc-tor'. +When non-nil, this option causes the VC commands to communicate with +the repository via Tor's proxy, using the 'torsocks' wrapper script. +The default is nil. + +++ *** New command 'log-edit-generate-changelog-from-diff', bound to 'C-c C-w'. This generates ChangeLog entries from the VC fileset diff. diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index bf238dedbb..40055091ef 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -268,8 +268,11 @@ and is passed 3 arguments: the COMMAND, the FILES and the FLAGS.") (if (not filelist) "." (mapconcat 'identity filelist " "))) (defcustom vc-tor nil - "If non-nil, communicate with the repository site via Tor." + "If non-nil, communicate with the repository site via Tor. +See https://2019.www.torproject.org/about/overview.html.en and +the man pages for \"torsocks\" for more details about Tor." :type 'boolean + :version "27.1" :group 'vc) ;;;###autoload commit 626e0a6aad6b0f3c7348f37c9b2c9854b06b449b Author: Richard Stallman Date: Sun Oct 13 21:42:53 2019 -0400 New defcustom 'vc-tor' * lisp/vc/vc-dispatcher.el (vc-tor): New user option. (vc-do-command): If vc-tor is non-nil, use 'torsocks'. diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index 40c392b21d..bf238dedbb 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -267,6 +267,11 @@ and is passed 3 arguments: the COMMAND, the FILES and the FLAGS.") ;; FIXME what about file names with spaces? (if (not filelist) "." (mapconcat 'identity filelist " "))) +(defcustom vc-tor nil + "If non-nil, communicate with the repository site via Tor." + :type 'boolean + :group 'vc) + ;;;###autoload (defun vc-do-command (buffer okstatus command file-or-list &rest flags) "Execute a slave command, notifying user and checking for errors. @@ -295,7 +300,8 @@ case, and the process object in the asynchronous case." ;; due to potential truncation of long messages. (message-truncate-lines t) (full-command - (concat (if (string= (substring command -1) "\n") + (concat (if vc-tor "torsocks " "") + (if (string= (substring command -1) "\n") (substring command 0 -1) command) " " (vc-delistify flags) commit a0f7ea599919f967331173fdde2b87e50c88c4b7 Author: Tassilo Horn Date: Fri Oct 25 22:07:39 2019 +0200 Adapt doc-view to latest image-mode changes The functions image-scroll-down, image-scroll-up, image-next-line, and image-previous-line now return pixel values instead of multiples of character height as of commit 9c66b09950. * lisp/doc-view.el (doc-view-scroll-up-or-next-page): (doc-view-scroll-down-or-previous-page): (doc-view-next-line-or-next-page): (doc-view-previous-line-or-previous-page): (doc-view-insert-image): Adapt to image-scroll-up/down and image-next/previous-line now returning pixel values instead of multiples of character heights. Fixes bug#37874. diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 1fbaebd626..d88150735f 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -598,7 +598,7 @@ Otherwise, goto next page only on typing SPC (ARG is nil)." (if (or doc-view-continuous (null arg)) (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-scroll-up arg)) + (when (= (window-vscroll nil t) (image-scroll-up arg)) (doc-view-next-page) (when (/= cur-page (doc-view-current-page)) (image-bob) @@ -615,7 +615,7 @@ Otherwise, goto previous page only on typing DEL (ARG is nil)." (if (or doc-view-continuous (null arg)) (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-scroll-down arg)) + (when (= (window-vscroll nil t) (image-scroll-down arg)) (doc-view-previous-page) (when (/= cur-page (doc-view-current-page)) (image-eob) @@ -631,7 +631,7 @@ at the bottom edge of the page moves to the next page." (if doc-view-continuous (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-next-line arg)) + (when (= (window-vscroll nil t) (image-next-line arg)) (doc-view-next-page) (when (/= cur-page (doc-view-current-page)) (image-bob) @@ -647,7 +647,7 @@ at the top edge of the page moves to the previous page." (if doc-view-continuous (let ((hscroll (window-hscroll)) (cur-page (doc-view-current-page))) - (when (= (window-vscroll) (image-previous-line arg)) + (when (= (window-vscroll nil t) (image-previous-line arg)) (doc-view-previous-page) (when (/= cur-page (doc-view-current-page)) (image-eob) @@ -1429,7 +1429,7 @@ ARGS is a list of image descriptors." (vscroll (image-mode-window-get 'vscroll win))) ;; Reset scroll settings, in case they were changed. (if hscroll (set-window-hscroll win hscroll)) - (if vscroll (set-window-vscroll win vscroll))))))))) + (if vscroll (set-window-vscroll win vscroll t))))))))) (defun doc-view-sort (a b) "Return non-nil if A should be sorted before B. commit 25ed447b7bec3af66cf0322239cfabbaf71bef26 Author: Alan Mackenzie Date: Fri Oct 25 20:11:48 2019 +0000 CC Mode: Fix positioning of point whilst inserting comments without non-ws * lisp/progmodes/cc-cmds.el (c-guess-fill-prefix): When determining a new block comment prefix (i.e. there isn't one already there to copy), and that prefix is hard up against a comment closer, ensure there are at least two spaces before the closer. (c-indent-new-comment-line): Amend the strategy for ensuring that point isn't left hard up against the comment closer after M-j. diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 0d9414e60f..9aa2019ae6 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -4083,14 +4083,18 @@ command to conveniently insert and align the necessary backslashes." ;; `comment-prefix' on a line and indent it to find the ;; correct column and the correct mix of tabs and spaces. (setq res - (let (tmp-pre tmp-post) + (let (tmp-pre tmp-post at-close) (unwind-protect (progn (goto-char (car lit-limits)) (if (looking-at comment-start-regexp) - (goto-char (min (match-end 0) - comment-text-end)) + (progn + (goto-char (min (match-end 0) + comment-text-end)) + (setq + at-close + (looking-at c-block-comment-ender-regexp))) (forward-char 2) (skip-chars-forward " \t")) @@ -4106,8 +4110,13 @@ command to conveniently insert and align the necessary backslashes." (save-excursion (skip-chars-backward " \t") (point)) - (point))))) - + (point)))) + ;; If hard up against the comment ender, the + ;; prefix must end in at least two spaces. + (when at-close + (or (string-match "\\s \\s +\\'" comment-prefix) + (setq comment-prefix + (concat comment-prefix " "))))) (setq tmp-pre (point-marker)) ;; We insert an extra non-whitespace character @@ -4776,7 +4785,6 @@ If a fill prefix is specified, it overrides all the above." (c-collect-line-comments c-lit-limits)) c-lit-type))) (pos (point)) - (start-col (current-column)) (comment-text-end (or (and (eq c-lit-type 'c) (save-excursion @@ -4821,9 +4829,10 @@ If a fill prefix is specified, it overrides all the above." (goto-char (+ (car c-lit-limits) 2)))) (funcall do-line-break) (insert-and-inherit (car fill)) - (if (> (current-column) start-col) - (move-to-column start-col)))) ; can this hit the - ; middle of a TAB? + (if (and (looking-at c-block-comment-ender-regexp) + (memq (char-before) '(?\ ?\t))) + (backward-char)))) ; can this hit the + ; middle of a TAB? ;; Inside a comment that should be broken. (let ((comment-start comment-start) (comment-end comment-end) commit 4e271a6c36c73cbf3b45ced26493aa6589669815 Author: Stephen Gildea Date: Fri Oct 25 08:44:15 2019 -0700 time-stamp-tests: consistently name the time vars * time-stamp-tests.el (with-time-stamp-test-env): rename local variable 'ref-time' to 'ref-time1', for parallelism with ref-time2 and ref-time3. diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 4cc4ea1a5b..d01d37a664 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -29,7 +29,7 @@ (user-full-name "Time Stamp Tester") (buffer-file-name "/emacs/test/time-stamped-file") (mail-host-address "test-mail-host-name") - (ref-time '(17337 16613)) ;Monday, Jan 2, 2006, 3:04:05 PM + (ref-time1 '(17337 16613)) ;Monday, Jan 2, 2006, 3:04:05 PM (ref-time2 '(22574 61591)) ;Friday, Nov 18, 2016, 12:14:15 PM (ref-time3 '(21377 34956)) ;Sunday, May 25, 2014, 06:07:08 AM (time-stamp-time-zone t)) ;use UTC @@ -41,7 +41,7 @@ (lambda () "test-system-name.example.org"))) ;; Not all reference times are used in all tests; ;; suppress the byte compiler's "unused" warning. - (list ref-time ref-time2 ref-time3) + (list ref-time1 ref-time2 ref-time3) ,@body))) (put 'with-time-stamp-test-env 'lisp-indent-hook 'defun) @@ -61,90 +61,90 @@ "Test time-stamp formats for named day of week." (with-time-stamp-test-env ;; implemented and documented since 1997 - (should (equal (time-stamp-string "%3a" ref-time) "Mon")) - (should (equal (time-stamp-string "%#A" ref-time) "MONDAY")) + (should (equal (time-stamp-string "%3a" ref-time1) "Mon")) + (should (equal (time-stamp-string "%#A" ref-time1) "MONDAY")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%3A" ref-time) "MON")) - (should (equal (time-stamp-string "%:a" ref-time) "Monday")) + (should (equal (time-stamp-string "%3A" ref-time1) "MON")) + (should (equal (time-stamp-string "%:a" ref-time1) "Monday")) ;; implemented since 2001, documented since 2019 - (should (equal (time-stamp-string "%#a" ref-time) "MON")) - (should (equal (time-stamp-string "%:A" ref-time) "Monday")) + (should (equal (time-stamp-string "%#a" ref-time1) "MON")) + (should (equal (time-stamp-string "%:A" ref-time1) "Monday")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%^A" ref-time) "MONDAY")) + (should (equal (time-stamp-string "%^A" ref-time1) "MONDAY")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%a" ref-time) "Mon")) - (should (equal (time-stamp-string "%^a" ref-time) "MON")) - (should (equal (time-stamp-string "%A" ref-time) "Monday")))) + (should (equal (time-stamp-string "%a" ref-time1) "Mon")) + (should (equal (time-stamp-string "%^a" ref-time1) "MON")) + (should (equal (time-stamp-string "%A" ref-time1) "Monday")))) (ert-deftest time-stamp-test-month-name () "Test time-stamp formats for month name." (with-time-stamp-test-env ;; implemented and documented since 1997 - (should (equal (time-stamp-string "%3b" ref-time) "Jan")) - (should (equal (time-stamp-string "%#B" ref-time) "JANUARY")) + (should (equal (time-stamp-string "%3b" ref-time1) "Jan")) + (should (equal (time-stamp-string "%#B" ref-time1) "JANUARY")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%3B" ref-time) "JAN")) - (should (equal (time-stamp-string "%:b" ref-time) "January")) + (should (equal (time-stamp-string "%3B" ref-time1) "JAN")) + (should (equal (time-stamp-string "%:b" ref-time1) "January")) ;; implemented since 2001, documented since 2019 - (should (equal (time-stamp-string "%#b" ref-time) "JAN")) - (should (equal (time-stamp-string "%:B" ref-time) "January")) + (should (equal (time-stamp-string "%#b" ref-time1) "JAN")) + (should (equal (time-stamp-string "%:B" ref-time1) "January")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%^B" ref-time) "JANUARY")) + (should (equal (time-stamp-string "%^B" ref-time1) "JANUARY")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%b" ref-time) "Jan")) - (should (equal (time-stamp-string "%^b" ref-time) "JAN")) - (should (equal (time-stamp-string "%B" ref-time) "January")))) + (should (equal (time-stamp-string "%b" ref-time1) "Jan")) + (should (equal (time-stamp-string "%^b" ref-time1) "JAN")) + (should (equal (time-stamp-string "%B" ref-time1) "January")))) (ert-deftest time-stamp-test-day-of-month () "Test time-stamp formats for day of month." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2d" ref-time) " 2")) + (should (equal (time-stamp-string "%2d" ref-time1) " 2")) (should (equal (time-stamp-string "%2d" ref-time2) "18")) - (should (equal (time-stamp-string "%02d" ref-time) "02")) + (should (equal (time-stamp-string "%02d" ref-time1) "02")) (should (equal (time-stamp-string "%02d" ref-time2) "18")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:d" ref-time) "2")) + (should (equal (time-stamp-string "%:d" ref-time1) "2")) (should (equal (time-stamp-string "%:d" ref-time2) "18")) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1d" ref-time) "2")) + (should (equal (time-stamp-string "%1d" ref-time1) "2")) (should (equal (time-stamp-string "%1d" ref-time2) "18")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-d" ref-time) "2")) + (should (equal (time-stamp-string "%-d" ref-time1) "2")) (should (equal (time-stamp-string "%-d" ref-time2) "18")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_d" ref-time) " 2")) + (should (equal (time-stamp-string "%_d" ref-time1) " 2")) (should (equal (time-stamp-string "%_d" ref-time2) "18")) - (should (equal (time-stamp-string "%d" ref-time) "02")) + (should (equal (time-stamp-string "%d" ref-time1) "02")) (should (equal (time-stamp-string "%d" ref-time2) "18")))) (ert-deftest time-stamp-test-hours-24 () "Test time-stamp formats for hour on a 24-hour clock." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2H" ref-time) "15")) + (should (equal (time-stamp-string "%2H" ref-time1) "15")) (should (equal (time-stamp-string "%2H" ref-time2) "12")) (should (equal (time-stamp-string "%2H" ref-time3) " 6")) - (should (equal (time-stamp-string "%02H" ref-time) "15")) + (should (equal (time-stamp-string "%02H" ref-time1) "15")) (should (equal (time-stamp-string "%02H" ref-time2) "12")) (should (equal (time-stamp-string "%02H" ref-time3) "06")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:H" ref-time) "15")) + (should (equal (time-stamp-string "%:H" ref-time1) "15")) (should (equal (time-stamp-string "%:H" ref-time2) "12")) (should (equal (time-stamp-string "%:H" ref-time3) "6")) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1H" ref-time) "15")) + (should (equal (time-stamp-string "%1H" ref-time1) "15")) (should (equal (time-stamp-string "%1H" ref-time2) "12")) (should (equal (time-stamp-string "%1H" ref-time3) "6")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-H" ref-time) "15")) + (should (equal (time-stamp-string "%-H" ref-time1) "15")) (should (equal (time-stamp-string "%-H" ref-time2) "12")) (should (equal (time-stamp-string "%-H" ref-time3) "6")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_H" ref-time) "15")) + (should (equal (time-stamp-string "%_H" ref-time1) "15")) (should (equal (time-stamp-string "%_H" ref-time2) "12")) (should (equal (time-stamp-string "%_H" ref-time3) " 6")) - (should (equal (time-stamp-string "%H" ref-time) "15")) + (should (equal (time-stamp-string "%H" ref-time1) "15")) (should (equal (time-stamp-string "%H" ref-time2) "12")) (should (equal (time-stamp-string "%H" ref-time3) "06")))) @@ -152,29 +152,29 @@ "Test time-stamp formats for hour on a 12-hour clock." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2I" ref-time) " 3")) + (should (equal (time-stamp-string "%2I" ref-time1) " 3")) (should (equal (time-stamp-string "%2I" ref-time2) "12")) (should (equal (time-stamp-string "%2I" ref-time3) " 6")) - (should (equal (time-stamp-string "%02I" ref-time) "03")) + (should (equal (time-stamp-string "%02I" ref-time1) "03")) (should (equal (time-stamp-string "%02I" ref-time2) "12")) (should (equal (time-stamp-string "%02I" ref-time3) "06")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:I" ref-time) "3")) ;PM + (should (equal (time-stamp-string "%:I" ref-time1) "3")) ;PM (should (equal (time-stamp-string "%:I" ref-time2) "12")) ;PM (should (equal (time-stamp-string "%:I" ref-time3) "6")) ;AM ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1I" ref-time) "3")) + (should (equal (time-stamp-string "%1I" ref-time1) "3")) (should (equal (time-stamp-string "%1I" ref-time2) "12")) (should (equal (time-stamp-string "%1I" ref-time3) "6")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-I" ref-time) "3")) + (should (equal (time-stamp-string "%-I" ref-time1) "3")) (should (equal (time-stamp-string "%-I" ref-time2) "12")) (should (equal (time-stamp-string "%-I" ref-time3) "6")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_I" ref-time) " 3")) + (should (equal (time-stamp-string "%_I" ref-time1) " 3")) (should (equal (time-stamp-string "%_I" ref-time2) "12")) (should (equal (time-stamp-string "%_I" ref-time3) " 6")) - (should (equal (time-stamp-string "%I" ref-time) "03")) + (should (equal (time-stamp-string "%I" ref-time1) "03")) (should (equal (time-stamp-string "%I" ref-time2) "12")) (should (equal (time-stamp-string "%I" ref-time3) "06")))) @@ -182,154 +182,156 @@ "Test time-stamp formats for month number." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2m" ref-time) " 1")) + (should (equal (time-stamp-string "%2m" ref-time1) " 1")) (should (equal (time-stamp-string "%2m" ref-time2) "11")) - (should (equal (time-stamp-string "%02m" ref-time) "01")) + (should (equal (time-stamp-string "%02m" ref-time1) "01")) (should (equal (time-stamp-string "%02m" ref-time2) "11")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:m" ref-time) "1")) + (should (equal (time-stamp-string "%:m" ref-time1) "1")) (should (equal (time-stamp-string "%:m" ref-time2) "11")) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1m" ref-time) "1")) + (should (equal (time-stamp-string "%1m" ref-time1) "1")) (should (equal (time-stamp-string "%1m" ref-time2) "11")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-m" ref-time) "1")) + (should (equal (time-stamp-string "%-m" ref-time1) "1")) (should (equal (time-stamp-string "%-m" ref-time2) "11")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_m" ref-time) " 1")) + (should (equal (time-stamp-string "%_m" ref-time1) " 1")) (should (equal (time-stamp-string "%_m" ref-time2) "11")) - (should (equal (time-stamp-string "%m" ref-time) "01")) + (should (equal (time-stamp-string "%m" ref-time1) "01")) (should (equal (time-stamp-string "%m" ref-time2) "11")))) (ert-deftest time-stamp-test-minute () "Test time-stamp formats for minute." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2M" ref-time) " 4")) + (should (equal (time-stamp-string "%2M" ref-time1) " 4")) (should (equal (time-stamp-string "%2M" ref-time2) "14")) - (should (equal (time-stamp-string "%02M" ref-time) "04")) + (should (equal (time-stamp-string "%02M" ref-time1) "04")) (should (equal (time-stamp-string "%02M" ref-time2) "14")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:M" ref-time) "4")) + (should (equal (time-stamp-string "%:M" ref-time1) "4")) (should (equal (time-stamp-string "%:M" ref-time2) "14")) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1M" ref-time) "4")) + (should (equal (time-stamp-string "%1M" ref-time1) "4")) (should (equal (time-stamp-string "%1M" ref-time2) "14")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-M" ref-time) "4")) + (should (equal (time-stamp-string "%-M" ref-time1) "4")) (should (equal (time-stamp-string "%-M" ref-time2) "14")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_M" ref-time) " 4")) + (should (equal (time-stamp-string "%_M" ref-time1) " 4")) (should (equal (time-stamp-string "%_M" ref-time2) "14")) - (should (equal (time-stamp-string "%M" ref-time) "04")) + (should (equal (time-stamp-string "%M" ref-time1) "04")) (should (equal (time-stamp-string "%M" ref-time2) "14")))) (ert-deftest time-stamp-test-second () "Test time-stamp formats for second." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%2S" ref-time) " 5")) + (should (equal (time-stamp-string "%2S" ref-time1) " 5")) (should (equal (time-stamp-string "%2S" ref-time2) "15")) - (should (equal (time-stamp-string "%02S" ref-time) "05")) + (should (equal (time-stamp-string "%02S" ref-time1) "05")) (should (equal (time-stamp-string "%02S" ref-time2) "15")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:S" ref-time) "5")) + (should (equal (time-stamp-string "%:S" ref-time1) "5")) (should (equal (time-stamp-string "%:S" ref-time2) "15")) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%1S" ref-time) "5")) + (should (equal (time-stamp-string "%1S" ref-time1) "5")) (should (equal (time-stamp-string "%1S" ref-time2) "15")) ;; allowed but undocumented since 2019 (warned 1997-2019) - (should (equal (time-stamp-string "%-S" ref-time) "5")) + (should (equal (time-stamp-string "%-S" ref-time1) "5")) (should (equal (time-stamp-string "%-S" ref-time2) "15")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%_S" ref-time) " 5")) + (should (equal (time-stamp-string "%_S" ref-time1) " 5")) (should (equal (time-stamp-string "%_S" ref-time2) "15")) - (should (equal (time-stamp-string "%S" ref-time) "05")) + (should (equal (time-stamp-string "%S" ref-time1) "05")) (should (equal (time-stamp-string "%S" ref-time2) "15")))) (ert-deftest time-stamp-test-year-2digit () "Test time-stamp formats for %y." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%02y" ref-time) "06")) + (should (equal (time-stamp-string "%02y" ref-time1) "06")) (should (equal (time-stamp-string "%02y" ref-time2) "16")) ;; documented 1997-2019 - (should (equal (time-stamp-string "%:y" ref-time) "2006")) + (should (equal (time-stamp-string "%:y" ref-time1) "2006")) (should (equal (time-stamp-string "%:y" ref-time2) "2016")) ;; warned 1997-2019, changed in 2019 ;; (We don't expect the %-y or %_y form to be useful, ;; but we test both so that we can confidently state that ;; `-' and `_' affect all 2-digit conversions identically.) - (should (equal (time-stamp-string "%-y" ref-time) "6")) + (should (equal (time-stamp-string "%-y" ref-time1) "6")) (should (equal (time-stamp-string "%-y" ref-time2) "16")) - (should (equal (time-stamp-string "%_y" ref-time) " 6")) + (should (equal (time-stamp-string "%_y" ref-time1) " 6")) (should (equal (time-stamp-string "%_y" ref-time2) "16")) - (should (equal (time-stamp-string "%y" ref-time) "06")) + (should (equal (time-stamp-string "%y" ref-time1) "06")) (should (equal (time-stamp-string "%y" ref-time2) "16")) ;; implemented since 1995, warned since 2019, will change - (time-stamp-should-warn (equal (time-stamp-string "%04y" ref-time) "2006")) - (time-stamp-should-warn (equal (time-stamp-string "%4y" ref-time) "2006")))) + (time-stamp-should-warn + (equal (time-stamp-string "%04y" ref-time1) "2006")) + (time-stamp-should-warn + (equal (time-stamp-string "%4y" ref-time1) "2006")))) (ert-deftest time-stamp-test-year-4digit () "Test time-stamp format %Y." (with-time-stamp-test-env ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%Y" ref-time) "2006")))) + (should (equal (time-stamp-string "%Y" ref-time1) "2006")))) (ert-deftest time-stamp-test-am-pm () "Test time-stamp formats for AM and PM strings." (with-time-stamp-test-env ;; implemented and documented since 1997 - (should (equal (time-stamp-string "%#p" ref-time) "pm")) + (should (equal (time-stamp-string "%#p" ref-time1) "pm")) (should (equal (time-stamp-string "%#p" ref-time3) "am")) - (should (equal (time-stamp-string "%P" ref-time) "PM")) + (should (equal (time-stamp-string "%P" ref-time1) "PM")) (should (equal (time-stamp-string "%P" ref-time3) "AM")) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%p" ref-time) "PM")) + (should (equal (time-stamp-string "%p" ref-time1) "PM")) (should (equal (time-stamp-string "%p" ref-time3) "AM")))) (ert-deftest time-stamp-test-day-number-in-week () "Test time-stamp formats for day number in week." (with-time-stamp-test-env - (should (equal (time-stamp-string "%w" ref-time) "1")) + (should (equal (time-stamp-string "%w" ref-time1) "1")) (should (equal (time-stamp-string "%w" ref-time2) "5")) (should (equal (time-stamp-string "%w" ref-time3) "0")))) (ert-deftest time-stamp-test-time-zone () "Test time-stamp formats for time zone." (with-time-stamp-test-env - (let ((UTC-abbr (format-time-string "%Z" ref-time t)) - (utc-abbr (format-time-string "%#Z" ref-time t))) + (let ((UTC-abbr (format-time-string "%Z" ref-time1 t)) + (utc-abbr (format-time-string "%#Z" ref-time1 t))) ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%Z" ref-time) UTC-abbr)) + (should (equal (time-stamp-string "%Z" ref-time1) UTC-abbr)) ;; documented 1995-2019 - (should (equal (time-stamp-string "%z" ref-time) utc-abbr)) + (should (equal (time-stamp-string "%z" ref-time1) utc-abbr)) ;; implemented since 1997, documented since 2019 - (should (equal (time-stamp-string "%#Z" ref-time) utc-abbr))))) + (should (equal (time-stamp-string "%#Z" ref-time1) utc-abbr))))) (ert-deftest time-stamp-test-non-date-conversions () "Test time-stamp formats for non-date items." (with-time-stamp-test-env ;; implemented and documented since 1995 - (should (equal (time-stamp-string "%%" ref-time) "%")) ;% last char - (should (equal (time-stamp-string "%%P" ref-time) "%P")) ;% not last char - (should (equal (time-stamp-string "%f" ref-time) "time-stamped-file")) - (should (equal - (time-stamp-string "%F" ref-time) "/emacs/test/time-stamped-file")) - (should (equal (time-stamp-string "%h" ref-time) "test-mail-host-name")) + (should (equal (time-stamp-string "%%" ref-time1) "%")) ;% last char + (should (equal (time-stamp-string "%%P" ref-time1) "%P")) ;% not last char + (should (equal (time-stamp-string "%f" ref-time1) "time-stamped-file")) + (should + (equal (time-stamp-string "%F" ref-time1) "/emacs/test/time-stamped-file")) + (should (equal (time-stamp-string "%h" ref-time1) "test-mail-host-name")) ;; documented 1995-2019 (should (equal - (time-stamp-string "%s" ref-time) "test-system-name.example.org")) - (should (equal (time-stamp-string "%U" ref-time) "Time Stamp Tester")) - (should (equal (time-stamp-string "%u" ref-time) "test-logname")) + (time-stamp-string "%s" ref-time1) "test-system-name.example.org")) + (should (equal (time-stamp-string "%U" ref-time1) "Time Stamp Tester")) + (should (equal (time-stamp-string "%u" ref-time1) "test-logname")) ;; implemented since 2001, documented since 2019 - (should (equal (time-stamp-string "%L" ref-time) "Time Stamp Tester")) - (should (equal (time-stamp-string "%l" ref-time) "test-logname")) + (should (equal (time-stamp-string "%L" ref-time1) "Time Stamp Tester")) + (should (equal (time-stamp-string "%l" ref-time1) "test-logname")) ;; implemented since 2007, documented since 2019 (should (equal - (time-stamp-string "%Q" ref-time) "test-system-name.example.org")) + (time-stamp-string "%Q" ref-time1) "test-system-name.example.org")) (should (equal - (time-stamp-string "%q" ref-time) "test-system-name")))) + (time-stamp-string "%q" ref-time1) "test-system-name")))) (ert-deftest time-stamp-test-ignored-modifiers () "Test additional args allowed (but ignored) to allow for future expansion." @@ -342,7 +344,7 @@ (ert-deftest time-stamp-test-non-conversions () "Test that without a %, the text is copied literally." (with-time-stamp-test-env - (should (equal (time-stamp-string "No percent" ref-time) "No percent")))) + (should (equal (time-stamp-string "No percent" ref-time1) "No percent")))) (ert-deftest time-stamp-test-string-width () "Test time-stamp string width modifiers." commit 084007a5947980f3b61f52496d89560f9aa5bbf1 Merge: 4bcf3a5fdc d56e84409d Author: Michael Albinus Date: Fri Oct 25 16:52:14 2019 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit 4bcf3a5fdc2395244981a9a0877f1b0fb4224790 Author: Michael Albinus Date: Fri Oct 25 16:45:48 2019 +0200 Mention completion styles for Tramp user/host name completion * doc/misc/tramp.texi (File name completion): Emacs must have one of the completion styles `basic', `emacs21', or `emacs22'. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 0252620eb7..67472a87a3 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2834,10 +2834,11 @@ much more appropriate. @value{tramp} can complete the following @value{tramp} file name components: method names, user names, host names, and file names -located on remote hosts. Enable this by activating partial completion -in @file{.emacs}. +located on remote hosts. User name and host name completion is +activated only, if file name completion has one of the styles +@code{basic}, @code{emacs21}, or @code{emacs22}. @ifinfo -@xref{Completion Options, , , emacs}. +@xref{Completion Styles, , , emacs}. @end ifinfo For example, type @kbd{C-x C-f @value{prefixwithspace} s @key{TAB}}, commit d56e84409d49641b9acd78346dfe0c271825407e Author: Juanma Barranquero Date: Fri Oct 25 16:39:54 2019 +0200 windmove.el: Suppress warnings for obsolete functions * lisp/windmove.el (windmove-constrain-loc-for-movement) (windmove-wrap-loc-for-movement, windmove-reference-loc) (windmove-other-window-loc): Wrap calls to obsolete functions in `with-suppressed-warnings'. diff --git a/lisp/windmove.el b/lisp/windmove.el index d5c6e348be..16a5ca8128 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -222,26 +222,28 @@ is the direction of the movement, one of `left', `up', `right', or `down'. Returns the constrained coordinate." (declare (obsolete "no longer used." "27.1")) - (let ((frame-edges (windmove-frame-edges window)) - (in-minibuffer (window-minibuffer-p window))) - (let ((min-x (nth 0 frame-edges)) - (min-y (nth 1 frame-edges)) - (max-x (nth 2 frame-edges)) - (max-y (nth 3 frame-edges))) - (let ((new-x - (if (memq dir '(up down)) ; vertical movement - (windmove-constrain-to-range (car coord) min-x max-x) - (car coord))) - (new-y - (if (or (memq dir '(left right)) ; horizontal movement - (and (eq dir 'down) - (not in-minibuffer))) ; don't miss minibuffer - ;; (technically, we shouldn't constrain on min-y in the - ;; second case, but this shouldn't do any harm on a - ;; down movement.) - (windmove-constrain-to-range (cdr coord) min-y max-y) - (cdr coord)))) - (cons new-x new-y))))) + (with-suppressed-warnings ((obsolete windmove-frame-edges + windmove-constrain-to-range)) + (let ((frame-edges (windmove-frame-edges window)) + (in-minibuffer (window-minibuffer-p window))) + (let ((min-x (nth 0 frame-edges)) + (min-y (nth 1 frame-edges)) + (max-x (nth 2 frame-edges)) + (max-y (nth 3 frame-edges))) + (let ((new-x + (if (memq dir '(up down)) ; vertical movement + (windmove-constrain-to-range (car coord) min-x max-x) + (car coord))) + (new-y + (if (or (memq dir '(left right)) ; horizontal movement + (and (eq dir 'down) + (not in-minibuffer))) ; don't miss minibuffer + ;; (technically, we shouldn't constrain on min-y in the + ;; second case, but this shouldn't do any harm on a + ;; down movement.) + (windmove-constrain-to-range (cdr coord) min-y max-y) + (cdr coord)))) + (cons new-x new-y)))))) (defun windmove-wrap-loc-for-movement (coord window) "Takes the constrained COORD and wraps it around for the movement. @@ -250,22 +252,24 @@ frame, giving a coordinate (hopefully) in the window on the other edge of the frame. WINDOW is the window that movement is relative to (nil means the currently selected window). Returns the wrapped coordinate." (declare (obsolete "no longer used." "27.1")) - (let* ((frame-edges (windmove-frame-edges window)) - (frame-minibuffer (minibuffer-window (if window - (window-frame window) - (selected-frame)))) - (minibuffer-active (minibuffer-window-active-p + (with-suppressed-warnings ((obsolete windmove-frame-edges + windmove-constrain-around-range)) + (let* ((frame-edges (windmove-frame-edges window)) + (frame-minibuffer (minibuffer-window (if window + (window-frame window) + (selected-frame)))) + (minibuffer-active (minibuffer-window-active-p frame-minibuffer))) - (let ((min-x (nth 0 frame-edges)) - (min-y (nth 1 frame-edges)) - (max-x (nth 2 frame-edges)) - (max-y (if (not minibuffer-active) - (- (nth 3 frame-edges) - (window-height frame-minibuffer)) - (nth 3 frame-edges)))) - (cons - (windmove-constrain-around-range (car coord) min-x max-x) - (windmove-constrain-around-range (cdr coord) min-y max-y))))) + (let ((min-x (nth 0 frame-edges)) + (min-y (nth 1 frame-edges)) + (max-x (nth 2 frame-edges)) + (max-y (if (not minibuffer-active) + (- (nth 3 frame-edges) + (window-height frame-minibuffer)) + (nth 3 frame-edges)))) + (cons + (windmove-constrain-around-range (car coord) min-x max-x) + (windmove-constrain-around-range (cdr coord) min-y max-y)))))) (defun windmove-reference-loc (&optional arg window) "Return the reference location for directional window selection. @@ -289,13 +293,14 @@ supplied, if ARG is greater or smaller than zero, respectively." ((< effective-arg 0) bottom-right) ((= effective-arg 0) - (windmove-coord-add - top-left - ;; Don't care whether window is horizontally scrolled - - ;; `posn-at-point' handles that already. See also: - ;; https://lists.gnu.org/r/emacs-devel/2012-01/msg00638.html - (posn-col-row - (posn-at-point (window-point window) window)))))))) + (with-suppressed-warnings ((obsolete windmove-coord-add)) + (windmove-coord-add + top-left + ;; Don't care whether window is horizontally scrolled - + ;; `posn-at-point' handles that already. See also: + ;; https://lists.gnu.org/r/emacs-devel/2012-01/msg00638.html + (posn-col-row + (posn-at-point (window-point window) window))))))))) (defun windmove-other-window-loc (dir &optional arg window) "Return a location in the window to be moved to. @@ -305,7 +310,9 @@ is handled as by `windmove-reference-loc'; WINDOW is the window that movement is relative to." (declare (obsolete "no longer used." "27.1")) (let ((edges (window-edges window)) ; edges: (x0, y0, x1, y1) - (refpoint (windmove-reference-loc arg window))) ; (x . y) + (refpoint (with-suppressed-warnings + ((obsolete windmove-reference-loc)) + (windmove-reference-loc arg window)))) ; (x . y) (cond ((eq dir 'left) (cons (- (nth 0 edges) commit 17db4a0a02157457cf0d2a6f6c3afa5184e118be Author: Juanma Barranquero Date: Fri Oct 25 15:42:13 2019 +0200 windmove.el: Mark unused code as obsolete * lisp/windmove.el (windmove-window-distance-delta) (windmove-coord-add, windmove-constrain-to-range) (windmove-constrain-around-range, windmove-frame-edges) (windmove-constrain-loc-for-movement) (windmove-wrap-loc-for-movement, windmove-reference-loc) (windmove-other-window-loc): Declare obsolete. (windmove-find-other-window, windmove-do-window-select): Doc fixes. * etc/NEWS: Document it. diff --git a/etc/NEWS b/etc/NEWS index 20967d4d77..56127ba601 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -750,6 +750,13 @@ that was in the specified direction. to the commands that swap the states of the selected window with the window in the specified direction. +*** Windmove code no longer used is now obsolete. That includes the +user option 'windmove-window-distance-delta' and the functions +'windmove-coord-add', 'windmove-constrain-to-range', +'windmove-constrain-around-range', 'windmove-frame-edges', +'windmove-constrain-loc-for-movement', 'windmove-wrap-loc-for-movement', +'windmove-reference-loc' and 'windmove-other-window-loc'. + ** Octave mode The mode is automatically enabled in files that start with the 'function' keyword. diff --git a/lisp/windmove.el b/lisp/windmove.el index feb269a407..d5c6e348be 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -109,14 +109,6 @@ ;; ;; (setq windmove-wrap-around t) ;; -;; -;; Note: If you have an Emacs that manifests a bug that sometimes -;; causes the occasional creation of a "lost column" between windows, -;; so that two adjacent windows do not actually touch, you may want to -;; increase the value of `windmove-window-distance-delta' to 2 or 3: -;; -;; (setq windmove-window-distance-delta 2) -;; ;; Acknowledgments: ;; @@ -167,150 +159,41 @@ to a value larger than 1 may be useful in getting around window- placement bugs in old versions of Emacs." :type 'number :group 'windmove) +(make-obsolete-variable 'windmove-window-distance-delta + "no longer used." "27.1") -;; Implementation overview: -;; -;; The conceptual framework behind this code is all fairly simple. We -;; are on one window; we wish to move to another. The correct window -;; to move to is determined by the position of point in the current -;; window as well as the overall window setup. -;; -;; Early on, I made the decision to base my implementation around the -;; built-in function `window-at'. This function takes a frame-based -;; coordinate, and returns the window that contains it. Using this -;; function, the job of the various top-level windmove functions can -;; be decomposed: first, find the current frame-based location of -;; point; second, manipulate it in some way to give a new location, -;; that hopefully falls in the window immediately at left (or right, -;; etc.); third, use `window-at' and `select-window' to select the -;; window at that new location. -;; -;; This is probably not the only possible architecture, and it turns -;; out to have some inherent cruftiness. (Well, okay, the third step -;; is pretty clean....) We will consider each step in turn. -;; -;; A quick digression about coordinate frames: most of the functions -;; in the windmove package deal with screen coordinates in one way or -;; another. These coordinates are always relative to some reference -;; points. Window-based coordinates have their reference point in the -;; upper-left-hand corner of whatever window is being talked about; -;; frame-based coordinates have their reference point in the -;; upper-left-hand corner of the entire frame (of which the current -;; window is a component). -;; -;; All coordinates are zero-based, which simply means that the -;; reference point (whatever it is) is assigned the value (x=0, y=0). -;; X-coordinates grow down the screen, and Y-coordinates grow towards -;; the right of the screen. +;; Note: ;; -;; Okay, back to work. The first step is to gather information about -;; the frame-based coordinates of point, or rather, the reference -;; location. The reference location can be point, or the upper-left, -;; or the lower-right corner of the window; the particular one used is -;; controlled by the prefix argument to `windmove-left' and all the -;; rest. -;; -;; This work is done by `windmove-reference-loc'. It can figure out -;; the locations of the corners by calling `window-edges' combined -;; with the result of `posn-at-point'. -;; -;; The second step is more messy. Conceptually, it is fairly simple: -;; if we know the reference location, and the coordinates of the -;; current window, we can "throw" our reference point just over the -;; appropriate edge of the window, and see what other window is -;; there. More explicitly, consider this example from the user -;; documentation above. -;; -;; ------------- -;; | | A | -;; | | | -;; | |----- -;; | * | | (* is point in the currently -;; | | B | selected window) -;; | | | -;; ------------- -;; -;; The asterisk marks the reference point; we wish to move right. -;; Since we are moving horizontally, the Y coordinate of the new -;; location will be the same. The X coordinate can be such that it is -;; just past the edge of the present window. Obviously, the new point -;; will be inside window B. This in itself is fairly simple: using -;; the result of `windmove-reference-loc' and `window-edges', all the -;; necessary math can be performed. (Having said that, there is a -;; good deal of room for off-by-one errors, and Emacs 19.34, at least, -;; sometimes manifests a bug where two windows don't actually touch, -;; so a larger skip is required.) The actual math here is done by -;; `windmove-other-window-loc'. -;; -;; But we can't just pass the result of `windmove-other-window-loc' to -;; `window-at' directly. Why not? Suppose a move would take us off -;; the edge of the screen, say to the left. We want to give a -;; descriptive error message to the user. Or, suppose that a move -;; would place us in the minibuffer. What if the minibuffer is -;; inactive? -;; -;; Actually, the whole subject of the minibuffer edge of the frame is -;; rather messy. It turns out that with a sufficiently large delta, -;; we can fly off the bottom edge of the frame and miss the minibuffer -;; altogether. This, I think, is never right: if there's a minibuffer -;; and you're not in it, and you move down, the minibuffer should be -;; in your way. -;; -;; (By the way, I'm not totally sure that the code does the right -;; thing in really weird cases, like a frame with no minibuffer.) -;; -;; So, what we need is some ways to do constraining and such. The -;; early versions of windmove took a fairly simplistic approach to all -;; this. When I added the wrap-around option, those internals had to -;; be rewritten. After a *lot* of futzing around, I came up with a -;; two-step process that I think is general enough to cover the -;; relevant cases. (I'm not totally happy with having to pass the -;; window variable as deep as I do, but we can't have everything.) -;; -;; In the first phase, we make sure that the new location is sane. -;; "Sane" means that we can only fall of the edge of the frame in the -;; direction we're moving in, and that we don't miss the minibuffer if -;; we're moving down and not already in the minibuffer. The function -;; `windmove-constrain-loc-for-movement' takes care of all this. -;; -;; Then, we handle the wraparound, if it's enabled. The function -;; `windmove-wrap-loc-for-movement' takes coordinate values (both X -;; and Y) that fall off the edge of the frame, and replaces them with -;; values on the other side of the frame. It also has special -;; minibuffer-handling code again, because we want to wrap through the -;; minibuffer if it's not enabled. -;; -;; So, that's it. Seems to work. All of this work is done by the fun -;; function `windmove-find-other-window'. -;; -;; So, now we have a window to move to (or nil if something's gone -;; wrong). The function `windmove-do-window-select' is the main -;; driver function: it actually does the `select-window'. It is -;; called by four little convenience wrappers, `windmove-left', -;; `windmove-up', `windmove-right', and `windmove-down', which make -;; for convenient keybinding. - +;; The functions that follow were used in the implementation of +;; `windmove-find-other-window', but they are known to be unreliable +;; after the window and frame rework done in 2013, so they are no +;; longer used or maintained; their functionality is subsumed in the +;; new function `window-in-direction'. They are kept only for +;; compatibility and will be removed in the future. Please consider +;; using the new window interfaces documented in "(elisp)Windows". ;; Quick & dirty utility function to add two (x . y) coords. (defun windmove-coord-add (coord1 coord2) "Add the two coordinates. Both COORD1 and COORD2 are coordinate cons pairs, (HPOS . VPOS). The result is another coordinate cons pair." + (declare (obsolete "no longer used." "27.1")) (cons (+ (car coord1) (car coord2)) (+ (cdr coord1) (cdr coord2)))) - (defun windmove-constrain-to-range (n min-n max-n) "Ensure that N is between MIN-N and MAX-N inclusive by constraining. If N is less than MIN-N, return MIN-N; if greater than MAX-N, return MAX-N." + (declare (obsolete "no longer used." "27.1")) (max min-n (min n max-n))) (defun windmove-constrain-around-range (n min-n max-n) "Ensure that N is between MIN-N and MAX-N inclusive by wrapping. If N is less than MIN-N, return MAX-N; if greater than MAX-N, return MIN-N." + (declare (obsolete "no longer used." "27.1")) (cond ((< n min-n) max-n) ((> n max-n) min-n) @@ -324,18 +207,9 @@ of the frame; (X-MAX, Y-MAX) is the zero-based coordinate of the bottom-right corner of the frame. For example, if a frame has 76 rows and 181 columns, the return value from `windmove-frame-edges' will be the list (0 0 180 75)." + (declare (obsolete "no longer used." "27.1")) (window-edges (frame-root-window window))) -;; it turns out that constraining is always a good thing, even when -;; wrapping is going to happen. this is because: -;; first, since we disallow exotic diagonal-around-a-corner type -;; movements, so we can always fix the unimportant direction (the one -;; we're not moving in). -;; second, if we're moving down and we're not in the minibuffer, then -;; constraining the y coordinate to max-y is okay, because if that -;; falls in the minibuffer and the minibuffer isn't active, that y -;; coordinate will still be off the bottom of the frame as the -;; wrapping function sees it and so will get wrapped around anyway. (defun windmove-constrain-loc-for-movement (coord window dir) "Constrain COORD so that it is reasonable for the given movement. This involves two things: first, make sure that the \"off\" coordinate @@ -347,6 +221,7 @@ accidentally. WINDOW is the window that movement is relative to; DIR is the direction of the movement, one of `left', `up', `right', or `down'. Returns the constrained coordinate." + (declare (obsolete "no longer used." "27.1")) (let ((frame-edges (windmove-frame-edges window)) (in-minibuffer (window-minibuffer-p window))) (let ((min-x (nth 0 frame-edges)) @@ -368,17 +243,13 @@ Returns the constrained coordinate." (cdr coord)))) (cons new-x new-y))))) -;; having constrained in the limited sense of windmove-constrain-loc- -;; for-movement, the wrapping code is actually much simpler than it -;; otherwise would be. the only complication is that we need to check -;; if the minibuffer is active, and, if not, pretend that it's not -;; even part of the frame. (defun windmove-wrap-loc-for-movement (coord window) "Takes the constrained COORD and wraps it around for the movement. This makes an out-of-range x or y coordinate and wraps it around the frame, giving a coordinate (hopefully) in the window on the other edge of the frame. WINDOW is the window that movement is relative to (nil means the currently selected window). Returns the wrapped coordinate." + (declare (obsolete "no longer used." "27.1")) (let* ((frame-edges (windmove-frame-edges window)) (frame-minibuffer (minibuffer-window (if window (window-frame window) @@ -396,10 +267,6 @@ means the currently selected window). Returns the wrapped coordinate." (windmove-constrain-around-range (car coord) min-x max-x) (windmove-constrain-around-range (cdr coord) min-y max-y))))) - -;; This calculates the reference location in the current window: the -;; frame-based (x . y) of either point, the top-left, or the -;; bottom-right of the window, depending on ARG. (defun windmove-reference-loc (&optional arg window) "Return the reference location for directional window selection. Return a coordinate (HPOS . VPOS) that is frame-based. If ARG is nil @@ -407,6 +274,7 @@ or not supplied, the reference point is the buffer's point in the currently-selected window, or WINDOW if supplied; otherwise, it is the top-left or bottom-right corner of the selected window, or WINDOW if supplied, if ARG is greater or smaller than zero, respectively." + (declare (obsolete "no longer used." "27.1")) (let ((effective-arg (if (null arg) 0 (prefix-numeric-value arg))) (edges (window-inside-edges window))) (let ((top-left (cons (nth 0 edges) @@ -429,15 +297,13 @@ supplied, if ARG is greater or smaller than zero, respectively." (posn-col-row (posn-at-point (window-point window) window)))))))) -;; This uses the reference location in the current window (calculated -;; by `windmove-reference-loc' above) to find a reference location -;; that will hopefully be in the window we want to move to. (defun windmove-other-window-loc (dir &optional arg window) "Return a location in the window to be moved to. Return value is a frame-based (HPOS . VPOS) value that should be moved to. DIR is one of `left', `up', `right', or `down'; an optional ARG is handled as by `windmove-reference-loc'; WINDOW is the window that movement is relative to." + (declare (obsolete "no longer used." "27.1")) (let ((edges (window-edges window)) ; edges: (x0, y0, x1, y1) (refpoint (windmove-reference-loc arg window))) ; (x . y) (cond @@ -463,15 +329,19 @@ movement is relative to." ;; Rewritten on 2013-12-13 using `window-in-direction'. After the ;; pixelwise change the old approach didn't work any more. martin (defun windmove-find-other-window (dir &optional arg window) - "Return the window object in direction DIR. -DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'." + "Return the window object in direction DIR as seen from WINDOW. +DIR is one of `left', `up', `right', or `down'. +WINDOW must be a live window and defaults to the selected one. +Optional ARG, if negative, means to use the right or bottom edge of +WINDOW as reference position, instead of `window-point'; if positive, +use the left or top edge of WINDOW as reference point." (window-in-direction dir window nil arg windmove-wrap-around t)) ;; Selects the window that's hopefully at the location returned by -;; `windmove-other-window-loc', or screams if there's no window there. +;; `windmove-find-other-window', or screams if there's no window there. (defun windmove-do-window-select (dir &optional arg window) - "Move to the window at direction DIR. -DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'. + "Move to the window at direction DIR as seen from WINDOW. +DIR, ARG, and WINDOW are handled as by `windmove-find-other-window'. If no window is at direction DIR, an error is signaled. If `windmove-create-window' is non-nil, try to create a new window in direction DIR instead." commit 372c4ebf6d3c7d39cc5b1e04e7f228543fec107d Author: Juanma Barranquero Date: Fri Oct 25 14:23:07 2019 +0200 * lisp/windmove.el (windmove-frame-edges): Simplify. diff --git a/lisp/windmove.el b/lisp/windmove.el index f5f51480db..feb269a407 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -324,15 +324,7 @@ of the frame; (X-MAX, Y-MAX) is the zero-based coordinate of the bottom-right corner of the frame. For example, if a frame has 76 rows and 181 columns, the return value from `windmove-frame-edges' will be the list (0 0 180 75)." - (let* ((frame (if window - (window-frame window) - (selected-frame))) - (top-left (window-edges (frame-first-window frame))) - (x-min (nth 0 top-left)) - (y-min (nth 1 top-left)) - (x-max (1- (frame-width frame))) ; 1- for last row & col - (y-max (1- (frame-height frame)))) - (list x-min y-min x-max y-max))) + (window-edges (frame-root-window window))) ;; it turns out that constraining is always a good thing, even when ;; wrapping is going to happen. this is because: commit fcc427f3562e43791ed2ab4370dc2c13e7435849 Author: Lars Ingebrigtsen Date: Fri Oct 25 12:41:29 2019 +0200 Fix gnus-thread-hide-subtree defcustom * lisp/gnus/gnus-sum.el (gnus-thread-hide-subtree): Make the "Non-nil" predicate do what it's supposed to (i.e., return non-nil on non-nil values (excepting predicates)) (bug#37916). diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index b5d744843f..f21bc7584e 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -334,7 +334,7 @@ If threads are hidden, you have to run the command :group 'gnus-thread :type '(radio (sexp :format "Non-nil\n" :match (lambda (widget value) - (not (or (consp value) (functionp value)))) + (and value (not (functionp value)))) :value t) (const nil) (sexp :tag "Predicate specifier"))) commit f131e396f8a32003b795456130ea37efa6ff41eb Author: Stefan Monnier Date: Thu Oct 24 23:06:23 2019 -0400 * lisp/cedet/mode-local.el: Clean up name space Mostly renaming functions by adding `mode-local--` to their name and leaving an obsolete alias behind, just in case. (define-child-mode): Make obsolete. (mode-local--set-parent): Rename from set-mode-local-parent. (mode-local--new-bindings): Rename from new-mode-local-bindings. Use `obarray-make`. (mode-local--activate-bindings): Rename from activate-mode-local-bindings. (mode-local--deactivate-bindings): Rename from deactivate-mode-local-bindings. (make-obsolete-overload): Rename properties with a `mode-local--` prefix. Adjust all users. (mode-local--overload-obsoleted-by): Rename from overload-obsoleted-by. (mode-local--overload-that-obsolete): Rename from overload-that-obsolete. (mode-local--function-overload-p): Rename from function-overload-p. (mode-local-read-function): Mark obsolete. (mode-local--overload-docstring-extension): Rename from overload-docstring-extension. (mode-local--describe-overload): Rename from describe-mode-local-overload. * lisp/cedet/semantic/fw.el (semantic-install-function-overrides): Remove unused `mode` argument. * lisp/cedet/semantic/grammar-wy.el (semantic-grammar-wy--install-parser): * lisp/cedet/semantic/bovine/grammar.el (bovine-grammar-mode): * lisp/cedet/semantic/texi.el (semantic-default-texi-setup): * lisp/cedet/semantic/wisent/grammar.el (wisent-grammar-setupcode-builder) (wisent-grammar-mode): * lisp/cedet/semantic/html.el (semantic-default-html-setup): Make the `semantic-` prefix explicit to ease grep search. (html-helper-mode): Remove obsolete setting. * lisp/cedet/semantic/wisent/javascript.el: Fix js-mode/javascript-mode mixup so we don't need define-child-mode any more. (semantic-get-local-variables, semantic-ctxt-current-symbol) (semantic-tag-protection, semantic-analyze-scope-calculate-access): Use `js-mode` rather than `javascript-mode` as the mode name since that's the real mode's name. * lisp/cedet/semantic/wisent/python.el (python-2-mode, python-3-mode): Remove child declaration for non-existing modes. * lisp/cedet/srecode/map.el (srecode-map-validate-file-for-mode): Simplify. diff --git a/etc/NEWS b/etc/NEWS index 01fdf39ab0..20967d4d77 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2170,7 +2170,8 @@ if you set 'time-stamp-format' or 'time-stamp-pattern' with a file-local variable, you may need to update the value. ** mode-local -*** 'define-overload' is declared obsolete. +*** Declare 'define-overload' and 'define-child-mode' as obsolete +*** Rename several internal functions to use a ''mode-local-' prefix * New Modes and Packages in Emacs 27.1 diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 602961c199..c4e5280df3 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -126,7 +126,7 @@ after changing the major mode." (mode-local-map-file-buffers (lambda () ;; Make sure variables are set up for this mode. - (activate-mode-local-bindings) + (mode-local--activate-bindings) (run-hooks 'mode-local-init-hook)) (lambda () (not (mode-local-initialized-p))) @@ -139,7 +139,9 @@ after changing the major mode." ;;; Mode lineage ;; -(defsubst set-mode-local-parent (mode parent) +(define-obsolete-function-alias 'set-mode-local-parent + #'mode-local--set-parent "27.1") +(defsubst mode-local--set-parent (mode parent) "Set parent of major mode MODE to PARENT mode. To work properly, this function should be called after PARENT mode local variables have been defined." @@ -147,14 +149,15 @@ local variables have been defined." ;; Refresh mode bindings to get mode local variables inherited from ;; PARENT. To work properly, the following should be called after ;; PARENT mode local variables have been defined. - (mode-local-map-mode-buffers #'activate-mode-local-bindings mode)) + (mode-local-map-mode-buffers #'mode-local--activate-bindings mode)) (defmacro define-child-mode (mode parent &optional _docstring) "Make major mode MODE inherit behavior from PARENT mode. DOCSTRING is optional and not used. To work properly, this should be put after PARENT mode local variables definition." - `(set-mode-local-parent ',mode ',parent)) + (declare (obsolete define-derived-mode "27.1")) + `(mode-local--set-parent ',mode ',parent)) (defun mode-local-use-bindings-p (this-mode desired-mode) "Return non-nil if THIS-MODE can use bindings of DESIRED-MODE." @@ -176,9 +179,11 @@ behaviors. Use the function `mode-local-bind' to define new bindings.") (defvar mode-local-active-mode nil "Major mode in which bindings are active.") -(defsubst new-mode-local-bindings () +(define-obsolete-function-alias 'new-mode-local-bindings + #'mode-local--new-bindings "27.1") +(defsubst mode-local--new-bindings () "Return a new empty mode bindings symbol table." - (make-vector 13 0)) + (obarray-make 13)) (defun mode-local-bind (bindings &optional plist mode) "Define BINDINGS in the specified environment. @@ -208,7 +213,7 @@ hook." ;; Install in given MODE symbol table. Create a new one if ;; needed. (setq table (or (get mode 'mode-local-symbol-table) - (new-mode-local-bindings))) + (mode-local--new-bindings))) (put mode 'mode-local-symbol-table table)) ;; Fail if trying to bind mode variables in local context! (if (plist-get plist 'mode-variable-flag) @@ -217,7 +222,7 @@ hook." ;; needed. (setq table (or mode-local-symbol-table (setq mode-local-symbol-table - (new-mode-local-bindings))))) + (mode-local--new-bindings))))) (while bindings (setq binding (car bindings) bindings (cdr bindings) @@ -286,7 +291,9 @@ doesn't have PROPERTY set." ;;; Mode local variables ;; -(defun activate-mode-local-bindings (&optional mode) +(define-obsolete-function-alias 'activate-mode-local-bindings + #'mode-local--activate-bindings "27.1") +(defun mode-local--activate-bindings (&optional mode) "Activate variables defined locally in MODE and its parents. That is, copy mode local bindings into corresponding buffer local variables. @@ -328,7 +335,9 @@ Elements are (SYMBOL . PREVIOUS-VALUE), describing one variable." table))) old-locals))) -(defun deactivate-mode-local-bindings (&optional mode) +(define-obsolete-function-alias 'deactivate-mode-local-bindings + #'mode-local--deactivate-bindings "27.1") +(defun mode-local--deactivate-bindings (&optional mode) "Deactivate variables defined locally in MODE and its parents. That is, kill buffer local variables set from the corresponding mode local bindings. @@ -364,19 +373,19 @@ To use the symbol MODE (quoted), use `with-mode-local'." ) (unwind-protect (progn - (deactivate-mode-local-bindings ,old-mode) + (mode-local--deactivate-bindings ,old-mode) (setq mode-local-active-mode ,new-mode) ;; Save the previous value of buffer-local variables - ;; changed by `activate-mode-local-bindings'. - (setq ,old-locals (activate-mode-local-bindings ,new-mode)) + ;; changed by `mode-local--activate-bindings'. + (setq ,old-locals (mode-local--activate-bindings ,new-mode)) ,@body) - (deactivate-mode-local-bindings ,new-mode) + (mode-local--deactivate-bindings ,new-mode) ;; Restore the previous value of buffer-local variables. (dolist (,local ,old-locals) (set (car ,local) (cdr ,local))) ;; Restore the mode local variables. (setq mode-local-active-mode ,old-mode) - (activate-mode-local-bindings ,old-mode))))) + (mode-local--activate-bindings ,old-mode))))) (defmacro with-mode-local (mode &rest body) "With the local bindings of MODE, evaluate BODY. @@ -453,20 +462,24 @@ DOCSTRING is optional." (defun make-obsolete-overload (old new when) "Mark OLD overload as obsoleted by NEW overload. WHEN is a string describing the first release where it was made obsolete." - (put old 'overload-obsoleted-by new) - (put old 'overload-obsoleted-since when) + (put old 'mode-local--overload-obsoleted-by new) + (put old 'mode-local--overload-obsoleted-since when) (put old 'mode-local-overload t) - (put new 'overload-obsolete old)) + (put new 'mode-local--overload-obsolete old)) -(defsubst overload-obsoleted-by (overload) +(define-obsolete-function-alias 'overload-obsoleted-by + #'mode-local--overload-obsoleted-by "27.1") +(defsubst mode-local--overload-obsoleted-by (overload) "Get the overload symbol obsoleted by OVERLOAD. Return the obsolete symbol or nil if not found." - (get overload 'overload-obsolete)) + (get overload 'mode-local--overload-obsolete)) -(defsubst overload-that-obsolete (overload) +(define-obsolete-function-alias 'overload-that-obsolete + #'mode-local--overload-that-obsolete "27.1") +(defsubst mode-local--overload-that-obsolete (overload) "Return the overload symbol that obsoletes OVERLOAD. Return the symbol found or nil if OVERLOAD is not obsolete." - (get overload 'overload-obsoleted-by)) + (get overload 'mode-local--overload-obsoleted-by)) (defsubst fetch-overload (overload) "Return the current OVERLOAD function, or nil if not found. @@ -474,9 +487,9 @@ First, lookup for OVERLOAD into locally bound mode local symbols, then in those bound in current `major-mode' and its parents." (or (mode-local-symbol-value overload nil 'override-flag) ;; If an obsolete overload symbol exists, try it. - (and (overload-obsoleted-by overload) + (and (mode-local--overload-obsoleted-by overload) (mode-local-symbol-value - (overload-obsoleted-by overload) nil 'override-flag)))) + (mode-local--overload-obsoleted-by overload) nil 'override-flag)))) (defun mode-local--override (name args body) "Return the form that handles overloading of function NAME. @@ -566,7 +579,9 @@ OVERARGS is a list of arguments passed to the override and (define-obsolete-function-alias 'define-overload 'define-overloadable-function "27.1") -(defsubst function-overload-p (symbol) +(define-obsolete-function-alias 'function-overload-p + #'mode-local--function-overload-p "27.1") +(defsubst mode-local--function-overload-p (symbol) "Return non-nil if SYMBOL is a function which can be overloaded." (and symbol (symbolp symbol) (get symbol 'mode-local-overload))) @@ -601,22 +616,27 @@ BODY is the implementation of this function." (defun mode-local-read-function (prompt &optional initial hist default) "Interactively read in the name of a mode-local function. PROMPT, INITIAL, HIST, and DEFAULT are the same as for `completing-read'." - (completing-read prompt obarray 'function-overload-p t initial hist default)) + (declare (obsolete nil "27.1")) + (completing-read prompt obarray #'mode-local--function-overload-p t initial hist default)) ;;; Help support ;; -(defun overload-docstring-extension (overload) +(define-obsolete-function-alias 'overload-docstring-extension + #'mode-local--overload-docstring-extension "27.1") +(defun mode-local--overload-docstring-extension (overload) "Return the doc string that augments the description of OVERLOAD." (let ((doc "\nThis function can be overloaded\ with `define-mode-local-override'.") - (sym (overload-obsoleted-by overload))) + (sym (mode-local--overload-obsoleted-by overload))) (when sym (setq doc (format "%s\nIt has made the overload `%s' obsolete since %s." - doc sym (get sym 'overload-obsoleted-since)))) - (setq sym (overload-that-obsolete overload)) + doc sym + (get sym 'mode-local--overload-obsoleted-since)))) + (setq sym (mode-local--overload-that-obsolete overload)) (when sym - (setq doc (format "%s\nThis overload is obsolete since %s;\nUse `%s' instead." - doc (get overload 'overload-obsoleted-since) sym))) + (setq doc (format + "%s\nThis overload is obsolete since %s;\nUse `%s' instead." + doc (get overload 'mode-local--overload-obsoleted-since) sym))) doc)) (defun mode-local-augment-function-help (symbol) @@ -630,7 +650,7 @@ SYMBOL is a function that can be overridden." (beginning-of-line) (forward-line -1)) (let ((inhibit-read-only t)) - (insert (substitute-command-keys (overload-docstring-extension symbol)) + (insert (substitute-command-keys (mode-local--overload-docstring-extension symbol)) "\n") ;; NOTE TO SELF: ;; LIST ALL LOADED OVERRIDES FOR SYMBOL HERE @@ -639,16 +659,16 @@ SYMBOL is a function that can be overridden." ;; We are called from describe-function in help-fns.el, where this is defined. (defvar describe-function-orig-buffer) -(defun describe-mode-local-overload (symbol) +(defun mode-local--describe-overload (symbol) "For `help-fns-describe-function-functions'; add overloads for SYMBOL." - (when (function-overload-p symbol) + (when (mode-local--function-overload-p symbol) (let ((default (or (intern-soft (format "%s-default" (symbol-name symbol))) symbol)) (override (with-current-buffer describe-function-orig-buffer (fetch-overload symbol))) modes) - (insert (substitute-command-keys (overload-docstring-extension symbol)) + (insert (substitute-command-keys (mode-local--overload-docstring-extension symbol)) "\n\n") (insert (format-message "default function: `%s'\n" default)) (if override @@ -671,7 +691,7 @@ SYMBOL is a function that can be overridden." ))) ))) -(add-hook 'help-fns-describe-function-functions #'describe-mode-local-overload) +(add-hook 'help-fns-describe-function-functions #'mode-local--describe-overload) (declare-function xref-item-location "xref" (xref) t) @@ -687,7 +707,7 @@ SYMBOL is a function that can be overridden." (defun xref-mode-local-overload (symbol) "For `elisp-xref-find-def-functions'; add overloads for SYMBOL." ;; Current buffer is the buffer where xref-find-definitions was invoked. - (when (function-overload-p symbol) + (when (mode-local--function-overload-p symbol) (let* ((symbol-file (find-lisp-object-file-name symbol (symbol-function symbol))) (default (intern-soft (format "%s-default" (symbol-name symbol)))) diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el index b05082c60e..862969dbc8 100644 --- a/lisp/cedet/semantic/bovine/c.el +++ b/lisp/cedet/semantic/bovine/c.el @@ -69,8 +69,10 @@ This function does not do any hidden buffer changes." ) ;;; Code: -(define-child-mode c++-mode c-mode - "`c++-mode' uses the same parser as `c-mode'.") +(with-suppressed-warnings ((obsolete define-child-mode)) + ;; FIXME: We should handle this some other way! + (define-child-mode c++-mode c-mode + "`c++-mode' uses the same parser as `c-mode'.")) ;;; Include Paths @@ -930,7 +932,7 @@ the regular parser." ) ; save match data ;; Hack in mode-local - (activate-mode-local-bindings) + (mode-local--activate-bindings) ;; Setup C parser (semantic-default-c-setup) ;; CHEATER! The following 3 lines are from diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index dd21f50325..590256cc70 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el @@ -496,7 +496,8 @@ used to perform the override." (if (and (eq (semantic-tag-class tag) 'function) (semantic-tag-get-attribute tag :overloadable)) ;; Calc the doc to use for the overloadable symbols. - (overload-docstring-extension (intern (semantic-tag-name tag))) + (mode-local--overload-docstring-extension + (intern (semantic-tag-name tag))) "")) (defun semantic-emacs-lisp-obsoleted-doc (tag) @@ -944,8 +945,10 @@ See `semantic-format-tag-prototype' for Emacs Lisp for more details." "Add variables. ELisp variables can be pretty long, so track this one too.") -(define-child-mode lisp-mode emacs-lisp-mode - "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.") +(with-suppressed-warnings ((obsolete define-child-mode)) + ;; FIXME: We should handle this some other way! + (define-child-mode lisp-mode emacs-lisp-mode + "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'.")) ;;;###autoload (defun semantic-default-elisp-setup () diff --git a/lisp/cedet/semantic/bovine/grammar.el b/lisp/cedet/semantic/bovine/grammar.el index 7c25b79db8..4d7b008dbd 100644 --- a/lisp/cedet/semantic/bovine/grammar.el +++ b/lisp/cedet/semantic/bovine/grammar.el @@ -438,8 +438,8 @@ Menu items are appended to the common grammar menu.") "Major mode for editing Bovine grammars." (semantic-grammar-setup-menu bovine-grammar-menu) (semantic-install-function-overrides - '((grammar-parsetable-builder . bovine-grammar-parsetable-builder) - (grammar-setupcode-builder . bovine-grammar-setupcode-builder)))) + '((semantic-grammar-parsetable-builder . bovine-grammar-parsetable-builder) + (semantic-grammar-setupcode-builder . bovine-grammar-setupcode-builder)))) (add-to-list 'auto-mode-alist '("\\.by\\'" . bovine-grammar-mode)) diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el index e07f090184..202dec3df3 100644 --- a/lisp/cedet/semantic/fw.el +++ b/lisp/cedet/semantic/fw.el @@ -186,8 +186,8 @@ Mark OLDFNALIAS as obsolete, such that the byte compiler will throw a warning when it encounters this symbol." (defalias oldfnalias newfn) (make-obsolete oldfnalias newfn when) - (when (and (function-overload-p newfn) - (not (overload-obsoleted-by newfn)) + (when (and (mode-local--function-overload-p newfn) + (not (mode-local--overload-obsoleted-by newfn)) ;; Only throw this warning when byte compiling things. (boundp 'byte-compile-current-file) byte-compile-current-file @@ -261,7 +261,7 @@ FUNCTION does not have arguments. When FUNCTION is entered (semantic-alias-obsolete 'define-mode-overload-implementation 'define-mode-local-override "23.2") -(defun semantic-install-function-overrides (overrides &optional transient mode) +(defun semantic-install-function-overrides (overrides &optional transient) "Install the function OVERRIDES in the specified environment. OVERRIDES must be an alist ((OVERLOAD . FUNCTION) ...) where OVERLOAD is a symbol identifying an overloadable entry, and FUNCTION is the @@ -282,8 +282,7 @@ later installation should be done in MODE hook." (cons (intern (format "semantic-%s" name)) (cdr e))))) overrides) (list 'constant-flag (not transient) - 'override-flag t) - mode)) + 'override-flag t))) ;;; User Interrupt handling ;; diff --git a/lisp/cedet/semantic/grammar-wy.el b/lisp/cedet/semantic/grammar-wy.el index 3b99469f55..1da57862d5 100644 --- a/lisp/cedet/semantic/grammar-wy.el +++ b/lisp/cedet/semantic/grammar-wy.el @@ -421,7 +421,7 @@ (defun semantic-grammar-wy--install-parser () "Setup the Semantic Parser." (semantic-install-function-overrides - '((parse-stream . wisent-parse-stream))) + '((semantic-parse-stream . wisent-parse-stream))) (setq semantic-parser-name "LALR" semantic--parse-table semantic-grammar-wy--parse-table semantic-debug-parser-source "grammar.wy" diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el index 3a8165c423..f70fec2db7 100644 --- a/lisp/cedet/semantic/html.el +++ b/lisp/cedet/semantic/html.el @@ -247,13 +247,15 @@ tag with greater section value than LEVEL is found." semantic-stickyfunc-sticky-classes '(section) ) (semantic-install-function-overrides - '((tag-components . semantic-html-components) + '((semantic-tag-components . semantic-html-components) ) t) ) -(define-child-mode html-helper-mode html-mode - "`html-helper-mode' needs the same semantic support as `html-mode'.") +;; `html-helper-mode' hasn't been updated since 2004, so it's not very +;; relevant nowadays. +;;(define-child-mode html-helper-mode html-mode +;; "`html-helper-mode' needs the same semantic support as `html-mode'.") (provide 'semantic/html) diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el index d07dc806a4..a81b23ca75 100644 --- a/lisp/cedet/semantic/lex-spp.el +++ b/lisp/cedet/semantic/lex-spp.el @@ -1071,7 +1071,7 @@ and variable state from the current buffer." (error nil)) ;; Hack in mode-local - (activate-mode-local-bindings) + (mode-local--activate-bindings) ;; Call the major mode's setup function (let ((entry (assq major-mode semantic-new-buffer-setup-functions))) diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el index 3a0050b920..73f0e734f3 100644 --- a/lisp/cedet/semantic/texi.el +++ b/lisp/cedet/semantic/texi.el @@ -63,9 +63,9 @@ Each tag returned is of the form: or (\"NAME\" def) -It is an override of 'parse-region and must be installed by the +It is an override of `semantic-parse-region' and must be installed by the function `semantic-install-function-overrides'." - (mapcar 'semantic-texi-expand-tag + (mapcar #'semantic-texi-expand-tag (semantic-texi-parse-headings))) (defun semantic-texi-parse-changes () @@ -451,8 +451,8 @@ that start with that symbol." "Set up a buffer for parsing of Texinfo files." ;; This will use our parser. (semantic-install-function-overrides - '((parse-region . semantic-texi-parse-region) - (parse-changes . semantic-texi-parse-changes))) + '((semantic-parse-region . semantic-texi-parse-region) + (semantic-parse-changes . semantic-texi-parse-changes))) (setq semantic-parser-name "TEXI" ;; Setup a dummy parser table to enable parsing! semantic--parse-table t diff --git a/lisp/cedet/semantic/wisent/grammar.el b/lisp/cedet/semantic/wisent/grammar.el index e6b389b60b..1254f99680 100644 --- a/lisp/cedet/semantic/wisent/grammar.el +++ b/lisp/cedet/semantic/wisent/grammar.el @@ -297,7 +297,7 @@ Return the expanded expression." "Return the parser setup code." (format "(semantic-install-function-overrides\n\ - '((parse-stream . wisent-parse-stream)))\n\ + '((semantic-parse-stream . wisent-parse-stream)))\n\ (setq semantic-parser-name \"LALR\"\n\ semantic--parse-table %s\n\ semantic-debug-parser-source %S\n\ @@ -326,8 +326,8 @@ Menu items are appended to the common grammar menu.") "Major mode for editing Wisent grammars." (semantic-grammar-setup-menu wisent-grammar-menu) (semantic-install-function-overrides - '((grammar-parsetable-builder . wisent-grammar-parsetable-builder) - (grammar-setupcode-builder . wisent-grammar-setupcode-builder)))) + '((semantic-grammar-parsetable-builder . wisent-grammar-parsetable-builder) + (semantic-grammar-setupcode-builder . wisent-grammar-setupcode-builder)))) (defvar-mode-local wisent-grammar-mode semantic-grammar-macros '( diff --git a/lisp/cedet/semantic/wisent/javascript.el b/lisp/cedet/semantic/wisent/javascript.el index 7722c95360..4c93c0dc4f 100644 --- a/lisp/cedet/semantic/wisent/javascript.el +++ b/lisp/cedet/semantic/wisent/javascript.el @@ -64,13 +64,13 @@ to this variable NAME." ;; the tags created by the javascript parser. ;; Local context (define-mode-local-override semantic-get-local-variables - javascript-mode () + js-mode () "Get local values from a specific context. This function overrides `get-local-variables'." ;; Does javascript have identifiable local variables? nil) -(define-mode-local-override semantic-tag-protection javascript-mode (tag &optional parent) +(define-mode-local-override semantic-tag-protection js-mode (tag &optional parent) "Return protection information about TAG with optional PARENT. This function returns on of the following symbols: nil - No special protection. Language dependent. @@ -85,14 +85,14 @@ The default behavior (if not overridden with `tag-protection' is to return a symbol based on type modifiers." nil) -(define-mode-local-override semantic-analyze-scope-calculate-access javascript-mode (type scope) +(define-mode-local-override semantic-analyze-scope-calculate-access js-mode (type scope) "Calculate the access class for TYPE as defined by the current SCOPE. Access is related to the :parents in SCOPE. If type is a member of SCOPE then access would be 'private. If TYPE is inherited by a member of SCOPE, the access would be 'protected. Otherwise, access is 'public." nil) -(define-mode-local-override semantic-ctxt-current-symbol javascript-mode (&optional point) +(define-mode-local-override semantic-ctxt-current-symbol js-mode (&optional point) "Return the current symbol the cursor is on at POINT in a list. This is a very simple implementation for Javascript symbols. It will at maximum do one split, so that the first part is seen as @@ -117,13 +117,6 @@ This is currently needed for the mozrepl omniscient database." ;;; Setup Function ;; -;; Since javascript-mode is an alias for js-mode, let it inherit all -;; the overrides. -(define-child-mode js-mode javascript-mode) - -;; Since javascript-mode is an alias for js-mode, let it inherit all -;; the overrides. -(define-child-mode js-mode javascript-mode) ;; In semantic-imenu.el, not part of Emacs. (defvar semantic-imenu-summary-function) diff --git a/lisp/cedet/semantic/wisent/python.el b/lisp/cedet/semantic/wisent/python.el index f0e294efa6..540c59b9a7 100644 --- a/lisp/cedet/semantic/wisent/python.el +++ b/lisp/cedet/semantic/wisent/python.el @@ -530,11 +530,6 @@ Shortens `code' tags, but passes through for others." (code . "Code"))) ) -;; Make sure the newer python modes pull in the same python -;; mode overrides. -(define-child-mode python-2-mode python-mode "Python 2 mode") -(define-child-mode python-3-mode python-mode "Python 3 mode") - ;;; Utility functions ;; diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el index 08ff0e6305..343cc9155d 100644 --- a/lisp/cedet/srecode/map.el +++ b/lisp/cedet/srecode/map.el @@ -346,8 +346,8 @@ if that file is NEW, otherwise assume the mode has not changed." Argument FAST implies that the file should not be reparsed if there is already an entry for it. Return non-nil if the map changed." - (when (or (not fast) - (not (srecode-map-entry-for-file-anywhere srecode-current-map file))) + (unless (and fast + (srecode-map-entry-for-file-anywhere srecode-current-map file)) (let ((buff-orig (get-file-buffer file)) (dirty nil)) (save-excursion commit 4a083b0d36a8b2afe23447dbc357de3641140d4d Author: Paul Eggert Date: Thu Oct 24 14:32:06 2019 -0700 Update from Gnulib This incorporates: 2019-10-23 nstrftime: speed up integer overflow checking 2019-10-23 port better to GCC under macOS 2019-10-15 inttypes: use more-robust test for int range 2019-10-14 update-copyright: use en dashes in .texi ranges * build-aux/update-copyright, lib/intprops.h, lib/inttypes.in.h: * lib/nstrftime.c, lib/verify.h: Copy from Gnulib. diff --git a/build-aux/update-copyright b/build-aux/update-copyright index b3f6b29805..e4809f620d 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -98,7 +98,7 @@ # 6. Blank lines, even if preceded by the prefix, do not appear # within the FSF copyright statement. # 7. Each copyright year is 2 or 4 digits, and years are separated by -# commas or dashes. Whitespace may appear after commas. +# commas, "-", or "--". Whitespace may appear after commas. # # Environment variables: # @@ -192,7 +192,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g) $holder_re =~ s/\s/$ws_re/g; my $stmt_remainder_re = "(?:$ws_re$circle_c_re)?" - . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*" + . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*" . "((?:\\d\\d)?\\d\\d)$ws_re$holder_re"; if (/\G$stmt_remainder_re/) { @@ -231,26 +231,28 @@ if (defined $stmt_re) # Make the use of intervals consistent. if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS}) { - $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg; + $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg; } else { + my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-"; + $stmt =~ s/ (\d{4}) (?: - (,\ |-) + (,\ |--?) ((??{ - if ($2 eq '-') { '\d{4}'; } + if ($2 ne ', ') { '\d{4}'; } elsif (!$3) { $1 + 1; } else { $3 + 1; } })) )+ - /$1-$3/gx; + /$1$ndash$3/gx; # When it's 2, emit a single range encompassing all year numbers. $ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2 - and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/; + and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/; } # Format within margin. diff --git a/lib/intprops.h b/lib/intprops.h index 36c6359a21..bf561ad0a6 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -22,18 +22,6 @@ #include -/* If the compiler lacks __has_builtin, define it well enough for this - source file only. */ -#ifndef __has_builtin -# define __has_builtin(x) _GL_HAS_##x -# if 5 <= __GNUC__ && !defined __ICC -# define _GL_HAS___builtin_add_overflow 1 -# else -# define _GL_HAS___builtin_add_overflow 0 -# endif -# define _GL_TEMPDEF___has_builtin -#endif - /* Return a value with the common real type of E and V and the value of V. Do not evaluate E. */ #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) @@ -234,8 +222,10 @@ /* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow (A, B, P) work when P is non-null. */ -#if __has_builtin (__builtin_add_overflow) +#if 5 <= __GNUC__ && !defined __ICC # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) #else # define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 #endif @@ -586,10 +576,4 @@ : (tmin) / (a) < (b)) \ : (tmax) / (b) < (a))) -#ifdef _GL_TEMPDEF___has_builtin -# undef __has_builtin -# undef _GL_HAS___builtin_add_overflow -# undef _GL_TEMPDEF___has_builtin -#endif - #endif /* _GL_INTPROPS_H */ diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h index 31e40c51a6..49bcbc168f 100644 --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -49,15 +49,15 @@ #ifndef __GLIBC__ # include #endif -/* Get CHAR_BIT. */ +/* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */ #include /* On mingw, __USE_MINGW_ANSI_STDIO only works if is also included */ #if defined _WIN32 && ! defined __CYGWIN__ # include #endif -#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX) -# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to ." +#if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1) +# error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to ." #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ diff --git a/lib/nstrftime.c b/lib/nstrftime.c index bc84da5a0c..461dadb292 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -68,6 +68,8 @@ extern char *tzname[]; #include #include +#include + #ifndef FALLTHROUGH # if __GNUC__ < 7 # define FALLTHROUGH ((void) 0) @@ -113,13 +115,6 @@ extern char *tzname[]; ? (a) >> (b) \ : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0)) -/* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if t is signed; log10 (2.0) < 146/485; - add 1 for integer division truncation; add 1 more for a minus sign - if needed. */ -#define INT_STRLEN_BOUND(t) \ - ((sizeof (t) * CHAR_BIT - 1) * 146 / 485 + 2) - #define TM_YEAR_BASE 1900 #ifndef __isleap @@ -704,15 +699,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) width = 0; do { - if (width > INT_MAX / 10 - || (width == INT_MAX / 10 && *f - L_('0') > INT_MAX % 10)) - /* Avoid overflow. */ + if (INT_MULTIPLY_WRAPV (width, 10, &width) + || INT_ADD_WRAPV (width, *f - L_('0'), &width)) width = INT_MAX; - else - { - width *= 10; - width += *f - L_('0'); - } ++f; } while (ISDIGIT (*f)); diff --git a/lib/verify.h b/lib/verify.h index 06e975ebf6..a58005c398 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -56,16 +56,6 @@ # undef _Static_assert #endif -/* If the compiler lacks __has_builtin, define it well enough for this - source file only. */ -#ifndef __has_builtin -# define __has_builtin(x) _GL_HAS_##x -# define _GL_HAS___builtin_unreachable (4 < __GNUC__ + (5 <= __GNUC_MINOR__)) -# define _GL_HAS___builtin_trap \ - (3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))) -# define _GL_TEMPDEF___has_builtin -#endif - /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. @@ -243,6 +233,22 @@ template /* @assert.h omit start@ */ +#if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)) +# define _GL_HAS_BUILTIN_TRAP 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap) +#else +# define _GL_HAS_BUILTIN_TRAP 0 +#endif + +#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) +# define _GL_HAS_BUILTIN_UNREACHABLE 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) +#else +# define _GL_HAS_BUILTIN_UNREACHABLE 0 +#endif + /* Each of these macros verifies that its argument R is nonzero. To be portable, R should be an integer constant expression. Unlike assert (R), there is no run-time overhead. @@ -276,11 +282,11 @@ template can suffer if R uses hard-to-optimize features such as function calls not inlined by the compiler. */ -#if __has_builtin (__builtin_unreachable) +#if _GL_HAS_BUILTIN_UNREACHABLE # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) -#elif (defined GCC_LINT || defined lint) && __has_builtin (__builtin_trap) +#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP /* Doing it this way helps various packages when configured with --enable-gcc-warnings, which compiles with -Dlint. It's nicer when 'assume' silences warnings even with older GCCs. */ @@ -290,13 +296,6 @@ template # define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) #endif -#ifdef _GL_TEMPDEF___has_builtin -# undef __has_builtin -# undef _GL_HAS___builtin_unreachable -# undef _GL_HAS___builtin_trap -# undef _GL_TEMPDEF___has_builtin -#endif - /* @assert.h omit end@ */ #endif commit 57162dbc065a3b9f9b8dfd555ef628e639061839 Author: Juanma Barranquero Date: Thu Oct 24 21:16:43 2019 +0200 * doc/lispref/display.texi: Document `delay-warning' diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index d7a118296c..6290c89cdc 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -828,7 +828,13 @@ that warning is not logged. Sometimes, you may wish to avoid showing a warning while a command is running, and only show it only after the end of the command. You can -use the variable @code{delayed-warnings-list} for this. +use the function @code{delay-warning} for this. + +@defun delay-warning type message &optional level buffer-name +This function is the delayed counterpart to @code{display-warning} +(@pxref{Warning Basics}), and it is called with the same arguments. +The warning message is queued into @code{delayed-warnings-list}. +@end defun @defvar delayed-warnings-list The value of this variable is a list of warnings to be displayed after @@ -840,8 +846,8 @@ the current command has finished. Each element must be a list @noindent with the same form, and the same meanings, as the argument list of -@code{display-warning} (@pxref{Warning Basics}). Immediately after -running @code{post-command-hook} (@pxref{Command Overview}), the Emacs +@code{display-warning}. Immediately after running +@code{post-command-hook} (@pxref{Command Overview}), the Emacs command loop displays all the warnings specified by this variable, then resets it to @code{nil}. @end defvar commit 539d0411bb04e5b3b32cd77ac3b3e4ad364589da Author: Mattias Engdegård Date: Tue Oct 22 17:02:23 2019 +0200 rx.el: Refactor user-definition expansion * lisp/emacs-lisp/rx.el (rx--translate-not): Simplify structure. * lisp/emacs-lisp/rx.el (rx--expand-def): New. (rx--translate-symbol, rx--translate-form): Use rx--expand-def. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 2370948e81..d7677f1444 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -122,9 +122,27 @@ Each entry is: as the rx form DEF (which can contain members of ARGS).") (defsubst rx--lookup-def (name) + "Current definition of NAME: (DEF) or (ARGS DEF), or nil if none." (or (cdr (assq name rx--local-definitions)) (get name 'rx-definition))) +(defun rx--expand-def (form) + "FORM expanded (once) if a user-defined construct; otherwise nil." + (cond ((symbolp form) + (let ((def (rx--lookup-def form))) + (and def + (if (cdr def) + (error "Not an `rx' symbol definition: %s" form) + (car def))))) + ((consp form) + (let* ((op (car form)) + (def (rx--lookup-def op))) + (and def + (if (cdr def) + (rx--expand-template + op (cdr form) (nth 0 def) (nth 1 def)) + (error "Not an `rx' form definition: %s" op))))))) + ;; TODO: Additions to consider: ;; - A construct like `or' but without the match order guarantee, ;; maybe `unordered-or'. Useful for composition or generation of @@ -155,11 +173,8 @@ Each entry is: ((let ((class (cdr (assq sym rx--char-classes)))) (and class (cons (list (concat "[[:" (symbol-name class) ":]]")) t)))) - ((let ((definition (rx--lookup-def sym))) - (and definition - (if (cdr definition) - (error "Not an `rx' symbol definition: %s" sym) - (rx--translate (nth 0 definition)))))) + ((let ((expanded (rx--expand-def sym))) + (and expanded (rx--translate expanded)))) ;; For compatibility with old rx. ((let ((entry (assq sym rx-constituents))) @@ -446,21 +461,23 @@ If NEGATED, negate the sense (thus making it positive)." (error "rx `not' form takes exactly one argument")) (let ((arg (car body))) (cond - ((consp arg) - (pcase (car arg) - ((or 'any 'in 'char) (rx--translate-any (not negated) (cdr arg))) - ('syntax (rx--translate-syntax (not negated) (cdr arg))) - ('category (rx--translate-category (not negated) (cdr arg))) - ('not (rx--translate-not (not negated) (cdr arg))) - (_ (error "Illegal argument to rx `not': %S" arg)))) + ((and (consp arg) + (pcase (car arg) + ((or 'any 'in 'char) + (rx--translate-any (not negated) (cdr arg))) + ('syntax + (rx--translate-syntax (not negated) (cdr arg))) + ('category + (rx--translate-category (not negated) (cdr arg))) + ('not + (rx--translate-not (not negated) (cdr arg)))))) + ((let ((class (cdr (assq arg rx--char-classes)))) + (and class + (rx--translate-any (not negated) (list class))))) ((eq arg 'word-boundary) (rx--translate-symbol (if negated 'word-boundary 'not-word-boundary))) - (t - (let ((class (cdr (assq arg rx--char-classes)))) - (if class - (rx--translate-any (not negated) (list class)) - (error "Illegal argument to rx `not': %s" arg))))))) + (t (error "Illegal argument to rx `not': %S" arg))))) (defun rx--atomic-regexp (item) "ITEM is (REGEXP . PRECEDENCE); return a regexp of precedence t." @@ -874,30 +891,28 @@ can expand to any number of values." ((or 'regexp 'regex) (rx--translate-regexp body)) (op - (unless (symbolp op) - (error "Bad rx operator `%S'" op)) - (let ((definition (rx--lookup-def op))) - (if definition - (if (cdr definition) - (rx--translate - (rx--expand-template - op body (nth 0 definition) (nth 1 definition))) - (error "Not an `rx' form definition: %s" op)) - - ;; For compatibility with old rx. - (let ((entry (assq op rx-constituents))) - (if (progn - (while (and entry (not (consp (cdr entry)))) - (setq entry - (if (symbolp (cdr entry)) - ;; Alias for another entry. - (assq (cdr entry) rx-constituents) - ;; Wrong type, try further down the list. - (assq (car entry) - (cdr (memq entry rx-constituents)))))) - entry) - (rx--translate-compat-form (cdr entry) form) - (error "Unknown rx form `%s'" op))))))))) + (cond + ((not (symbolp op)) (error "Bad rx operator `%S'" op)) + + ((let ((expanded (rx--expand-def form))) + (and expanded + (rx--translate expanded)))) + + ;; For compatibility with old rx. + ((let ((entry (assq op rx-constituents))) + (and (progn + (while (and entry (not (consp (cdr entry)))) + (setq entry + (if (symbolp (cdr entry)) + ;; Alias for another entry. + (assq (cdr entry) rx-constituents) + ;; Wrong type, try further down the list. + (assq (car entry) + (cdr (memq entry rx-constituents)))))) + entry) + (rx--translate-compat-form (cdr entry) form)))) + + (t (error "Unknown rx form `%s'" op))))))) (defconst rx--builtin-forms '(seq sequence : and or | any in char not-char not commit b3b74514e98e2fc85c261a1444ce2db0cf23abfc Author: Stefan Kangas Date: Thu Oct 24 01:08:30 2019 +0200 Update FAQ section on large files (Bug#37818) * doc/misc/efaq.texi (Problems with very large files): Extend section and remove information about ancient versions of Emacs. diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index 0b7b6d9c9f..29461bec7a 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -2918,20 +2918,29 @@ type @kbd{C-h C-p} to read it. @end menu @node Problems with very large files -@section Does Emacs have problems with files larger than 8 megabytes? +@section Does Emacs have problems with large files? @cindex Very large files, opening @cindex Large files, opening @cindex Opening very large files @cindex Maximum file size @cindex Files, maximum size -Old versions (i.e., anything before 19.29) of Emacs had problems editing -files larger than 8 megabytes. In versions 19.29 and later, the maximum -buffer size is at least @math{2^{27}-1}, or 134,217,727 bytes, or 132 MBytes. -The maximum buffer size on 32-bit machines increased to 256 MBytes in -Emacs 22, and again to 512 MBytes in Emacs 23.2. +Emacs has an inherent fixed limitation on the size of buffers. This +limit is stricter than the maximum size of objects supported by other +programs on the same architecture. -Emacs compiled on a 64-bit machine can handle much larger buffers. +The maximum buffer size on 32-bit machines is 512 MBytes beginning +with version 23.2. If Emacs was built using the +@code{--with-wide-int} flag, the maximum buffer size on 32-bit +machines is 2 GB. + +Emacs compiled on a 64-bit machine can handle much larger buffers; up +to @code{most-positive-fixnum} (2.3 exabytes). + +Due to things like decoding of multibyte characters, you can only +visit files with a size that is roughly half the buffer size limit. +When visiting compressed archives, the file size limit will be +smaller than that due to decompression. @node ^M in the shell buffer @section How do I get rid of @samp{^M} or echoed commands in my shell buffer? commit 61223a046c37d44f67e6600909439d32f8dd34f9 Author: Stefan Kangas Date: Thu Oct 24 01:08:20 2019 +0200 Update FAQ section on Emacs security (Bug#37818) * doc/misc/efaq.texi (Security risks with Emacs): Remove section on movemail. Add section on third-party packages. diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi index b45db4c84f..0b7b6d9c9f 100644 --- a/doc/misc/efaq.texi +++ b/doc/misc/efaq.texi @@ -3207,23 +3207,12 @@ You can tell Emacs the shell's current directory with the command @itemize @bullet @item -The @file{movemail} incident. (No, this is not a risk.) - -In his book @cite{The Cuckoo's Egg}, Cliff Stoll describes this in -chapter 4. The site at LBL had installed the @file{/etc/movemail} -program setuid root. (As of version 19, @file{movemail} is in your -architecture-specific directory; type @kbd{C-h v exec-directory -@key{RET}} to see what it is.) Since @code{movemail} had not been -designed for this situation, a security hole was created and users could -get root privileges. - -@code{movemail} has since been changed so that this security hole will -not exist, even if it is installed setuid root. However, -@code{movemail} no longer needs to be installed setuid root, which -should eliminate this particular risk. - -We have heard unverified reports that the 1988 Internet worm took -advantage of this configuration problem. +Third party packages. + +Any package you install into Emacs can run arbtitrary code with the +same privileges as the Emacs process itself. Be aware of this when +you use the package system (e.g. @code{M-x list-packages}) with third +party archives. Use only third parties that you can trust! @item The @code{file-local-variable} feature. (Yes, a risk, but easy to commit 53e7a763dd16509d90418bdf14d161db13271ea3 Author: Stefan Monnier Date: Wed Oct 23 17:48:41 2019 -0400 * lisp/cedet/mode-local.el: Use lexical-binding and `declare` (with-mode-local-symbol, with-mode-local, setq-mode-local) (defvar-mode-local, defconst-mode-local) (define-overloadable-function, define-mode-local-override): Use `declare` for indent and edebug specs. (xref-mode-local-find-overloadable-regexp): Simplify regexp. (mode-local-setup-edebug-specs): Delete. (edebug-setup-hook): Don't use any more. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 28867eea9b..602961c199 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -1,4 +1,4 @@ -;;; mode-local.el --- Support for mode local facilities +;;; mode-local.el --- Support for mode local facilities -*- lexical-binding:t -*- ;; ;; Copyright (C) 2004-2005, 2007-2019 Free Software Foundation, Inc. ;; @@ -120,7 +120,7 @@ which mode local bindings have been activated." "Initialize mode-local facilities. This is run from `find-file-hook', and from `post-command-hook' after changing the major mode." - (remove-hook 'post-command-hook 'mode-local-post-major-mode-change nil) + (remove-hook 'post-command-hook #'mode-local-post-major-mode-change nil) (let ((buffers mode-local-changed-mode-buffers)) (setq mode-local-changed-mode-buffers nil) (mode-local-map-file-buffers @@ -135,7 +135,7 @@ after changing the major mode." (defun mode-local-on-major-mode-change () "Function called in `change-major-mode-hook'." (add-to-list 'mode-local-changed-mode-buffers (current-buffer)) - (add-hook 'post-command-hook 'mode-local-post-major-mode-change t nil)) + (add-hook 'post-command-hook #'mode-local-post-major-mode-change t nil)) ;;; Mode lineage ;; @@ -149,7 +149,7 @@ local variables have been defined." ;; PARENT mode local variables have been defined. (mode-local-map-mode-buffers #'activate-mode-local-bindings mode)) -(defmacro define-child-mode (mode parent &optional docstring) +(defmacro define-child-mode (mode parent &optional _docstring) "Make major mode MODE inherit behavior from PARENT mode. DOCSTRING is optional and not used. To work properly, this should be put after PARENT mode local variables @@ -347,46 +347,46 @@ If MODE is not specified it defaults to current `major-mode'." (setq mode (get-mode-local-parent mode))))) (defmacro with-mode-local-symbol (mode &rest body) - "With the local bindings of MODE symbol, evaluate BODY. + "With the local bindings of MODE symbol, evaluate BODY. The current mode bindings are saved, BODY is evaluated, and the saved bindings are restored, even in case of an abnormal exit. Value is what BODY returns. This is like `with-mode-local', except that MODE's value is used. To use the symbol MODE (quoted), use `with-mode-local'." - (let ((old-mode (make-symbol "mode")) - (old-locals (make-symbol "old-locals")) - (new-mode (make-symbol "new-mode")) - (local (make-symbol "local"))) - `(let ((,old-mode mode-local-active-mode) - (,old-locals nil) - (,new-mode ,mode) - ) - (unwind-protect - (progn - (deactivate-mode-local-bindings ,old-mode) - (setq mode-local-active-mode ,new-mode) - ;; Save the previous value of buffer-local variables - ;; changed by `activate-mode-local-bindings'. - (setq ,old-locals (activate-mode-local-bindings ,new-mode)) - ,@body) - (deactivate-mode-local-bindings ,new-mode) - ;; Restore the previous value of buffer-local variables. - (dolist (,local ,old-locals) - (set (car ,local) (cdr ,local))) - ;; Restore the mode local variables. - (setq mode-local-active-mode ,old-mode) - (activate-mode-local-bindings ,old-mode))))) -(put 'with-mode-local-symbol 'lisp-indent-function 1) + (declare (indent 1)) + (let ((old-mode (make-symbol "mode")) + (old-locals (make-symbol "old-locals")) + (new-mode (make-symbol "new-mode")) + (local (make-symbol "local"))) + `(let ((,old-mode mode-local-active-mode) + (,old-locals nil) + (,new-mode ,mode) + ) + (unwind-protect + (progn + (deactivate-mode-local-bindings ,old-mode) + (setq mode-local-active-mode ,new-mode) + ;; Save the previous value of buffer-local variables + ;; changed by `activate-mode-local-bindings'. + (setq ,old-locals (activate-mode-local-bindings ,new-mode)) + ,@body) + (deactivate-mode-local-bindings ,new-mode) + ;; Restore the previous value of buffer-local variables. + (dolist (,local ,old-locals) + (set (car ,local) (cdr ,local))) + ;; Restore the mode local variables. + (setq mode-local-active-mode ,old-mode) + (activate-mode-local-bindings ,old-mode))))) (defmacro with-mode-local (mode &rest body) - "With the local bindings of MODE, evaluate BODY. + "With the local bindings of MODE, evaluate BODY. The current mode bindings are saved, BODY is evaluated, and the saved bindings are restored, even in case of an abnormal exit. Value is what BODY returns. This is like `with-mode-local-symbol', except that MODE is quoted and is not evaluated." - `(with-mode-local-symbol ',mode ,@body)) -(put 'with-mode-local 'lisp-indent-function 1) + (declare (indent 1)) + `(with-mode-local-symbol ',mode ,@body)) (defsubst mode-local-value (mode sym) @@ -403,6 +403,7 @@ The values VAL are expressions; they are evaluated. Set each SYM to the value of its VAL, locally in buffers already in MODE, or in buffers switched to that mode. Return the value of the last VAL." + (declare (debug (symbolp &rest symbolp form))) (when args (let (i ll bl sl tmp sym val) (setq i 0) @@ -427,16 +428,18 @@ Return the value of the last VAL." (defmacro defvar-mode-local (mode sym val &optional docstring) "Define MODE local variable SYM with value VAL. DOCSTRING is optional." + (declare (indent defun) + (debug (&define symbolp name def-form [ &optional stringp ] ))) `(progn (setq-mode-local ,mode ,sym ,val) (put (mode-local-symbol ',sym ',mode) 'variable-documentation ,docstring) ',sym)) -(put 'defvar-mode-local 'lisp-indent-function 'defun) (defmacro defconst-mode-local (mode sym val &optional docstring) "Define MODE local constant SYM with value VAL. DOCSTRING is optional." + (declare (indent defun) (debug defvar-mode-local)) (let ((tmp (make-symbol "tmp"))) `(let (,tmp) (setq-mode-local ,mode ,sym ,val) @@ -444,7 +447,6 @@ DOCSTRING is optional." (put ,tmp 'constant-flag t) (put ,tmp 'variable-documentation ,docstring) ',sym))) -(put 'defconst-mode-local 'lisp-indent-function 'defun) ;;; Function overloading ;; @@ -552,7 +554,8 @@ defined. The default is to call the function `NAME-default' with the appropriate arguments deduced from ARGS. OVERARGS is a list of arguments passed to the override and `NAME-default' function, in place of those deduced from ARGS." - (declare (doc-string 3)) + (declare (doc-string 3) + (debug (&define name lambda-list stringp def-body))) `(eval-and-compile (defun ,name ,args ,docstring @@ -561,7 +564,7 @@ OVERARGS is a list of arguments passed to the override and (put :override-with-args 'lisp-indent-function 1) (define-obsolete-function-alias 'define-overload - #'define-overloadable-function "27.1") + 'define-overloadable-function "27.1") (defsubst function-overload-p (symbol) "Return non-nil if SYMBOL is a function which can be overloaded." @@ -577,7 +580,8 @@ named function created with `define-overload'. DOCSTRING is the documentation string. BODY is the implementation of this function." ;; FIXME: Make this obsolete and use cl-defmethod with &context instead. - (declare (doc-string 4)) + (declare (doc-string 4) + (debug (&define name symbolp lambda-list stringp def-body))) (let ((newname (intern (format "%s-%s" name mode)))) `(progn (eval-and-compile @@ -667,7 +671,7 @@ SYMBOL is a function that can be overridden." ))) ))) -(add-hook 'help-fns-describe-function-functions 'describe-mode-local-overload) +(add-hook 'help-fns-describe-function-functions #'describe-mode-local-overload) (declare-function xref-item-location "xref" (xref) t) @@ -684,9 +688,11 @@ SYMBOL is a function that can be overridden." "For `elisp-xref-find-def-functions'; add overloads for SYMBOL." ;; Current buffer is the buffer where xref-find-definitions was invoked. (when (function-overload-p symbol) - (let* ((symbol-file (find-lisp-object-file-name symbol (symbol-function symbol))) + (let* ((symbol-file (find-lisp-object-file-name + symbol (symbol-function symbol))) (default (intern-soft (format "%s-default" (symbol-name symbol)))) - (default-file (when default (find-lisp-object-file-name default (symbol-function default)))) + (default-file (when default (find-lisp-object-file-name + default (symbol-function default)))) modes xrefs) @@ -701,12 +707,15 @@ SYMBOL is a function that can be overridden." (setq modes (sort modes (lambda (a b) - (not (equal b (get a 'mode-local-parent)))))) ;; a is not a child, or not a child of b + ;; a is not a child, or not a child of b + (not (equal b (get a 'mode-local-parent)))))) (dolist (mode modes) (let* ((major-mode mode) (override (fetch-overload symbol)) - (override-file (when override (find-lisp-object-file-name override (symbol-function override))))) + (override-file (when override + (find-lisp-object-file-name + override (symbol-function override))))) (when (and override override-file) (let ((meta-name (cons override major-mode)) @@ -734,14 +743,16 @@ SYMBOL is a function that can be overridden." (push (elisp--xref-make-xref nil default default-file) xrefs)) (when symbol-file - (push (elisp--xref-make-xref 'define-overloadable-function symbol symbol-file) xrefs)) + (push (elisp--xref-make-xref 'define-overloadable-function + symbol symbol-file) + xrefs)) xrefs))) -(add-hook 'elisp-xref-find-def-functions 'xref-mode-local-overload) +(add-hook 'elisp-xref-find-def-functions #'xref-mode-local-overload) (defconst xref-mode-local-find-overloadable-regexp - "(\\(\\(define-overloadable-function\\)\\|\\(define-overload\\)\\) +%s" + "(define-overload\\(able-function\\)? +%s" "Regexp used by `xref-find-definitions' when searching for a mode-local overloadable function definition.") @@ -757,8 +768,12 @@ META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)." (re-search-forward regexp nil t) )) -(add-to-list 'find-function-regexp-alist '(define-overloadable-function . xref-mode-local-find-overloadable-regexp)) -(add-to-list 'find-function-regexp-alist (cons 'define-mode-local-override #'xref-mode-local-find-override)) +(add-to-list 'find-function-regexp-alist + '(define-overloadable-function + . xref-mode-local-find-overloadable-regexp)) +(add-to-list 'find-function-regexp-alist + (cons 'define-mode-local-override + #'xref-mode-local-find-override)) ;; Help for mode-local bindings. (defun mode-local-print-binding (symbol) @@ -796,19 +811,19 @@ META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)." ;; Print symbols by type (when us (princ "\n !! Unspecified symbols\n") - (mapc 'mode-local-print-binding us)) + (mapc #'mode-local-print-binding us)) (when mc (princ "\n ** Mode local constants\n") - (mapc 'mode-local-print-binding mc)) + (mapc #'mode-local-print-binding mc)) (when mv (princ "\n ** Mode local variables\n") - (mapc 'mode-local-print-binding mv)) + (mapc #'mode-local-print-binding mv)) (when fo (princ "\n ** Final overloaded functions\n") - (mapc 'mode-local-print-binding fo)) + (mapc #'mode-local-print-binding fo)) (when ov (princ "\n ** Overloaded functions\n") - (mapc 'mode-local-print-binding ov)) + (mapc #'mode-local-print-binding ov)) )) (defun mode-local-describe-bindings-2 (buffer-or-mode) @@ -876,27 +891,8 @@ invoked interactively." (when (setq mode (intern-soft mode)) (mode-local-describe-bindings-1 mode (called-interactively-p 'any)))) -;;; edebug support -;; -(defun mode-local-setup-edebug-specs () - "Define edebug specification for mode local macros." - (def-edebug-spec setq-mode-local - (symbolp &rest symbolp form)) - (def-edebug-spec defvar-mode-local - (&define symbolp name def-form [ &optional stringp ] )) - (def-edebug-spec defconst-mode-local - defvar-mode-local) - (def-edebug-spec define-overload - (&define name lambda-list stringp def-body)) - (def-edebug-spec define-overloadable-function - (&define name lambda-list stringp def-body)) - (def-edebug-spec define-mode-local-override - (&define name symbolp lambda-list stringp def-body))) - -(add-hook 'edebug-setup-hook 'mode-local-setup-edebug-specs) - -(add-hook 'find-file-hook 'mode-local-post-major-mode-change) -(add-hook 'change-major-mode-hook 'mode-local-on-major-mode-change) +(add-hook 'find-file-hook #'mode-local-post-major-mode-change) +(add-hook 'change-major-mode-hook #'mode-local-on-major-mode-change) (provide 'mode-local) commit 042fd120cc5988b15eae98b5dbcd9c2d62f968e6 Author: Juri Linkov Date: Thu Oct 24 00:34:07 2019 +0300 * lisp/dired.el (dired-mark-pop-up): Set tab-line-format to nil (bug#37699). diff --git a/lisp/dired.el b/lisp/dired.el index 3146511305..75dfbc4b9a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3436,7 +3436,8 @@ argument or confirmation)." (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files)) (remove-text-properties (point-min) (point-max) - '(mouse-face nil help-echo nil))))))) + '(mouse-face nil help-echo nil)) + (setq tab-line-format nil)))))) (defun dired-format-columns-of-files (files) (let ((beg (point))) commit 96afd74bf852ca9405ffda5d9d281bb43d0c7f04 Author: Juri Linkov Date: Wed Oct 23 23:58:30 2019 +0300 * lisp/tab-bar.el: Allow to specify interactively where to add a new tab. * lisp/tab-bar.el (tab-bar-new-tab-to): Rename from tab-bar-new-tab. Add optional arg TO-INDEX. (tab-bar-new-tab): New implementation to use relative ARG. (tab-new-to): Alias to tab-bar-new-tab-to. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 8a4ad03d1d..617057cf46 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -561,9 +561,11 @@ If `rightmost', create as the last tab." :group 'tab-bar :version "27.1") -(defun tab-bar-new-tab () - "Add a new tab at the position specified by `tab-bar-new-tab-to'." - (interactive) +(defun tab-bar-new-tab-to (&optional to-index) + "Add a new tab at the absolute position TO-INDEX. +TO-INDEX counts from 1. If no TO-INDEX is specified, then add +a new tab at the position specified by `tab-bar-new-tab-to'." + (interactive "P") (let* ((tabs (funcall tab-bar-tabs-function)) (from-index (tab-bar--current-tab-index tabs)) (from-tab (tab-bar--tab))) @@ -585,11 +587,12 @@ If `rightmost', create as the last tab." (when from-index (setf (nth from-index tabs) from-tab)) (let ((to-tab (tab-bar--current-tab)) - (to-index (pcase tab-bar-new-tab-to - ('leftmost 0) - ('rightmost (length tabs)) - ('left (1- (or from-index 1))) - ('right (1+ (or from-index 0)))))) + (to-index (or (if to-index (1- to-index)) + (pcase tab-bar-new-tab-to + ('leftmost 0) + ('rightmost (length tabs)) + ('left (1- (or from-index 1))) + ('right (1+ (or from-index 0))))))) (setq to-index (max 0 (min (or to-index 0) (length tabs)))) (cl-pushnew to-tab (nthcdr to-index tabs)) (when (eq to-index 0) @@ -606,6 +609,18 @@ If `rightmost', create as the last tab." (unless tab-bar-mode (message "Added new tab at %s" tab-bar-new-tab-to)))) +(defun tab-bar-new-tab (&optional arg) + "Create a new tab ARG positions to the right. +If a negative ARG, create a new tab ARG positions to the left. +If ARG is zero, create a new tab in place of the current tab." + (interactive "P") + (if arg + (let* ((tabs (funcall tab-bar-tabs-function)) + (from-index (or (tab-bar--current-tab-index tabs) 0)) + (to-index (+ from-index (prefix-numeric-value arg)))) + (tab-bar-new-tab-to (1+ to-index))) + (tab-bar-new-tab-to))) + (defvar tab-bar-closed-tabs nil "A list of closed tabs to be able to undo their closing.") @@ -771,6 +786,7 @@ function `tab-bar-tab-name-function'." ;;; Short aliases (defalias 'tab-new 'tab-bar-new-tab) +(defalias 'tab-new-to 'tab-bar-new-tab-to) (defalias 'tab-close 'tab-bar-close-tab) (defalias 'tab-close-other 'tab-bar-close-other-tabs) (defalias 'tab-undo 'tab-bar-undo-close-tab) commit 9f52f61be501534c53aada7ffb47c3f1fa6cf98b Author: Juri Linkov Date: Wed Oct 23 23:53:08 2019 +0300 * lisp/tab-bar.el: Rename tab-bar-swap-tabs to tab-bar-move-tab-to. * lisp/tab-bar.el (tab-bar-move-tab-to): Rename from tab-bar-swap-tabs. Change logic to push the moved tab between existing tabs. (tab-bar-move-tab): Call tab-bar-move-tab-to instead of tab-bar-swap-tabs. (tab-move-to): Rename alias from tab-swap. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 7ea319c0e9..8a4ad03d1d 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -525,15 +525,18 @@ to the numeric argument. ARG counts from 1." (defalias 'tab-bar-select-tab-by-name 'tab-bar-switch-to-tab) -(defun tab-bar-swap-tabs (to-index &optional from-index) - "Exchange positions of two tabs referred by FROM-INDEX and TO-INDEX. +(defun tab-bar-move-tab-to (to-index &optional from-index) + "Move tab from FROM-INDEX position to new position at TO-INDEX. FROM-INDEX defaults to the current tab index. FROM-INDEX and TO-INDEX count from 1." (interactive "P") (let* ((tabs (funcall tab-bar-tabs-function)) - (from-index (or from-index (1+ (tab-bar--current-tab-index tabs))))) - (cl-rotatef (nth (1- from-index) tabs) - (nth (1- to-index) tabs)))) + (from-index (or from-index (1+ (tab-bar--current-tab-index tabs)))) + (from-tab (nth (1- from-index) tabs)) + (to-index (max 0 (min (1- to-index) (1- (length tabs)))))) + (setq tabs (delq from-tab tabs)) + (cl-pushnew from-tab (nthcdr to-index tabs)) + (set-frame-parameter nil 'tabs tabs))) (defun tab-bar-move-tab (&optional arg) "Move the current tab ARG positions to the right. @@ -542,7 +545,7 @@ If a negative ARG, move the current tab ARG positions to the left." (let* ((tabs (funcall tab-bar-tabs-function)) (from-index (or (tab-bar--current-tab-index tabs) 0)) (to-index (mod (+ from-index arg) (length tabs)))) - (tab-bar-swap-tabs (1+ to-index) (1+ from-index)))) + (tab-bar-move-tab-to (1+ to-index) (1+ from-index)))) (defcustom tab-bar-new-tab-to 'right @@ -774,8 +777,8 @@ function `tab-bar-tab-name-function'." (defalias 'tab-select 'tab-bar-select-tab) (defalias 'tab-next 'tab-bar-switch-to-next-tab) (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) -(defalias 'tab-swap 'tab-bar-swap-tabs) (defalias 'tab-move 'tab-bar-move-tab) +(defalias 'tab-move-to 'tab-bar-move-tab-to) (defalias 'tab-rename 'tab-bar-rename-tab) (defalias 'tab-list 'tab-bar-list) commit 666686a3880a748d1c000682ce06914d59764849 Author: Juri Linkov Date: Wed Oct 23 23:39:31 2019 +0300 Implement tab close undo feature for tab-bar. * lisp/tab-bar.el (tab-bar-closed-tabs): New variable. (tab-bar-close-tab): Add closed tab to tab-bar-closed-tabs. Disable tab-bar-mode on closing the last tab. (tab-bar-close-other-tabs): Add all closed tabs to tab-bar-closed-tabs. (tab-bar-undo-close-tab): New command. (tab-undo): Alias to tab-bar-undo-close-tab. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 8350b4e694..7ea319c0e9 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -604,6 +604,9 @@ If `rightmost', create as the last tab." (message "Added new tab at %s" tab-bar-new-tab-to)))) +(defvar tab-bar-closed-tabs nil + "A list of closed tabs to be able to undo their closing.") + (defcustom tab-bar-close-tab-select 'right "Defines what tab to select after closing the specified tab. If `left', select the adjacent left tab. @@ -640,11 +643,19 @@ TO-INDEX counts from 1." ;; Re-read tabs after selecting another tab (setq tabs (funcall tab-bar-tabs-function)))) - (set-frame-parameter nil 'tabs (delq (nth close-index tabs) tabs)) + (let ((close-tab (nth close-index tabs))) + (push `((frame . ,(selected-frame)) + (index . ,close-index) + (tab . ,(if (eq (car close-tab) 'current-tab) + (tab-bar--tab) + close-tab))) + tab-bar-closed-tabs) + (set-frame-parameter nil 'tabs (delq close-tab tabs))) (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= (length tabs) tab-bar-show))) + (or (<= (length tabs) 1) ; closed the last tab + (and (natnump tab-bar-show) + (<= (length tabs) tab-bar-show)))) (tab-bar-mode -1)) (force-mode-line-update) @@ -665,7 +676,14 @@ TO-INDEX counts from 1." (let* ((tabs (funcall tab-bar-tabs-function)) (current-index (tab-bar--current-tab-index tabs))) (when current-index + (dotimes (index (length tabs)) + (unless (eq index current-index) + (push `((frame . ,(selected-frame)) + (index . ,index) + (tab . ,(nth index tabs))) + tab-bar-closed-tabs))) (set-frame-parameter nil 'tabs (list (nth current-index tabs))) + (when (and tab-bar-mode (and (natnump tab-bar-show) (<= 1 tab-bar-show))) @@ -675,6 +693,32 @@ TO-INDEX counts from 1." (unless tab-bar-mode (message "Deleted all other tabs"))))) +(defun tab-bar-undo-close-tab () + "Restore the last closed tab." + (interactive) + ;; Pop out closed tabs that were on already deleted frames + (while (and tab-bar-closed-tabs + (not (frame-live-p (cdr (assq 'frame (car tab-bar-closed-tabs)))))) + (pop tab-bar-closed-tabs)) + + (if tab-bar-closed-tabs + (let* ((closed (pop tab-bar-closed-tabs)) + (frame (cdr (assq 'frame closed))) + (index (cdr (assq 'index closed))) + (tab (cdr (assq 'tab closed)))) + (unless (eq frame (selected-frame)) + (select-frame-set-input-focus frame)) + + (let ((tabs (tab-bar-tabs))) + (setq index (max 0 (min index (length tabs)))) + (cl-pushnew tab (nthcdr index tabs)) + (when (eq index 0) + ;; pushnew handles the head of tabs but not frame-parameter + (set-frame-parameter nil 'tabs tabs)) + (tab-bar-select-tab (1+ index)))) + + (message "No more closed tabs to undo"))) + (defun tab-bar-rename-tab (name &optional arg) "Rename the tab specified by its absolute position ARG. @@ -726,6 +770,7 @@ function `tab-bar-tab-name-function'." (defalias 'tab-new 'tab-bar-new-tab) (defalias 'tab-close 'tab-bar-close-tab) (defalias 'tab-close-other 'tab-bar-close-other-tabs) +(defalias 'tab-undo 'tab-bar-undo-close-tab) (defalias 'tab-select 'tab-bar-select-tab) (defalias 'tab-next 'tab-bar-switch-to-next-tab) (defalias 'tab-previous 'tab-bar-switch-to-prev-tab) commit 72e1e30afeb3e69797fb43af216e9d8c4945359f Author: Stefan Monnier Date: Wed Oct 23 16:15:41 2019 -0400 * lisp/cedet/semantic/analyze/complete.el: Fix completion-at-point Completion tables are not supposed to signal errors: emacs -q M-x semantic-mode ; visit a file supported by semantic, such as a C file ; put cursor in a blank space M-x completion-at-point It will error with: "Nothing to complete" (semantic-analyze-possible-completions): Return nil instead of signaling errors. diff --git a/lisp/cedet/semantic/analyze/complete.el b/lisp/cedet/semantic/analyze/complete.el index b471c0d1a1..b473ade159 100644 --- a/lisp/cedet/semantic/analyze/complete.el +++ b/lisp/cedet/semantic/analyze/complete.el @@ -93,8 +93,10 @@ in a buffer." context (semantic-analyze-current-context context))) (ans (if (not context) - (error "Nothing to complete") - (:override)))) + (when (called-interactively-p 'any) + (error "Nothing to complete")) + (with-demoted-errors "%S" + (:override))))) ;; If interactive, display them. (when (called-interactively-p 'any) (with-output-to-temp-buffer "*Possible Completions*" commit b7037662e1111d55218fb2345f9ebb9ed3ebef13 Author: Lars Ingebrigtsen Date: Wed Oct 23 11:55:13 2019 +0200 Ensure that the prompt is kept on the final line * lisp/erc/erc-goodies.el (erc-possibly-scroll-to-bottom): New function. (scrolltobottom): Add to erc-insert-done-hook. * lisp/erc/erc.el (erc-insert-done-hook): New hook (bug#11697). (erc-display-line-1): Use it. diff --git a/etc/NEWS b/etc/NEWS index 43411b7d4f..01fdf39ab0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1233,6 +1233,13 @@ fail. ** erc +--- +*** New hook 'erc-insert-done-hook'. +This hook is called after strings have been inserted into the buffer, +and is free to alter point and window configurations, as it's not +called from inside a 'save-excursion', as opposed to +'erc-insert-post-hook'. + --- *** 'erc-button-google-url' has been renamed to 'erc-button-search-url' and its value has been changed to Duck Duck Go. diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el index 5e7946810b..b08970d258 100644 --- a/lisp/erc/erc-goodies.el +++ b/lisp/erc/erc-goodies.el @@ -55,14 +55,21 @@ argument to `recenter'." (define-erc-module scrolltobottom nil "This mode causes the prompt to stay at the end of the window." ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) + (add-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (erc-add-scroll-to-bottom)))) ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom) + (remove-hook 'erc-insert-done-hook 'erc-possibly-scroll-to-bottom) (dolist (buffer (erc-buffer-list)) (with-current-buffer buffer (remove-hook 'post-command-hook 'erc-scroll-to-bottom t))))) +(defun erc-possibly-scroll-to-bottom () + "Like `erc-add-scroll-to-bottom', but only if window is selected." + (when (eq (selected-window) (get-buffer-window)) + (erc-scroll-to-bottom))) + (defun erc-add-scroll-to-bottom () "A hook function for `erc-mode-hook' to recenter output at bottom of window. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 86f103ef23..1c5ecf99c6 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1097,6 +1097,14 @@ At this point, all modifications from prior hook functions are done." erc-make-read-only erc-save-buffer-in-logs)) +(defcustom erc-insert-done-hook nil + "This hook is called after inserting strings into the buffer. +This hook is not called from inside `save-excursion' and should +preserve point if needed." + :group 'erc-hooks + :version "27.1" + :type 'hook) + (defcustom erc-send-modify-hook nil "Sending hook for functions that will change the text's appearance. This hook is called just after `erc-send-pre-hook' when the values @@ -2419,6 +2427,7 @@ If STRING is nil, the function does nothing." (when erc-remove-parsed-property (remove-text-properties (point-min) (point-max) '(erc-parsed nil)))))))) + (run-hooks 'erc-insert-done-hook) (erc-update-undo-list (- (or (marker-position erc-insert-marker) (point-max)) insert-position)))))) commit 496202d00ead9cdb649443f831e3cc8dfcf6aadd Author: Lars Ingebrigtsen Date: Wed Oct 23 11:13:54 2019 +0200 Make erc-cmd-CLEAR do what its doc string says * lisp/erc/erc.el (erc-cmd-CLEAR): Delete the buffer contents instead of recentering (bug#31743). diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 65a4d5034d..86f103ef23 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2939,7 +2939,8 @@ If no USER argument is specified, list the contents of `erc-ignore-list'." (defun erc-cmd-CLEAR () "Clear the window content." - (recenter 0) + (let ((inhibit-read-only t)) + (delete-region (point-min) (line-beginning-position))) t) (put 'erc-cmd-CLEAR 'process-not-needed t) commit 98387b9e2455b0bd5a2aafe6fac939fb111eedce Author: Lars Ingebrigtsen Date: Wed Oct 23 10:50:29 2019 +0200 Make display of S/MIME signatures slightly better * lisp/epg.el (epg-signature-to-string): Decode percent escapes (bug#36101). diff --git a/lisp/epg.el b/lisp/epg.el index 1a107600a5..090317f422 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -420,7 +420,7 @@ callback data (if any)." (if user-id (concat " " (if (stringp user-id) - user-id + (epg--decode-percent-escape-as-utf-8 user-id) (epg-decode-dn user-id))) "") (if (epg-signature-validity signature) commit 55dcd32ad2209dc34bfb6b713bf73be9bf4c4cb2 (refs/remotes/origin/emacs-26) Author: Leo Liu Date: Mon Oct 7 18:52:33 2019 +0800 Fix rcirc not to interpret nil as nickname (bug#37344) * lisp/net/rcirc.el (rcirc-send-privmsg): Type check `target'. (rcirc-cmd-me): Send CTCP only when `target' exists. diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index de524d9ef1..d95db26cae 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -825,6 +825,7 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") (process-send-string process string))) (defun rcirc-send-privmsg (process target string) + (cl-check-type target string) (rcirc-send-string process (format "PRIVMSG %s :%s" target string))) (defun rcirc-send-ctcp (process target request &optional args) @@ -2337,8 +2338,8 @@ With a prefix arg, prompt for new topic." (let ((timestamp (format-time-string "%s"))) (rcirc-send-ctcp process target "PING" timestamp))) -(defun rcirc-cmd-me (args &optional process target) - (rcirc-send-ctcp process target "ACTION" args)) +(defun rcirc-cmd-me (args process target) + (when target (rcirc-send-ctcp process target "ACTION" args))) (defun rcirc-add-or-remove (set &rest elements) (dolist (elt elements) commit bd0f173199c112b2b146e727f80e973e7fc12143 Author: Mattias Engdegård Date: Wed Jul 10 19:24:58 2019 +0200 Fix trig simplification crash (bug#33052) * lisp/calc/calc-alg.el (calcFunc-sec, calcFunc-csc, calcFunc-cot): Check that `math-known-sin' and `math-known-tan' succeeded before using their value in arithmetic. * test/lisp/calc/calc-tests.el (calc-test-trig): Add regression tests. Backport from master. diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el index 8e3476d191..b41749ca77 100644 --- a/lisp/calc/calc-alg.el +++ b/lisp/calc/calc-alg.el @@ -847,11 +847,13 @@ (and (eq calc-angle-mode 'rad) (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) (and n - (math-div 1 (math-known-sin (car n) (nth 1 n) 120 300))))) + (let ((s (math-known-sin (car n) (nth 1 n) 120 300))) + (and s (math-div 1 s)))))) (and (eq calc-angle-mode 'deg) (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) (and n - (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 300))))) + (let ((s (math-known-sin (car n) (nth 1 n) '(frac 2 3) 300))) + (and s (math-div 1 s)))))) (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) (math-div 1 @@ -872,11 +874,13 @@ (and (eq calc-angle-mode 'rad) (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) (and n - (math-div 1 (math-known-sin (car n) (nth 1 n) 120 0))))) + (let ((s (math-known-sin (car n) (nth 1 n) 120 0))) + (and s (math-div 1 s)))))) (and (eq calc-angle-mode 'deg) (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) (and n - (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 0))))) + (let ((s (math-known-sin (car n) (nth 1 n) '(frac 2 3) 0))) + (and s (math-div 1 s)))))) (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) (math-div 1 (nth 1 (nth 1 math-simplify-expr)))) (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos) @@ -977,11 +981,13 @@ (and (eq calc-angle-mode 'rad) (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi var-pi)))) (and n - (math-div 1 (math-known-tan (car n) (nth 1 n) 120))))) + (let ((tn (math-known-tan (car n) (nth 1 n) 120))) + (and tn (math-div 1 tn)))))) (and (eq calc-angle-mode 'deg) (let ((n (math-integer-plus (nth 1 math-simplify-expr)))) (and n - (math-div 1 (math-known-tan (car n) (nth 1 n) '(frac 2 3)))))) + (let ((tn (math-known-tan (car n) (nth 1 n) '(frac 2 3)))) + (and tn (math-div 1 tn)))))) (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin) (math-div (list 'calcFunc-sqrt (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))) diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 3f0b65aeee..1c89857a18 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -138,6 +138,36 @@ An existing calc stack is reused, otherwise a new one is created." (nth 1 (calcFunc-cos 1))) 0 4)))))) +(ert-deftest calc-test-trig () + "Trigonometric simplification; bug#33052." + (let ((calc-angle-mode 'rad)) + (let ((calc-symbolic-mode t)) + (should (equal (math-simplify '(calcFunc-sin (/ (var pi var-pi) 4))) + '(/ (calcFunc-sqrt 2) 2))) + (should (equal (math-simplify '(calcFunc-cos (/ (var pi var-pi) 4))) + '(/ (calcFunc-sqrt 2) 2))) + (should (equal (math-simplify '(calcFunc-sec (/ (var pi var-pi) 4))) + '(calcFunc-sqrt 2))) + (should (equal (math-simplify '(calcFunc-csc (/ (var pi var-pi) 4))) + '(calcFunc-sqrt 2))) + (should (equal (math-simplify '(calcFunc-tan (/ (var pi var-pi) 3))) + '(calcFunc-sqrt 3))) + (should (equal (math-simplify '(calcFunc-cot (/ (var pi var-pi) 3))) + '(/ (calcFunc-sqrt 3) 3)))) + (let ((calc-symbolic-mode nil)) + (should (equal (math-simplify '(calcFunc-sin (/ (var pi var-pi) 4))) + '(calcFunc-sin (/ (var pi var-pi) 4)))) + (should (equal (math-simplify '(calcFunc-cos (/ (var pi var-pi) 4))) + '(calcFunc-cos (/ (var pi var-pi) 4)))) + (should (equal (math-simplify '(calcFunc-sec (/ (var pi var-pi) 4))) + '(calcFunc-sec (/ (var pi var-pi) 4)))) + (should (equal (math-simplify '(calcFunc-csc (/ (var pi var-pi) 4))) + '(calcFunc-csc (/ (var pi var-pi) 4)))) + (should (equal (math-simplify '(calcFunc-tan (/ (var pi var-pi) 3))) + '(calcFunc-tan (/ (var pi var-pi) 3)))) + (should (equal (math-simplify '(calcFunc-cot (/ (var pi var-pi) 3))) + '(calcFunc-cot (/ (var pi var-pi) 3))))))) + (ert-deftest calc-test-solve-linear-system () "Test linear system solving (bug#35374)." ;; x + y = 3 commit 73e1727c405214086bb3a0647c91855e1b0853c2 Author: Mattias Engdegård Date: Sun Sep 22 15:03:02 2019 +0200 Fix linear equation system solving in Calc (bug#35374) * lisp/calc/calcalg2.el (math-try-solve-for): To solve Ax^n=0 where A is a nonzero constant and x the variable to solve for, solve x^n=0 instead of solving A=0 (which obviously fails) or something equally stupid. * test/lisp/calc/calc-tests.el (calc-test-solve-linear-system): New. diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 18243bfc74..2a716633ae 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el @@ -2417,6 +2417,12 @@ ((= (length math-t1) 2) (apply 'math-solve-linear (car math-t2) math-try-solve-sign math-t1)) + ((= (length math-t1) 1) + ;; Constant polynomial. + (if (eql (nth 2 math-t2) 1) + nil ; No possible solution. + ;; Root of the factor, if any. + (math-try-solve-for (nth 2 math-t2) 0 nil t))) (math-solve-full (math-poly-all-roots (car math-t2) math-t1)) (calc-symbolic-mode nil) diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 8afec593b1..3f0b65aeee 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -138,6 +138,109 @@ An existing calc stack is reused, otherwise a new one is created." (nth 1 (calcFunc-cos 1))) 0 4)))))) +(ert-deftest calc-test-solve-linear-system () + "Test linear system solving (bug#35374)." + ;; x + y = 3 + ;; 2x - 3y = -4 + ;; with the unique solution x=1, y=2 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 3) + (calcFunc-eq (- (* 2 (var x var-x)) (* 3 (var y var-y))) -4)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 1) + (calcFunc-eq (var y var-y) 2)))) + + ;; x + y = 1 + ;; x + y = 2 + ;; has no solution + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 2)) + '(vec (var x var-x) (var y var-y))) + '(calcFunc-solve + (vec + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 2)) + (vec (var x var-x) (var y var-y))))) + ;; x - y = 1 + ;; x + y = 1 + ;; with the unique solution x=1, y=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (- (var x var-x) (var y var-y)) 1) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 1)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 1) + (calcFunc-eq (var y var-y) 0)))) + ;; 2x - 3y + z = 5 + ;; x + y - 2z = 0 + ;; -x + 2y + 3z = -3 + ;; with the unique solution x=1, y=-1, z=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq + (+ (- (* 2 (var x var-x)) (* 3 (var y var-y))) (var z var-z)) + 5) + (calcFunc-eq + (- (+ (var x var-x) (var y var-y)) (* 2 (var z var-z))) + 0) + (calcFunc-eq + (+ (- (* 2 (var y var-y)) (var x var-x)) (* 3 (var z var-z))) + -3)) + '(vec (var x var-x) (var y var-y) (var z var-z))) + ;; The `float' forms in the result are just artefacts of Calc's + ;; current solver; it should be fixed to produce exact (integral) + ;; results in this case. + '(vec (calcFunc-eq (var x var-x) (float 1 0)) + (calcFunc-eq (var y var-y) (float -1 0)) + (calcFunc-eq (var z var-z) 0)))) + ;; x = y + 1 + ;; x = y + ;; has no solution + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (var x var-x) (+ (var y var-y) 1)) + (calcFunc-eq (var x var-x) (var y var-y))) + '(vec (var x var-x) (var y var-y))) + '(calcFunc-solve + (vec + (calcFunc-eq (var x var-x) (+ (var y var-y) 1)) + (calcFunc-eq (var x var-x) (var y var-y))) + (vec (var x var-x) (var y var-y))))) + ;; x + y + z = 6 + ;; x + y = 3 + ;; x - y = 1 + ;; with the unique solution x=2, y=1, z=3 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (+ (+ (var x var-x) (var y var-y)) (var z var-z)) 6) + (calcFunc-eq (+ (var x var-x) (var y var-y)) 3) + (calcFunc-eq (- (var x var-x) (var y var-y)) 1)) + '(vec (var x var-x) (var y var-y) (var z var-z))) + '(vec + (calcFunc-eq (var x var-x) 2) + (calcFunc-eq (var y var-y) 1) + (calcFunc-eq (var z var-z) 3)))) + ;; x = 3 + ;; x + 4y^2 = 3 (ok, so this one isn't linear) + ;; with the unique (double) solution x=3, y=0 + (should (equal + (calcFunc-solve + '(vec + (calcFunc-eq (var x var-x) 3) + (calcFunc-eq (+ (var x var-x) (* 4 (^ (var y var-y) 2))) 3)) + '(vec (var x var-x) (var y var-y))) + '(vec (calcFunc-eq (var x var-x) 3) + (calcFunc-eq (var y var-y) 0))))) + (provide 'calc-tests) ;;; calc-tests.el ends here commit bba9757a1fd7b05f7b18b0666735711d231972fa Author: Tino Calancha Date: Tue Sep 17 18:07:50 2019 +0200 Backport: Fix an assignment to free variable warning It fixes a bug introduced by commit 'query-replace-regexp undo: Update next-replacement after undo' (30c4f35a6fc8a6507930923766c3126ac1c2063f) See https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00364.html * lisp/replace.el(perform-replace): Rename variable to next-replacement-replaced. (cherry picked from commit cbc10ec71e9f189e8d6fd5c6927aec4872e0fd96) diff --git a/lisp/replace.el b/lisp/replace.el index dd24d8ba92..6dba7d77a8 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2597,7 +2597,7 @@ It must return a string." search-string (nth (if replaced 4 3) elt) last-replacement (nth (if replaced 3 4) elt) search-string-replaced search-string - last-replacement-replaced last-replacement + next-replacement-replaced last-replacement last-was-act-and-show nil) (when (and (= stack-idx stack-len)