commit 0597c1b94e5206e980865c6513e923280a3c3ce1 (HEAD, refs/remotes/origin/master) Author: Dmitry Gutov Date: Sat May 25 00:40:34 2019 +0300 ; Add NEWS entries for recent Xref changes diff --git a/etc/NEWS b/etc/NEWS index c05401ea76..8e8172a81b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1466,6 +1466,17 @@ buffer periodically when 'auto-revert-avoid-polling' is non-nil. ** Xref +*** New variable 'xref-show-definitions-function'. +It encapsulates the logic pertinent to showing the result of +'xref-find-definitions'. The user can change it to customize its +behavior and the display of results. + +*** Search results show the buffer even for one hit. +The search-type Xref commands (e.g. 'xref-find-references' or +'project-find-regexp') now show the results buffer even when there is +only one hit. This can be altered by changing +'xref-show-xrefs-function'. + *** Xref buffers support refreshing the search results. A new command 'xref-refresh-results' is bound to 'g'. commit 157d506dd73df15b6a80d06f3c15e4a899c4ef81 Author: Dmitry Gutov Date: Sat May 25 00:15:46 2019 +0300 Rename xref--revert-xref-buffer to xref-refresh-results * lisp/progmodes/xref.el (xref-refresh-results): Rename from xref--revert-xref-buffer (bug#35702). diff --git a/etc/NEWS b/etc/NEWS index 064143047d..c05401ea76 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1464,6 +1464,11 @@ the new variable 'buffer-auto-revert-by-notification' to a non-nil value. Auto Revert mode can use this information to avoid polling the buffer periodically when 'auto-revert-avoid-polling' is non-nil. +** Xref + +*** Xref buffers support refreshing the search results. +A new command 'xref-refresh-results' is bound to 'g'. + * New Modes and Packages in Emacs 27.1 diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 45d2fc2fe2..b7390aa7ba 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -695,7 +695,7 @@ references displayed in the current *xref* buffer." ;; suggested by Johan Claesson "to further reduce finger movement": (define-key map (kbd ".") #'xref-next-line) (define-key map (kbd ",") #'xref-prev-line) - (define-key map (kbd "g") #'xref--revert-xref-buffer) + (define-key map (kbd "g") #'xref-refresh-results) map)) (define-derived-mode xref--xref-buffer-mode special-mode "XREF" @@ -802,7 +802,8 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (setq xref--fetcher fetcher) (current-buffer))))) -(defun xref--revert-xref-buffer () +(defun xref-refresh-results () + "Refresh the search results in the current buffer." (interactive) (unless xref--fetcher (user-error "Reverting not supported")) commit e309818ecee190727d85c6f3f878c99445d06cfe Author: Dmitry Gutov Date: Sat May 25 00:11:41 2019 +0300 Support reverting in xref-find-definitions results as well * lisp/progmodes/xref.el (xref--show-xref-buffer): Expect the first argument to always be a function (bug#35702). Handle a FETCHED-XREFS entry in ALIST. (xref--show-defs-buffer): Update accordingly. (xref--create-fetcher): Extract from xref--find-xrefs. (xref--find-definitions): Use it. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 6a4906a232..45d2fc2fe2 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -782,7 +782,11 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." #'equal)) (defun xref--show-xref-buffer (fetcher alist) - (let* ((xrefs (if (functionp fetcher) (funcall fetcher) fetcher)) + (cl-assert (functionp fetcher)) + (let* ((xrefs + (or + (assoc-default 'fetched-xrefs alist) + (funcall fetcher))) (xref-alist (xref--analyze xrefs))) (with-current-buffer (get-buffer-create xref-buffer-name) (setq buffer-undo-list nil) @@ -795,8 +799,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." (goto-char (point-min)) (setq xref--original-window (assoc-default 'window alist) xref--original-window-intent (assoc-default 'display-action alist)) - (when (functionp fetcher) - (setq xref--fetcher fetcher)) + (setq xref--fetcher fetcher) (current-buffer))))) (defun xref--revert-xref-buffer () @@ -817,13 +820,16 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." 'face 'error)))) (goto-char (point-min))))) -(defun xref--show-defs-buffer (xrefs alist) - (cond - ((not (cdr xrefs)) - (xref--pop-to-location (car xrefs) - (assoc-default 'display-action alist))) - (t - (xref--show-xref-buffer xrefs alist)))) +(defun xref--show-defs-buffer (fetcher alist) + (let ((xrefs (funcall fetcher))) + (cond + ((not (cdr xrefs)) + (xref--pop-to-location (car xrefs) + (assoc-default 'display-action alist))) + (t + (xref--show-xref-buffer fetcher + (cons (cons 'fetched-xrefs xrefs) + alist)))))) (defvar xref-show-xrefs-function 'xref--show-xref-buffer @@ -885,28 +891,29 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." ;;; Commands (defun xref--find-xrefs (input kind arg display-action) + (xref--show-xrefs + (xref--create-fetcher input kind arg) + display-action)) + +(defun xref--find-definitions (id display-action) + (xref--show-defs + (xref--create-fetcher id 'definitions id) + display-action)) + +(defun xref--create-fetcher (input kind arg) (let* ((orig-buffer (current-buffer)) (orig-position (point)) (backend (xref-find-backend)) - (method (intern (format "xref-backend-%s" kind))) - (fetcher (lambda () - (save-excursion - (when (buffer-live-p orig-buffer) - (set-buffer orig-buffer) - (ignore-errors (goto-char orig-position))) - (let ((xrefs (funcall method backend arg))) - (unless xrefs - (xref--not-found-error kind input)) - xrefs))))) - (xref--show-xrefs fetcher display-action))) - -(defun xref--find-definitions (id display-action) - (let ((xrefs (funcall #'xref-backend-definitions - (xref-find-backend) - id))) - (unless xrefs - (xref--not-found-error 'definitions id)) - (xref--show-defs xrefs display-action))) + (method (intern (format "xref-backend-%s" kind)))) + (lambda () + (save-excursion + (when (buffer-live-p orig-buffer) + (set-buffer orig-buffer) + (ignore-errors (goto-char orig-position))) + (let ((xrefs (funcall method backend arg))) + (unless xrefs + (xref--not-found-error kind input)) + xrefs))))) (defun xref--not-found-error (kind input) (user-error "No %s found for: %s" (symbol-name kind) input)) commit 35f305652c9eacb2e75fa6bcd784247d4de939fb Author: Stefan Monnier Date: Fri May 24 12:26:14 2019 -0400 * lisp/emacs-lisp/package.el (package-install-from-archive): Fix last change Don't place the unibyte content of of the downloaded file into a multibyte buffer. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6b92916095..670831d963 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1913,9 +1913,12 @@ if all the in-between dependencies are also in PACKAGE-LIST." ;; This function will be called after signature checking. (lambda (&optional good-sigs) ;; Signature checked, unpack now. - (with-temp-buffer (insert content) - (let ((save-silently t)) - (package-unpack pkg-desc))) + (with-temp-buffer ;FIXME: Just use the previous current-buffer. + (set-buffer-multibyte nil) + (cl-assert (not (multibyte-string-p content))) + (insert content) + (let ((save-silently t)) + (package-unpack pkg-desc))) ;; Here the package has been installed successfully, mark it as ;; signed if appropriate. (when good-sigs commit 43db6dd6b4cc9445eacbb39181fefd0ead9ba98d Merge: adab8bd35b f6d3005069 Author: Michael Albinus Date: Fri May 24 15:36:15 2019 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit adab8bd35be440900ac6e4a250665bca2f9c7d51 Author: Michael Albinus Date: Fri May 24 15:36:02 2019 +0200 Fix Bug#35769 * lisp/net/tramp-adb.el (tramp-adb-connection-local-default-profile): * lisp/net/tramp-integration.el (tramp-connection-local-default-profile): Do not set it on w32 systems. (Bug#35769) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 008a5cedd8..9a214c369a 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -1294,8 +1294,11 @@ connection if a previous connection has died for some reason." ;; Default settings for connection-local variables. (defconst tramp-adb-connection-local-default-profile - '((shell-file-name . "/system/bin/sh") - (shell-command-switch . "-c")) + ;; `w32-shell-name' is derived from `shell-file-name'. Don't let it + ;; be confused. + (unless (eq system-type 'windows-nt) + '((shell-file-name . "/system/bin/sh") + (shell-command-switch . "-c"))) "Default connection-local variables for remote adb connections.") ;; `connection-local-set-profile-variables' and diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index 35d2eb38e6..6e3b0279ec 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -174,8 +174,11 @@ NAME must be equal to `tramp-current-connection'." ;;; Default connection-local variables for Tramp: (defconst tramp-connection-local-default-profile - '((shell-file-name . "/bin/sh") - (shell-command-switch . "-c")) + ;; `w32-shell-name' is derived from `shell-file-name'. Don't let it + ;; be confused. + (unless (eq system-type 'windows-nt) + '((shell-file-name . "/bin/sh") + (shell-command-switch . "-c"))) "Default connection-local variables for remote connections.") ;; `connection-local-set-profile-variables' and commit f6d3005069551f3ed5817078a095b868007bf12d Author: Matthew Bauer Date: Mon May 13 18:39:32 2019 -0400 Add "Enter Auth" prompt handling for OpenVPN (Bug#35724) * lisp/comint.el (comint-password-prompt-regexp): Allow "Enter Auth" at the beginning. diff --git a/lisp/comint.el b/lisp/comint.el index 3939371ab8..b6ed199327 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -349,13 +349,14 @@ This variable is buffer-local." ;; Ubuntu's sudo prompts like `[sudo] password for user:' ;; Some implementations of passwd use "Password (again)" as the 2nd prompt. ;; Something called "perforce" uses "Enter password:". -;; See M-x comint-testsuite--test-comint-password-prompt-regexp. +;; OpenVPN prints a prompt like: "Enter Auth Password:". +;; See ert test `comint-test-password-regexp'. (defcustom comint-password-prompt-regexp (concat "\\(^ *\\|" (regexp-opt '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the" - "Old" "old" "New" "new" "'s" "login" + "Enter Auth" "enter auth" "Old" "old" "New" "new" "'s" "login" "Kerberos" "CVS" "UNIX" " SMB" "LDAP" "PEM" "SUDO" "[sudo]" "Repeat" "Bad" "Retype") t) diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el index 49e59c526f..0d2d648bba 100644 --- a/test/lisp/comint-tests.el +++ b/test/lisp/comint-tests.el @@ -39,6 +39,7 @@ "[sudo] user 的密码:" ; localized "Password (again):" "Enter password:" + "Enter Auth Password:" ; OpenVPN (Bug#35724) "Mot de Passe :" ; localized (Bug#29729) "Passwort:") ; localized "List of strings that should match `comint-password-prompt-regexp'.")