commit b261dd13478770624217287166255cfc8c620868 (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Fri Dec 1 09:18:28 2023 +0200 * lisp/simple.el (minibuffer-default-add-shell-commands): Require 'dired-aux'. This is necessary for 'shell-command-guess' after removing autoload cookie since declare-function doesn't autoload it. diff --git a/lisp/simple.el b/lisp/simple.el index 0fbab6cfa89..652fc7ba540 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4284,7 +4284,8 @@ minibuffer-default-add-shell-commands (let* ((filename (if (listp minibuffer-default) (car minibuffer-default) minibuffer-default)) - (commands (and filename (shell-command-guess (list filename))))) + (commands (and filename (require 'dired-aux) + (shell-command-guess (list filename))))) (setq commands (mapcar (lambda (command) (concat command " " filename)) commands)) commit 90450a387422f025b7060a3a7977f30ae395bb1d Author: Juri Linkov Date: Thu Nov 30 20:11:36 2023 +0200 * lisp/simple.el: Add declare-function for shell-command-guess. * lisp/dired-aux.el (shell-command-guess): Remove unneeded autoload cookie. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 94ca5ddbcc3..1a17ed749e8 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1334,7 +1334,6 @@ shell-command-guess-functions :group 'dired :version "30.1") -;;;###autoload (defun shell-command-guess (files) "Return a list of shell commands, appropriate for FILES. The list is populated by calling functions from diff --git a/lisp/simple.el b/lisp/simple.el index 35bce6ab4b8..0fbab6cfa89 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4274,6 +4274,7 @@ shell-command-default-error-buffer stdout will be intermixed in the output stream.") (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) +(declare-function shell-command-guess "dired-aux" (files)) (defun minibuffer-default-add-shell-commands () "Return a list of all commands associated with the current file. commit 5519ec4746ffdabfa949ea9d7e562feb2458f35c Author: Juri Linkov Date: Thu Nov 30 19:39:16 2023 +0200 * lisp/dired-aux.el (shell-command-guess-open): New defcustom (bug#18132). (shell-command-guess-open): New function. (shell-command-guess-functions): Add 'shell-command-guess-open' to choice. diff --git a/etc/NEWS b/etc/NEWS index 6661ac70e1b..db8a47fd739 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -505,9 +505,11 @@ default is nil. *** New user option 'shell-command-guess-functions'. It defines how to populate a list of commands available -for 'M-!', 'M-&', '!', '&' based on marked files in Dired. -Possible backends are 'dired-guess-default', MIME types, -XDG configuration. +for 'M-!', 'M-&', '!', '&' and the context menu "Open With" +based on marked files in Dired. Possible backends are +'dired-guess-default', MIME types, XDG configuration +and a universal command such as "open" or "start" +that delegates to the OS. ** Ediff diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 47e97c96ce1..94ca5ddbcc3 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1329,6 +1329,7 @@ shell-command-guess-functions (choice (function-item shell-command-guess-dired) (function-item shell-command-guess-mailcap) (function-item shell-command-guess-xdg) + (function-item shell-command-guess-open) (function :tag "Custom function"))) :group 'dired :version "30.1") @@ -1380,6 +1381,27 @@ shell-command-guess-xdg xdg-mime-apps))) (append xdg-commands commands))) +(defcustom shell-command-guess-open + (cond + ((executable-find "xdg-open") + "xdg-open") + ((memq system-type '(gnu/linux darwin)) + "open") + ((memq system-type '(windows-nt ms-dos)) + "start") + ((eq system-type 'cygwin) + "cygstart") + ((executable-find "run-mailcap") + "run-mailcap")) + "A shell command to open a file externally." + :type 'string + :group 'dired + :version "30.1") + +(defun shell-command-guess-open (commands _files) + "Populate COMMANDS by the `open' command." + (append (ensure-list shell-command-guess-open) commands)) + ;;; Commands that delete or redisplay part of the dired buffer commit dcd755dabcf9ef95d6d0534c11c668f44c6f89c2 Author: Eli Zaretskii Date: Thu Nov 30 17:17:02 2023 +0200 Fix validation of :box face attribute * src/xfaces.c (Finternal_set_lisp_face_attribute): Fix the logic of validating the :box attribute. The previous code would always allow invalid attributes of :box as long as the invalid attribute was the last in the list. (Bug#67404) diff --git a/src/xfaces.c b/src/xfaces.c index 96382e78397..a23f4c302ed 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3371,12 +3371,13 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, if (!CONSP (tem)) break; v = XCAR (tem); - tem = XCDR (tem); if (EQ (k, QCline_width)) { - if ((!CONSP(v) || !FIXNUMP (XCAR (v)) || XFIXNUM (XCAR (v)) == 0 - || !FIXNUMP (XCDR (v)) || XFIXNUM (XCDR (v)) == 0) + if ((!CONSP(v) + || !FIXNUMP (XCAR (v)) + || XFIXNUM (XCAR (v)) == 0 + || !FIXNUMP (XCDR (v)) || XFIXNUM (XCDR (v)) == 0) && (!FIXNUMP (v) || XFIXNUM (v) == 0)) break; } @@ -3393,6 +3394,8 @@ DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, } else break; + + tem = XCDR (tem); } valid_p = NILP (tem); commit a91185211924f65adf7c1376b7f2d710099a5903 Author: Michael Albinus Date: Thu Nov 30 15:02:37 2023 +0100 * lisp/net/tramp.el (tramp-signal-process): PROCESS can also be a string. * test/lisp/net/tramp-tests.el (tramp-test31-signal-process): Extend. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9ca0e3c34d3..854af3e0455 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -6730,7 +6730,14 @@ tramp-signal-process `remote-pid', or PROCESS is a number and REMOTE is a remote file name, PROCESS is interpreted as process on the respective remote host, which will be the process to signal. +If PROCESS is a string, it is interpreted as process object with +the respective process name, or as a number. SIGCODE may be an integer, or a symbol whose name is a signal name." + (when (stringp process) + (setq process (or (get-process process) + (and (string-match-p (rx bol (+ digit) eol) process) + (string-to-number process)) + (signal 'wrong-type-argument (list #'processp process))))) (let (pid vec) (cond ((processp process) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 726403f193c..58b8530ca2b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5684,55 +5684,63 @@ tramp-test31-signal-process (delete-exited-processes t) kill-buffer-query-functions command proc) - (dolist (sigcode '(2 INT)) - (unwind-protect - (with-temp-buffer - (setq command "trap 'echo boom; exit 1' 2; sleep 100" - proc (start-file-process-shell-command - (format "test1%s" sigcode) (current-buffer) command)) - (should (processp proc)) - (should (process-live-p proc)) - (should (equal (process-status proc) 'run)) - (should (numberp (process-get proc 'remote-pid))) - (should (equal (process-get proc 'remote-command) - (with-connection-local-variables - `(,shell-file-name ,shell-command-switch ,command)))) - (should (zerop (signal-process proc sigcode))) - ;; Let the process accept the signal. - (with-timeout (10 (tramp--test-timeout-handler)) - (while (accept-process-output proc 0 nil t))) - (should-not (process-live-p proc))) + ;; The PROCESS argument of `signal-process' can be a string. Test + ;; this as well. + (dolist + (func '(identity + (lambda (x) (format "%s" (if (processp x) (process-name x) x))))) + (dolist (sigcode '(2 INT)) + (unwind-protect + (with-temp-buffer + (setq command "trap 'echo boom; exit 1' 2; sleep 100" + proc (start-file-process-shell-command + (format "test1-%s" sigcode) (current-buffer) command)) + (should (processp proc)) + (should (process-live-p proc)) + (should (equal (process-status proc) 'run)) + (should (numberp (process-get proc 'remote-pid))) + (should + (equal (process-get proc 'remote-command) + (with-connection-local-variables + `(,shell-file-name ,shell-command-switch ,command)))) + (should (zerop (signal-process (funcall func proc) sigcode))) + ;; Let the process accept the signal. + (with-timeout (10 (tramp--test-timeout-handler)) + (while (accept-process-output proc 0 nil t))) + (should-not (process-live-p proc))) - ;; Cleanup. - (ignore-errors (kill-process proc)) - (ignore-errors (delete-process proc))) + ;; Cleanup. + (ignore-errors (kill-process proc)) + (ignore-errors (delete-process proc))) - (unwind-protect - (with-temp-buffer - (setq command "trap 'echo boom; exit 1' 2; sleep 100" - proc (start-file-process-shell-command - (format "test2%s" sigcode) (current-buffer) command)) - (should (processp proc)) - (should (process-live-p proc)) - (should (equal (process-status proc) 'run)) - (should (numberp (process-get proc 'remote-pid))) - (should (equal (process-get proc 'remote-command) - (with-connection-local-variables - `(,shell-file-name ,shell-command-switch ,command)))) - ;; `signal-process' has argument REMOTE since Emacs 29. - (with-no-warnings + (unwind-protect + (with-temp-buffer + (setq command "trap 'echo boom; exit 1' 2; sleep 100" + proc (start-file-process-shell-command + (format "test2-%s" sigcode) (current-buffer) command)) + (should (processp proc)) + (should (process-live-p proc)) + (should (equal (process-status proc) 'run)) + (should (numberp (process-get proc 'remote-pid))) (should - (zerop - (signal-process - (process-get proc 'remote-pid) sigcode default-directory)))) - ;; Let the process accept the signal. - (with-timeout (10 (tramp--test-timeout-handler)) - (while (accept-process-output proc 0 nil t))) - (should-not (process-live-p proc))) + (equal (process-get proc 'remote-command) + (with-connection-local-variables + `(,shell-file-name ,shell-command-switch ,command)))) + ;; `signal-process' has argument REMOTE since Emacs 29. + (with-no-warnings + (should + (zerop + (signal-process + (funcall func (process-get proc 'remote-pid)) + sigcode default-directory)))) + ;; Let the process accept the signal. + (with-timeout (10 (tramp--test-timeout-handler)) + (while (accept-process-output proc 0 nil t))) + (should-not (process-live-p proc))) - ;; Cleanup. - (ignore-errors (kill-process proc)) - (ignore-errors (delete-process proc)))))) + ;; Cleanup. + (ignore-errors (kill-process proc)) + (ignore-errors (delete-process proc))))))) (ert-deftest tramp-test31-list-system-processes () "Check `list-system-processes'." commit 5aba199d75414f51ec1c3ce61d769cf3d8912daf Author: Michael Albinus Date: Thu Nov 30 14:48:54 2023 +0100 * lisp/net/tramp.el (tramp-local-host-regexp): Extend. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e19b8c78f8c..9ca0e3c34d3 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -552,14 +552,17 @@ tramp-restricted-shell-hosts-alist ;;;###tramp-autoload (defcustom tramp-local-host-regexp - (rx - bos - (| (literal tramp-system-name) - (| "localhost" "localhost4" "localhost6" "127.0.0.1" "::1")) - eos) + (rx bos + (| (literal tramp-system-name) + (| "localhost" "127.0.0.1" "::1" + ;; Fedora. + "localhost4" "localhost6" + ;; Ubuntu. + "ip6-localhost" "ip6-loopback")) + eos) "Host names which are regarded as local host. If the local host runs a chrooted environment, set this to nil." - :version "29.1" + :version "30.1" :type '(choice (const :tag "Chrooted environment" nil) (regexp :tag "Host regexp"))) commit 8525be6d5eca0c75008ec1dc799cae537156feea Author: Mattias EngdegÄrd Date: Wed Nov 29 17:51:46 2023 +0100 Move malformed-function warning from byte-opt to cconv (bug#67483) We shouldn't be warning inside the optimiser in the first place. * lisp/emacs-lisp/byte-opt.el (byte-optimize-form): Remove byte-compile-form-stack manipulation. (byte-optimize-form-code-walker): Move malformed function warning from here... * lisp/emacs-lisp/cconv.el: ...to here. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 06257a9a2da..7a61a8fce7e 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -485,10 +485,6 @@ byte-optimize-form-code-walker (`(,(pred byte-code-function-p) . ,exps) (cons fn (mapcar #'byte-optimize-form exps))) - (`(,(pred (not symbolp)) . ,_) - (byte-compile-warn-x form "`%s' is a malformed function" fn) - form) - ((guard (when for-effect (if-let ((tmp (byte-opt--fget fn 'side-effect-free))) (or byte-compile-delete-errors @@ -514,7 +510,6 @@ byte-optimize-one-form (byte-optimize-form form for-effect))) (defun byte-optimize-form (form &optional for-effect) - (push form byte-compile-form-stack) (while (progn ;; First, optimize all sub-forms of this one. @@ -531,7 +526,6 @@ byte-optimize-form (byte-compile-log " %s\t==>\t%s" old new) (setq form new) (not (eq new old)))))))) - (pop byte-compile-form-stack) form) (defun byte-optimize--rename-var-body (var new-var body) diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 3e75020a013..e65c39e3998 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -615,11 +615,15 @@ cconv-convert (cconv-convert exp env extend)) (`(,func . ,forms) - ;; First element is function or whatever function-like forms are: or, and, - ;; if, catch, progn, prog1, while, until - `(,func . ,(mapcar (lambda (form) - (cconv-convert form env extend)) - forms))) + (if (symbolp func) + ;; First element is function or whatever function-like forms are: + ;; or, and, if, catch, progn, prog1, while, until + `(,func . ,(mapcar (lambda (form) + (cconv-convert form env extend)) + forms)) + (macroexp--warn-wrap form (format-message "Malformed function `%S'" + (car form)) + nil nil))) (_ (or (cdr (assq form env)) form))))