commit 35023214031e130b43fd14f5ee7cd07e778b8176 (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Mon Aug 16 03:13:30 2021 +0300 Fix regressions in the last change * lisp/vc/vc-git.el (vc-git-register): Use file names verbatim with 'git update-index', as it only accepts file names, not pathspecs (bug#39452). * lisp/vc/vc.el (vc-print-root-log): Expand ROOTDIR, so that vc-git-print-log doesn't receive an abbreviated name. Literal pathspecs don't work with those. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index ffe1e6832c..6b26515430 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -876,7 +876,7 @@ The car of the list is the current branch." (push crt dlist) (push crt flist))) (when flist - (vc-git-command nil 0 (vc-git--literal-pathspecs flist) "update-index" "--add" "--")) + (vc-git-command nil 0 flist "update-index" "--add" "--")) (when dlist (vc-git-command nil 0 (vc-git--literal-pathspecs dlist) "add")))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index a97caa702a..e2b12c6cb0 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2603,8 +2603,8 @@ with its diffs (if the underlying VCS supports that)." (setq backend (vc-responsible-backend rootdir)) (unless backend (error "Directory is not version controlled"))) - (setq default-directory rootdir) - (vc-print-log-internal backend (list rootdir) revision revision limit + (setq default-directory (expand-file-name rootdir)) + (vc-print-log-internal backend (list default-directory) revision revision limit (when with-diff 'with-diff)))) ;;;###autoload commit 7ec057458135eed0dd08e2de4089e4814d71e440 Author: Juri Linkov Date: Sun Aug 15 19:18:05 2021 +0300 * lisp/simple.el (shift-select-mode): Add new choice 'permanent' (bug#50038). (handle-shift-selection): Handle new choice 'permanent'. diff --git a/etc/NEWS b/etc/NEWS index 09ace73f5d..c2b53e4705 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -263,6 +263,12 @@ This works in text buffers and over images. Typing a numeric prefix arg (e.g. 'M-5') before starting horizontal scrolling changes its step value. The value is saved in the user option 'mouse-wheel-scroll-amount-horizontal'. +--- +** New choice 'permanent' for 'shift-select-mode'. +When the mark was activated by shifted motion keys, +non-shifted motion keys don't deactivate the mark +after customizing 'shift-select-mode' to 'permanent'. + --- ** The default value of 'frame-title-format' and 'icon-title-format' has changed. These variables are used to display the title bar of visible frames diff --git a/lisp/simple.el b/lisp/simple.el index 1661346b37..7da315e869 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6660,9 +6660,16 @@ is temporarily turned on. Furthermore, the mark will be deactivated by any subsequent point motion key that was not shift-translated, or by any action that normally deactivates the mark in Transient Mark mode. +When the value is `permanent', the mark will be deactivated by any +action which normally does that, but not by motion keys that were +not shift-translated. + See `this-command-keys-shift-translated' for the meaning of shift-translation." - :type 'boolean + :type '(choice (const :tag "Off" nil) + (const :tag "Permanent" permanent) + (other :tag "On" t)) + :version "28.1" :group 'editing-basics) (defun handle-shift-selection () @@ -6680,7 +6687,12 @@ translation. Otherwise, if the region has been activated temporarily, deactivate it, and restore the variable `transient-mark-mode' to its earlier value." - (cond ((and shift-select-mode this-command-keys-shift-translated) + (cond ((and (eq shift-select-mode 'permanent) + this-command-keys-shift-translated) + (unless mark-active + (push-mark nil nil t))) + ((and shift-select-mode + this-command-keys-shift-translated) (unless (and mark-active (eq (car-safe transient-mark-mode) 'only)) (setq-local transient-mark-mode commit 0da97a4ed9b0819fd9112f572a61724a66ba83a6 Author: Juri Linkov Date: Sun Aug 15 19:15:42 2021 +0300 * lisp/tab-bar.el (tab-bar-new-button-show): Make variable obsolete. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index d16711bed6..4ec1143128 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -365,6 +365,7 @@ When this is nil, you can create new tabs with \\[tab-new]." (force-mode-line-update)) :group 'tab-bar :version "27.1") +(make-obsolete-variable 'tab-bar-new-button-show 'tab-bar-format "28.1") (defvar tab-bar-new-button " + " "Button for creating a new tab.") commit bf11c698b6af5eb243da656b57d99084a2c2e890 Author: Stefan Monnier Date: Sun Aug 15 10:18:08 2021 -0400 * lisp/nxml/nxml-mode.el (nxml-mode): Use add-function This avoids calling the internal function `buffer-substring--filter` from `nxml.el`. (nxml--buffer-substring-filter): Adjust accordingly. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 5a3499dd16..b7d1b190e8 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -540,7 +540,8 @@ Many aspects this mode can be customized using (nxml-scan-prolog))))) (setq-local syntax-ppss-table sgml-tag-syntax-table) (setq-local syntax-propertize-function #'nxml-syntax-propertize) - (setq-local filter-buffer-substring-function #'nxml--buffer-substring-filter) + (add-function :filter-return (local 'filter-buffer-substring-function) + #'nxml--buffer-substring-filter) (add-hook 'change-major-mode-hook #'nxml-cleanup nil t) (when (not (and (buffer-file-name) (file-exists-p (buffer-file-name)))) @@ -565,18 +566,16 @@ Many aspects this mode can be customized using (with-demoted-errors (rng-nxml-mode-init))) -(defun nxml--buffer-substring-filter (beg end &optional delete) - (let ((string (buffer-substring--filter beg end delete))) - ;; The `rng-state' property is huge, so don't copy it to the kill - ;; ring. This avoids problems when saving the kill ring with - ;; savehist. - (when (seq-find (lambda (elem) - (plist-get (nth 2 elem) 'rng-state)) - (object-intervals string)) - (remove-text-properties 0 (length string) - '(rng-state nil fontified nil) - string)) - string)) +(defun nxml--buffer-substring-filter (string) + ;; The `rng-state' property is huge, so don't copy it to the kill ring. + ;; This avoids problems when saving the kill ring with savehist. + (when (seq-find (lambda (elem) + (plist-get (nth 2 elem) 'rng-state)) + (object-intervals string)) + (remove-text-properties 0 (length string) + '(rng-state nil fontified nil) + string)) + string) (defun nxml-cleanup () "Clean up after nxml-mode." commit 2a022e9be3a1f46dde2fa230d0b31fb6fbb5d66a Author: Lars Ingebrigtsen Date: Sun Aug 15 15:43:35 2021 +0200 Filter out rng-state elements in nxml-mode buffers from the kill ring * lisp/nxml/nxml-mode.el (nxml--buffer-substring-filter): Filter out `rng-state' objects (bug#50061). (nxml-mode): Set `filter-buffer-substring-function'. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 1bc905cee2..5a3499dd16 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -540,6 +540,7 @@ Many aspects this mode can be customized using (nxml-scan-prolog))))) (setq-local syntax-ppss-table sgml-tag-syntax-table) (setq-local syntax-propertize-function #'nxml-syntax-propertize) + (setq-local filter-buffer-substring-function #'nxml--buffer-substring-filter) (add-hook 'change-major-mode-hook #'nxml-cleanup nil t) (when (not (and (buffer-file-name) (file-exists-p (buffer-file-name)))) @@ -564,6 +565,19 @@ Many aspects this mode can be customized using (with-demoted-errors (rng-nxml-mode-init))) +(defun nxml--buffer-substring-filter (beg end &optional delete) + (let ((string (buffer-substring--filter beg end delete))) + ;; The `rng-state' property is huge, so don't copy it to the kill + ;; ring. This avoids problems when saving the kill ring with + ;; savehist. + (when (seq-find (lambda (elem) + (plist-get (nth 2 elem) 'rng-state)) + (object-intervals string)) + (remove-text-properties 0 (length string) + '(rng-state nil fontified nil) + string)) + string)) + (defun nxml-cleanup () "Clean up after nxml-mode." ;; Disable associated minor modes. commit ab23fa4eb22f6557414724769958a63f1c59b49a Author: João Távora Date: Sun Aug 15 13:19:59 2021 +0100 Sort by recency in flex completion style when no flexy stuff happening Fixes: bug#49888 * minibuffer.el (completion--flex-adjust-metadata): Fall back to usual alphanumeric, length, recency strategy if no minibuffer input. There is still a bug indicated by the nearby FIXMEs, though. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 1e8e9fc624..f335a9e13b 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3947,27 +3947,39 @@ that is non-nil." ((compose-flex-sort-fn (existing-sort-fn) ; wish `cl-flet' had proper indentation... (lambda (completions) - (let ((pre-sorted - (if existing-sort-fn - (funcall existing-sort-fn completions) - completions))) - (cond - ((or (not (window-minibuffer-p)) - ;; JT@2019-12-23: FIXME: this is still wrong. What - ;; we need to test here is "some input that actually - ;; leads to flex filtering", not "something after - ;; the minibuffer prompt". Among other - ;; inconsistencies, the latter is always true for - ;; file searches, meaning the next clauses will be - ;; ignored. - (> (point-max) (minibuffer-prompt-end))) - (sort - pre-sorted - (lambda (c1 c2) - (let ((s1 (get-text-property 0 'completion-score c1)) - (s2 (get-text-property 0 'completion-score c2))) - (> (or s1 0) (or s2 0)))))) - (t pre-sorted)))))) + (cond + (;; Sort by flex score whenever outside the minibuffer or + ;; in the minibuffer with some input. JT@2019-12-23: + ;; FIXME: this is still wrong. What we need to test here + ;; is "some input that actually leads to flex filtering", + ;; not "something after the minibuffer prompt". Among + ;; other inconsistencies, the latter is always true for + ;; file searches, meaning the next clauses in this cond + ;; will be ignored. + (or (not (window-minibuffer-p)) + (> (point-max) (minibuffer-prompt-end))) + (sort + (if existing-sort-fn + (funcall existing-sort-fn completions) + completions) + (lambda (c1 c2) + (let ((s1 (get-text-property 0 'completion-score c1)) + (s2 (get-text-property 0 'completion-score c2))) + (> (or s1 0) (or s2 0)))))) + (;; If no existing sort fn and nothing flexy happening, use + ;; the customary sorting strategy. + ;; + ;; JT@2021-08-15: FIXME: ideally this wouldn't repeat + ;; logic in `completion-all-sorted-completions', but that + ;; logic has other context that is either expensive to + ;; compute or not easy to access here. + (not existing-sort-fn) + (let ((lalpha (minibuffer--sort-by-length-alpha completions)) + (hist (and (minibufferp) + (and (not (eq minibuffer-history-variable t)) + (symbol-value minibuffer-history-variable))))) + (if hist (minibuffer--sort-by-position hist lalpha) lalpha))) + (t (funcall existing-sort-fn completions)))))) `(metadata (display-sort-function . ,(compose-flex-sort-fn commit 926eeb7dd4b35a311d51cb651cc0c64fa4a5ab2c Author: Augusto Stoffel Date: Sun Aug 15 14:00:49 2021 +0200 Allow evaluating Python code across machines * python.el (python-shell-send-string): Ensure that the temporary file is created in the host running the Python process (bug#50057). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2557704e40..20299c20d2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3085,7 +3085,8 @@ t when called interactively." (list (read-string "Python command: ") nil t)) (let ((process (or process (python-shell-get-process-or-error msg)))) (if (string-match ".\n+." string) ;Multiline. - (let* ((temp-file-name (python-shell--save-temp-file string)) + (let* ((temp-file-name (with-current-buffer (process-buffer process) + (python-shell--save-temp-file string))) (file-name (or (buffer-file-name) temp-file-name))) (python-shell-send-file file-name process temp-file-name t)) (comint-send-string process string) commit 42a98feb5b8ff2d60701da4462864699c434562c Author: Lars Ingebrigtsen Date: Sun Aug 15 13:36:24 2021 +0200 Run execute-extended-command key binding suggestion from a timer * lisp/simple.el (execute-extended-command): Run the key binding suggestion from a timer instead of in the program flow -- this allows `post-command-hook' to be executed immediately (bug#50042). diff --git a/lisp/simple.el b/lisp/simple.el index 985beb06fc..1661346b37 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2194,6 +2194,8 @@ Also see `suggest-key-bindings'." (setq binding candidate)))) binding)) +(defvar execute-extended-command--binding-timer nil) + (defun execute-extended-command (prefixarg &optional command-name typed) ;; Based on Fexecute_extended_command in keyboard.c of Emacs. ;; Aaron S. Hawley 2009-08-24 @@ -2258,15 +2260,24 @@ invoking, give a prefix argument to `execute-extended-command'." (setq binding (execute-extended-command--shorter (symbol-name function) typed)))) (when binding - (with-temp-message - (format-message "You can run the command `%s' with %s" - function - (if (stringp binding) - (concat "M-x " binding " RET") - (key-description binding))) - (sit-for (if (numberp suggest-key-bindings) - suggest-key-bindings - 2)))))))) + ;; This is normally not necessary -- the timer should run + ;; immediately, but be defensive and ensure that we never + ;; have two of these timers in flight. + (when execute-extended-command--binding-timer + (cancel-timer execute-extended-command--binding-timer)) + (setq execute-extended-command--binding-timer + (run-at-time + 0 nil + (lambda () + (with-temp-message + (format-message "You can run the command `%s' with %s" + function + (if (stringp binding) + (concat "M-x " binding " RET") + (key-description binding))) + (sit-for (if (numberp suggest-key-bindings) + suggest-key-bindings + 2))))))))))) (defun execute-extended-command-for-buffer (prefixarg &optional command-name typed) commit 55772baee1627571c0814cf2d666fb3b963ff591 Author: Lars Ingebrigtsen Date: Sun Aug 15 13:25:18 2021 +0200 Make Emacs compile with musl instead of glibc * src/alloc.c: musl doesn't have malloc_info (bug#50058). diff --git a/src/alloc.c b/src/alloc.c index 8edcd06c84..4ea337ddba 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -7318,7 +7318,7 @@ Frames, windows, buffers, and subprocesses count as vectors make_int (strings_consed)); } -#ifdef GNU_LINUX +#if defined GNU_LINUX && defined __GLIBC__ DEFUN ("malloc-info", Fmalloc_info, Smalloc_info, 0, 0, "", doc: /* Report malloc information to stderr. This function outputs to stderr an XML-formatted @@ -7678,7 +7678,7 @@ N should be nonnegative. */); defsubr (&Sgarbage_collect_maybe); defsubr (&Smemory_info); defsubr (&Smemory_use_counts); -#ifdef GNU_LINUX +#if defined GNU_LINUX && defined __GLIBC__ defsubr (&Smalloc_info); #endif defsubr (&Ssuspicious_object); commit 36964b2358f6a3a0c722b04cf5b8505f247c300c Author: Eli Zaretskii Date: Sun Aug 15 14:18:17 2021 +0300 ; * src/xdisp.c (display_mode_lines): Fix comment. diff --git a/src/xdisp.c b/src/xdisp.c index ac80827bc3..972b90177c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -25434,8 +25434,9 @@ redisplay_mode_lines (Lisp_Object window, bool force) } -/* Display the mode and/or header line of window W. Value is the sum - number of mode lines, header lines, and tab lines actually displayed. */ +/* Display the mode line, the header line, and the tab-line of window + W. Value is the sum number of mode lines, header lines, and tab + lines actually displayed. */ static int display_mode_lines (struct window *w) commit fdf148cab4c0b74028b34dd4d3a2cd9e4efa8c19 Author: Eli Zaretskii Date: Sun Aug 15 14:11:23 2021 +0300 Fix unwarranted point movement after C-g When the same buffer is displayed in more than one window, redisplay temporarily moves point to the window-point when it works on non-selected windows. If we allow C-g to quit out of redisplay_window in this situation, point will appear to have moved to the window-point of that non-selected window, which is unwarranted. These changes prevent quitting in strategic places, so that we never quit out of redisplay_window. * src/xdisp.c (run_window_scroll_functions): Prevent quitting while running window-scroll-functions, so that we don't quit out of redisplay_window with temporarily moved point. (redisplay_window): While redisplaying the mode line, prevent quitting, to avoid exiting while point is temporarily moved. (decode_mode_spec): Use safe_call1 instead of call1, to trap any errors instead of letting them throw out of redisplay. (Bug#44448) diff --git a/src/xdisp.c b/src/xdisp.c index e62f7e3df6..ac80827bc3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17275,8 +17275,11 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) if (!NILP (Vwindow_scroll_functions)) { + ptrdiff_t count = SPECPDL_INDEX (); + specbind (Qinhibit_quit, Qt); run_hook_with_args_2 (Qwindow_scroll_functions, window, make_fixnum (CHARPOS (startp))); + unbind_to (count, Qnil); SET_TEXT_POS_FROM_MARKER (startp, w->start); /* In case the hook functions switch buffers. */ set_buffer_internal (XBUFFER (w->contents)); @@ -19269,7 +19272,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) w->start_at_line_beg = (CHARPOS (startp) == BEGV || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'); - /* Display the mode line, if we must. */ + /* Display the mode line, header line, and tab-line, if we must. */ if ((update_mode_line /* If window not full width, must redo its mode line if (a) the window to its side is being redone and @@ -19288,8 +19291,11 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) || window_wants_header_line (w) || window_wants_tab_line (w))) { + ptrdiff_t count1 = SPECPDL_INDEX (); + specbind (Qinhibit_quit, Qt); display_mode_lines (w); + unbind_to (count1, Qnil); /* If mode line height has changed, arrange for a thorough immediate redisplay using the correct mode line height. */ @@ -19337,7 +19343,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) finish_menu_bars: /* When we reach a frame's selected window, redo the frame's menu - bar and the frame's title. */ + bar, tool bar, tab-bar, and the frame's title. */ if (update_mode_line && EQ (FRAME_SELECTED_WINDOW (f), window)) { @@ -25428,8 +25434,8 @@ redisplay_mode_lines (Lisp_Object window, bool force) } -/* Display the mode and/or header line of window W. Value is the - sum number of mode lines and header lines displayed. */ +/* Display the mode and/or header line of window W. Value is the sum + number of mode lines, header lines, and tab lines actually displayed. */ static int display_mode_lines (struct window *w) @@ -27009,7 +27015,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, Lisp_Object val = Qnil; if (STRINGP (curdir)) - val = call1 (intern ("file-remote-p"), curdir); + val = safe_call1 (intern ("file-remote-p"), curdir); val = unbind_to (count, val); commit e2eb58c4874bc8dedb7f3da9f9e0626ccfe74cdf Author: Masahiro Nakamura Date: Sun Aug 15 11:54:56 2021 +0200 Mark up commands in shortdoc.el for modes * lisp/emacs-lisp/shortdoc.el: Add command mode tagging (bug#50064). diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index a74a5a4225..1b0fbfdf71 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -1317,7 +1317,8 @@ Example: "Keymap for `shortdoc-mode'.") (define-derived-mode shortdoc-mode special-mode "shortdoc" - "Mode for shortdoc.") + "Mode for shortdoc." + :interactive nil) (defun shortdoc--goto-section (arg sym &optional reverse) (unless (natnump arg) @@ -1332,26 +1333,26 @@ Example: (defun shortdoc-next (&optional arg) "Move cursor to the next function. With ARG, do it that many times." - (interactive "p") + (interactive "p" shortdoc-mode) (shortdoc--goto-section arg 'shortdoc-function)) (defun shortdoc-previous (&optional arg) "Move cursor to the previous function. With ARG, do it that many times." - (interactive "p") + (interactive "p" shortdoc-mode) (shortdoc--goto-section arg 'shortdoc-function t) (backward-char 1)) (defun shortdoc-next-section (&optional arg) "Move cursor to the next section. With ARG, do it that many times." - (interactive "p") + (interactive "p" shortdoc-mode) (shortdoc--goto-section arg 'shortdoc-section)) (defun shortdoc-previous-section (&optional arg) "Move cursor to the previous section. With ARG, do it that many times." - (interactive "p") + (interactive "p" shortdoc-mode) (shortdoc--goto-section arg 'shortdoc-section t) (forward-line -2))