commit 01ea96b5548a80e6aabc69428439113ce0a8c17e (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Mon Oct 14 08:47:02 2019 +0200 Fix up previous dired change again * lisp/dired.el (dired-set-id): Fix the name of the face after the previous change. diff --git a/lisp/dired.el b/lisp/dired.el index 268f0d494b..5ad5904c79 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -431,7 +431,7 @@ Subexpression 2 must end right before the \\n.") (defvar dired-perm-write-face 'dired-perm-write "Face name used for permissions of group- and world-writable files.") -(defface dired-set-idguid +(defface dired-set-id '((((type w32 pc)) :inherit default) ;; These default to rw-rw-rw. (t (:inherit font-lock-warning-face))) "Face used to highlight permissions of suid and guid files." commit eb57ed8dd29490e0b315a0a41842f748ef554a11 Author: Lars Ingebrigtsen Date: Mon Oct 14 08:43:36 2019 +0200 Fix typo in previous dired change * lisp/dired.el (dired-set-idguid): Remove superfluous ' introduced by previous change (bug#37742). diff --git a/lisp/dired.el b/lisp/dired.el index 57c5040263..268f0d494b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -431,7 +431,7 @@ Subexpression 2 must end right before the \\n.") (defvar dired-perm-write-face 'dired-perm-write "Face name used for permissions of group- and world-writable files.") -(defface dired-set-idguid' +(defface dired-set-idguid '((((type w32 pc)) :inherit default) ;; These default to rw-rw-rw. (t (:inherit font-lock-warning-face))) "Face used to highlight permissions of suid and guid files." commit 9a56b9bf71af83292d6831e08a8179b7cf5ee7d8 Author: Eli Zaretskii Date: Mon Oct 14 09:33:51 2019 +0300 ; Minor fixes in documentation * doc/emacs/xresources.texi (Table of Resources): * doc/emacs/cmdargs.texi (Misc X): * etc/NEWS: Fix recent changes in documentation. diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index fa28c3eabc..b3d9af0baf 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -1238,7 +1238,7 @@ Disable the blinking cursor on graphical displays. @itemx --basic-display @opindex --basic-display Disable the menu-bar, the tool-bar, the scroll-bars, tool tips, and -font-lock-mode, and turn off the blinking cursor. This can be useful +turn off font-lock-mode and the blinking cursor. This can be useful for making a test case that simplifies debugging of display problems. @end table diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index e349d40333..3b9448f8a8 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -223,12 +223,12 @@ Width of the internal frame border, in pixels. @end ifnottex @item @code{lineSpacing} (class @code{LineSpacing}) -@cindex line spacing +@cindex line spacing (X resource) Additional space between lines, in pixels. @ifnottex @item @code{menuBackground} (class @code{Background}) -@cindex background for menus +@cindex background for menus (X resource) The background color of the menus in non-toolkit versions of Emacs. (For toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif Resources}, and see @ref{GTK resources}.) @@ -245,13 +245,13 @@ If @samp{none}, Emacs will not make a minibuffer in this frame; it will use a separate minibuffer frame instead. @item @code{paneFont} (class @code{Font}) -@cindex font for menus +@cindex font for menus (X resource) Font name for menu pane titles, in non-toolkit versions of Emacs. (For toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif Resources}, and see @ref{GTK resources}.) @item @code{paneForeground} (class @code{Foreground}) -@cindex foreground for menus +@cindex foreground for menus (X resource) Foreground color for menu pane titles, in non-toolkit versions of Emacs. (For toolkit versions, see @ref{Lucid Resources}, also see @ref{Motif Resources}, and see @ref{GTK resources}.) @@ -272,17 +272,17 @@ Switch foreground and background default colors if @samp{on}, use colors as specified if @samp{off}. @item @code{screenGamma} (class @code{ScreenGamma}) -@cindex gamma correction +@cindex gamma correction (X resource) Gamma correction for colors, equivalent to the frame parameter @code{screen-gamma}. @item @code{scrollBar} (class @code{ScrollBar}) -@cindex scroll bar +@cindex scroll bar (X resource) If the value of this resource is @samp{off} or @samp{false} or @samp{0}, Emacs disables Scroll Bar mode at startup (@pxref{Scroll Bars}). @item @code{scrollBarWidth} (class @code{ScrollBarWidth}) -@cindex scrollbar width +@cindex scrollbar width (X resource) The scroll bar width in pixels, equivalent to the frame parameter @code{scroll-bar-width}. Do not set this resource if Emacs is compiled with GTK+ support. @@ -315,18 +315,18 @@ useful for debugging X problems. Name to display in the title bar of the initial Emacs frame. @item @code{toolBar} (class @code{ToolBar}) -@cindex tool bar +@cindex tool bar (X resource) If the value of this resource is @samp{off} or @samp{false} or @samp{0}, Emacs disables Tool Bar mode at startup (@pxref{Tool Bars}). @item @code{tabBar} (class @code{TabBar}) -@cindex tab bar +@cindex tab bar (X resource) If the value of this resource is @samp{on} or @samp{yes} or @samp{1}, Emacs enables Tab Bar mode at startup (@pxref{Tab Bars}). @item @code{useXIM} (class @code{UseXIM}) -@cindex XIM -@cindex X input methods +@cindex XIM (X resource) +@cindex X input methods (X resource) @cindex input methods, X Disable use of X input methods (XIM) if @samp{false} or @samp{off}. This is only relevant if your Emacs is built with XIM support. It diff --git a/etc/NEWS b/etc/NEWS index 63ab33bdd4..34925c1af7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -454,7 +454,8 @@ Note that this key binding will not work on MS-Windows systems if * Editing Changes in Emacs 27.1 +++ -** 'zap-to-char' uses the new 'read-char-with-history' function to allow +** '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 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. @@ -764,8 +765,8 @@ remapped to these, respectively. ** Dired --- -*** On systems that support it, Dired now font-locks the permissions -of suid/guid files specially with the 'dired-set-id' face. +*** On systems that support suid/guid files, Dired now fontifies the +permissions of such files with a special face 'dired-set-id'. +++ *** New command 'dired-create-empty-file'. @@ -2387,9 +2388,9 @@ scrolling. * Lisp Changes in Emacs 27.1 -** There is a new function 'read-char-with-history' that works like -'read-char', but maintains a history that can be navigated via the -'M-p'/'M-n' keystrokes. +** 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. ** 'setq-local' can now set an arbitrary number of variables, which makes the syntax more like 'setq'. commit 120f691e99d7d98a959ec9a6075cb4e473831bee Author: Lars Ingebrigtsen Date: Mon Oct 14 07:49:25 2019 +0200 (help-fns--var-aliases): Fix compilation warning in previous patch. diff --git a/lisp/help-fns.el b/lisp/help-fns.el index bd27ad6260..5e55240dab 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1231,7 +1231,7 @@ variable.\n"))) (add-hook 'help-fns-describe-variable-functions #'help-fns--var-aliases) (defun help-fns--var-aliases (variable) ;; Mention if it has any aliases. - (let (aliases) + (let (aliases alias) (mapatoms (lambda (sym) (when (and (boundp sym) commit c4fcaf5e729fe5ff9249a56b1d0f5927ef3932a5 Author: Lars Ingebrigtsen Date: Mon Oct 14 07:47:53 2019 +0200 Make `C-h v' list all aliases a variable has * lisp/help-fns.el (help-fns--var-aliases): New function (bug#15179). diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 06b15a30f9..bd27ad6260 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1228,6 +1228,30 @@ variable.\n"))) " This variable is an alias for `%s'.\n" alias))))) +(add-hook 'help-fns-describe-variable-functions #'help-fns--var-aliases) +(defun help-fns--var-aliases (variable) + ;; Mention if it has any aliases. + (let (aliases) + (mapatoms + (lambda (sym) + (when (and (boundp sym) + (setq alias (indirect-variable sym)) + (eq alias variable) + (not (eq alias sym))) + (push sym aliases))) + obarray) + (when aliases + (princ + (if (= (length aliases) 1) + (format-message + " This variable has an alias: `%s'.\n" (car aliases)) + (format-message + " This variable has the following aliases: %s.\n" + (mapconcat + (lambda (sym) + (format "`%s'" sym)) + aliases ",\n "))))))) + (add-hook 'help-fns-describe-variable-functions #'help-fns--var-bufferlocal) (defun help-fns--var-bufferlocal (variable) (let ((permanent-local (get variable 'permanent-local)) commit 9aa13cd4beccfe41e8f4930cb029bd60e7788e93 Author: Hong Xu Date: Mon Oct 14 06:46:47 2019 +0200 Make url-hexify-string accept a list of allowed chars (bug#26469) * lisp/url/url-util.el (url-hexify-string): Accept a list of allowed chars. * doc/misc/url.texi (URI Encoding): Update url-hexify-string doc and index improvements (bug#24694). diff --git a/doc/misc/url.texi b/doc/misc/url.texi index e72d9bfe3d..79dead185d 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi @@ -221,6 +221,7 @@ URI's @var{port} slot is @code{nil}. @section URI Encoding @cindex percent encoding +@findex url-generic-parse-url The @code{url-generic-parse-url} parser does not obey RFC 3986 in one respect: it allows non-@acronym{ASCII} characters in URI strings. @@ -233,6 +234,7 @@ then percent encoded to @samp{%D3%A7}. (Certain ``reserved'' @acronym{ASCII} characters must also be percent encoded when they appear in URI components.) +@findex url-encode-url The function @code{url-encode-url} can be used to convert a URI string containing arbitrary characters to one that is properly percent-encoded in accordance with RFC 3986. @@ -244,6 +246,8 @@ e.g., converting the scheme component to lowercase if it was previously uppercase. @end defun +@findex url-hexify-string +@findex url-unhex-string To convert between a string containing arbitrary characters and a percent-encoded all-@acronym{ASCII} string, use the functions @code{url-hexify-string} and @code{url-unhex-string}: @@ -263,8 +267,8 @@ The allowed characters are specified by @var{allowed-chars}. If this argument is @code{nil}, the allowed characters are those specified as @dfn{unreserved characters} by RFC 3986 (see the variable @code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should -be a vector whose @var{n}-th element is non-@code{nil} if character -@var{n} is allowed. +be either a list of allowed chars, or a vector whose Nth element is +non-nil if character N is allowed. @end defun @defun url-unhex-string string &optional allow-newlines diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index a390723e73..223a6ba982 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -395,9 +395,12 @@ 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." - (unless allowed-chars +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." + (if allowed-chars + (unless (vectorp allowed-chars) + (setq allowed-chars (url--allowed-chars allowed-chars))) (setq allowed-chars (url--allowed-chars url-unreserved-chars))) (mapconcat (lambda (byte) (if (aref allowed-chars byte) commit 8aeba640460adbad283d4a18f91cce8e0364c40d Author: Lars Ingebrigtsen Date: Mon Oct 14 06:08:19 2019 +0200 Tweak ispell-init-process messaging * lisp/textmodes/ispell.el (ispell-init-process): Output a "done" after the "starting" message (bug#12828). diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index c1b21fdd2e..be2e192e5a 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -2876,19 +2876,23 @@ Keeps argument list for future Ispell invocations for no async support." (setq ispell-filter nil ispell-filter-continue nil) ;; may need to restart to select new personal dictionary. (ispell-kill-ispell t) - (message "Starting new Ispell process %s with %s dictionary..." - ispell-program-name - (or ispell-local-dictionary ispell-dictionary "default")) - (sit-for 0) - (setq ispell-library-directory (ispell-check-version) - ;; Assign a non-nil value to ispell-process-directory - ;; before calling ispell-start-process, since that - ;; function needs it to set default-directory when - ;; ispell-async-processp is nil. - ispell-process-directory default-directory - ispell-process (ispell-start-process) - ispell-filter nil - ispell-filter-continue nil) + (let ((reporter + (make-progress-reporter + (format "Starting new Ispell process %s with %s dictionary..." + ispell-program-name + (or ispell-local-dictionary ispell-dictionary + "default"))))) + (sit-for 0) + (setq ispell-library-directory (ispell-check-version) + ;; Assign a non-nil value to ispell-process-directory + ;; before calling ispell-start-process, since that + ;; function needs it to set default-directory when + ;; ispell-async-processp is nil. + ispell-process-directory default-directory + ispell-process (ispell-start-process) + ispell-filter nil + ispell-filter-continue nil) + (progress-reporter-done reporter)) (unless (equal ispell-process-directory (expand-file-name "~/")) ;; At this point, `ispell-process-directory' will be "~/" unless using commit f521225736b2a6ab38bb94298fb4d3ace3d9a9ec Author: Lars Ingebrigtsen Date: Mon Oct 14 05:41:45 2019 +0200 Add a new tar-copy-preserve-time variable * lisp/tar-mode.el (tar-copy-preserve-time): New variable (bug#11882). (tar-copy): Use it. diff --git a/etc/NEWS b/etc/NEWS index 8f95496705..63ab33bdd4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -553,6 +553,11 @@ current and the previous or the next line, as before. * Changes in Specialized Modes and Packages in Emacs 27.1 +--- +** The 'C' command in 'tar-mode' will now preserve the timestamp of +the extracted file if the new variable 'tar-copy-preserve-time' is +non-nil. + --- ** 'autoconf-mode' is now used instead of 'm4-mode' for the acinclude.m4/aclocal.m4/acsite.m4 files. diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 8e7e1945cb..569b01f978 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -127,6 +127,11 @@ the file never exists on disk." This information is useful, but it takes screen space away from file names." :type 'boolean) +(defcustom tar-copy-preserve-time nil + "Non-nil means that Tar mode preserves the timestamp when copying files." + :type 'boolean + :version "27.1") + (defvar tar-parse-info nil) (defvar tar-superior-buffer nil "Buffer containing the tar archive from which a member was extracted.") @@ -1001,11 +1006,16 @@ actually appear on disk when you save the tar-file's buffer." (defun tar-copy (&optional to-file) "In Tar mode, extract this entry of the tar file into a file on disk. If TO-FILE is not supplied, it is prompted for, defaulting to the name of -the current tar-entry." +the current tar-entry. + +If `tar-copy-preserve-time' is non-nil, the original +timestamp (if present in the tar file) will be used on the +extracted file." (interactive (list (tar-read-file-name))) (let* ((descriptor (tar-get-descriptor)) (name (tar-header-name descriptor)) (size (tar-header-size descriptor)) + (date (tar-header-date descriptor)) (start (tar-header-data-start descriptor)) (end (+ start size)) (inhibit-file-name-handlers inhibit-file-name-handlers) @@ -1024,7 +1034,10 @@ the current tar-entry." inhibit-file-name-handlers)) inhibit-file-name-operation 'write-region)) (let ((coding-system-for-write 'no-conversion)) - (write-region start end to-file nil nil nil t))) + (write-region start end to-file nil nil nil t)) + (when (and tar-copy-preserve-time + date) + (set-file-times to-file date))) (message "Copied tar entry %s to %s" name to-file))) (defun tar-new-entry (filename &optional index) commit eac531b760aa805c293339eba78e58b5b89fa211 Author: Lars Ingebrigtsen Date: Mon Oct 14 05:19:37 2019 +0200 Clarify message about newer source file * src/lread.c (Fload): Mention which file was actually used instead of just saying that the .el is newer than the .elc (bug#10637). diff --git a/src/lread.c b/src/lread.c index 1098190ae7..4ea6202972 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1364,7 +1364,7 @@ Return t if the file exists and loads successfully. */) { Lisp_Object msg_file; msg_file = Fsubstring (found, make_fixnum (0), make_fixnum (-1)); - message_with_string ("Source file `%s' newer than byte-compiled file", + message_with_string ("Source file `%s' newer than byte-compiled file; using older file", msg_file, 1); } } commit a590a8058d52c1cbe0f80b7ed0d8b0abed7bf7ef Author: Lars Ingebrigtsen Date: Mon Oct 14 05:09:32 2019 +0200 Allow zap-to-char to use a history * doc/emacs/killing.texi (Other Kill Commands): Document it. * lisp/simple.el (read-char-with-history): New function (bug#10477). (zap-to-char): Use it to have a history. diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi index c554d2e283..80e2868908 100644 --- a/doc/emacs/killing.texi +++ b/doc/emacs/killing.texi @@ -244,7 +244,10 @@ with @kbd{C-x @key{DEL}} and @kbd{M-k} (@pxref{Sentences}). searching: it reads a character and kills from point up to (and including) the next occurrence of that character in the buffer. A numeric argument acts as a repeat count; a negative argument means to -search backward and kill text before point. +search backward and kill text before point. A history of previously +used characters is maintained and can be accessed via the +@kbd{M-p}/@kbd{M-n} keystrokes. This is mainly useful if the +character to be used has to be entered via a complicated input method. @node Kill Options @subsection Options for Killing diff --git a/etc/NEWS b/etc/NEWS index 4e62627f90..8f95496705 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -453,6 +453,12 @@ Note that this key binding will not work on MS-Windows systems if * Editing Changes in Emacs 27.1 ++++ +** 'zap-to-char' uses the new 'read-char-with-history' 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. + +++ ** 'save-some-buffers' now has a new action in the prompt: 'C-f' will exit the command and switch to the buffer currently being asked about. @@ -2376,6 +2382,10 @@ scrolling. * Lisp Changes in Emacs 27.1 +** There is a new function 'read-char-with-history' that works like +'read-char', but maintains a history that can be navigated via the +'M-p'/'M-n' keystrokes. + ** 'setq-local' can now set an arbitrary number of variables, which makes the syntax more like 'setq'. diff --git a/lisp/simple.el b/lisp/simple.el index 4d80c4c1b4..2add266960 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5159,12 +5159,80 @@ 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 `read-char-with-history'.") + +(defun read-char-with-history (prompt &optional inherit-input-method seconds + history) + "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-char prompt inherit-input-method seconds)) + ;; Go back in history. + (cond + ((eq result ?\M-p) + (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. + ((eq result ?\M-n) + (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 ?\r) + (unless (zerop index) + (setq result (elt (symbol-value histvar) (1- index))))))) + ;; Record the chosen key. + (set histvar (cons result (symbol-value histvar))) + result)) + (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 "Zap to char: " t))) + (read-char-with-history "Zap to char: " t))) ;; Avoid "obsolete" warnings for translation-table-for-input. (with-no-warnings (if (char-table-p translation-table-for-input) commit f0f2a53b27187903c86189bd03f072ac6ddaba9c Author: Lars Ingebrigtsen Date: Mon Oct 14 03:31:33 2019 +0200 Font-lock suid/guid files in Dired * lisp/dired.el (dired-font-lock-keywords): Font-lock suid/guid permissions (bug#8186). (dired-sguid): New face. diff --git a/etc/NEWS b/etc/NEWS index d9d895ac81..4e62627f90 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -752,6 +752,10 @@ remapped to these, respectively. ** Dired +--- +*** On systems that support it, Dired now font-locks the permissions +of suid/guid files specially with the 'dired-set-id' face. + +++ *** New command 'dired-create-empty-file'. diff --git a/lisp/dired.el b/lisp/dired.el index 6e48d28b4c..57c5040263 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -431,6 +431,13 @@ Subexpression 2 must end right before the \\n.") (defvar dired-perm-write-face 'dired-perm-write "Face name used for permissions of group- and world-writable files.") +(defface dired-set-idguid' + '((((type w32 pc)) :inherit default) ;; These default to rw-rw-rw. + (t (:inherit font-lock-warning-face))) + "Face used to highlight permissions of suid and guid files." + :group 'dired-faces + :version "27.1") + (defface dired-directory '((t (:inherit font-lock-function-name-face))) "Face used for subdirectories." @@ -499,6 +506,12 @@ Subexpression 2 must end right before the \\n.") (list (concat dired-re-maybe-mark dired-re-inode-size "[-d].......\\(w\\).") ; world writable '(1 dired-perm-write-face)) + (list (concat dired-re-maybe-mark dired-re-inode-size + "[-d]..\\(s\\)......") ; suid + '(1 'dired-set-id)) + (list (concat dired-re-maybe-mark dired-re-inode-size + "[-d].....\\(S\\)...") ; guid + '(1 'dired-set-id)) ;; ;; Subdirectories. (list dired-re-dir commit d1963b312d021e277c12005a2b130c292623e5e7 Author: Lars Ingebrigtsen Date: Mon Oct 14 02:52:25 2019 +0200 Further changes to ensure that copy-keymap doesn't segfault * src/keymap.c (copy_keymap_1, copy_keymap_set_char_table): Ensure we don't recurse infinitely when using non-sparse keymaps, too. This change makes this form not segfault: (let ((map (make-keymap))) (define-key map " " map) (copy-keymap map)) diff --git a/src/keymap.c b/src/keymap.c index 5aed4129bb..0b7de3e9cc 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -975,10 +975,12 @@ copy_keymap_item (Lisp_Object elt, int depth) } static void -copy_keymap_set_char_table (Lisp_Object chartable, Lisp_Object idx, +copy_keymap_set_char_table (Lisp_Object chartable_and_depth, Lisp_Object idx, Lisp_Object elt) { - Fset_char_table_range (chartable, idx, copy_keymap_item (elt, 0)); + Fset_char_table_range + (XCAR (chartable_and_depth), idx, + copy_keymap_item (elt, XFIXNUM (XCDR (chartable_and_depth)))); } static Lisp_Object @@ -999,7 +1001,8 @@ copy_keymap_1 (Lisp_Object keymap, int depth) if (CHAR_TABLE_P (elt)) { elt = Fcopy_sequence (elt); - map_char_table (copy_keymap_set_char_table, Qnil, elt, elt); + map_char_table (copy_keymap_set_char_table, Qnil, elt, + Fcons (elt, make_fixnum (depth + 1))); } else if (VECTORP (elt)) { commit ea7610f1f1e0022647000502a5dfcba8707c4964 Author: Stefan Kangas Date: Fri Oct 11 02:21:08 2019 +0200 Clarify mouse commands section in manual * doc/emacs/frames.texi (Mouse Commands): Clarify section on mouse wheel somewhat. (Bug#28182) diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 169eebab3e..f93c5b168b 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -201,14 +201,14 @@ deactivating the mark. @xref{Shift Selection}. @vindex mouse-wheel-progressive-speed Some mice have a ``wheel'' which can be used for scrolling. Emacs supports scrolling windows with the mouse wheel, by default, on most -graphical displays. There is also support for increasing or -decreasing the height of the default face, by default bound to -scrolling with the @key{Ctrl} modifier. To toggle this feature, use -@kbd{M-x mouse-wheel-mode}. The variables -@code{mouse-wheel-follow-mouse} and @code{mouse-wheel-scroll-amount} -determine where and by how much buffers are scrolled. The variable +graphical displays. To toggle this feature, use @kbd{M-x +mouse-wheel-mode}. The variables @code{mouse-wheel-follow-mouse} and +@code{mouse-wheel-scroll-amount} determine where and by how much +buffers are scrolled. The variable @code{mouse-wheel-progressive-speed} determines whether the scroll -speed is linked to how fast you move the wheel. +speed is linked to how fast you move the wheel. This mode also +supports increasing or decreasing the height of the default face, by +default bound to scrolling with the @key{Ctrl} modifier. @vindex mouse-wheel-tilt-scroll @vindex mouse-wheel-flip-direction commit f0e220af088384599b5206f2b6efca05252e578a Author: Juri Linkov Date: Mon Oct 14 01:00:38 2019 +0300 Don't display the number of windows in tab name in tab-bar by default. * lisp/tab-bar.el (tab-bar-tab-name-function): Change the default value. (tab-bar-tab-name-current): Rename from tab-bar-tab-name-selected-window. (tab-bar-tab-name-current-with-count): New function. (tab-bar-tab-name-all): Rename from tab-bar-tab-name-all-windows. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 8abe14138a..52245dd78f 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -249,14 +249,18 @@ This helps to select the tab by its number using `tab-bar-select-tab'." (defvar tab-bar-separator nil) -(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-selected-window +(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-current "Function to get a tab name. Function gets no arguments. The choice is between displaying only the name of the current buffer in the tab name (default), or displaying the names of all buffers from all windows in the window configuration." - :type '(choice (const :tag "Selected window buffer" tab-bar-tab-name-selected-window) - (const :tag "All window buffers" tab-bar-tab-name-all-windows) + :type '(choice (const :tag "Selected window buffer" + tab-bar-tab-name-current) + (const :tag "Selected window buffer with window count" + tab-bar-tab-name-current-with-count) + (const :tag "All window buffers" + tab-bar-tab-name-all) (function :tag "Function")) :initialize 'custom-initialize-default :set (lambda (sym val) @@ -265,7 +269,11 @@ from all windows in the window configuration." :group 'tab-bar :version "27.1") -(defun tab-bar-tab-name-selected-window () +(defun tab-bar-tab-name-current () + "Generate tab name from the buffer of the selected window." + (window-buffer (minibuffer-selected-window))) + +(defun tab-bar-tab-name-current-with-count () "Generate tab name from the buffer of the selected window. Also add the number of windows in the window configuration." (let ((count (length (window-list-1 nil 'nomini))) @@ -274,7 +282,7 @@ Also add the number of windows in the window configuration." (format "%s (%d)" name count) (format "%s" name)))) -(defun tab-bar-tab-name-all-windows () +(defun tab-bar-tab-name-all () "Generate tab name from buffers of all windows." (mapconcat #'buffer-name (delete-dups (mapcar #'window-buffer commit dafd329771f5028cdac1a2691a236ffa296c360c Author: Juri Linkov Date: Mon Oct 14 00:18:56 2019 +0300 * lisp/window.el (next-buffer, previous-buffer): Add repeat count arg. * doc/emacs/buffers.texi (Select Buffer): Mention arg as repeat count. (Bug#37514) diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 269f9f7d6f..74e6211f80 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -127,7 +127,8 @@ Modes}). (@code{previous-buffer}) selects the previous buffer (following the order of most recent selection in the current frame), while @kbd{C-x @key{RIGHT}} (@code{next-buffer}) moves through buffers in the reverse -direction. +direction. Both commands support a numeric prefix argument that +serves as a repeat count. @kindex C-x 4 b @findex switch-to-buffer-other-window diff --git a/etc/NEWS b/etc/NEWS index ada7af3746..d9d895ac81 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2115,9 +2115,10 @@ The new command 'global-tab-line-mode' enables the tab line above each window, which you can use to switch buffers in the window. Selecting the previous window-local tab is the same as typing 'C-x ' (previous-buffer), selecting the next tab is the same as 'C-x ' -(next-buffer). Clicking on the plus icon adds a new buffer to the -window-local tab line of buffers. Using the mouse wheel on the -tab line scrolls tabs that display the window buffers. +(next-buffer). Both commands support a numeric prefix argument as +a repeat count. Clicking on the plus icon adds a new buffer to the +window-local tab line of buffers. Using the mouse wheel on the tab +line scrolls tabs that display the window buffers. ** fileloop.el lets one setup multifile operations like search&replace. diff --git a/lisp/window.el b/lisp/window.el index d7955209cd..80d9d2e072 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4747,31 +4747,33 @@ displayed there." (interactive) (switch-to-buffer (last-buffer))) -(defun next-buffer () - "In selected window switch to next buffer. +(defun next-buffer (&optional arg) + "In selected window switch to ARGth next buffer. Call `switch-to-next-buffer' unless the selected window is the minibuffer window or is dedicated to its buffer." - (interactive) + (interactive "p") (cond ((window-minibuffer-p) (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) (user-error "Window is strongly dedicated to its buffer")) (t - (switch-to-next-buffer)))) + (dotimes (_ (or arg 1)) + (switch-to-next-buffer))))) -(defun previous-buffer () - "In selected window switch to previous buffer. +(defun previous-buffer (&optional arg) + "In selected window switch to ARGth previous buffer. Call `switch-to-prev-buffer' unless the selected window is the minibuffer window or is dedicated to its buffer." - (interactive) + (interactive "p") (cond ((window-minibuffer-p) (user-error "Cannot switch buffers in minibuffer window")) ((eq (window-dedicated-p) t) (user-error "Window is strongly dedicated to its buffer")) (t - (switch-to-prev-buffer)))) + (dotimes (_ (or arg 1)) + (switch-to-prev-buffer))))) (defun delete-windows-on (&optional buffer-or-name frame) "Delete all windows showing BUFFER-OR-NAME. commit e56c0bba4f66d5171daccbd743fbc5dd721c7dc3 Author: Lars Ingebrigtsen Date: Sun Oct 13 22:56:38 2019 +0200 Make list-buffers--refresh preserve marks * lisp/buff-menu.el (list-buffers--refresh): Preserve the marked buffers when refreshing the list (bug#6491). diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 3cea186e6e..2a67eab460 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -646,7 +646,11 @@ means list those buffers and no others." (defun list-buffers--refresh (&optional buffer-list old-buffer) ;; Set up `tabulated-list-format'. (let ((name-width Buffer-menu-name-width) - (size-width Buffer-menu-size-width)) + (size-width Buffer-menu-size-width) + (marked-buffers (Buffer-menu-marked-buffers)) + (buffer-menu-buffer (current-buffer)) + (show-non-file (not Buffer-menu-files-only)) + entries) ;; Handle obsolete variable: (if Buffer-menu-buffer+size-width (setq name-width (- Buffer-menu-buffer+size-width size-width))) @@ -656,14 +660,11 @@ means list those buffers and no others." '("M" 1 t) `("Buffer" ,name-width t) `("Size" ,size-width tabulated-list-entry-size-> - :right-align t) + :right-align t) `("Mode" ,Buffer-menu-mode-width t) - '("File" 1 t)))) - (setq tabulated-list-use-header-line Buffer-menu-use-header-line) - ;; Collect info for each buffer we're interested in. - (let ((buffer-menu-buffer (current-buffer)) - (show-non-file (not Buffer-menu-files-only)) - entries) + '("File" 1 t))) + (setq tabulated-list-use-header-line Buffer-menu-use-header-line) + ;; Collect info for each buffer we're interested in. (dolist (buffer (or buffer-list (buffer-list (if Buffer-menu-use-frame-buffer-list (selected-frame))))) @@ -677,12 +678,16 @@ means list those buffers and no others." (not (eq buffer buffer-menu-buffer)) (or file show-non-file)))) (push (list buffer - (vector (if (eq buffer old-buffer) "." " ") + (vector (cond + ((eq buffer old-buffer) ".") + ((member buffer marked-buffers) ">") + (t " ")) (if buffer-read-only "%" " ") (if (buffer-modified-p) "*" " ") (Buffer-menu--pretty-name name) (number-to-string (buffer-size)) - (concat (format-mode-line mode-name nil nil buffer) + (concat (format-mode-line mode-name + nil nil buffer) (if mode-line-process (format-mode-line mode-line-process nil nil buffer))) commit 097a03d2a372c1285696779c7051d5b044d437f5 Author: Juri Linkov Date: Sun Oct 13 23:56:17 2019 +0300 Enable tab-bar-mode from X resources * lisp/startup.el (x-apply-session-resources): Enable tab-bar-mode when X resource "tabBar" class "TabBar" is "on", "yes" or "1". * doc/man/emacs.1.in: * doc/emacs/xresources.texi (Table of Resources): Document X resource "tabBar" (class "TabBar"). diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 2b403b4a33..fa28c3eabc 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -1237,9 +1237,9 @@ Disable the blinking cursor on graphical displays. @opindex -D @itemx --basic-display @opindex --basic-display -Disable the menu-bar, the tool-bar, the scroll-bars, and tool tips, -and turn off the blinking cursor. This can be useful for making a -test case that simplifies debugging of display problems. +Disable the menu-bar, the tool-bar, the scroll-bars, tool tips, and +font-lock-mode, and turn off the blinking cursor. This can be useful +for making a test case that simplifies debugging of display problems. @end table The @samp{--xrm} option (@pxref{Resources}) specifies additional diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi index d8b70ef900..e349d40333 100644 --- a/doc/emacs/xresources.texi +++ b/doc/emacs/xresources.texi @@ -319,6 +319,11 @@ Name to display in the title bar of the initial Emacs frame. If the value of this resource is @samp{off} or @samp{false} or @samp{0}, Emacs disables Tool Bar mode at startup (@pxref{Tool Bars}). +@item @code{tabBar} (class @code{TabBar}) +@cindex tab bar +If the value of this resource is @samp{on} or @samp{yes} or +@samp{1}, Emacs enables Tab Bar mode at startup (@pxref{Tab Bars}). + @item @code{useXIM} (class @code{UseXIM}) @cindex XIM @cindex X input methods diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index ab385168af..e9fcbf48cb 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -2324,8 +2324,8 @@ minibuffer or the echo area. Non-zero if this window is a @dfn{pseudo window}. A pseudo window is either a window used to display the menu bar or the tool bar (when Emacs uses toolkits that don't display their own menu bar and tool -bar) or a window showing a tooltip on a tooltip frame. Pseudo windows -are in general not accessible from Lisp code. +bar) or the tab bar or a window showing a tooltip on a tooltip frame. +Pseudo windows are in general not accessible from Lisp code. @item parent Internally, Emacs arranges windows in a tree; each group of siblings diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in index 25c32e018a..5fe12aed95 100644 --- a/doc/man/emacs.1.in +++ b/doc/man/emacs.1.in @@ -284,7 +284,7 @@ frames is a width of 80 and a height between 35 and 40, depending on the OS and the window manager. See the Emacs manual, section "Options for Window Size and Position", for information on how window sizes interact -with selecting or deselecting the tool bar and menu bar. +with selecting or deselecting the tool bar, tab bar and menu bar. .TP .BI \-lsp " pixels\fR,\fP " \-\-line\-spacing= "pixels" Additional space to put between lines. @@ -517,6 +517,9 @@ window. .BR toolBar " (class " ToolBar ) Number of lines to reserve for the tool bar. .TP +.BR tabBar " (class " TabBar ) +Number of lines to reserve for the tab bar. +.TP .BR useXIM " (class " UseXIM ) Turns off use of X input methods (XIM) if .I false diff --git a/etc/NEWS b/etc/NEWS index 5b3dabe22a..ada7af3746 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2089,8 +2089,8 @@ file-local variable, you may need to update the value. ** Tab Bars +++ -*** Tab-Bar mode -The new command 'tab-bar-mode' enables the tab-bar at the top of each +*** Tab Bar mode +The new command 'tab-bar-mode' enables the tab bar at the top of each frame, where you can use tabs to switch between named persistent window configurations. @@ -2101,20 +2101,23 @@ edit file in another tab; and 'C-TAB' and 'S-C-TAB' switch to the next or previous tab. You can also switch between tabs and create/delete tabs with a mouse. -Tab-related commands are available even when the Tab-Bar mode is -disabled: by default, they enable Tab-Bar mode in that case. +Tab-related commands are available even when the tab-bar-mode is +disabled: by default, they enable tab-bar-mode in that case. + +The X resource "tabBar", class "TabBar" enables the tab bar +when its value is "on", "yes" or "1". Read the new Info node "(emacs) Tab Bars" for full description of all related features. -*** Tab-Line mode -The new command 'global-tab-line-mode' enables the tab-line above each +*** Tab Line mode +The new command 'global-tab-line-mode' enables the tab line above each window, which you can use to switch buffers in the window. Selecting the previous window-local tab is the same as typing 'C-x ' (previous-buffer), selecting the next tab is the same as 'C-x ' (next-buffer). Clicking on the plus icon adds a new buffer to the -window-local tab-line of buffers. Using the mouse wheel on the -tab-line scrolls tabs that display the window buffers. +window-local tab line of buffers. Using the mouse wheel on the +tab line scrolls tabs that display the window buffers. ** fileloop.el lets one setup multifile operations like search&replace. diff --git a/lisp/startup.el b/lisp/startup.el index 48b483415a..30f1a253ee 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1512,18 +1512,22 @@ as `x-initialize-window-system' for X, either at startup (prior to reading the init file), or afterwards when the user first opens a graphical frame. -This can set the values of `menu-bar-mode', `tool-bar-mode', and -`no-blinking-cursor', as well as the `cursor' face. Changed -settings will be marked as \"CHANGED outside of Customize\"." +This can set the values of `menu-bar-mode', `tool-bar-mode', +`tab-bar-mode', and `no-blinking-cursor', as well as the `cursor' face. +Changed settings will be marked as \"CHANGED outside of Customize\"." (let ((no-vals '("no" "off" "false" "0")) (settings '(("menuBar" "MenuBar" menu-bar-mode nil) - ("tabBar" "TabBar" tab-bar-mode nil) ("toolBar" "ToolBar" tool-bar-mode nil) ("scrollBar" "ScrollBar" scroll-bar-mode nil) ("cursorBlink" "CursorBlink" no-blinking-cursor t)))) (dolist (x settings) (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals) (set (nth 2 x) (nth 3 x))))) + (let ((yes-vals '("yes" "on" "true" "1")) + (settings '(("tabBar" "TabBar" tab-bar-mode 1)))) + (dolist (x settings) + (if (member (x-get-resource (nth 0 x) (nth 1 x)) yes-vals) + (funcall (nth 2 x) (nth 3 x))))) (let ((color (x-get-resource "cursorColor" "Foreground"))) (when color (put 'cursor 'theme-face commit 21f2922b8436f67a8519339593cde69083d215c1 Author: Juri Linkov Date: Sun Oct 13 23:47:33 2019 +0300 Fix initial value of frame-inhibit-implied-resize * src/frame.c (syms_of_frame): Update doc string and default value of frame-inhibit-implied-resize in NS to not include 'tab-bar-lines, and non-toolkit X builds to include 'tab-bar-lines. diff --git a/src/frame.c b/src/frame.c index 099db29598..f7e65be727 100644 --- a/src/frame.c +++ b/src/frame.c @@ -6268,7 +6268,7 @@ a non-nil value in your init file. */); DEFVAR_LISP ("frame-inhibit-implied-resize", frame_inhibit_implied_resize, doc: /* Whether frames should be resized implicitly. -If this option is nil, setting font, menu bar, tool bar, internal +If this option is nil, setting font, menu bar, tool bar, tab bar, internal borders, fringes or scroll bars of a specific frame may resize the frame in order to preserve the number of columns or lines it displays. If this option is t, no such resizing is done. Note that the size of @@ -6278,8 +6278,8 @@ width of fullwidth frames never change implicitly. The value of this option can be also be a list of frame parameters. In this case, resizing is inhibited when changing a parameter that appears in that list. The parameters currently handled by this option include -`font', `font-backend', `internal-border-width', `menu-bar-lines' and -`tool-bar-lines'. +`font', `font-backend', `internal-border-width', `menu-bar-lines', +`tool-bar-lines' and `tab-bar-lines'. Changing any of the parameters `scroll-bar-width', `scroll-bar-height', `vertical-scroll-bars', `horizontal-scroll-bars', `left-fringe' and @@ -6290,25 +6290,27 @@ width by the width of one scroll bar provided this option is nil and keep it unchanged if this option is either t or a list containing `vertical-scroll-bars'. -The default value is \\='(tab-bar-lines) in GTK+, (which means that -adding/removing a tab bar does not change the frame height), -\\='(tab-bar-lines tool-bar-lines) on Lucid, Motif and Windows -\(which means that adding/removing a tool bar or tab bar does not -change the frame height), nil on all other window systems (which -means that changing any of the parameters listed above may change -the size of the frame), and t otherwise (which means the frame size -never changes implicitly when there's no window system support). +In NS that use the external tool bar and no tab bar, the default value +is nil which means that changing any of the parameters listed above +may change the size of the frame. In GTK+ that use the external tool +bar, the default value is \\='(tab-bar-lines) which means that +adding/removing a tab bar does not change the frame height. On all +other types of GUI frames, the default value is \\='(tab-bar-lines +tool-bar-lines) which means that adding/removing a tool bar or tab bar +does not change the frame height. Otherwise it's t which means the +frame size never changes implicitly when there's no window +system support. Note that when a frame is not large enough to accommodate a change of any of the parameters listed above, Emacs may try to enlarge the frame even if this option is non-nil. */); #if defined (HAVE_WINDOW_SYSTEM) -#if defined USE_GTK +#if defined (HAVE_NS) + frame_inhibit_implied_resize = Qnil; +#elif defined (USE_GTK) frame_inhibit_implied_resize = list1 (Qtab_bar_lines); -#elif defined (USE_LUCID) || defined (USE_MOTIF) || defined (HAVE_NTGUI) - frame_inhibit_implied_resize = list2 (Qtab_bar_lines, Qtool_bar_lines); #else - frame_inhibit_implied_resize = Qnil; + frame_inhibit_implied_resize = list2 (Qtab_bar_lines, Qtool_bar_lines); #endif #else frame_inhibit_implied_resize = Qt; commit 88eadc75d0de8534b26fd490143c94ab2ee4cc45 Author: Lars Ingebrigtsen Date: Sun Oct 13 22:22:31 2019 +0200 Fix hitting RET on some text in compilation-mode * lisp/progmodes/compile.el (compilation-next-error-function): Don't bug out with an incomprehensible error message on "make[2]:" texts (bug#5316). (compilation-find-file): Protect against there being no file name. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 7d7a1b99d9..cd7a5dc677 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2509,6 +2509,8 @@ This is the value of `next-error-function' in Compilation buffers." (loc (compilation--message->loc msg)) (end-loc (compilation--message->end-loc msg)) (marker (point-marker))) + (unless loc + (user-error "No next error")) (setq compilation-current-error (point-marker) overlay-arrow-position (if (bolp) @@ -2822,7 +2824,8 @@ attempts to find a file whose name is produced by (format FMT FILENAME)." (expand-file-name directory) default-directory)) buffer thisdir fmts name) - (if (file-name-absolute-p filename) + (if (and filename + (file-name-absolute-p filename)) ;; The file name is absolute. Use its explicit directory as ;; the first in the search path, and strip it from FILENAME. (setq filename (abbreviate-file-name (expand-file-name filename)) @@ -2850,8 +2853,11 @@ attempts to find a file whose name is produced by (format FMT FILENAME)." (and w (progn (compilation-set-window w marker) (compilation-set-overlay-arrow w)))) (let* ((name (read-file-name - (format "Find this %s in (default %s): " - compilation-error filename) + (format "Find this %s in%s: " + compilation-error + (if filename + (format " (default %s)" filename) + "")) spec-dir filename t nil ;; The predicate below is fine when called from ;; minibuffer-complete-and-exit, but it's too commit 5c4195fd364fe3b2d0fb591fb04f5be2652b810f Author: Paul Eggert Date: Sun Oct 13 12:55:12 2019 -0700 * src/xdisp.c (note_tab_bar_highlight): Simplify HAVE_NS ifdefs. diff --git a/src/xdisp.c b/src/xdisp.c index 252e3ed7c1..1cfd7ef760 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13334,9 +13334,6 @@ note_tab_bar_highlight (struct frame *f, int x, int y) { Lisp_Object window = f->tab_bar_window; struct window *w = XWINDOW (window); -#ifndef HAVE_NS - Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); -#endif Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos, vpos; struct glyph *glyph; @@ -13346,9 +13343,6 @@ note_tab_bar_highlight (struct frame *f, int x, int y) int prop_idx; bool close_p; enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; -#ifndef HAVE_NS - bool mouse_down_p; -#endif int rc; /* Function note_mouse_highlight is called with negative X/Y @@ -13372,18 +13366,17 @@ note_tab_bar_highlight (struct frame *f, int x, int y) clear_mouse_face (hlinfo); + bool mouse_down_p = false; #ifndef HAVE_NS /* Mouse is down, but on different tab-bar item? */ + Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); mouse_down_p = (gui_mouse_grabbed (dpyinfo) && f == dpyinfo->last_mouse_frame); if (mouse_down_p && f->last_tab_bar_item != prop_idx) return; - +#endif draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; -#else - draw = DRAW_IMAGE_RAISED; -#endif /* HAVE_NS */ /* If tab-bar item is not enabled, don't highlight it. */ enabled_p = AREF (f->tab_bar_items, prop_idx + TAB_BAR_ITEM_ENABLED_P); commit b02f0ae995110393f7a8136d01933fb80960fc54 Author: Lars Ingebrigtsen Date: Sun Oct 13 21:36:57 2019 +0200 Add a new action in save-some-buffers to view the buffer * doc/emacs/files.texi (Save Commands): Document it. * lisp/files.el (save-some-buffers-action-alist): Offer to pop to the buffer and then quit (bug#3625). (save-some-buffers): Implement it. (save-some-buffers--switch-window-callback): New variable. diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 9fe1b564a8..c3ede1833b 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -419,6 +419,9 @@ about other buffers. View the buffer that you are currently being asked about. When you exit View mode, you get back to @code{save-some-buffers}, which asks the question again. +@item C-f +Exit @code{save-some-buffers} and visit the buffer that you are +currently being asked about. @item d Diff the buffer against its corresponding file, so you can see what changes you would be saving. This calls the command diff --git a/etc/NEWS b/etc/NEWS index eeb02b7066..5b3dabe22a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -453,6 +453,10 @@ Note that this key binding will not work on MS-Windows systems if * Editing Changes in Emacs 27.1 ++++ +** 'save-some-buffers' now has a new action in the prompt: 'C-f' will +exit the command and switch to the buffer currently being asked about. + +++ ** The new 'amalgamating-undo-limit' variable can be used to control how many changes should be amalgamated when using the 'undo' command. diff --git a/lisp/files.el b/lisp/files.el index a1c7e3c814..007195d22a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -5390,6 +5390,8 @@ Before and after saving the buffer, this function runs (declare-function diff-no-select "diff" (old new &optional switches no-async buf)) +(defvar save-some-buffers--switch-window-callback nil) + (defvar save-some-buffers-action-alist `((?\C-r ,(lambda (buf) @@ -5401,6 +5403,11 @@ Before and after saving the buffer, this function runs ;; Return nil to ask about BUF again. nil) ,(purecopy "view this buffer")) + (?\C-f + ,(lambda (buf) + (funcall save-some-buffers--switch-window-callback buf) + (setq quit-flag t)) + ,(purecopy "view this buffer and quit")) (?d ,(lambda (buf) (if (null (buffer-file-name buf)) (message "Not applicable: no file") @@ -5464,69 +5471,79 @@ change the additional actions you can take on files." (interactive "P") (unless pred (setq pred save-some-buffers-default-predicate)) - (save-window-excursion - (let* (queried autosaved-buffers - files-done abbrevs-done) - (dolist (buffer (buffer-list)) - ;; First save any buffers that we're supposed to save unconditionally. - ;; That way the following code won't ask about them. - (with-current-buffer buffer - (when (and buffer-save-without-query (buffer-modified-p)) - (push (buffer-name) autosaved-buffers) - (save-buffer)))) - ;; Ask about those buffers that merit it, - ;; and record the number thus saved. - (setq files-done - (map-y-or-n-p - (lambda (buffer) - ;; Note that killing some buffers may kill others via - ;; hooks (e.g. Rmail and its viewing buffer). - (and (buffer-live-p buffer) - (buffer-modified-p buffer) - (not (buffer-base-buffer buffer)) - (or - (buffer-file-name buffer) - (with-current-buffer buffer - (or (eq buffer-offer-save 'always) - (and pred buffer-offer-save (> (buffer-size) 0))))) - (or (not (functionp pred)) - (with-current-buffer buffer (funcall pred))) - (if arg - t - (setq queried t) - (if (buffer-file-name buffer) - (format "Save file %s? " - (buffer-file-name buffer)) - (format "Save buffer %s? " - (buffer-name buffer)))))) - (lambda (buffer) - (with-current-buffer buffer - (save-buffer))) - (buffer-list) - '("buffer" "buffers" "save") - save-some-buffers-action-alist)) - ;; Maybe to save abbrevs, and record whether - ;; we either saved them or asked to. - (and save-abbrevs abbrevs-changed - (progn - (if (or arg - (eq save-abbrevs 'silently) - (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name))) - (write-abbrev-file nil)) - ;; Don't keep bothering user if he says no. - (setq abbrevs-changed nil) - (setq abbrevs-done t))) - (or queried (> files-done 0) abbrevs-done - (cond - ((null autosaved-buffers) - (when (called-interactively-p 'any) - (files--message "(No files need saving)"))) - ((= (length autosaved-buffers) 1) - (files--message "(Saved %s)" (car autosaved-buffers))) - (t - (files--message "(Saved %d files: %s)" - (length autosaved-buffers) - (mapconcat 'identity autosaved-buffers ", ")))))))) + (let* ((switched-buffer nil) + (save-some-buffers--switch-window-callback + (lambda (buffer) + (setq switched-buffer buffer))) + queried autosaved-buffers + files-done abbrevs-done) + (unwind-protect + (save-window-excursion + (dolist (buffer (buffer-list)) + ;; First save any buffers that we're supposed to save + ;; unconditionally. That way the following code won't ask + ;; about them. + (with-current-buffer buffer + (when (and buffer-save-without-query (buffer-modified-p)) + (push (buffer-name) autosaved-buffers) + (save-buffer)))) + ;; Ask about those buffers that merit it, + ;; and record the number thus saved. + (setq files-done + (map-y-or-n-p + (lambda (buffer) + ;; Note that killing some buffers may kill others via + ;; hooks (e.g. Rmail and its viewing buffer). + (and (buffer-live-p buffer) + (buffer-modified-p buffer) + (not (buffer-base-buffer buffer)) + (or + (buffer-file-name buffer) + (with-current-buffer buffer + (or (eq buffer-offer-save 'always) + (and pred buffer-offer-save + (> (buffer-size) 0))))) + (or (not (functionp pred)) + (with-current-buffer buffer (funcall pred))) + (if arg + t + (setq queried t) + (if (buffer-file-name buffer) + (format "Save file %s? " + (buffer-file-name buffer)) + (format "Save buffer %s? " + (buffer-name buffer)))))) + (lambda (buffer) + (with-current-buffer buffer + (save-buffer))) + (buffer-list) + '("buffer" "buffers" "save") + save-some-buffers-action-alist)) + ;; Maybe to save abbrevs, and record whether + ;; we either saved them or asked to. + (and save-abbrevs abbrevs-changed + (progn + (if (or arg + (eq save-abbrevs 'silently) + (y-or-n-p (format "Save abbrevs in %s? " + abbrev-file-name))) + (write-abbrev-file nil)) + ;; Don't keep bothering user if he says no. + (setq abbrevs-changed nil) + (setq abbrevs-done t))) + (or queried (> files-done 0) abbrevs-done + (cond + ((null autosaved-buffers) + (when (called-interactively-p 'any) + (files--message "(No files need saving)"))) + ((= (length autosaved-buffers) 1) + (files--message "(Saved %s)" (car autosaved-buffers))) + (t + (files--message + "(Saved %d files: %s)" (length autosaved-buffers) + (mapconcat 'identity autosaved-buffers ", ")))))) + (when switched-buffer + (pop-to-buffer-same-window switched-buffer))))) (defun clear-visited-file-modtime () "Clear out records of last mod time of visited file. commit 67ed6ee7337d66dc1101e41bc2e67bde5ab0ecd4 Author: Mattias Engdegård Date: Thu Oct 10 21:20:20 2019 +0200 Correctly explain test failures with mixed uni/multibyte strings * lisp/emacs-lisp/ert.el (ert--explain-equal-rec): * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-equal): When explaining a difference between a unibyte and a multibyte string, first convert both to multibyte. Otherwise, we might end up comparing unibyte char C to multibyte char C, 127 Date: Sun Oct 13 20:06:19 2019 +0200 Mention shifted alphabetical control GUI sequences * doc/emacs/custom.texi (Modifier Keys): Mention that you can bind shifted alphabetical control sequences in GUI frames (bug#23247). diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 7bb6142395..492e15c249 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1903,14 +1903,21 @@ same thing as @kbd{M-a}. This concerns only alphabetical characters, and does not apply to shifted versions of other keys; for instance, @kbd{C-@@} is not the same as @kbd{C-2}. - A @key{Control}-modified alphabetical character is always considered -case-insensitive: Emacs always treats @kbd{C-A} as @kbd{C-a}, -@kbd{C-B} as @kbd{C-b}, and so forth. The reason for this is -historical. + A @key{Control}-modified alphabetical character is generally +considered case-insensitive: Emacs always treats @kbd{C-A} as +@kbd{C-a}, @kbd{C-B} as @kbd{C-b}, and so forth. The reason for this +is historical: In non-graphical environments there is no distinction +between those keystrokes. However, you can bind shifted @key{Control} +alphabetical keystrokes in GUI frames: + +@lisp +(global-set-key (kbd "C-S-n") #'previous-line) +@end lisp For all other modifiers, you can make the modified alphabetical -characters case-sensitive when you customize Emacs. For instance, you -could make @kbd{M-a} and @kbd{M-A} run different commands. +characters case-sensitive (even on non-graphical frames) when you +customize Emacs. For instance, you could make @kbd{M-a} and @kbd{M-A} +run different commands. Although only the @key{Control} and @key{Meta} modifier keys are commonly used, Emacs supports three other modifier keys. These are commit 07cbc3bb1cef9e935d64e358fbaa162e0870ea80 Author: Philipp Stephani Date: Sun Oct 13 17:24:10 2019 +0200 Avoid compiler warnings on macOS. * src/xdisp.c (note_tab_bar_highlight): Define variables 'dpyinfo' and 'mouse_down_p' only if needed. diff --git a/src/xdisp.c b/src/xdisp.c index 893ce9269c..252e3ed7c1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13334,7 +13334,9 @@ note_tab_bar_highlight (struct frame *f, int x, int y) { Lisp_Object window = f->tab_bar_window; struct window *w = XWINDOW (window); +#ifndef HAVE_NS Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); +#endif Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos, vpos; struct glyph *glyph; @@ -13344,7 +13346,9 @@ note_tab_bar_highlight (struct frame *f, int x, int y) int prop_idx; bool close_p; enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; +#ifndef HAVE_NS bool mouse_down_p; +#endif int rc; /* Function note_mouse_highlight is called with negative X/Y commit fc759eb9b3018394d14e62f12cb4a5c5585c38f2 Author: Basil L. Contovounesios Date: Sun Oct 13 16:36:02 2019 +0100 Fix with-coding-priority markup in Elisp manual * doc/lispref/nonascii.texi (Specifying Coding Systems): Don't use '&rest' in conjunction with 'body...' in arglist of with-coding-priority. Fix typo and cross-referencing (2-arg @pxref adds a trailing period). diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi index 612c362f4a..a3789dd667 100644 --- a/doc/lispref/nonascii.texi +++ b/doc/lispref/nonascii.texi @@ -1821,11 +1821,11 @@ priority list for coding systems, thus making their priority higher than all the rest. @end defun -@defmac with-coding-priority coding-systems &rest body@dots{} -This macro execute @var{body}, like @code{progn} does -(@pxref{Sequencing, progn}), with @var{coding-systems} at the front of -the priority list for coding systems. @var{coding-systems} should be -a list of coding systems to prefer during execution of @var{body}. +@defmac with-coding-priority coding-systems &rest body +This macro executes @var{body}, like @code{progn} does +(@pxref{Sequencing}), with @var{coding-systems} at the front of the +priority list for coding systems. @var{coding-systems} should be a +list of coding systems to prefer during execution of @var{body}. @end defmac @node Explicit Encoding commit d9a01dcd9fe2a0e5f84b708cdd34c3e7e8fb9189 Author: Stephen Gildea Date: Sun Oct 13 07:58:55 2019 -0700 Minor tweaks to time-stamp documentation strings * time-stamp.el (time-stamp): Reformat the explanation of the variables that affect time-stamp, for easier reading. In particular, wrap the documentation to 75 characters, so that it displays neatly as a before-save-hook customization option. * time-stamp-tests.el (with-time-stamp-test-env): Use imperative voice, per checkdoc. diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 6da576f377..094ef91526 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -256,12 +256,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." + +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." (interactive) (let ((line-limit time-stamp-line-limit) (ts-start time-stamp-start) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 37822f6e29..4cc4ea1a5b 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -24,7 +24,7 @@ (require 'time-stamp) (defmacro with-time-stamp-test-env (&rest body) - "Evaluates BODY with some standard time-stamp test variables bound." + "Evaluate BODY with some standard time-stamp test variables bound." `(let ((user-login-name "test-logname") (user-full-name "Time Stamp Tester") (buffer-file-name "/emacs/test/time-stamped-file") commit 9946defe21f2f9b902e5eb86e31aca710e369db1 Author: Alan Mackenzie Date: Sun Oct 13 13:15:35 2019 +0000 In compilation-tear-down-arrow-spec-in-margin, test compilation-arrow-overlay * lisp/progmodes/compile.el (compilation-tear-down-arrow-spec-in-margin): Make sure compilation-arrow-overlay is an overlay before performing overlay operations on it. This fixes bug #37733. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 505e0917dc..7d7a1b99d9 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2670,10 +2670,11 @@ Actual value is never used, only the text property.") (defun compilation-tear-down-arrow-spec-in-margin () "Restore compilation-arrow-overlay to not using the margin, which is removed." - (overlay-put compilation-arrow-overlay 'before-string nil) - (delete-overlay compilation-arrow-overlay) - (setq compilation-arrow-overlay nil) - (set-window-margins (selected-window) (- (car (window-margins)) 2))) + (when (overlayp compilation-arrow-overlay) + (overlay-put compilation-arrow-overlay 'before-string nil) + (delete-overlay compilation-arrow-overlay) + (setq compilation-arrow-overlay nil) + (set-window-margins (selected-window) (- (car (window-margins)) 2)))) (defun compilation-set-overlay-arrow (w) "Set up, or switch off, the overlay-arrow for window W."