commit 81267db01dfab3d9f24ff12359db3577efdf9ccf (HEAD, refs/remotes/origin/master) Author: Spencer Baugh Date: Fri Aug 22 17:19:09 2025 -0400 Pass dired default filenames via defaults argument Rather than using minibuffer-with-setup-hook, just pass the list of default file names as a regular argument to read-file-name. This allows read-file-name to run abbreviate-file-name on the defaults as it normally does, instead of the defaults appearing in expanded form. dired-dwim-target-defaults changes slightly to return the correct default at the start of the list. * lisp/dired-aux.el (dired-do-create-files) (dired-compare-directories): Pass default file names as an argument. (bug#79293) (dired-dwim-target-defaults): Return the correct default at the start of the list. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 049d200f590..e28106d9865 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -330,14 +330,13 @@ only in the active region if `dired-mark-region' is non-nil." (interactive (list (let* ((target-dir (dired-dwim-target-directory)) - (defaults (dired-dwim-target-defaults nil target-dir))) + (defaults (dired-dwim-target-defaults nil target-dir))) (minibuffer-with-setup-hook (lambda () - (setq-local minibuffer-default-add-function nil) - (setq minibuffer-default defaults)) + (setq-local minibuffer-default-add-function nil)) (read-directory-name (format "Compare %s with: " (dired-current-directory)) - target-dir target-dir t))) + target-dir defaults t))) (read-from-minibuffer "Mark if (lisp expr or RET): " nil nil t nil "nil")) dired-mode) (let* ((dir1 (dired-current-directory)) @@ -2668,17 +2667,12 @@ Optional arg HOW-TO determines how to treat the target. (dired-one-file ; fluid variable inside dired-create-files (and (consp fn-list) (null (cdr fn-list)) (car fn-list))) (target-dir (dired-dwim-target-directory)) - (default (and dired-one-file - (not dired-dwim-target) ; Bug#25609 - (expand-file-name (file-name-nondirectory - (car fn-list)) - target-dir))) (defaults (dired-dwim-target-defaults fn-list target-dir)) (target (expand-file-name ; fluid variable inside dired-create-files (minibuffer-with-setup-hook (lambda () - (setq-local minibuffer-default-add-function nil) - (setq minibuffer-default defaults)) + ;; Don't run `read-file-name--defaults' + (setq-local minibuffer-default-add-function nil)) (dired-mark-read-file-name (format "%s %%s %s: " (if dired-one-file op1 operation) @@ -2688,7 +2682,7 @@ Optional arg HOW-TO determines how to treat the target. ;; other operations copy (etc) to the ;; prompted file name. "from" "to")) - target-dir op-symbol arg rfn-list default)))) + target-dir op-symbol arg rfn-list defaults)))) (into-dir (progn (when @@ -2813,28 +2807,26 @@ Optional arg HOW-TO determines how to treat the target. this-dir))) (defun dired-dwim-target-defaults (fn-list target-dir) - ;; Return a list of default values for file-reading functions in Dired. - ;; This list may contain directories from Dired buffers in other windows. - ;; `fn-list' is a list of file names used to build a list of defaults. - ;; When nil or more than one element, a list of defaults will - ;; contain only directory names. `target-dir' is a directory name - ;; to exclude from the returned list, for the case when this - ;; directory name is already presented in initial input. - ;; For Dired operations that support `dired-dwim-target', - ;; the argument `target-dir' should have the value returned - ;; from `dired-dwim-target-directory'. + "Return a list of default values for file-reading functions in Dired. + +This list may contain directories from Dired buffers in other windows. +FN-LIST is a list of file names used to build a list of defaults. +When nil or more than one element, a list of defaults will +contain only directory names. + +TARGET-DIR should be the initial input in the minibuffer for the +file-reading function. For Dired operations that support +`dired-dwim-target', TARGET-DIR should have the value returned from +`dired-dwim-target-directory'." (let ((dired-one-file (and (consp fn-list) (null (cdr fn-list)) (car fn-list))) (current-dir (and (eq major-mode 'dired-mode) (dired-current-directory))) ;; 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. + ;; Force TARGET-DIR then CURRENT-DIR to be first in the list. (setq 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)) + (delete-dups (delq nil (cons target-dir (cons current-dir dired-dirs))))) ;; Return a list of default values. (if dired-one-file ;; For one file operation, provide a list that contains @@ -2847,10 +2839,7 @@ Optional arg HOW-TO determines how to treat the target. (mapcar (lambda (dir) (expand-file-name (file-name-nondirectory (car fn-list)) dir)) - (reverse dired-dirs)) - (list (expand-file-name - (file-name-nondirectory (car fn-list)) - (or target-dir current-dir)))) + (reverse dired-dirs))) ;; For multi-file operation, return only a list of other directories. dired-dirs))) commit b5ec833bc8c6d06a5c57409f37175d0cace715ab Author: Juri Linkov Date: Thu Aug 28 09:09:18 2025 +0300 * lisp/tab-bar.el (frameset-session-filter-tabs): New function. Push new function to 'frameset-session-filter-alist' with 'tabs' key (bug#79291). diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 4c585985fb6..db16775d884 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1469,6 +1469,14 @@ be scaled for display on the current frame." (push '(tabs . frameset-filter-tabs) frameset-filter-alist) +;; Session filter used within same session by `frameset-to-register' +;; should make a deep copy of tabs to prevent modification +;; of saved data. +(defun frameset-session-filter-tabs (current _filtered _parameters _saving) + (copy-tree current)) + +(push '(tabs . frameset-session-filter-tabs) frameset-session-filter-alist) + (defun tab-bar--tab (&optional frame) "Make a new tab data structure that can be added to tabs on the FRAME." (let* ((tab (tab-bar--current-tab-find nil frame)) commit 088c53175429c4cfd8be4c3c24438494ce205a23 Author: Dmitry Gutov Date: Thu Aug 28 03:16:35 2025 +0300 ruby-flymake-simple: Refine further * lisp/progmodes/ruby-mode.el (ruby-flymake-simple): Relax regexp but limit allowed characters (bug#79257). diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 0a6ead870a7..459f8f338f7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2516,7 +2516,7 @@ A slash character after any of these should begin a regexp.")) (goto-char (point-min)) (cl-loop while (search-forward-regexp - "^\\(?:ruby: \\)?\\(?:.*\\.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$" + "^\\(?:[^:|]+: \\)?\\(?:.*\\.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$" nil t) for msg = (match-string 2) for (beg . end) = (flymake-diag-region commit e46471ed0746ad290d466e893015f6f794c06cc1 Author: Spencer Baugh Date: Thu Aug 21 14:33:23 2025 -0400 Make RET choose the selected completion Previously, one could select a completion via M-/M-, but then RET would not actually select the chosen completion. With the addition of completion-auto-deselect, this is not actually necessary: we can reasonably assume that when a completion is selected, the user wants to use that, since their last action must have been to select it. So, just choose the selected completion on RET. This lets us default minibuffer-completion-auto-choose to nil. For minibuffers with require-match completion, this can be done by changing the existing command bound to RET. For minibuffers with nil require-match completion, RET was previously bound to exit-minibuffer, and changing exit-minibuffer to have this logic is risky. We handle that case by adding a new minibuffer-completion-exit which wraps exit-minibuffer and bind RET to it. * lisp/minibuffer.el (minibuffer-insert-completion-if-selected) (minibuffer-completion-exit, completion--selected-candidate): Add. (minibuffer-complete-and-exit): Call minibuffer-choose-completion. (bug#77253) (minibuffer-local-completion-map): Bind RET to minibuffer-completion-exit, overriding exit-minibuffer. (completion-in-region-mode-map): Bind RET to minibuffer-choose-completion when there's a selected candidate. (minibuffer-completion-auto-choose): Default to nil. (minibuffer-visible-completions--filter) (minibuffer-visible-completions-map): Delete RET binding, no longer necessary. * lisp/simple.el (completion-setup-function): Update completion help text to show more correct bindings. * test/lisp/minibuffer-tests.el (completions-header-format-test) (minibuffer-next-completion): Set minibuffer-completion-auto-choose=t explicitly. (with-minibuffer-setup, minibuffer-completion-RET-prefix) (completion-in-region-next-completion): Add new tests. * etc/NEWS: Announce. diff --git a/etc/NEWS b/etc/NEWS index cdf46096034..af6dd0c2151 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -183,6 +183,14 @@ different completion categories by customizing be updated as you type, or nil to suppress this always. Note that for large or inefficient completion tables this can slow down typing. +--- +*** RET chooses the completion selected with M-/M- +If a completion candidate is selected with M- or M-, hitting +RET will exit completion with that as the result. This works both in +minibuffer completion and in-buffer completion. This supersedes +'minibuffer-completion-auto-choose', which previously provided similar +behavior; that variable is now nil by default. + +++ *** New user option 'completion-pcm-leading-wildcard'. This option configures how the partial-completion style does completion. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 3558b14bf78..55b6d79a813 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1983,12 +1983,17 @@ DONT-CYCLE tells the function not to setup cycling." (defvar minibuffer--original-buffer nil "Buffer that was current when `completing-read' was called.") -(defun minibuffer-complete-and-exit () +(defun minibuffer-complete-and-exit (&optional no-exit) "Exit if the minibuffer contains a valid completion. Otherwise, try to complete the minibuffer contents. If completion leads to a valid completion, a repetition of this command will exit. +If a completion candidate is selected in the *Completions* buffer, it +will be inserted in the minibuffer first. If NO-EXIT is non-nil, don't +actually exit the minibuffer, just insert the selected completion if +any. + If `minibuffer-completion-confirm' is `confirm', do not try to complete; instead, ask for confirmation and accept any input if confirmed. @@ -1997,9 +2002,12 @@ If `minibuffer-completion-confirm' is `confirm-after-completion', preceding minibuffer command was a member of `minibuffer-confirm-exit-commands', and accept the input otherwise." - (interactive) - (completion-complete-and-exit (minibuffer--completion-prompt-end) (point-max) - #'exit-minibuffer)) + (interactive "P") + (when (completion--selected-candidate) + (minibuffer-choose-completion t t)) + (unless no-exit + (completion-complete-and-exit (minibuffer--completion-prompt-end) (point-max) + #'exit-minibuffer))) (defun completion-complete-and-exit (beg end exit-function) (completion--complete-and-exit @@ -3010,6 +3018,11 @@ Also respects the obsolete wrapper hook `completion-in-region-functions'. ;; completion-at-point called directly. "M-?" #'completion-help-at-point "TAB" #'completion-at-point + ;; If a completion is selected, RET will choose it. + "RET" `(menu-item "" minibuffer-choose-completion :filter + ,(lambda (cmd) + (when (completion--selected-candidate) + cmd))) "M-" #'minibuffer-previous-completion "M-" #'minibuffer-next-completion "M-RET" #'minibuffer-choose-completion) @@ -3216,6 +3229,17 @@ The completion method is determined by `completion-at-point-functions'." (define-key map "\n" 'exit-minibuffer) (define-key map "\r" 'exit-minibuffer)) +(defun minibuffer-completion-exit (&optional no-exit) + "Call `exit-minibuffer', inserting the selected completion first if any. + +If NO-EXIT is non-nil, don't `exit-minibuffer', just insert the selected +completion." + (interactive "P") + (when (completion--selected-candidate) + (minibuffer-choose-completion t t)) + (unless no-exit + (exit-minibuffer))) + (defvar-keymap minibuffer-local-completion-map :doc "Local keymap for minibuffer input with completion." :parent minibuffer-local-map @@ -3225,6 +3249,7 @@ The completion method is determined by `completion-at-point-functions'." ;; another binding for it. ;; "M-TAB" #'minibuffer-force-complete "SPC" #'minibuffer-complete-word + "RET" #'minibuffer-completion-exit "?" #'minibuffer-completion-help "" #'switch-to-completions "M-v" #'switch-to-completions @@ -3344,16 +3369,18 @@ and `RET' accepts the input typed into the minibuffer." (window-buffer (active-minibuffer-window))) window))) +(defun completion--selected-candidate () + "Return the selected completion candidate if any." + (when-let* ((window (minibuffer--completions-visible))) + (with-current-buffer (window-buffer window) + (get-text-property (point) 'completion--string)))) + (defun minibuffer-visible-completions--filter (cmd) "Return CMD if `minibuffer-visible-completions' bindings should be active." (if minibuffer-visible-completions--always-bind cmd (when-let* ((window (minibuffer--completions-visible))) - (when (if (eq cmd #'minibuffer-choose-completion-or-exit) - (with-current-buffer (window-buffer window) - (get-text-property (point) 'completion--string)) - t) - cmd)))) + cmd))) (defun minibuffer-visible-completions--bind (binding) "Use BINDING when completions are visible. @@ -3369,7 +3396,6 @@ displaying the *Completions* buffer exists." "" (minibuffer-visible-completions--bind #'minibuffer-next-completion) "" (minibuffer-visible-completions--bind #'minibuffer-previous-line-completion) "" (minibuffer-visible-completions--bind #'minibuffer-next-line-completion) - "RET" (minibuffer-visible-completions--bind #'minibuffer-choose-completion-or-exit) "C-g" (minibuffer-visible-completions--bind #'minibuffer-hide-completions)) ;;; Completion tables. @@ -5125,13 +5151,13 @@ and execute the forms." (completion--lazy-insert-strings) ,@body)))) -(defcustom minibuffer-completion-auto-choose t +(defcustom minibuffer-completion-auto-choose nil "Non-nil means to automatically insert completions to the minibuffer. When non-nil, then `minibuffer-next-completion' and `minibuffer-previous-completion' will insert the completion selected by these commands to the minibuffer." :type 'boolean - :version "29.1") + :version "31.1") (defun minibuffer-next-completion (&optional n vertical) "Move to the next item in its completions window from the minibuffer. diff --git a/lisp/simple.el b/lisp/simple.el index b0f6621b37e..2a13d59e5cd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -10570,28 +10570,24 @@ Called from `temp-buffer-show-hook'." ;; Maybe insert help string. (when completion-show-help (goto-char (point-min)) - (if minibuffer-visible-completions - (let ((helps - (with-current-buffer (window-buffer (active-minibuffer-window)) - (let ((minibuffer-visible-completions--always-bind t)) - (list - (substitute-command-keys - (if (display-mouse-p) - "Click or type \\[minibuffer-choose-completion-or-exit] on a completion to select it.\n" - "Type \\[minibuffer-choose-completion-or-exit] on a completion to select it.\n")) + (let ((helps + (with-current-buffer (window-buffer (active-minibuffer-window)) + (let ((minibuffer-visible-completions--always-bind t)) + (list + (substitute-command-keys + (if (display-mouse-p) + "Click or type \\[minibuffer-choose-completion] on a completion to select it.\n" + "Type \\[minibuffer-choose-completion] on a completion to select it.\n")) + (if minibuffer-visible-completions (substitute-command-keys "Type \\[minibuffer-next-completion], \\[minibuffer-previous-completion], \ \\[minibuffer-next-line-completion], \\[minibuffer-previous-line-completion] \ -to move point between completions.\n\n")))))) - (dolist (help helps) - (insert help))) - (insert (substitute-command-keys - (if (display-mouse-p) - "Click or type \\[minibuffer-choose-completion] on a completion to select it.\n" - "Type \\[minibuffer-choose-completion] on a completion to select it.\n"))) - (insert (substitute-command-keys - "Type \\[minibuffer-next-completion] or \\[minibuffer-previous-completion] \ +to move point between completions.\n\n") + (substitute-command-keys + "Type \\[minibuffer-next-completion] or \\[minibuffer-previous-completion] \ to move point between completions.\n\n"))))))) + (dolist (help helps) + (insert help))))))) (add-hook 'completion-setup-hook #'completion-setup-function) diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el index c2c37e63012..99753f31330 100644 --- a/test/lisp/minibuffer-tests.el +++ b/test/lisp/minibuffer-tests.el @@ -433,6 +433,17 @@ 15))) +(defmacro with-minibuffer-setup (completing-read &rest body) + (declare (indent 1) (debug (collection body))) + `(catch 'result + (minibuffer-with-setup-hook + (lambda () + (let ((redisplay-skip-initial-frame nil) + (executing-kbd-macro nil)) ; Don't skip redisplay + (throw 'result (progn . ,body)))) + (let ((executing-kbd-macro t)) ; Force the real minibuffer + ,completing-read)))) + (defmacro completing-read-with-minibuffer-setup (collection &rest body) (declare (indent 1) (debug (collection body))) `(catch 'result @@ -569,6 +580,7 @@ (ert-deftest completions-header-format-test () (let ((completion-show-help nil) + (minibuffer-completion-auto-choose t) (completions-header-format nil)) (completing-read-with-minibuffer-setup '("aa" "ab" "ac") @@ -718,11 +730,50 @@ (should (equal (minibuffer-contents) "ccc"))))) (ert-deftest minibuffer-next-completion () - (let ((default-directory (ert-resource-directory))) + (let ((default-directory (ert-resource-directory)) + (minibuffer-completion-auto-choose t)) (completing-read-with-minibuffer-setup #'read-file-name-internal (insert "d/") (execute-kbd-macro (kbd "M- M- M-")) (should (equal "data/minibuffer-test-cttq$$tion" (minibuffer-contents)))))) +(ert-deftest minibuffer-completion-RET-prefix () + ;; REQUIRE-MATCH=nil + (with-minibuffer-setup + (completing-read ":" '("aaa" "bbb" "ccc") nil nil) + (execute-kbd-macro (kbd "M- M- C-u RET")) + (should (equal "bbb" (minibuffer-contents)))) + ;; REQUIRE-MATCH=t + (with-minibuffer-setup + (completing-read ":" '("aaa" "bbb" "ccc") nil t) + (execute-kbd-macro (kbd "M- M- C-u RET")) + (should (equal "bbb" (minibuffer-contents))))) + +(defun test/completion-at-point () + (list (point-min) (point) '("test:a" "test:b"))) + +(ert-deftest completion-in-region-next-completion () + (with-current-buffer (get-buffer-create "*test*") + ;; Put this buffer in the selected window so + ;; `minibuffer--completions-visible' works. + (pop-to-buffer (current-buffer)) + (setq-local completion-at-point-functions (list #'test/completion-at-point)) + (insert "test:") + (completion-help-at-point) + (should (minibuffer--completions-visible)) + ;; C-u RET and RET have basically the same behavior for + ;; completion-in-region-mode, since they both dismiss *Completions* + ;; while leaving completion-in-region-mode still active. + (execute-kbd-macro (kbd "M-")) + (should (equal (completion--selected-candidate) "test:a")) + (execute-kbd-macro (kbd "C-u RET")) + (should (equal (buffer-string) "test:a")) + (delete-char -1) + (completion-help-at-point) + (execute-kbd-macro (kbd "M- M-")) + (should (equal (completion--selected-candidate) "test:b")) + (execute-kbd-macro (kbd "RET")) + (should (equal (buffer-string) "test:b")))) + (provide 'minibuffer-tests) ;;; minibuffer-tests.el ends here commit 7efa4e34bbde31f3b8fbfe510a1cc2ddbc45ac1f Author: Robert Pluim Date: Thu Aug 7 15:51:19 2025 +0200 ; * lisp/font-lock.el: Remove unneeded "cl-lib" require. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 188f03cbb9c..0d1bd18ee23 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -207,7 +207,6 @@ ;;; Code: (require 'syntax) -(eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'subr-x)) ;; Define core `font-lock' group. commit 6aa0be3d46eca9ad66bc0a519585e5e53a53caa9 Author: Robert Pluim Date: Wed Aug 27 10:52:32 2025 +0200 ; * etc/NEWS: Correct AUTH=PLAIN description. diff --git a/etc/NEWS b/etc/NEWS index 6845a726c29..cdf46096034 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1478,9 +1478,10 @@ replies. --- *** 'imap-authenticate' can now use PLAIN authentication. -"AUTH=PLAIN" support is auto-enabled if the IMAP server supports it. Pass -a specific authentication type to 'imap-authenticate' or remove 'plain' -from 'imap-authenticators' if you do not wish to use "AUTH=PLAIN". +"AUTH=PLAIN" support is auto-enabled if the IMAP server supports it. If +you do not wish to use "AUTH=PLAIN", pass a specific authentication type +to 'imap-open' for 'imap-authenticate' to use, or remove 'plain' from +'imap-authenticators'. ** Rmail commit b7cef005717b4b125e250863f20691f99e4fdb91 Author: Robert Pluim Date: Tue Aug 26 11:46:57 2025 +0200 ; Fix formatting * src/process.c (clear_fd_callback_data, delete_write_fd, delete_keyboard_wait_descriptor): Space before paren. diff --git a/src/process.c b/src/process.c index c8b70a4174c..d6efac5479d 100644 --- a/src/process.c +++ b/src/process.c @@ -467,7 +467,7 @@ static struct fd_callback_data } fd_callback_info[FD_SETSIZE]; static void -clear_fd_callback_data(struct fd_callback_data* elem) +clear_fd_callback_data (struct fd_callback_data* elem) { elem->func = NULL; elem->data = NULL; @@ -577,7 +577,7 @@ delete_write_fd (int fd) fd_callback_info[fd].flags &= ~(FOR_WRITE | NON_BLOCKING_CONNECT_FD); if (fd_callback_info[fd].flags == 0) { - clear_fd_callback_data(&fd_callback_info[fd]); + clear_fd_callback_data (&fd_callback_info[fd]); if (fd == max_desc) recompute_max_desc (); @@ -8322,7 +8322,7 @@ delete_keyboard_wait_descriptor (int desc) #ifdef subprocesses eassert (desc >= 0 && desc < FD_SETSIZE); - clear_fd_callback_data(&fd_callback_info[desc]); + clear_fd_callback_data (&fd_callback_info[desc]); if (desc == max_desc) recompute_max_desc (); commit 29c35668d0b61883a9bf06b8396b9932aa3113fe Author: Michael Albinus Date: Wed Aug 27 11:24:12 2025 +0200 Extend info-xref-test-emacs-manuals, fix info reference * doc/lispref/loading.texi (Autoload): Fix reference. * test/lisp/info-xref-tests.el (info-xref-test-emacs-manuals): Print output buffer. diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index 836d980ff0d..f6a3a0e2c26 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -690,7 +690,7 @@ and @code{define-overloadable-function} (see the commentary in (@pxref{Top,Autotyping,,autotype,Autotyping}), @code{transient-define-prefix}, @code{transient-define-suffix}, @code{transient-define-infix}, @code{transient-define-argument}, and -@code{transient-define-group} (@pxref{TOP,Transient,,transient,Transient +@code{transient-define-group} (@pxref{Top,Transient,,transient,Transient User and Developer Manual}). @end table diff --git a/test/lisp/info-xref-tests.el b/test/lisp/info-xref-tests.el index 718e4712e4e..f7e42978b80 100644 --- a/test/lisp/info-xref-tests.el +++ b/test/lisp/info-xref-tests.el @@ -165,11 +165,11 @@ text. (skip-unless (file-readable-p "emacs.info")) (info-xref-check-all) (with-current-buffer info-xref-output-buffer + (message "%s" (buffer-substring-no-properties (point-min) (point-max))) (goto-char (point-max)) (should (search-backward "done" nil t)) (should (string-match-p " [0-9]\\{3,\\} good, 0 bad" (buffer-substring-no-properties (pos-bol) (pos-eol))))))) - ;;; info-xref-tests.el ends here commit f908d854d616b7c68e1f4009ad4c1da0afc7db06 Author: john muhl Date: Tue Aug 26 15:12:26 2025 -0500 ; Various code cleanup in 'lua-mode' (Bug#79309) * lisp/progmodes/lua-mode.el (lua-indent-level): Contemporary Lua style guides no longer recommend 3 as default. Change type to 'natnum'. (lua-always-show, lua-get-block-token-info) (lua--backward-up-list-noerror, lua-make-indentation-info-pair) (lua-accumulate-indentation-info) (lua-calculate-indentation-block-modifier): Quote function names. (lua-toggle-electric-state): Re-format to avoid confusion. (lua-is-continuing-statement-p-1): Fix typo. (lua--builtins): Move docstring to correct location. (lua-is-continuing-statement-p-1): Remove unnecessary 'or'. (lua-make-lua-string): Remove excessive backslashes and unnecessary use of a temporary buffer. (lua-find-matching-token-word): Make it clear that 'goto-char' is only used only for its side-effect. diff --git a/lisp/progmodes/lua-mode.el b/lisp/progmodes/lua-mode.el index f8d9ed98f1a..2e051d6d552 100644 --- a/lisp/progmodes/lua-mode.el +++ b/lisp/progmodes/lua-mode.el @@ -150,10 +150,10 @@ :prefix "lua-" :group 'languages) -(defcustom lua-indent-level 3 +(defcustom lua-indent-level 4 "Amount by which Lua subexpressions are indented." - :type 'integer - :safe #'integerp + :type 'natnum + :safe #'natnump :version "31.1") (defcustom lua-comment-start "-- " @@ -183,7 +183,7 @@ Should be a list of strings." :version "31.1") (defcustom lua-always-show t - "Non-nil means display lua-process-buffer after sending a command." + "Non-nil means display `lua-process-buffer' after sending a command." :type 'boolean :group 'lua) @@ -204,7 +204,6 @@ Should be a list of strings." :type 'string :group 'lua) - (defvar lua-process nil "The active Lua process.") @@ -390,11 +389,11 @@ traceback location." (concat (module-name-re x) (module-members-re x))) modules "\\|") - "\\)")))) - "A regexp that matches Lua builtin functions & variables. + "\\)"))) + "A regexp that matches Lua builtin functions & variables. -This is a compilation of 5.1, 5.2 and 5.3 builtins taken from the -index of respective Lua reference manuals.") +This is a compilation of 5.1-5.4 builtins taken from the index of +respective Lua reference manuals.")) (defvar lua-font-lock-keywords `(;; Highlight the hash-bang line "#!/foo/bar/lua" as comment @@ -917,7 +916,7 @@ type.") (any ")]}")))))) (defun lua-get-block-token-info (token) - "Return the block token info entry for TOKEN from lua-block-token-alist." + "Return the block token info entry for TOKEN from `lua-block-token-alist'." (assoc token lua-block-token-alist)) (defun lua-get-token-match-re (token-info direction) @@ -993,9 +992,10 @@ DIRECTION has to be either \\='forward or \\='backward." (eq match-type 'middle-or-open) (eq found-type 'middle-or-open) (eq match-type found-type)) - (goto-char found-pos) - (lua-find-matching-token-word - found-token search-direction)) + (progn + (goto-char found-pos) + (lua-find-matching-token-word + found-token search-direction))) (when maybe-found-pos (goto-char maybe-found-pos) (throw 'found maybe-found-pos))) @@ -1202,7 +1202,7 @@ end-of-statement.") (match-beginning 2)))))) (defun lua--backward-up-list-noerror () - "Safe version of lua-backward-up-list that does not signal an error." + "Safe version of `lua-backward-up-list' that does not signal an error." (condition-case nil (lua-backward-up-list) (scan-error nil))) @@ -1249,40 +1249,39 @@ end-of-statement.") lua-funcheader))))) (defun lua-is-continuing-statement-p-1 () - "Return non-nil if current lined continues a statement. + "Return non-nil if current line continues a statement. More specifically, return the point in the line that is continued. The criteria for a continuing statement are: -* the last token of the previous line is a continuing op, - OR the first token of the current line is a continuing op +* The last token of the previous line is a continuing op, + OR the first token of the current line is a continuing op. -* the expression is not enclosed by a parentheses/braces/brackets" +* The expression is not enclosed by a parentheses/braces/brackets." (let (prev-line continuation-pos parent-block-opener) (save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back))) (and prev-line (not (lua--continuation-breaking-line-p)) (save-excursion - (or - ;; Binary operator or keyword that implies continuation. - (and (setq continuation-pos - (or (lua-first-token-continues-p) - (save-excursion - (and (goto-char prev-line) - ;; Check last token of previous nonblank line - (lua-last-token-continues-p))))) - (not - ;; Operators/keywords does not create continuation - ;; inside some blocks: - (and (setq parent-block-opener - (car-safe (lua--backward-up-list-noerror))) - (or - ;; Inside parens/brackets - (member parent-block-opener '("(" "[")) - ;; Inside braces if it is a comma - (and (eq (char-after continuation-pos) ?,) - (equal parent-block-opener "{"))))) - continuation-pos)))))) + ;; Binary operator or keyword that implies continuation. + (and (setq continuation-pos + (or (lua-first-token-continues-p) + (save-excursion + (goto-char prev-line) + ;; Check last token of previous nonblank line + (lua-last-token-continues-p)))) + (not + ;; Operators/keywords does not create continuation + ;; inside some blocks: + (and (setq parent-block-opener + (car-safe (lua--backward-up-list-noerror))) + (or + ;; Inside parens/brackets + (member parent-block-opener '("(" "[")) + ;; Inside braces if it is a comma + (and (eq (char-after continuation-pos) ?,) + (equal parent-block-opener "{"))))) + continuation-pos))))) (defun lua-is-continuing-statement-p (&optional parse-start) "Return non-nil if PARSE-START should be indented as continuation line. @@ -1328,7 +1327,7 @@ This true is when the line: (defun lua-make-indentation-info-pair (found-token found-pos) "Create a pair from FOUND-TOKEN and FOUND-POS for indentation calculation. -This is a helper function to lua-calculate-indentation-info. +This is a helper function to `lua-calculate-indentation-info'. Don't use standalone." (cond ;; Functions are a bit tricky to indent right. They can appear in a @@ -1525,7 +1524,7 @@ The argument PARSE-END is a buffer position that bounds the calculation." indentation-info)) (defun lua-accumulate-indentation-info (reversed-indentation-info) - "Accumulate indent information from lua-calculate-indentation-info. + "Accumulate indent information from `lua-calculate-indentation-info'. Returns either the relative indentation shift, or the absolute column to indent to. @@ -1553,8 +1552,8 @@ The argument REVERSED-INDENTATION-INFO is an indentation INFO-LIST." (defun lua-calculate-indentation-block-modifier (&optional parse-end) "Return amount by which this line modifies the indentation. -Beginnings of blocks add lua-indent-level once each, and endings of -blocks subtract lua-indent-level once each. This function is used to +Beginnings of blocks add `lua-indent-level' once each, and endings of +blocks subtract `lua-indent-level' once each. This function is used to determine how the indentation of the following line relates to this one. The argument PARSE-END is a buffer position that bounds the calculation." @@ -1814,19 +1813,17 @@ This function just searches for a `end' at the beginning of a line." (defun lua-make-lua-string (str) "Convert STR to Lua literal." - (save-match-data - (with-temp-buffer - (insert str) - (goto-char (point-min)) - (while (re-search-forward "[\"'\\\t\\\n]" nil t) - (cond - ((string= (match-string 0) "\n") - (replace-match "\\\\n")) - ((string= (match-string 0) "\t") - (replace-match "\\\\t")) - (t - (replace-match "\\\\\\&" t)))) - (concat "'" (buffer-string) "'")))) + (concat "'" + (replace-regexp-in-string + (rx (or ?\" ?' ?\t ?\n ?\\)) + (lambda (s) + (cdr (assq (aref s 0) '((?\" . "\\\"") + (?\\ . "\\\\") + (?\n . "\\n") + (?\t . "\\t") + (?' . "\\'"))))) + str t t) + "'")) ;;;###autoload (defalias 'run-lua #'lua-start-process) @@ -2031,7 +2028,8 @@ left out." (interactive "P") (let ((num_arg (prefix-numeric-value arg))) (setq lua-electric-flag (cond ((or (null arg) - (zerop num_arg)) (not lua-electric-flag)) + (zerop num_arg)) + (not lua-electric-flag)) ((< num_arg 0) nil) ((> num_arg 0) t)))) (message "%S" lua-electric-flag)) commit 6b0b70233a2a29d3d4ea83b0ea07b337271c0d5f Author: john muhl Date: Wed Aug 27 00:04:56 2025 +0300 ; ruby-flymake-simple: Only match relative file name (bug#79257) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 5c8a4025419..0a6ead870a7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -2516,7 +2516,7 @@ A slash character after any of these should begin a regexp.")) (goto-char (point-min)) (cl-loop while (search-forward-regexp - "^\\(?:.*ruby: \\)?\\(?:.*\\.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$" + "^\\(?:ruby: \\)?\\(?:.*\\.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$" nil t) for msg = (match-string 2) for (beg . end) = (flymake-diag-region commit ff83b735f94359a602ac543c13492178d70b1bc3 Author: Eli Zaretskii Date: Tue Aug 26 16:24:55 2025 +0300 Fix last change in 'next_element_from_display_vector' * src/xdisp.c (next_element_from_display_vector): Only switch the iterator from unibyte to multibyte, never in the other direction, and not if the original character came from a unibyte buffer. (Bug#79317) diff --git a/src/xdisp.c b/src/xdisp.c index 59483768d92..89561d750b6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9158,8 +9158,14 @@ next_element_from_display_vector (struct it *it) it->len = CHAR_BYTES (it->c); /* The character code in the display vector could be non-ASCII, in which case we must make the iterator multibyte, so that a - suitable font for the character is looked up. */ - it->multibyte_p = !ASCII_CHAR_P (it->c); + suitable font for the character is looked up. But don't do + that if the original character came from a unibyte buffer. */ + if (!ASCII_CHAR_P (it->c) + && !it->multibyte_p + && !(((it->sp == 0 && BUFFERP (it->object)) + || (it->sp > 1 && !NILP (it->stack[0].string))) + && NILP (BVAR (current_buffer, enable_multibyte_characters)))) + it->multibyte_p = 1; /* The entry may contain a face id to use. Such a face id is the id of a Lisp face, not a realized face. A face id of