commit d50e3226b1a6234830e7946518f31c99669915cb (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Sat May 25 09:12:42 2024 +0300 Fix encoding of text when saving a gpg-encoded file * lisp/epa-file.el (epa-file-write-region): Revert inadvertent change from July 15, 2020 which broke selection of a correct encoding for stuff sent to 'gpg'. (Bug#71080) diff --git a/lisp/epa-file.el b/lisp/epa-file.el index a4942e78de7..90cc91e99a0 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -267,7 +267,14 @@ encryption is used." (setq file (expand-file-name file)) (let* ((coding-system (or coding-system-for-write (if (fboundp 'select-safe-coding-system) - (let ((buffer-file-name file)) + ;; This is needed because + ;; `auto-coding-alist' has + ;; `no-conversion' for *.gpg files, + ;; which would otherwise force + ;; `select-safe-coding-system' return + ;; `no-conversion'. + (let ((buffer-file-name + (file-name-sans-extension file))) (select-safe-coding-system (point-min) (point-max))) buffer-file-coding-system))) commit 984fb346fdf0d5ec9eaea6126aad0bea8823b8a3 Author: Robin Joy Date: Fri May 24 14:26:39 2024 +0200 Erase existing duplicates in eshell-history-ring Erase all existing duplicates instead of just the last duplicate entry when 'eshell-hist-ignoredups' is set to 'erase'. Multiple duplicates can exist in case 'eshell-hist-ignoredups' was set to something else than 'erase' in the past or if the history file contains duplicates (bug#71107). * lisp/eshell/em-hist.el (eshell-add-input-to-history): Remove all duplicates from history ring. * test/lisp/eshell/em-hist-tests.el (em-hist-test/add-to-history/erase-existing-dups): New test. diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 21029eae1bc..b171a2850ff 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -398,11 +398,9 @@ input." (pcase eshell-hist-ignoredups ('nil t) ; Always add to history ('erase ; Add, removing any old occurrences - (when-let ((old-index (ring-member eshell-history-ring input))) - ;; Remove the old occurrence of this input so we can - ;; add it to the end. FIXME: Should we try to - ;; remove multiple old occurrences, e.g. if the user - ;; recently changed to using `erase'? + (while-let ((old-index (ring-member eshell-history-ring input))) + ;; Remove the old occurrences of this input so we can + ;; add it to the end. (ring-remove eshell-history-ring old-index)) t) (_ ; Add if not already the latest entry diff --git a/test/lisp/eshell/em-hist-tests.el b/test/lisp/eshell/em-hist-tests.el index a4e1e01b124..40e6f90478d 100644 --- a/test/lisp/eshell/em-hist-tests.el +++ b/test/lisp/eshell/em-hist-tests.el @@ -163,6 +163,23 @@ elements against that; if t (the default), check against EXPECTED." (should (equal (ring-elements eshell-history-ring) '("echo hi" "echo bye")))))) +(ert-deftest em-hist-test/add-to-history/erase-existing-dups () + "Test adding to history, erasing any old dups after switching to 'erase." + (let ((eshell-hist-ignoredups nil)) + (with-temp-eshell + (eshell-insert-command "echo hi") + (eshell-insert-command "echo bye") + (eshell-insert-command "echo bye") + (eshell-insert-command "echo hi") + (eshell-insert-command "echo bye") + (setq eshell-hist-ignoredups 'erase) + (eshell-insert-command "echo hi") + (should (equal (ring-elements eshell-history-ring) + '("echo hi" "echo bye" "echo bye" "echo bye"))) + (eshell-insert-command "echo bye") + (should (equal (ring-elements eshell-history-ring) + '("echo bye" "echo hi")))))) + (provide 'em-hist-test) ;;; em-hist-tests.el ends here commit f3dd0d981cbb9c0fa10a3c5b05b244ed7a0f4e6b Author: Tassilo Horn Date: Fri May 24 23:04:33 2024 +0200 ; Fix previous fix for bug#70796 diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 569de5a2b91..4a691e5bf67 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -196,10 +196,10 @@ subexpression 10." (funcall bug-reference-url-format))))))) ;; Delete remaining but unused overlays. (dolist (ov overlays) - (delete-overlay ov))) - ;; Signal the bounds we actually fontified to jit-lock to allow for - ;; optimizations (bug#70796). - `(jit-lock-bounds ,beg-line . ,end-line))) + (delete-overlay ov)) + ;; Signal the bounds we actually fontified to jit-lock to allow for + ;; optimizations (bug#70796). + `(jit-lock-bounds ,beg-line . ,end-line)))) ;; Taken from button.el. (defun bug-reference-push-button (&optional pos _use-mouse-action) commit c812c935486010bfe2f80c3887c708fbaa4907a6 Author: Spencer Baugh Date: Wed May 22 08:28:07 2024 -0400 Fix usage of cons cells in grep-find-ignored-files grep-find-ignored-files is documented to also include cons cells, not just globs, but there were two places outside grep.el where we were using it as if it was only a string list. To fix this, add a helper function named grep-find-ignored-files which handles grep-find-ignored-files properly and returns the list of globs, and use it everywhere. * lisp/progmodes/grep.el (grep--filter-list-by-dir) (grep-find-ignored-files): New functions. (rgrep-find-ignored-directories): Use grep--filter-list-by-dir. (lgrep, rgrep-default-command): Use grep-find-ignored-files function. * lisp/dired-aux.el (dired-do-find-regexp): Use grep-find-ignored-files function. * lisp/progmodes/project.el (project-ignores): Use grep-find-ignored-files function, if bound. (bug#71115) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index bb911513321..ddacd2600d0 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -3851,13 +3851,13 @@ REGEXP should use constructs supported by your local `grep' command." (interactive "sSearch marked files (regexp): " dired-mode) (require 'grep) (require 'xref) - (defvar grep-find-ignored-files) (declare-function rgrep-find-ignored-directories "grep" (dir)) + (declare-function grep-find-ignored-files "grep" (dir)) (let* ((marks (dired-get-marked-files nil nil nil nil t)) (ignores (nconc (mapcar #'file-name-as-directory (rgrep-find-ignored-directories default-directory)) - grep-find-ignored-files)) + (grep-find-ignored-files default-directory))) (fetcher (lambda () (let (files xrefs) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 657349cbdff..0a9de04fce1 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1176,6 +1176,19 @@ REGEXP is used as a string in the prompt." (defvar grep-use-directories-skip 'auto-detect) +(defun grep--filter-list-by-dir (list dir) + "Include elements of LIST which are applicable to DIR." + (delq nil (mapcar + (lambda (ignore) + (cond ((stringp ignore) ignore) + ((consp ignore) + (and (funcall (car ignore) dir) (cdr ignore))))) + list))) + +(defun grep-find-ignored-files (dir) + "Return the list of ignored files applicable to DIR." + (grep--filter-list-by-dir grep-find-ignored-files dir)) + ;;;###autoload (defun lgrep (regexp &optional files dir confirm) "Run grep, searching for REGEXP in FILES in directory DIR. @@ -1236,20 +1249,13 @@ command before it's run." regexp files nil - (and grep-find-ignored-files - (concat " --exclude=" - (mapconcat - (lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument - ignore grep-quoting-style)) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (cdr ignore) - grep-quoting-style))))) - grep-find-ignored-files - " --exclude="))) + (when-let ((ignores (grep-find-ignored-files dir))) + (concat " --exclude=" + (mapconcat + (lambda (ignore) + (shell-quote-argument ignore grep-quoting-style)) + ignores + " --exclude="))) (and (eq grep-use-directories-skip t) '("--directories=skip")))) (when command @@ -1353,13 +1359,8 @@ to indicate whether the grep should be case sensitive or not." (setq default-directory dir))))))) (defun rgrep-find-ignored-directories (dir) - "Return the list of ignored directories applicable to `dir'." - (delq nil (mapcar - (lambda (ignore) - (cond ((stringp ignore) ignore) - ((consp ignore) - (and (funcall (car ignore) dir) (cdr ignore))))) - grep-find-ignored-directories))) + "Return the list of ignored directories applicable to DIR." + (grep--filter-list-by-dir grep-find-ignored-directories dir)) (defun rgrep-default-command (regexp files dir) "Compute the command for \\[rgrep] to use by default." @@ -1377,37 +1378,31 @@ to indicate whether the grep should be case sensitive or not." (shell-quote-argument ")" grep-quoting-style)) dir (concat - (and grep-find-ignored-directories - (concat "-type d " - (shell-quote-argument "(" grep-quoting-style) - ;; we should use shell-quote-argument here - " -path " - (mapconcat - (lambda (d) - (shell-quote-argument (concat "*/" d) grep-quoting-style)) - (rgrep-find-ignored-directories dir) - " -o -path ") - " " - (shell-quote-argument ")" grep-quoting-style) - " -prune -o ")) - (and grep-find-ignored-files - (concat (shell-quote-argument "!" grep-quoting-style) " -type d " - (shell-quote-argument "(" grep-quoting-style) - ;; we should use shell-quote-argument here - " -name " - (mapconcat - (lambda (ignore) - (cond ((stringp ignore) - (shell-quote-argument ignore grep-quoting-style)) - ((consp ignore) - (and (funcall (car ignore) dir) - (shell-quote-argument - (cdr ignore) grep-quoting-style))))) - grep-find-ignored-files - " -o -name ") - " " - (shell-quote-argument ")" grep-quoting-style) - " -prune -o "))))) + (when-let ((ignored-dirs (rgrep-find-ignored-directories dir))) + (concat "-type d " + (shell-quote-argument "(" grep-quoting-style) + ;; we should use shell-quote-argument here + " -path " + (mapconcat + (lambda (d) + (shell-quote-argument (concat "*/" d) grep-quoting-style)) + ignored-dirs + " -o -path ") + " " + (shell-quote-argument ")" grep-quoting-style) + " -prune -o ")) + (when-let ((ignored-files (grep-find-ignored-files dir))) + (concat (shell-quote-argument "!" grep-quoting-style) " -type d " + (shell-quote-argument "(" grep-quoting-style) + ;; we should use shell-quote-argument here + " -name " + (mapconcat + (lambda (ignore) (shell-quote-argument ignore grep-quoting-style)) + ignored-files + " -o -name ") + " " + (shell-quote-argument ")" grep-quoting-style) + " -prune -o "))))) (defun grep-find-toggle-abbreviation () "Toggle showing the hidden part of rgrep/lgrep/zrgrep command line." diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index a95d1267dd2..c57c16073b9 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -295,7 +295,7 @@ headers search path, load path, class path, and so on." Nominally unique, but not enforced." (file-name-nondirectory (directory-file-name (project-root project)))) -(cl-defgeneric project-ignores (_project _dir) +(cl-defgeneric project-ignores (_project dir) "Return the list of glob patterns to ignore inside DIR. Patterns can match both regular files and directories. To root an entry, start it with `./'. To match directories only, @@ -305,12 +305,15 @@ end it with `/'. DIR must be either `project-root' or one of ;; TODO: Support whitelist entries. (require 'grep) (defvar grep-find-ignored-files) + (declare-function grep-find-ignored-files "grep" (dir)) (nconc (mapcar (lambda (dir) (concat dir "/")) vc-directory-exclusion-list) - grep-find-ignored-files)) + (if (fboundp 'grep-find-ignored-files) + (grep-find-ignored-files dir) + grep-find-ignored-files))) (defun project--file-completion-table (all-files) (lambda (string pred action) commit 59d7730a46a4a51a2c7e3c800a1d60f92a2322b6 Author: Tassilo Horn Date: Fri May 24 21:52:34 2024 +0200 bug-reference: signal fontified bounds back to jit-lock (bug#70796) * lisp/progmodes/bug-reference.el (bug-reference-fontify): Signal fontified bounds back to jit-lock in order to allow for redisplay optimizations (bug#70796). diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 46163774e47..569de5a2b91 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -196,7 +196,10 @@ subexpression 10." (funcall bug-reference-url-format))))))) ;; Delete remaining but unused overlays. (dolist (ov overlays) - (delete-overlay ov))))) + (delete-overlay ov))) + ;; Signal the bounds we actually fontified to jit-lock to allow for + ;; optimizations (bug#70796). + `(jit-lock-bounds ,beg-line . ,end-line))) ;; Taken from button.el. (defun bug-reference-push-button (&optional pos _use-mouse-action) commit 9ebe6aa5f1092241a98e0a16db918e3dc1062f1c Author: Juri Linkov Date: Fri May 24 20:55:30 2024 +0300 * lisp/dired.el (dired-mode-map): Bind "E" to 'dired-do-open' (bug#18132). (dired-mode-immediate-menu): Add menu item "Display Externally" for 'dired-do-open'. * lisp/dired-aux.el (dired-do-open): Add autoload cookie. diff --git a/etc/NEWS b/etc/NEWS index 23c87ca5c8b..d058acc3572 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -812,10 +812,10 @@ and a universal command such as "open" or "start" that delegates to the OS. *** New command 'dired-do-open'. -This command is bound to "Open" in the context menu; it "opens" the -marked or clicked on files according to the OS conventions. For -example, on systems supporting XDG, this runs 'xdg-open' on the -files. +This command is bound to 'E' (mnemonics "External"). Also it can be +used by clicking "Open" in the context menu; it "opens" the marked or +clicked on files according to the OS conventions. For example, on +systems supporting XDG, this runs 'xdg-open' on the files. *** New variable 'dired-guess-shell-alist-optional'. It contains commands for external viewers and players for various media diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 83e71b644b8..bb911513321 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1448,6 +1448,7 @@ This excludes `dired-guess-shell-alist-user' and (declare-function w32-shell-execute "w32fns.c") +;;;###autoload (defun dired-do-open (&optional arg) "Open all marked (or next ARG) files using an external program. This \"opens\" the file(s) using the external command that is most diff --git a/lisp/dired.el b/lisp/dired.el index 2b1db9f6e31..f2a75df6ef1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2276,9 +2276,10 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." "~" #'dired-flag-backup-files ;; Upper case keys (except !) for operating on the marked files "A" #'dired-do-find-regexp - "C" #'dired-do-copy "B" #'dired-do-byte-compile + "C" #'dired-do-copy "D" #'dired-do-delete + "E" #'dired-do-open "G" #'dired-do-chgrp "H" #'dired-do-hardlink "I" #'dired-do-info @@ -2483,7 +2484,9 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." ["Display Image" image-dired-dired-display-image :help "Display sized image in a separate window"] ["Display Image Externally" image-dired-dired-display-external - :help "Display image in external viewer"])) + :help "Display image in external viewer"] + ["Display Externally" dired-do-open + :help "Display file in external viewer"])) (easy-menu-define dired-mode-regexp-menu dired-mode-map "Regexp menu for Dired mode." commit 74f15ad72d937b309dafecba872bccd1a880181e Author: Juri Linkov Date: Fri May 24 20:48:42 2024 +0300 New variable shell-command-guess-dired-optional (bug#18132) * doc/emacs/dired.texi (Shell Command Guessing): Add dired-guess-shell-alist-optional. * lisp/dired.el (dired-guess-shell-alist-user): * lisp/dired-aux.el (dired-do-shell-command): Add dired-guess-shell-alist-optional to docstring. (dired-guess-shell-alist-default): Move media commands to 'dired-guess-shell-alist-optional'. (dired-guess-shell-alist-optional): New variable. (dired-guess-default): Add 'dired-guess-shell-alist-optional' to the end after 'dired-guess-shell-alist-user' and 'dired-guess-shell-alist-default'. (shell-command-guess-functions): Add more options. (shell-command-guess-dired): Remove function. (shell-command-guess-dired-user) (shell-command-guess-dired-default) (shell-command-guess-dired-optional): New functions. diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index a3a740f9727..898c0bfaade 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -1167,11 +1167,20 @@ guessing off. The elements of @code{dired-guess-shell-alist-user} (defined by the user) will override these rules. @end defvar +@defvar dired-guess-shell-alist-optional +This variable is like @code{dired-guess-shell-alist-default} but +contains external viewers and players for various media formats. +Setting this to @code{nil} turns guessing off. The variables +@code{dired-guess-shell-alist-user} and +@code{dired-guess-shell-alist-default} will override these rules. +@end defvar + @defvar dired-guess-shell-alist-user If non-@code{nil}, this variable specifies the user-defined alist of file regexps and their suggested commands. These rules take -precedence over the predefined rules in the variable -@code{dired-guess-shell-alist-default} when +precedence over the predefined rules in the variables +@code{dired-guess-shell-alist-default} and +@code{dired-guess-shell-alist-optional} when @code{dired-do-shell-command} is run). The default is @code{nil}. Each element of the alist looks like diff --git a/etc/NEWS b/etc/NEWS index a79a5844a22..23c87ca5c8b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -817,6 +817,10 @@ marked or clicked on files according to the OS conventions. For example, on systems supporting XDG, this runs 'xdg-open' on the files. +*** New variable 'dired-guess-shell-alist-optional'. +It contains commands for external viewers and players for various media +formats, moved to this list from 'dired-guess-shell-alist-default'. + *** The default value of 'dired-omit-size-limit' was increased. After performance improvements to omitting in large directories, the new default value is 300k, up from 100k. This means 'dired-omit-mode' will diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index d1d5ed9b144..83e71b644b8 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -868,8 +868,8 @@ In a noninteractive call (from Lisp code), you must specify the list of file names explicitly with the FILE-LIST argument, which can be produced by `dired-get-marked-files', for example. -`dired-guess-shell-alist-default' and -`dired-guess-shell-alist-user' are consulted when the user is +`dired-guess-shell-alist-default', `dired-guess-shell-alist-optional' +and `dired-guess-shell-alist-user' are consulted when the user is prompted for the shell command to use interactively. Also see the `dired-confirm-shell-command' variable." @@ -1068,8 +1068,8 @@ Return the result of `process-file' - zero for success." ;; * `dired-guess-shell-command' calls `dired-guess-default' with list of ;; marked files. ;; -;; * Parse `dired-guess-shell-alist-user' and -;; `dired-guess-shell-alist-default' (in that order) for the first REGEXP +;; * Parse `dired-guess-shell-alist-user', `dired-guess-shell-alist-default', +;; `dired-guess-shell-alist-optional' (in that order) for the first REGEXP ;; that matches the first file in the file list. ;; ;; * If the REGEXP matches all the entries of the file list then evaluate @@ -1219,28 +1219,10 @@ Return the result of `process-file' - zero for success." " " dired-guess-shell-znew-switches)) '("\\.pod\\'" "perldoc" "pod2man * | nroff -man") - '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing - '("\\.au\\'" "play") ; play Sun audiofiles - '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p") - '("\\.ogg\\'" "ogg123") - '("\\.mp3\\'" "mpg123") - '("\\.wav\\'" "play") '("\\.uu\\'" "uudecode") ; for uudecoded files - '("\\.hqx\\'" "mcvert") '("\\.sh\\'" "sh") ; execute shell scripts - '("\\.xbm\\'" "bitmap") ; view X11 bitmaps - '("\\.gp\\'" "gnuplot") - '("\\.p[bgpn]m\\'" "xloadimage") - '("\\.gif\\'" "xloadimage") ; view gif pictures - '("\\.tif\\'" "xloadimage") - '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG - '("\\.jpe?g\\'" "xloadimage") - '("\\.fig\\'" "xfig") ; edit fig pictures - '("\\.out\\'" "xgraph") ; for plotting purposes. '("\\.tex\\'" "latex" "tex") '("\\.texi\\(nfo\\)?\\'" "makeinfo" "texi2dvi") - '("\\.pdf\\'" "xpdf") - '("\\.doc\\'" "antiword" "strings") '("\\.rpm\\'" "rpm -qilp" "rpm -ivh") '("\\.dia\\'" "dia") '("\\.mgp\\'" "mgp") @@ -1269,7 +1251,37 @@ Return the result of `process-file' - zero for success." '("\\.sign?\\'" "gpg --verify")) "Default alist used for shell command guessing. -See `dired-guess-shell-alist-user'.") +See also `dired-guess-shell-alist-optional' and +`dired-guess-shell-alist-user'.") + +(defvar dired-guess-shell-alist-optional + (list + '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing + '("\\.au\\'" "play") ; play Sun audiofiles + '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p") + '("\\.ogg\\'" "ogg123") + '("\\.mp3\\'" "mpg123") + '("\\.wav\\'" "play") + '("\\.hqx\\'" "mcvert") + '("\\.xbm\\'" "bitmap") ; view X11 bitmaps + '("\\.gp\\'" "gnuplot") + '("\\.p[bgpn]m\\'" "xloadimage") + '("\\.gif\\'" "xloadimage") ; view gif pictures + '("\\.tif\\'" "xloadimage") + '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG + '("\\.jpe?g\\'" "xloadimage") + '("\\.fig\\'" "xfig") ; edit fig pictures + '("\\.out\\'" "xgraph") ; for plotting purposes. + '("\\.pdf\\'" "xpdf") + '("\\.doc\\'" "antiword" "strings")) + "Optional alist used for shell command guessing. +Unlike `dired-guess-shell-alist-default' that contains mostly the +standard commands that handle the files with corresponding extensions +such as the `tar' command handling the files with the `.tar' extension, +this list contains the commands such as media players and viewers +that don't exist on many systems where other alternatives are available. + +See also `dired-guess-shell-alist-user'.") (defun dired-guess-default (files) "Return a shell command, or a list of commands, appropriate for FILES. @@ -1289,7 +1301,8 @@ See `dired-guess-shell-alist-user'." (string-match-p (car elem) file)) files)) (append dired-guess-shell-alist-user - dired-guess-shell-alist-default))) + dired-guess-shell-alist-default + dired-guess-shell-alist-optional))) nil))))) (if (length= programs 1) (car programs) @@ -1323,13 +1336,21 @@ See `dired-guess-shell-alist-user'." (if (equal val "") default val)))) (defcustom shell-command-guess-functions - '(shell-command-guess-dired) + '(shell-command-guess-dired-optional + shell-command-guess-mailcap + shell-command-guess-xdg + shell-command-guess-dired-default + shell-command-guess-dired-user) "List of functions that guess shell commands for files. Each function receives a list of commands and a list of file names and should return the same list of commands with changes -such as added new commands." +such as new commands added to the beginning of the list. +In this case the commands from the last entry +will be at the top of the resulted list." :type '(repeat - (choice (function-item shell-command-guess-dired) + (choice (function-item shell-command-guess-dired-user) + (function-item shell-command-guess-dired-default) + (function-item shell-command-guess-dired-optional) (function-item shell-command-guess-mailcap) (function-item shell-command-guess-xdg) (function-item shell-command-guess-open) @@ -1350,9 +1371,29 @@ after adding own commands to the composite list." nil)) commands)) -(defun shell-command-guess-dired (commands files) - "Populate COMMANDS using `dired-guess-default'." - (append (ensure-list (dired-guess-default files)) commands)) +(defun shell-command-guess-dired-user (commands files) + "Populate COMMANDS using `dired-guess-shell-alist-user'. +This excludes `dired-guess-shell-alist-default' and +`dired-guess-shell-alist-optional'." + (let ((dired-guess-shell-alist-default nil) + (dired-guess-shell-alist-optional nil)) + (append (ensure-list (dired-guess-default files)) commands))) + +(defun shell-command-guess-dired-default (commands files) + "Populate COMMANDS using `dired-guess-shell-alist-default'. +This excludes `dired-guess-shell-alist-user' and +`dired-guess-shell-alist-optional'." + (let ((dired-guess-shell-alist-user nil) + (dired-guess-shell-alist-optional nil)) + (append (ensure-list (dired-guess-default files)) commands))) + +(defun shell-command-guess-dired-optional (commands files) + "Populate COMMANDS using `dired-guess-shell-alist-optional'. +This excludes `dired-guess-shell-alist-user' and +`dired-guess-shell-alist-default'." + (let ((dired-guess-shell-alist-user nil) + (dired-guess-shell-alist-default nil)) + (append (ensure-list (dired-guess-default files)) commands))) (declare-function mailcap-file-default-commands "mailcap" (files)) diff --git a/lisp/dired.el b/lisp/dired.el index 21085de97f2..2b1db9f6e31 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -443,8 +443,9 @@ is anywhere on its Dired line, except the beginning of the line." (defcustom dired-guess-shell-alist-user nil "User-defined alist of rules for suggested commands. -These rules take precedence over the predefined rules in the variable -`dired-guess-shell-alist-default' (to which they are prepended). +These rules take precedence over the predefined rules in the variables +`dired-guess-shell-alist-default' and `dired-guess-shell-alist-optional' +\(to which they are prepended). Each element of this list looks like commit 6d856acf17761552c5136833b0614a453364a0c5 Author: Eshel Yaron Date: Sat Apr 27 20:39:19 2024 +0200 ; Refine 'completion-preview-exact' face * lisp/completion-preview.el (completion-preview-exact): Use different underline color to further distinguish this face from 'completion-preview-common', and improve legibility with dark background color. diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 1f9ba2c3d7a..17d9ca938a8 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -129,7 +129,7 @@ If this option is nil, these commands do not display any message." (defface completion-preview-exact ;; An exact match is also the longest common prefix of all matches. - '((t :underline "gray25" :inherit completion-preview-common)) + '((t :underline "#00aa00" :inherit completion-preview-common)) "Face for matches in the completion preview overlay." :version "30.1") commit fda9ecc150934ed438673c963e2c002674acfb60 Author: Eshel Yaron Date: Wed May 1 18:59:45 2024 +0200 ; Exclude a few more modes in 'global-completion-preview-mode' * lisp/completion-preview.el (global-completion-preview-mode): Exclude a few non-edit major modes whose definition sets 'major-mode' directly, rather than using 'define-derived-mode'. diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index e2012b0f80a..1f9ba2c3d7a 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -570,11 +570,15 @@ backward." ;;;###autoload (define-globalized-minor-mode global-completion-preview-mode completion-preview-mode completion-preview-mode - :predicate '((not compilation-mode + :predicate '((not archive-mode + calc-mode + compilation-mode diff-mode dired-mode + image-mode minibuffer-mode minibuffer-inactive-mode + org-agenda-mode special-mode wdired-mode) t))