commit bdc21b246cdb6fe3d977222ab7566cfdf889a38c (HEAD, refs/remotes/origin/master) Author: Visuwesh Date: Thu Dec 26 17:19:41 2024 +0530 Ensure Dired window is selected when reverting buffer * lisp/dired.el (dired--make-directory-clickable): Ensure the Dired window is selected. This prevents erroneously reverting a non-Dired buffer. (Bug#74700) diff --git a/lisp/dired.el b/lisp/dired.el index 9929545eba9..2a020803528 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2088,8 +2088,10 @@ mouse-2: visit this file in other window" `(mouse-face highlight help-echo "mouse-1: re-read this buffer's directory" keymap ,(define-keymap - "" #'revert-buffer - "" 'follow-link + "" (lambda () + (interactive "@") + (revert-buffer)) + "" 'mouse-face "RET" #'revert-buffer)))))))) (defun dired--get-ellipsis-length () commit dc4b8d198bab5363e139853f656ff553dcdeeeb5 Author: Morgan Willcock Date: Wed Dec 25 09:47:42 2024 +0000 Set marker insertion type for Imenu markers * lisp/imenu.el (imenu-default-create-index-function) (imenu--generic-function): Configure Imenu markers to advance their position when characters are inserted at the marker position. (Bug#75072) diff --git a/lisp/imenu.el b/lisp/imenu.el index ba1ba5fcd00..12bc89cb159 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -583,7 +583,9 @@ The alternate method, which is the one most often used, is to call (and (stringp name) ;; [ydi] Updated for imenu-use-markers. (push (cons name - (if imenu-use-markers (point-marker) (point))) + (if imenu-use-markers + (copy-marker (point) t) + (point))) index-alist))) index-alist)) ;; Use generic expression if possible. @@ -688,7 +690,7 @@ depending on PATTERNS." (unless (assoc menu-title index-alist) (push (list menu-title) index-alist)) (if imenu-use-markers - (setq beg (copy-marker beg))) + (setq beg (copy-marker beg t))) (let ((item (if function (nconc (list (match-string-no-properties index) commit 6412a5503c404bbe177879d113c2299288c76ccd Author: Spencer Baugh Date: Tue Dec 10 12:41:49 2024 -0500 Consistently add wildcards for completion-pcm-leading-wildcard completion-pcm--find-all-completions has two different phases: First we turn the minibuffer text into a regex and matches completion alternatives against it. If that finds no matches, then we strip some text off the completions and minibuffer text and call ourselves recursively to find completions, then filter the results with the removed text (converted into a regex). Because of this, completion-pcm-leading-wildcard had inconsistent behavior: in the second phase, the filter created from the removed text would have a leading wildcard. That effectively adds wildcards in the middle of the minibuffer text at the start of each "word". But the first phrase created a regex which had no such wildcards. Thus, the two phases could get substantially different results. We fix this by changing completion-pcm-leading-wildcard to consistently add a leading wildcard for each word. This was always my intention. * lisp/minibuffer.el (completion-pcm--string->pattern): Include a wildcard after each delimter with completion-pcm-leading-wildcard. (bug#74772) * lisp/minibuffer.el (completion-pcm-leading-wildcard): Update docs. * doc/emacs/mini.texi (Completion Styles): Update docs. diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 0fcd24ed79d..8e0d58d0f7c 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -577,9 +577,9 @@ corresponding position in the completion alternative. @vindex completion-pcm-leading-wildcard If @code{completion-pcm-leading-wildcard} is set to @code{t}, this style -always acts as if a @dfn{wildcard} is present at the start of the -minibuffer text, similar to the @code{substring} style. For example, -@samp{l-m} will complete to @samp{emacs-lisp-mode}. +always acts as if a @dfn{wildcard} is present at the start of each word +in the minibuffer text, similar to the @code{substring} style. For +example, @samp{l-ode} will complete to @samp{emacs-lisp-mode}. @item emacs22 @cindex @code{emacs22}, completion style diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 253c26a84ea..39e7a399404 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3951,17 +3951,18 @@ the commands start with a \"-\" or a SPC." trivial))) (defcustom completion-pcm-leading-wildcard nil - "If non-nil, partial-completion completes as if there's a leading wildcard. + "If non-nil, partial-completion behaves as if each word is preceded by wildcard. -If nil (the default), partial-completion requires a matching completion -alternative to have the same beginning as the first \"word\" in the -minibuffer text, where \"word\" is determined by +If nil (the default), partial-completion requires each word in a +matching completion alternative to have the same beginning as each +\"word\" in the minibuffer text, where \"word\" is determined by `completion-pcm-word-delimiters'. If non-nil, partial-completion allows any string of characters to occur -at the beginning of a completion alternative, as if a wildcard such as -\"*\" was present at the beginning of the minibuffer text. This makes -partial-completion behave more like the substring completion style." +at the beginning of each word in a completion alternative, as if a +wildcard such as \"*\" was present at the beginning of each word. This +makes partial-completion behave more like the substring completion +style." :version "31.1" :type 'boolean) @@ -4008,7 +4009,7 @@ or a symbol, see `completion-pcm--merge-completions'." (setq p0 p) (push (substring string p (match-end 0)) pattern) ;; `any-delim' is used so that "a-b" also finds "array->beginning". - (setq pending 'any-delim) + (setq pending (if completion-pcm-leading-wildcard 'prefix 'any-delim)) (setq p0 (match-end 0)))) (setq p p0)) commit aaacd5806c75019b052a69764ef4d193d243573c Author: Visuwesh Date: Thu Dec 12 18:58:37 2024 +0530 Show the keybinding next to command in calc's x * lisp/calc/calc-ext.el (calc-execute-extended-command): Use M-x's ':affixation-function' to show the keybinding of the calc command next to its name. (Bug#74829) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 25d2492b277..0cbd02be657 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1728,8 +1728,11 @@ calc-kill calc-kill-region calc-yank)))) (interactive "P") (let* ((prompt (concat (calc-num-prefix-name n) "M-x ")) (cmd (intern - (completing-read prompt obarray 'commandp t "calc-" - 'calc-extended-command-history)))) + (let ((completion-extra-properties + (list :affixation-function + #'read-extended-command--affixation))) + (completing-read prompt obarray 'commandp t "calc-" + 'calc-extended-command-history))))) (setq prefix-arg n) (command-execute cmd))) commit b561f896b5e52d3e4571901fd5d545354ba29bac Author: Dmitry Gutov Date: Thu Dec 26 06:17:40 2024 +0200 ruby-ts--s-p-query: Put '_' syntax on ?! method definitions * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Put 'symbol' syntax on method definitions ending with [?!]. Reported in https://github.com/dgutov/robe/issues/149. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index a6fe39da45f..0ee72df6c9d 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1052,6 +1052,9 @@ leading double colon is not added." ;; Method calls with name ending with ? or !. ((call method: (identifier) @ident) (:match "[?!]\\'" @ident)) + ;; Method definitions for the above. + ((method name: (identifier) @ident) + (:match "[?!]\\'" @ident)) ;; Backtick method redefinition. ((operator "`" @backtick)) ;; TODO: Stop at interpolations. commit 704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb Author: Dmitry Gutov Date: Thu Dec 26 02:53:05 2024 +0200 ruby-ts-mode: Refine the forward-sexp improvement * lisp/progmodes/ruby-ts-mode.el (ruby-ts--sexp-list-p): New function (bug#73404). (ruby-ts-mode): Use it in sexp-list thing definition. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 4ef0cb18eae..a6fe39da45f 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1120,6 +1120,12 @@ leading double colon is not added." (equal (treesit-node-type (treesit-node-child node 0)) "("))) +(defun ruby-ts--sexp-list-p (node) + ;; Distinguish between the named `unless' node and the + ;; node with the same value of type. + (when (treesit-node-check node 'named) + (ruby-ts--sexp-p node))) + (defvar-keymap ruby-ts-mode-map :doc "Keymap used in Ruby mode" :parent prog-mode-map @@ -1235,7 +1241,7 @@ leading double colon is not added." "array" "hash") eol) - #'ruby-ts--sexp-p)) + #'ruby-ts--sexp-list-p)) (text ,(lambda (node) (or (member (treesit-node-type node) '("comment" "string_content" "heredoc_content")) commit e96727f0ea0986bffe7ff235e5abc5354e63a64d Author: Eli Zaretskii Date: Wed Dec 25 20:52:45 2024 +0200 ; Fix documentation of recent additions to treesit.el * lisp/treesit.el (treesit-language-display-name-alist) (treesit-language-display-name): Doc fixes. * etc/NEWS: Fix wording of entry announcing the above. diff --git a/etc/NEWS b/etc/NEWS index ca107bb4938..8adead78a32 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -994,10 +994,10 @@ it uses `forward-sexp-default-function'. +++ *** New function 'treesit-language-display-name'. -New function that returns the display name given the language symbol. -For example, 'cpp' is translated to "C++". Also adds a new variable -'treesit-language-display-name-alist' that the function uses to -translate display names. +This new function returns the display name of a language given the +language symbol. For example, 'cpp' is translated to "C++". A new +variable 'treesit-language-display-name-alist' holds the translations of +language symbols where that translation is not trivial. +++ *** New command 'treesit-explore' diff --git a/lisp/treesit.el b/lisp/treesit.el index 2616d16e800..eb3e26fff7e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -851,17 +851,18 @@ omitted, default END to BEG." ) "An alist mapping language symbols to their display names. -Used by `treesit-language-display-name'. If there's no mapping in this -alist, `treesit-language-display-name' converts the symbol to display -name by capitalizing the first letter. So languages like Java, -Javascript, Rust don't need an entry in this variable.") +Used by `treesit-language-display-name'. If there's no mapping for a +lamguage in this alist, `treesit-language-display-name' converts the +symbol to the display name by capitalizing the first letter of the +symbol's name. Thus, languages like Java, Javascript, Rust don't need +an entry in this variable.") (defun treesit-language-display-name (language) - "Returns the display name (a string) of LANGUAGE. + "Return the display name (a string) of LANGUAGE (a symbol). If LANGUAGE has an entry in `treesit-language-display-name-alist', use -the display name in their. Otherwise, capitalize the first letter of -LANGUAGE and return the string." +the display name from there. Otherwise, capitalize the first letter of +LANGUAGE's name and return the resulting string." (or (alist-get language treesit-language-display-name-alist) (capitalize (symbol-name language)))) commit d70ef80868996b9119f032cd13911c600436e29f Author: Eli Zaretskii Date: Wed Dec 25 20:46:14 2024 +0200 ; * doc/lispref/modes.texi (Imenu): Fix wording and markup. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index f227bdc635f..6ecee0b2ee7 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3112,10 +3112,11 @@ automatically sets up Imenu if this variable is non-@code{nil}. @defvar treesit-aggregated-simple-imenu-settings This variable allows major modes to configure Imenu for multiple languages. Its value is an alist mapping language symbols to Imenu -settings described in @var{treesit-simple-imenu-settings}. +settings of the form described above for the value of +@code{treesit-simple-imenu-settings}. -If both this variable and @var{treesit-simple-imenu-settings} is -non-@code{nil}, Emacs uses this variable for setting up Imenu. +If this variable is non-@code{nil}, it overrides +@code{treesit-simple-imenu-settings} for setting up Imenu. @end defvar @node Outline Minor Mode commit c09e056c43e344c5adda08ef819252824cff0ef0 Author: Juri Linkov Date: Wed Dec 25 19:52:10 2024 +0200 * lisp/treesit.el: Improvements for treesit-explore-mode (bug#75079) (treesit-explorer-switch-parser): Don't use completing-read on the single parser. (treesit-explore-mode): Don't save treesit-explore-mode to the desktop. diff --git a/lisp/treesit.el b/lisp/treesit.el index 464b7e688be..2616d16e800 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3911,8 +3911,10 @@ covers point. PARSER-NAME are unique." (interactive (list (let* ((parser-alist (treesit--explorer-generate-parser-alist)) - (parser-name (completing-read - "Parser: " (mapcar #'car parser-alist)))) + (parser-name (if (= (length parser-alist) 1) + (car parser-alist) + (completing-read + "Parser: " (mapcar #'car parser-alist))))) (alist-get parser-name parser-alist nil nil #'equal)))) (unless treesit-explore-mode @@ -3952,7 +3954,15 @@ window." (unless (memq 'treesit--explorer-tree-mode desktop-modes-not-to-save) (push 'treesit--explorer-tree-mode - desktop-modes-not-to-save)))) + desktop-modes-not-to-save))) + ;; Tell `desktop-save' to not save this minor mode + ;; that might disrupt loading the desktop + ;; with the prompt to select a parser. + (when (boundp 'desktop-minor-mode-table) + (unless (member '(treesit-explore-mode nil) + desktop-minor-mode-table) + (push '(treesit-explore-mode nil) + desktop-minor-mode-table)))) ;; Turn off explore mode. (remove-hook 'post-command-hook #'treesit--explorer-post-command t)