mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
(dired-at-point-prompter): Fix bug#80545
* lisp/ffap.el (ffap-read-file-or-url): Add `read-dir` argument to indicate we expect a directory as return value. Avoid `read-file-name` when we want a directory and the dialog UI might prevent us from doing so. (dired-at-point-prompter): Use the new arg.
This commit is contained in:
parent
7c5ab95f03
commit
666955dfa0
|
|
@ -1237,8 +1237,9 @@ If DIRNAME is already in a Dired buffer, that buffer is used without refresh."
|
||||||
(prog1 (pop-to-buffer-same-window (dired-noselect dirname switches))
|
(prog1 (pop-to-buffer-same-window (dired-noselect dirname switches))
|
||||||
(dired--display-ls-error)))
|
(dired--display-ls-error)))
|
||||||
|
|
||||||
;; This is needed to let clicks on the menu bar invoke Dired even if
|
;; This lets clicks on the menu bar invoke Dired even if some feature
|
||||||
;; some feature remaps the Dired command to another command.
|
;; remaps the Dired command to another command that does not handle this
|
||||||
|
;; situation correctly (e.g. earlier versions of `dired-at-point-prompter').
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun dired-from-menubar (dirname &optional switches)
|
(defun dired-from-menubar (dirname &optional switches)
|
||||||
"Edit an existing directory."
|
"Edit an existing directory."
|
||||||
|
|
|
||||||
12
lisp/ffap.el
12
lisp/ffap.el
|
|
@ -1607,7 +1607,7 @@ which may actually result in an URL rather than a filename."
|
||||||
(otherwise
|
(otherwise
|
||||||
(apply operation args)))))
|
(apply operation args)))))
|
||||||
|
|
||||||
(defun ffap-read-file-or-url (prompt guess)
|
(defun ffap-read-file-or-url (prompt guess &optional read-dir)
|
||||||
"Read file or URL from minibuffer, with PROMPT and initial GUESS."
|
"Read file or URL from minibuffer, with PROMPT and initial GUESS."
|
||||||
(let ((elem (cons ffap-url-regexp #'ffap--url-file-handler)))
|
(let ((elem (cons ffap-url-regexp #'ffap--url-file-handler)))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
|
|
@ -1623,7 +1623,12 @@ which may actually result in an URL rather than a filename."
|
||||||
(setq guess default-directory))
|
(setq guess default-directory))
|
||||||
(unless (ffap-file-remote-p guess)
|
(unless (ffap-file-remote-p guess)
|
||||||
(setq guess (abbreviate-file-name (expand-file-name guess))))
|
(setq guess (abbreviate-file-name (expand-file-name guess))))
|
||||||
(read-file-name prompt
|
(funcall
|
||||||
|
;; Copied from `dired-read-dir-and-switches'.
|
||||||
|
(if (and read-dir (next-read-file-uses-dialog-p))
|
||||||
|
#'read-directory-name
|
||||||
|
#'read-file-name)
|
||||||
|
prompt
|
||||||
(file-name-directory guess) nil nil
|
(file-name-directory guess) nil nil
|
||||||
(file-name-nondirectory guess))))
|
(file-name-nondirectory guess))))
|
||||||
;; Remove the special handler manually. We used to just let-bind
|
;; Remove the special handler manually. We used to just let-bind
|
||||||
|
|
@ -2158,7 +2163,8 @@ If `dired-at-point-require-prefix' is set, the prefix meaning is reversed."
|
||||||
((file-regular-p guess)
|
((file-regular-p guess)
|
||||||
(file-name-directory guess))
|
(file-name-directory guess))
|
||||||
(guess))))
|
(guess))))
|
||||||
(and guess (ffap-highlight))))
|
(and guess (ffap-highlight)))
|
||||||
|
'read-dir)
|
||||||
(ffap-highlight t)))
|
(ffap-highlight t)))
|
||||||
|
|
||||||
;;; ffap-dired-other-*, ffap-list-directory commands:
|
;;; ffap-dired-other-*, ffap-list-directory commands:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue