commit 26848af97f333c4699934a545eb2888b1006b326 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Thu Mar 9 19:01:19 2017 -0800 Simplify checks for xdg-open and xdg-email browse-url's xdg-open detection was too picky on some GNU/Linux desktops; see Bug#25778. Simplify the code by assuming xdg-open works if it is executable, as nowadays this is more likely to be correct than trying to use heuristics from a few years ago. Don't test for nohup: it is ineffective nowadays, as xdg-open's child uses the default action for SIGHUP even if xdg-open's invoker ignores SIGHUP. While we're at it, allow for Wayland here, as "emacs -nw" might be running in a non-X Wayland terminal. * lisp/mail/emacsbug.el (report-emacs-bug-can-use-xdg-email): * lisp/net/browse-url.el (browse-url-can-use-xdg-open): Simplify to a test for DISPLAY and whether the helper program is executable. Allow WAYLAND_DISPLAY as an option. diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index ecb7db60ae..c1aec6923f 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -77,33 +77,12 @@ (equal (executable-find "open") "/usr/bin/open") (memq system-type '(darwin)))) -;; FIXME this duplicates much of the logic from browse-url-can-use-xdg-open. (defun report-emacs-bug-can-use-xdg-email () "Return non-nil if the \"xdg-email\" command can be used. -xdg-email is a desktop utility that calls your preferred mail client. -This requires you to be running either Gnome, KDE, or Xfce4." - (and (getenv "DISPLAY") - (executable-find "xdg-email") - (or (getenv "GNOME_DESKTOP_SESSION_ID") - ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. - (condition-case nil - (eq 0 (call-process - "dbus-send" nil nil nil - "--dest=org.gnome.SessionManager" - "--print-reply" - "/org/gnome/SessionManager" - "org.gnome.SessionManager.CanShutdown")) - (error nil)) - (equal (getenv "KDE_FULL_SESSION") "true") - ;; FIXME? browse-url-can-use-xdg-open also accepts LXDE. - ;; Is that no good here, or just overlooked? - (condition-case nil - (eq 0 (call-process - "/bin/sh" nil nil nil - "-c" - ;; FIXME use string-match rather than grep. - "xprop -root _DT_SAVE_MODE|grep xfce4")) - (error nil))))) +xdg-email is a desktop utility that calls your preferred mail client." + (and ;; See browse-url-can-use-xdg-open. + (or (getenv "DISPLAY") (getenv "WAYLAND_DISPLAY")) + (executable-find "xdg-email"))) (defun report-emacs-bug-insert-to-mailer () "Send the message to your preferred mail client. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 04b49c4431..20ae072f65 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -45,7 +45,7 @@ ;; browse-url-generic arbitrary ;; browse-url-default-windows-browser MS-Windows browser ;; browse-url-default-macosx-browser macOS browser -;; browse-url-xdg-open Free Desktop xdg-open on Gnome, KDE, Xfce4, LXDE +;; browse-url-xdg-open freedesktop.org xdg-open ;; browse-url-kde KDE konqueror (kfm) ;; browse-url-elinks Elinks Don't know (tried with 0.12.GIT) @@ -944,36 +944,14 @@ instead of `browse-url-new-window-flag'." (defun browse-url-can-use-xdg-open () "Return non-nil if the \"xdg-open\" program can be used. -xdg-open is a desktop utility that calls your preferred web browser. -This requires you to be running either Gnome, KDE, Xfce4 or LXDE." - (and (getenv "DISPLAY") - (executable-find "xdg-open") - ;; xdg-open may call gnome-open and that does not wait for its child - ;; to finish. This child may then be killed when the parent dies. - ;; Use nohup to work around. See bug#7166, bug#8917, bug#9779 and - ;; http://lists.gnu.org/archive/html/emacs-devel/2009-07/msg00279.html - (executable-find "nohup") - (or (getenv "GNOME_DESKTOP_SESSION_ID") - ;; GNOME_DESKTOP_SESSION_ID is deprecated, check on Dbus also. - (condition-case nil - (eq 0 (call-process - "dbus-send" nil nil nil - "--dest=org.gnome.SessionManager" - "--print-reply" - "/org/gnome/SessionManager" - "org.gnome.SessionManager.CanShutdown")) - (error nil)) - (equal (getenv "KDE_FULL_SESSION") "true") - (condition-case nil - (eq 0 (call-process - "/bin/sh" nil nil nil - "-c" - ;; FIXME use string-match rather than grep. - "xprop -root _DT_SAVE_MODE|grep xfce4")) - (error nil)) - (member (getenv "DESKTOP_SESSION") '("LXDE" "Lubuntu")) - (equal (getenv "XDG_CURRENT_DESKTOP") "LXDE")))) - +xdg-open is a desktop utility that calls your preferred web browser." + ;; The exact set of situations where xdg-open works is complicated, + ;; and it would be a pain to duplicate xdg-open's situation-specific + ;; code here, as the code is a moving target. So assume that + ;; xdg-open will work if there is a graphical display; this should + ;; be good enough for platforms Emacs is likely to be running on. + (and (or (getenv "DISPLAY") (getenv "WAYLAND_DISPLAY")) + (executable-find "xdg-open"))) ;;;###autoload (defun browse-url-xdg-open (url &optional ignored) commit 092071345f265efcd3abd6de01552ebe95ffb9a1 Author: Vibhav Pant Date: Fri Mar 10 00:09:58 2017 +0530 Byte compile cond clauses without any bodies correctly. * lisp/emacs-lisp/bytecomp.el (byte-compile-cond-jump-table): When a cond clause has no body, push t on to the stack. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 25513bd024..7cbef8e434 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4128,7 +4128,9 @@ Return a list of the form ((TEST . VAR) ((VALUE BODY) ...))" ;; depth/tag conflicts or violating asserts down the road. ;; To make sure `byte-compile-body' itself doesn't violate this, ;; we use `cl-assert'. - (byte-compile-body body byte-compile--for-effect) + (if (null body) + (byte-compile-form t byte-compile--for-effect) + (byte-compile-body body byte-compile--for-effect)) (cl-assert (or (= byte-compile-depth init-depth) (= byte-compile-depth (1+ init-depth)))) (byte-compile-goto 'byte-goto donetag) commit 37b88d7b92ba77a771ce0dbff940b3dec1a366c5 Author: Michael Albinus Date: Thu Mar 9 19:44:37 2017 +0100 Fix bug#23006 * lisp/minibuffer.el (completion--nth-completion): Let-bind `non-essential'. * lisp/net/tramp.el (tramp-completion-mode): Fix docstring. (tramp-completion-mode-p): Optional parameter VEC. Replace check for `last-input-event' by analysing VEC argument. (tramp-error-with-buffer, tramp-file-name-handler) (tramp-connectable-p, tramp-handle-file-name-as-directory): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 00722ec4b1..530670fab7 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -894,21 +894,22 @@ This overrides the defaults specified in `completion-category-defaults'." ;; The quote/unquote function needs to come from the completion table (rather ;; than from completion-extra-properties) because it may apply only to some ;; part of the string (e.g. substitute-in-file-name). - (let ((requote - (when (completion-metadata-get metadata 'completion--unquote-requote) - (cl-assert (functionp table)) - (let ((new (funcall table string point 'completion--unquote))) - (setq string (pop new)) - (setq table (pop new)) - (setq point (pop new)) - (cl-assert (<= point (length string))) - (pop new)))) - (result - (completion--some (lambda (style) - (funcall (nth n (assq style - completion-styles-alist)) - string table pred point)) - (completion--styles metadata)))) + (let* ((requote + (when (completion-metadata-get metadata 'completion--unquote-requote) + (cl-assert (functionp table)) + (let ((new (funcall table string point 'completion--unquote))) + (setq string (pop new)) + (setq table (pop new)) + (setq point (pop new)) + (cl-assert (<= point (length string))) + (pop new)))) + (non-essential t) + (result + (completion--some (lambda (style) + (funcall (nth n (assq style + completion-styles-alist)) + string table pred point)) + (completion--styles metadata)))) (if requote (funcall requote result n) result))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 85619621d9..6cd52ae4e0 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4654,7 +4654,7 @@ connection if a previous connection has died for some reason." ;; check this for the process related to ;; `tramp-buffer-name'; otherwise `start-file-process' ;; wouldn't run ever when `non-essential' is non-nil. - (when (and (tramp-completion-mode-p) + (when (and (tramp-completion-mode-p vec) (null (get-process (tramp-buffer-name vec)))) (throw 'non-essential 'non-essential)) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 406cd02b52..03dcee4a97 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1559,7 +1559,7 @@ an input event arrives. The other arguments are passed to `tramp-error'." (when (and buf tramp-message-show-message (not (zerop tramp-verbose)) - (not (tramp-completion-mode-p)) + (not (tramp-completion-mode-p vec)) ;; Show only when Emacs has started already. (current-message)) (let ((enable-recursive-minibuffers t)) @@ -2028,17 +2028,17 @@ Falls back to normal file name handler if no Tramp file name handler exists." (let ((filename (apply 'tramp-file-name-for-operation operation args))) (if (and tramp-mode (tramp-tramp-file-p filename)) (save-match-data - (let* ((filename (tramp-replace-environment-variables filename)) - (non-essential - (and non-essential - (string-match - tramp-completion-file-name-regexp filename))) - (completion (tramp-completion-mode-p)) - (foreign - (tramp-find-foreign-file-name-handler - filename operation completion)) - result) - (with-parsed-tramp-file-name filename nil + (setq filename (tramp-replace-environment-variables filename)) + (with-parsed-tramp-file-name filename nil + (let* ((non-essential + (and non-essential + (string-match + tramp-completion-file-name-regexp filename))) + (completion (tramp-completion-mode-p v)) + (foreign + (tramp-find-foreign-file-name-handler + filename operation completion)) + result) ;; Call the backend function. (if foreign (tramp-condition-case-unless-debug err @@ -2262,34 +2262,27 @@ Falls back to normal file name handler if no Tramp file name handler exists." ;;;###autoload (defvar tramp-completion-mode nil - "If non-nil, external packages signal that they are in file name completion. - -This is necessary, because Tramp uses a heuristic depending on last -input event. This fails when external packages use other characters -but , or ?\\? for file name completion. This variable -should never be set globally, the intention is to let-bind it.") + "If non-nil, external packages signal that they are in file name completion.") (make-obsolete-variable 'tramp-completion-mode 'non-essential "26.1") ;; Necessary because `tramp-file-name-regexp-unified' and ;; `tramp-completion-file-name-regexp-unified' aren't different. If ;; nil is returned, `tramp-completion-run-real-handler' is called ;; (i.e. forwarding to `tramp-file-name-handler'). Otherwise, it -;; takes `tramp-run-real-handler'. Using `last-input-event' is a -;; little bit risky, because completing a file might require loading -;; other files, like "~/.netrc", and for them it shouldn't be decided -;; based on that variable. On the other hand, those files shouldn't -;; have partial Tramp file name syntax. +;; takes `tramp-run-real-handler'. ;;;###autoload -(progn (defun tramp-completion-mode-p () +(progn (defun tramp-completion-mode-p (&optional vec) "Check, whether method / user name / host name completion is active." (or ;; Signal from outside. `non-essential' has been introduced in Emacs 24. (and (boundp 'non-essential) (symbol-value 'non-essential)) ;; This variable has been obsoleted in Emacs 26. tramp-completion-mode - ;; Fallback. Some completion packages still don't support - ;; `non-essential' sufficiently. - (equal last-input-event 'tab)))) + ;; When the host name is a method, we are still in completion mode. + ;; Due to autoload dependencies, we cannot use `tramp-file-name-host'. + (and (equal tramp-syntax 'ftp) + (vectorp vec) + (member (aref vec 2) (mapcar 'car tramp-methods)))))) (defun tramp-connectable-p (filename) "Check, whether it is possible to connect the remote host w/o side-effects. @@ -2297,10 +2290,10 @@ This is true, if either the remote host is already connected, or if we are not in completion mode." (let (tramp-verbose) (and (tramp-tramp-file-p filename) - (or (not (tramp-completion-mode-p)) - (tramp-compat-process-live-p - (tramp-get-connection-process - (tramp-dissect-file-name filename))))))) + (with-parsed-tramp-file-name filename nil + (or (not (tramp-completion-mode-p v)) + (tramp-compat-process-live-p + (tramp-get-connection-process v))))))) (defun tramp-completion-handle-expand-file-name (name &optional dir) "Like `expand-file-name' for Tramp files." @@ -2878,7 +2871,7 @@ User is always nil." (tramp-file-name-method v) (tramp-file-name-user v) (tramp-file-name-host v) - (if (and (tramp-completion-mode-p) + (if (and (tramp-completion-mode-p v) (zerop (length (tramp-file-name-localname v)))) "" (tramp-run-real-handler commit 550c23d326da983af082ad8f0227ace16c652021 Author: Vibhav Pant Date: Thu Mar 9 20:02:03 2017 +0530 etc/NEWS: Add entry for new `switch' bytecode. diff --git a/etc/NEWS b/etc/NEWS index 32137a79da..f0df0a70ca 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -742,6 +742,12 @@ processes on exit. * Incompatible Lisp Changes in Emacs 26.1 +++ +** Certain cond/pcase/cl-case forms are now compiled using a faster jump +table implementation. This uses a new bytecode op `switch', which isn't +compatible with previous Emacs versions. This functionality can be disabled +by setting `byte-compile-cond-use-jump-table' to nil. + ++++ ** Resizing a frame no longer runs 'window-configuration-change-hook'. Put your function on 'window-size-change-functions' instead.