commit cda77d9544a41845bf9408581c61da3823251e57 (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Tue Dec 17 09:52:38 2024 +0200 * lisp/minibuffer.el: Mention `eager-display' in more docstrings. (completion-category-defaults, completion-category-overrides): Add `eager-display' to the docstring. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 91495f9f941..253c26a84ea 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1210,6 +1210,7 @@ an association list that can specify properties such as: - `group-function': function for grouping the completion candidates. - `annotation-function': function to add annotations in *Completions*. - `affixation-function': function to prepend/append a prefix/suffix. +- `eager-display': function to show *Completions* eagerly. Categories are symbols such as `buffer' and `file', used when completing buffer and file names, respectively. @@ -1231,6 +1232,7 @@ possible values are the same as in `completions-sort'. - `group-function': function for grouping the completion candidates. - `annotation-function': function to add annotations in *Completions*. - `affixation-function': function to prepend/append a prefix/suffix. +- `eager-display': function to show *Completions* eagerly. See more description of metadata in `completion-metadata'. Categories are symbols such as `buffer' and `file', used when commit 2f4a7f5ec3c75641e2a3c66156c2783c5576b1d7 Author: Juri Linkov Date: Tue Dec 17 09:47:42 2024 +0200 ; * etc/NEWS: Mention 'eager-display' for 'completion-category-overrides'. diff --git a/etc/NEWS b/etc/NEWS index 4f74795043e..d20c733c0c3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -109,6 +109,9 @@ the *Completions* buffer immediately. When the variable is set to t all completion commands show *Completions* immediately, respectively nil disables the eager display for all commands. The default setting auto enables eager completion only if requested by the command. +For more fine-grained control you can also toggle this feature +by category using the symbol 'eager-display' in the user option +'completion-category-overrides'. +++ *** New user option 'completion-pcm-leading-wildcard'. commit 97ae8f684d93a7cf895ebf8d9aabb31697d968a8 Author: Stefan Kangas Date: Tue Dec 17 01:40:59 2024 +0100 Don't use obsolete lisp-complete-symbol in ses.el * lisp/ses.el (ses-mode-edit-map): Replace obsolete function lisp-complete-symbol with completion-at-point. diff --git a/lisp/ses.el b/lisp/ses.el index 8b270842734..b02f2c4c103 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -203,10 +203,7 @@ Used for listing local printers or renamed cells.") [C-S-mouse-3] ses-insert-ses-range-click "\C-h\C-p" ses-list-local-printers "\C-h\C-n" ses-list-named-cells - "\M-\C-i" lisp-complete-symbol)) ; redefined - ; dynamically in - ; editing - ; functions + "\M-\C-i" completion-at-point)) (newmap (make-sparse-keymap))) (set-keymap-parent newmap minibuffer-local-map) (while keys commit 5a8adaeac81182f080b041a3a3840580c61213d2 Author: Stefan Kangas Date: Mon Dec 16 23:58:34 2024 +0100 unintern: Drop support for obsolete calling convention * lisp/subr.el (unintern): * src/lread.c (Funintern): Drop support for old calling convention, obsolete since 23.3. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-escape): Don't use obsolete calling convention. diff --git a/etc/NEWS b/etc/NEWS index 7066ce2ce37..4f74795043e 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1018,7 +1018,7 @@ only continue the active repeating sequence. It offers a more concise way to create a completion table with metadata. +++ -** 'all-completions' no longer supports the old calling convention. +** 'all-completions' and 'obarray' no longer support their old calling conventions. * Changes in Emacs 31.1 on Non-Free Operating Systems diff --git a/lisp/subr.el b/lisp/subr.el index fbd142493af..b025e39e7ba 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1973,7 +1973,6 @@ be a list of the form returned by `event-start' and `event-end'." (side-effect-free t) (obsolete log "24.4")) (log x 10)) -(set-advertised-calling-convention 'unintern '(name obarray) "23.3") (set-advertised-calling-convention 'indirect-function '(object) "25.1") (set-advertised-calling-convention 'redirect-frame-focus '(frame focus-frame) "24.3") (set-advertised-calling-convention 'libxml-parse-xml-region '(&optional start end base-url) "27.1") diff --git a/src/lread.c b/src/lread.c index 56e5522d270..1da82e44c8e 100644 --- a/src/lread.c +++ b/src/lread.c @@ -5085,13 +5085,12 @@ it defaults to the value of `obarray'. */) } } -DEFUN ("unintern", Funintern, Sunintern, 1, 2, 0, +DEFUN ("unintern", Funintern, Sunintern, 2, 2, 0, doc: /* Delete the symbol named NAME, if any, from OBARRAY. The value is t if a symbol was found and deleted, nil otherwise. NAME may be a string or a symbol. If it is a symbol, that symbol is deleted, if it belongs to OBARRAY--no other symbol is deleted. -OBARRAY, if nil, defaults to the value of the variable `obarray'. -usage: (unintern NAME OBARRAY) */) +OBARRAY, if nil, defaults to the value of the variable `obarray'. */) (Lisp_Object name, Lisp_Object obarray) { register Lisp_Object tem; diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 45714b3e7d9..8090507614b 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1119,7 +1119,7 @@ evaluation of BODY." (should (intern-soft "f-test4---")) (should-not (intern-soft "elisp--foo-test4---")) (should (= 84 (funcall (intern-soft "f-test4---")))) - (should (unintern "f-test4---")))) + (should (unintern "f-test4---" obarray)))) (ert-deftest elisp-dont-shadow-punctuation-only-symbols () (let* ((shorthanded-form '(/= 42 (-foo 42))) commit 80dc431b5a453c8200260969c8e2904e2d353b1e Author: Stefan Kangas Date: Mon Dec 16 22:21:37 2024 +0100 all-completions: Drop support for obsolete calling convention * src/minibuf.c (Fall_completions): * lisp/subr.el (all-completions): Drop support for old calling convention, obsolete since 23.1. * src/minibuf.c (Finternal_complete_buffer): Update caller. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index c5b9176d628..8f7d93c2749 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -966,21 +966,13 @@ too short). Both of those begin with the string @samp{foobar}. @end smallexample @end defun -@c Removed obsolete argument nospace. @defun all-completions string collection &optional predicate This function returns a list of all possible completions of @var{string}. The arguments to this function -@c (aside from @var{nospace}) are the same as those of @code{try-completion}, and it uses @code{completion-regexp-list} in the same way that @code{try-completion} does. -@ignore -The optional argument @var{nospace} is obsolete. If it is -non-@code{nil}, completions that start with a space are ignored unless -@var{string} starts with a space. -@end ignore - If @var{collection} is a function, it is called with three arguments: @var{string}, @var{predicate} and @code{t}; then @code{all-completions} returns whatever the function returns. @xref{Programmed Completion}. diff --git a/etc/NEWS b/etc/NEWS index 49a6fcf3fc8..7066ce2ce37 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1017,6 +1017,9 @@ only continue the active repeating sequence. ** New function 'completion-table-with-metadata'. It offers a more concise way to create a completion table with metadata. ++++ +** 'all-completions' no longer supports the old calling convention. + * Changes in Emacs 31.1 on Non-Free Operating Systems diff --git a/lisp/subr.el b/lisp/subr.el index 02cc84c04b7..fbd142493af 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1973,8 +1973,6 @@ be a list of the form returned by `event-start' and `event-end'." (side-effect-free t) (obsolete log "24.4")) (log x 10)) -(set-advertised-calling-convention - 'all-completions '(string collection &optional predicate) "23.1") (set-advertised-calling-convention 'unintern '(name obarray) "23.3") (set-advertised-calling-convention 'indirect-function '(object) "25.1") (set-advertised-calling-convention 'redirect-frame-focus '(frame focus-frame) "24.3") diff --git a/src/minibuf.c b/src/minibuf.c index 1f94e0e650e..9fd5c236f0b 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1826,7 +1826,7 @@ or from one of the possible completions. */) return Fsubstring (bestmatch, zero, end); } -DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 4, 0, +DEFUN ("all-completions", Fall_completions, Sall_completions, 2, 3, 0, doc: /* Search for partial matches of STRING in COLLECTION. Test each possible completion specified by COLLECTION @@ -1859,12 +1859,8 @@ the string key and the associated value. To be acceptable, a possible completion must also match all the regexps in `completion-regexp-list' (unless COLLECTION is a function, in -which case that function should itself handle `completion-regexp-list'). - -An obsolete optional fourth argument HIDE-SPACES is still accepted for -backward compatibility. If non-nil, strings in COLLECTION that start -with a space are ignored unless STRING itself starts with a space. */) - (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate, Lisp_Object hide_spaces) +which case that function should itself handle `completion-regexp-list'). */) + (Lisp_Object string, Lisp_Object collection, Lisp_Object predicate) { Lisp_Object tail, elt, eltstring; Lisp_Object allmatches; @@ -1932,12 +1928,6 @@ with a space are ignored unless STRING itself starts with a space. */) if (STRINGP (eltstring) && SCHARS (string) <= SCHARS (eltstring) - /* If HIDE_SPACES, reject alternatives that start with space - unless the input starts with space. */ - && (NILP (hide_spaces) - || (SBYTES (string) > 0 - && SREF (string, 0) == ' ') - || SREF (eltstring, 0) != ' ') && (tem = Fcompare_strings (eltstring, zero, make_fixnum (SCHARS (string)), string, zero, @@ -2155,7 +2145,7 @@ If FLAG is nil, invoke `try-completion'; if it is t, invoke return Ftry_completion (string, Vbuffer_alist, predicate); else if (EQ (flag, Qt)) { - Lisp_Object res = Fall_completions (string, Vbuffer_alist, predicate, Qnil); + Lisp_Object res = Fall_completions (string, Vbuffer_alist, predicate); if (SCHARS (string) > 0) return res; else commit 16eb038d472b5765beb3b18e1058846efbdf97af Author: Stefan Kangas Date: Mon Dec 16 22:13:28 2024 +0100 * lisp/dired.el (dired-summary): Use substitute-command-keys. diff --git a/lisp/dired.el b/lisp/dired.el index 028b862d159..9929545eba9 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2846,7 +2846,9 @@ Keybindings: ;; FIXME this should check the key-bindings and use ;; substitute-command-keys if non-standard (message - "d-elete, u-ndelete, x-punge, f-ind, o-ther window, R-ename, C-opy, h-elp")) + (substitute-command-keys + (concat "\\`d'-elete, \\`u'-ndelete, \\`x'-punge, \\`f'-ind, " + "\\`o'-ther window, \\`R'-ename, \\`C'-opy, \\`h'-elp")))) (defun dired-undo () "Undo in a Dired buffer. commit 0d3cffe60c1e79cf2dfd2bb1a683a7f60ea6b779 Author: Stefan Kangas Date: Mon Dec 16 22:06:35 2024 +0100 ; Fix indentation problem diff --git a/src/lread.c b/src/lread.c index c25ffb3c4fe..56e5522d270 100644 --- a/src/lread.c +++ b/src/lread.c @@ -962,7 +962,7 @@ floating-point value. If `inhibit-interaction' is non-nil, this function will signal an `inhibited-interaction' error. */) -(Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) + (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) { Lisp_Object val; commit 7c94898fa53d3605ba643df25206386de70ade61 Author: Stefan Kangas Date: Mon Dec 16 22:01:07 2024 +0100 Ignore some more Python tooling directories when grepping * lisp/progmodes/python.el (python-base-mode): Add Pytest and Rope cache directories to 'grep-find-ignored-directories'. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2f8d506fc60..dca0936c826 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7143,7 +7143,8 @@ implementations: `python-mode' and `python-ts-mode'." (defvar grep-files-aliases) (defvar grep-find-ignored-directories) (cl-pushnew '("py" . "*.py") grep-files-aliases :test #'equal) - (dolist (dir '(".tox" ".venv" ".mypy_cache" ".ruff_cache")) + (dolist (dir '(".mypy_cache" ".pytest_cache" ".ropeproject" + ".ruff_cache" ".tox" ".venv")) (cl-pushnew dir grep-find-ignored-directories)))) (setq-local prettify-symbols-alist python-prettify-symbols-alist) commit a07c89cf9b93ac78d55b528134c09c376afc58da Author: Stefan Kangas Date: Mon Dec 16 21:58:56 2024 +0100 Make VC exclude Repo directories * lisp/vc/vc-hooks.el (vc-directory-exclusion-list): Also ignore ".repo" directory created by Repo. Ref: https://android.googlesource.com/tools/repo diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 8f212e96933..ab0d150ece9 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -118,12 +118,12 @@ An empty list disables VC altogether." :version "25.1" :group 'vc) -;; Note: we don't actually have a darcs back end yet. -;; Also, Arch is unsupported, and the Meta-CVS back end has been removed. +;; Note: we don't actually have a darcs back end yet. Also, Arch and +;; Repo are unsupported, and the Meta-CVS back end has been removed. ;; The Arch back end will be retrieved and fixed if it is ever required. (defcustom vc-directory-exclusion-list (purecopy '("SCCS" "RCS" "CVS" "MCVS" ".src" ".svn" ".git" ".hg" ".bzr" - "_MTN" "_darcs" "{arch}")) + "_MTN" "_darcs" "{arch}" ".repo")) "List of directory names to be ignored when walking directory trees." :type '(repeat string) :group 'vc) commit 02a1e3052b665b8d7d8ea122a6ecb6878c6cece0 Author: Stefan Kangas Date: Mon Dec 16 21:48:45 2024 +0100 Improve heuristic for Python walrus operator * lisp/progmodes/python.el (python-base-mode): Improve heuristic for Python walrus operator in 'electric-layout-mode'. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 493eab5e611..2f8d506fc60 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7073,11 +7073,10 @@ implementations: `python-mode' and `python-ts-mode'." `((?: . ,(lambda () (and (zerop (car (syntax-ppss))) (python-info-statement-starts-block-p) - ;; Heuristic: assume walrus operator := - ;; when colon is preceded by space. + ;; Heuristic for walrus operator := (save-excursion (goto-char (- (point) 2)) - (looking-at (rx (not space) ":"))) + (looking-at (rx (not space) ":" eol))) 'after))))) ;; Add """ ... """ pairing to electric-pair-mode. commit 5c1889c964c99fa3cb0cd91b7703d59bd9fcb495 Author: Stefan Kangas Date: Mon Dec 16 21:46:12 2024 +0100 Use substitute-command-keys in map-y-or-n-p * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Use substitute-command-keys. diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index 7b135c54a15..8ba88972a89 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -135,8 +135,10 @@ The function's value is the number of actions taken." mouse-event last-nonmenu-event)) (setq user-keys (if action-alist (concat (mapconcat (lambda (elt) - (key-description - (vector (car elt)))) + (substitute-command-keys + (format "\\`%s'" + (key-description + (vector (car elt)))))) action-alist ", ") " ") "") @@ -165,10 +167,13 @@ The function's value is the number of actions taken." 'quit)) ;; Prompt in the echo area. (let ((cursor-in-echo-area (not no-cursor-in-echo-area))) - (message (apply 'propertize "%s(y, n, !, ., q, %sor %s) " - minibuffer-prompt-properties) - prompt user-keys - (key-description (vector help-char))) + (message (substitute-command-keys + (format + (apply #'propertize + "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') " + minibuffer-prompt-properties) + prompt user-keys + (key-description (vector help-char))))) (if minibuffer-auto-raise (raise-frame (window-frame (minibuffer-window)))) (unwind-protect @@ -184,12 +189,14 @@ The function's value is the number of actions taken." (when (fboundp 'set-text-conversion-style) (set-text-conversion-style text-conversion-style))) ;; Show the answer to the question. - (message "%s(y, n, !, ., q, %sor %s) %s" - prompt user-keys - (key-description (vector help-char)) - (if (equal char -1) - "[end-of-keyboard-macro]" - (single-key-description char)))) + (message (substitute-command-keys + (format + "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') %s" + prompt user-keys + (key-description (vector help-char)) + (if (equal char -1) + "[end-of-keyboard-macro]" + (single-key-description char)))))) (setq def (lookup-key map (vector char)))) (cond ((eq def 'exit) (setq next (lambda () nil))) @@ -264,8 +271,10 @@ Type \\`SPC' or \\`y' to %s the current %s; (funcall try-again)) (t ;; Random char. - (message "Type %s for help." - (key-description (vector help-char))) + (message (substitute-command-keys + (format + "Type \\`%s' for help" + (key-description (vector help-char))))) (beep) (sit-for 1) (funcall try-again)))) commit 826b11ddc6c69a06fbed09519b78896085647af0 Author: Stefan Kangas Date: Mon Dec 16 21:43:29 2024 +0100 Bind inhibit-read-only to t in substitute-command-keys * lisp/help.el (substitute-command-keys): Bind inhibit-read-only to t, to allow modifying strings that are intended for the minibuffer, and therefore already use minibuffer-prompt-properties. diff --git a/lisp/help.el b/lisp/help.el index ef0b7ffc01d..9f692e1d042 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1397,6 +1397,7 @@ Otherwise, return a new string." ;; itself. (let ((keymap overriding-local-map) (inhibit-modification-hooks t) + (inhibit-read-only t) (orig-buf (current-buffer))) (with-temp-buffer (insert string) commit 78b50603a25d8eb366deab92ce1f475aef497a64 Author: Juri Linkov Date: Mon Dec 16 21:12:52 2024 +0200 ; * etc/NEWS: Add 'completion-table-with-metadata' to "Lisp Changes". diff --git a/etc/NEWS b/etc/NEWS index bdcee0ed272..49a6fcf3fc8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1014,6 +1014,9 @@ continue the already activated repeating sequence. Also 'defvar-keymap' supports a new keyword ':continue-only' with a list of commands that only continue the active repeating sequence. +** New function 'completion-table-with-metadata'. +It offers a more concise way to create a completion table with metadata. + * Changes in Emacs 31.1 on Non-Free Operating Systems commit 3aceae113bc88e52bf1c791f9dadad749a66ab53 Author: Daniel Mendler Date: Mon Dec 9 22:28:08 2024 +0100 Use `completion-table-with-metadata' (bug#74865) Prefer `completion-table-with-metadata' over explicit completion table lambdas for clarity. Furthermore prefer it over `completion-extra-properties' to avoid problems with recursive minibuffers and recursive completion sessions, since the completion metadata applies only to the outer completion session. * lisp/bookmark.el (bookmark-completing-read): * lisp/faces.el (read-face-name): * lisp/international/emoji.el (emoji--read-emoji): * lisp/net/dictionary.el (dictionary-completing-read-dictionary): * lisp/net/rcirc.el (rcirc-completion-at-point): * lisp/net/eww.el (eww-read-alternate-url): * lisp/simple.el (read-from-kill-ring): Use it. * lisp/calendar/calendar.el (calendar-read-date): Use `completion-table-with-metadata' and `completion-table-case-fold'. * lisp/proced.el (proced--read-signal): New function. (proced-send-signal): Use it. diff --git a/lisp/bookmark.el b/lisp/bookmark.el index d43f9f740ca..e87b43b3c78 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -587,11 +587,8 @@ If DEFAULT is nil then return empty string for empty input." (let* ((completion-ignore-case bookmark-completion-ignore-case) (default (unless (equal "" default) default))) (completing-read (format-prompt prompt default) - (lambda (string pred action) - (if (eq action 'metadata) - '(metadata (category . bookmark)) - (complete-with-action - action bookmark-alist string pred))) + (completion-table-with-metadata + bookmark-alist '((category . bookmark))) nil 0 nil 'bookmark-history default)))) diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 7c883617aca..60d8fdd6aee 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -2335,14 +2335,14 @@ returned is (month year)." defyear)) (month-array calendar-month-name-array) (defmon (aref month-array (1- (calendar-extract-month default-date)))) - (completion-ignore-case t) (month (cdr (assoc-string - (let ((completion-extra-properties - '(:category calendar-month))) - (completing-read - (format-prompt "Month name" defmon) - (append month-array nil) - nil t nil nil defmon)) + (completing-read + (format-prompt "Month name" defmon) + (completion-table-with-metadata + (completion-table-case-fold + (append month-array nil)) + `((category . calendar-month))) + nil t nil nil defmon) (calendar-make-alist month-array 1) t))) (defday (calendar-extract-day default-date)) (last (calendar-last-day-of-month month year))) diff --git a/lisp/faces.el b/lisp/faces.el index f8ec0f1a187..05df685c679 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1147,17 +1147,6 @@ returned. Otherwise, DEFAULT is returned verbatim." (let ((prompt (if default (format-prompt prompt default) (format "%s: " prompt))) - (completion-extra-properties - `(:affixation-function - ,(lambda (faces) - (mapcar - (lambda (face) - (list face - (concat (propertize read-face-name-sample-text - 'face face) - "\t") - "")) - faces)))) aliasfaces nonaliasfaces faces) ;; Build up the completion tables. (mapatoms (lambda (s) @@ -1180,7 +1169,18 @@ returned. Otherwise, DEFAULT is returned verbatim." (nreverse faces)) (let ((face (completing-read prompt - (completion-table-in-turn nonaliasfaces aliasfaces) + (completion-table-with-metadata + (completion-table-in-turn nonaliasfaces aliasfaces) + `((affixation-function + . ,(lambda (faces) + (mapcar + (lambda (face) + (list face + (concat (propertize read-face-name-sample-text + 'face face) + "\t") + "")) + faces))))) nil t nil 'face-name-history defaults))) (when (facep face) (if (stringp face) (intern face) diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el index 7ede6ac8058..337a2914084 100644 --- a/lisp/international/emoji.el +++ b/lisp/international/emoji.el @@ -663,25 +663,22 @@ We prefer the earliest unique letter." (name (completing-read "Insert emoji: " - (lambda (string pred action) - (if (eq action 'metadata) - (list 'metadata - (cons - 'affixation-function - ;; Add the glyphs to the start of the displayed - ;; strings when TAB-ing. - (lambda (strings) - (mapcar - (lambda (name) - (if emoji-alternate-names - (list name "" "") - (list name - (concat - (or (gethash name emoji--all-bases) " ") - "\t") - ""))) - strings)))) - (complete-with-action action table string pred))) + (completion-table-with-metadata + table + `((affixation-function + ;; Add the glyphs to the start of the displayed + ;; strings when TAB-ing. + . ,(lambda (strings) + (mapcar + (lambda (name) + (if emoji-alternate-names + (list name "" "") + (list name + (concat + (or (gethash name emoji--all-bases) " ") + "\t") + ""))) + strings))))) nil t))) (if (cl-plusp (length name)) (let ((glyph (if emoji-alternate-names diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 42fb8c57b40..8c7d87f56a5 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1609,15 +1609,17 @@ which usually includes the languages it supports." (defun dictionary-completing-read-dictionary () "Prompt for a dictionary the server supports." (let* ((dicts (dictionary-dictionaries)) - (len (apply #'max (mapcar #'length (mapcar #'car dicts)))) - (completion-extra-properties - (list :annotation-function - (lambda (key) - (concat (make-string (1+ (- len (length key))) ?\s) - (alist-get key dicts nil nil #'string=)))))) - (completing-read (format-prompt "Select dictionary" - dictionary-default-dictionary) - dicts nil t nil nil dictionary-default-dictionary))) + (len (apply #'max (mapcar #'length (mapcar #'car dicts))))) + (completing-read + (format-prompt "Select dictionary" + dictionary-default-dictionary) + (completion-table-with-metadata + dicts + `((annotation-function + . ,(lambda (key) + (concat (make-string (1+ (- len (length key))) ?\s) + (alist-get key dicts nil nil #'string=)))))) + nil t nil nil dictionary-default-dictionary))) (define-button-type 'help-word :supertype 'help-xref diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 4609755a902..9b4bbca2e3e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -2926,31 +2926,34 @@ with completion. If there are none, return nil." (mapcar #'caddr alternates)))) (sep-width (string-pixel-width " "))) (if (cdr alternates) - (let ((completion-extra-properties - (list :annotation-function - (lambda (feed) - (let* ((attrs (alist-get feed - alternates - nil - nil - #'string=)) - (type (car attrs)) - (title (cadr attrs))) + (completing-read + "Alternate URL: " + (completion-table-with-metadata + alternates + `((annotation-function + . ,(lambda (feed) + (let* ((attrs (alist-get feed + alternates + nil + nil + #'string=)) + (type (car attrs)) + (title (cadr attrs))) + (concat + (propertize " " 'display + `(space :align-to + (,(+ sep-width + url-max-width)))) + title + (when type (concat (propertize " " 'display `(space :align-to - (,(+ sep-width - url-max-width)))) - title - (when type - (concat - (propertize " " 'display - `(space :align-to - (,(+ (* 2 sep-width) - url-max-width - title-max-width)))) - "[" type "]")))))))) - (completing-read "Alternate URL: " alternates nil t)) + (,(+ (* 2 sep-width) + url-max-width + title-max-width)))) + "[" type "]")))))))) + nil t) (caar alternates))))) (defun eww-copy-alternate-url () diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 33e4008fc0b..87ebdac6211 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1323,10 +1323,8 @@ The list is updated automatically by `defun-rcirc-command'.") (rcirc-channel-nicks (rcirc-buffer-process) rcirc-target)))))) (list beg (point) - (lambda (str pred action) - (if (eq action 'metadata) - '(metadata (cycle-sort-function . identity)) - (complete-with-action action table str pred))))))) + (completion-table-with-metadata + table '((cycle-sort-function . identity))))))) (defun rcirc-set-decode-coding-system (coding-system) "Set the decode CODING-SYSTEM used in this channel." diff --git a/lisp/proced.el b/lisp/proced.el index da9212f6802..21d1d7c9da4 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -2110,6 +2110,20 @@ The value returned is the value of the last form in BODY." (window-height . fit-window-to-buffer))) ,@body)))) +(defun proced--read-signal (count) + "Read a SIGNAL via `completing-read' for COUNT processes." + (completing-read + (format-prompt "Send signal [%s]" + "TERM" + (if (= 1 count) + "1 process" + (format "%d processes" count))) + (completion-table-with-metadata + (completion-table-case-fold proced-signal-list) + `((annotation-function + . ,(lambda (s) (cdr (assoc s proced-signal-list)))))) + nil nil nil nil "TERM")) + (defun proced-send-signal (&optional signal process-alist) "Send a SIGNAL to processes in PROCESS-ALIST. PROCESS-ALIST is an alist as returned by `proced-marked-processes'. @@ -2124,20 +2138,10 @@ Then PROCESS-ALIST contains the marked processes or the process point is on and SIGNAL is queried interactively. This noninteractive usage is still supported but discouraged. It will be removed in a future version of Emacs." (interactive - (let* ((process-alist (proced-marked-processes)) - (pnum (if (= 1 (length process-alist)) - "1 process" - (format "%d processes" (length process-alist)))) - (completion-ignore-case t) - (completion-extra-properties - `(:annotation-function - ,(lambda (s) (cdr (assoc s proced-signal-list)))))) - (proced-with-processes-buffer process-alist - (list (completing-read (format-prompt "Send signal [%s]" - "TERM" pnum) - proced-signal-list - nil nil nil nil "TERM") - process-alist))) + (let ((process-alist (proced-marked-processes))) + (proced-with-processes-buffer + process-alist + (list (proced--read-signal (length process-alist)) process-alist))) proced-mode) (unless (and signal process-alist) @@ -2151,18 +2155,9 @@ supported but discouraged. It will be removed in a future version of Emacs." (sit-for 2)) (setq process-alist (proced-marked-processes)) (unless signal - (let ((pnum (if (= 1 (length process-alist)) - "1 process" - (format "%d processes" (length process-alist)))) - (completion-ignore-case t) - (completion-extra-properties - `(:annotation-function - ,(lambda (s) (cdr (assoc s proced-signal-list)))))) - (proced-with-processes-buffer process-alist - (setq signal (completing-read (format-prompt "Send signal [%s]" - "TERM" pnum) - proced-signal-list - nil nil nil nil "TERM")))))) + (proced-with-processes-buffer + process-alist + (setq signal (proced--read-signal (length process-alist)))))) (let (failures) ;; Why not always use `signal-process'? See diff --git a/lisp/simple.el b/lisp/simple.el index f2ee4a5df67..e3e6ab6b564 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6511,11 +6511,9 @@ PROMPT is a string to prompt with." map))) (completing-read prompt - (lambda (string pred action) - (if (eq action 'metadata) - ;; Keep sorted by recency - '(metadata (display-sort-function . identity)) - (complete-with-action action completions string pred))) + ;; Keep sorted by recency + (completion-table-with-metadata + completions '((display-sort-function . identity))) nil nil nil (if history-pos (cons 'read-from-kill-ring-history commit d2986e79b76d442f8620195a54120d8be3e4583c Author: Juri Linkov Date: Mon Dec 16 20:12:25 2024 +0200 * lisp/comint.el (comint-complete-input-ring): New command (bug#74694). (comint-mode-map): Bind 'comint-complete-input-ring' to 'C-x '. diff --git a/etc/NEWS b/etc/NEWS index 48546a2d916..bdcee0ed272 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -337,6 +337,12 @@ It removes all the buttons in the specified region. +++ *** Disabling 'button-mode' now removes all buttons in the current buffer. +** Shell + +*** New command to complete the shell history. +'comint-complete-input-ring' ('C-x ') is like 'minibuffer-complete-history' +but completes on comint inputs. + ** Eshell --- diff --git a/lisp/comint.el b/lisp/comint.el index d966625550c..33f095ff6b1 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -543,6 +543,7 @@ via PTYs.") (define-key map "\er" 'comint-history-isearch-backward-regexp) (define-key map [?\C-c ?\M-r] 'comint-previous-matching-input-from-input) (define-key map [?\C-c ?\M-s] 'comint-next-matching-input-from-input) + (define-key map [?\C-x up] 'comint-complete-input-ring) (define-key map "\e\C-l" 'comint-show-output) (define-key map "\C-m" 'comint-send-input) (define-key map "\C-d" 'comint-delchar-or-maybe-eof) @@ -1180,6 +1181,24 @@ See also `comint-read-input-ring'." (set-window-configuration conf) (push ch unread-command-events)))))) +(defun comint-complete-input-ring () + "Complete a list of recent inputs entered into the current buffer. +Like `minibuffer-complete-history' but completes on comint inputs. +This function makes `comint-dynamic-list-input-ring' obsolete." + (interactive) + (let ((completions + (if (and (ring-p comint-input-ring) + (not (ring-empty-p comint-input-ring))) + (ring-elements comint-input-ring) + (user-error "No history available"))) + (completion-in-region-mode-predicate + (lambda () (get-buffer-window "*Completions*" 0)))) + (completion-in-region + (comint-line-beginning-position) (point-max) + (completion-table-with-metadata + completions '((category . comint-input) + (display-sort-function . identity) + (cycle-sort-function . identity)))))) (defun comint-regexp-arg (prompt) "Return list of regexp and prefix arg using PROMPT." commit 61f1d7fc682c28b3e67a9d8f529ff7046dfdbff1 Author: Ship Mints Date: Mon Dec 16 17:58:10 2024 +0100 Support pixelwise frame cloning (Bug#74750) * lisp/frame.el (clone-frame): Honor 'frame-resize-pixelwise' when cloning a frame's geometry via the 'text-pixels' feature of 'make-frame' (Bug#74750). Correctly specify source frame in 'display-graphic-p' test for tty selection behavior. diff --git a/lisp/frame.el b/lisp/frame.el index 1b5aa8cff08..02f3f9f9dae 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -863,6 +863,9 @@ When called from Lisp, returns the new frame." (defun clone-frame (&optional frame no-windows) "Make a new frame with the same parameters and windows as FRAME. With a prefix arg NO-WINDOWS, don't clone the window configuration. +When the user option `frame-resize-pixelwise' is non-nil, and FRAME is +not text-only, clone the originating frame's pixel size. Otherwise, use +the number of FRAME's columns and lines for the clone. FRAME defaults to the selected frame. The frame is created on the same terminal as FRAME. If the terminal is a text-only terminal then @@ -875,10 +878,17 @@ also select the new frame." (seq-remove (lambda (elem) (memq (car elem) frame-internal-parameters)) (frame-parameters frame))) - (new-frame (make-frame))) + new-frame) + (when (and frame-resize-pixelwise + (display-graphic-p frame)) + (push (cons 'width (cons 'text-pixels (frame-text-width frame))) + default-frame-alist) + (push (cons 'height (cons 'text-pixels (frame-text-height frame))) + default-frame-alist)) + (setq new-frame (make-frame)) (when windows (window-state-put windows (frame-root-window new-frame) 'safe)) - (unless (display-graphic-p) + (unless (display-graphic-p frame) (select-frame new-frame)) new-frame)) commit d5b23b219dc620bc23437158a769138e3b972ba6 Author: john muhl Date: Sun Dec 15 17:15:35 2024 -0600 Add Qutebrowser to list of choices in customize * lisp/net/browse-url.el (browse-url--browser-defcustom-type): Include 'browse-url-qutebrowser' so that it appears in the Choice menus of 'browse-url-browser-function' and 'browse-url-secondary-browser-function'. (Bug#74904) diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 10165465921..8d9046f77b0 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -167,6 +167,7 @@ :value browse-url-text-emacs) (function-item :tag "KDE" :value browse-url-kde) (function-item :tag "Elinks" :value browse-url-elinks) + (function-item :tag "Qutebrowser" :value browse-url-qutebrowser) (function-item :tag "Specified by `Browse Url Generic Program'" :value browse-url-generic) ,@(when (eq system-type 'windows-nt) commit b5ba5cbacf2b8122d720f89dd93d36a5c0fd39ec Author: Martin Rudalics Date: Mon Dec 16 16:36:59 2024 +0100 Don't inhibit resizing when making a new frame (Bug#74750) * src/frame.h (struct frame): Remove inhibit_horizontal_resize and inhibit_vertical_resize slots. * src/frame.c (frame_inhibit_resize, make_frame) (Fframe_after_make_frame, gui_figure_window_size): Remove all operations on frame's inhibit_horizontal_resize and inhibit_vertical_resize slots (Bug#74750). diff --git a/src/frame.c b/src/frame.c index f6053fca3ef..f22bd501a8d 100644 --- a/src/frame.c +++ b/src/frame.c @@ -158,20 +158,16 @@ bool frame_inhibit_resize (struct frame *f, bool horizontal, Lisp_Object parameter) { Lisp_Object fullscreen = get_frame_param (f, Qfullscreen); - bool inhibit - = (f->after_make_frame - ? (EQ (frame_inhibit_implied_resize, Qt) - || (CONSP (frame_inhibit_implied_resize) - && !NILP (Fmemq (parameter, frame_inhibit_implied_resize))) - || (horizontal - && !NILP (fullscreen) && !EQ (fullscreen, Qfullheight)) - || (!horizontal - && !NILP (fullscreen) && !EQ (fullscreen, Qfullwidth)) - || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) - : ((horizontal && f->inhibit_horizontal_resize) - || (!horizontal && f->inhibit_vertical_resize))); - return inhibit; + return (f->after_make_frame + && (EQ (frame_inhibit_implied_resize, Qt) + || (CONSP (frame_inhibit_implied_resize) + && !NILP (Fmemq (parameter, frame_inhibit_implied_resize))) + || (horizontal + && !NILP (fullscreen) && !EQ (fullscreen, Qfullheight)) + || (!horizontal + && !NILP (fullscreen) && !EQ (fullscreen, Qfullwidth)) + || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))); } @@ -957,8 +953,6 @@ make_frame (bool mini_p) f->garbaged = true; f->can_set_window_size = false; f->after_make_frame = false; - f->inhibit_horizontal_resize = false; - f->inhibit_vertical_resize = false; f->tab_bar_redisplayed = false; f->tab_bar_resized = false; f->tool_bar_redisplayed = false; @@ -3128,8 +3122,6 @@ otherwise used with utter care to avoid that running functions on { struct frame *f = decode_live_frame (frame); f->after_make_frame = !NILP (made); - f->inhibit_horizontal_resize = false; - f->inhibit_vertical_resize = false; return made; } @@ -5918,7 +5910,6 @@ gui_figure_window_size (struct frame *f, Lisp_Object parms, bool tabbar_p, xsignal1 (Qargs_out_of_range, XCDR (width)); text_width = XFIXNUM (XCDR (width)); - f->inhibit_horizontal_resize = true; } else if (FLOATP (width)) { @@ -5954,7 +5945,6 @@ gui_figure_window_size (struct frame *f, Lisp_Object parms, bool tabbar_p, xsignal1 (Qargs_out_of_range, XCDR (height)); text_height = XFIXNUM (XCDR (height)); - f->inhibit_vertical_resize = true; } else if (FLOATP (height)) { diff --git a/src/frame.h b/src/frame.h index 1d920d1a6bc..172eb5eca99 100644 --- a/src/frame.h +++ b/src/frame.h @@ -519,10 +519,6 @@ struct frame bool_bf tool_bar_redisplayed : 1; bool_bf tool_bar_resized : 1; - /* Inhibit implied resize before after_make_frame is set. */ - bool_bf inhibit_horizontal_resize : 1; - bool_bf inhibit_vertical_resize : 1; - /* Non-zero if this frame's faces need to be recomputed. */ bool_bf face_change : 1;