]> git.eshelyaron.com Git - emacs.git/commitdiff
ffap ido accommodation
authordickmao <none>
Tue, 3 Aug 2021 16:02:48 +0000 (12:02 -0400)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 4 Aug 2021 07:20:38 +0000 (09:20 +0200)
Now that ffap-file-finder can be ido-find-file, the
noninteractive portion of find-file-at-point cannot
assume ffap-file-finder always takes an argument
(ido-find-file does not).

* lisp/ffap.el (find-file-at-point): Do not call ffap-file-finder.
* test/lisp/ffap-tests.el (ffap-ido-mode): Test it.

lisp/ffap.el
test/lisp/ffap-tests.el

index b398d1c9f2164bceb711d0342d2aaa5be3803445..9be9c2906eadf493426fca85bbf95be34c7ea2d1 100644 (file)
@@ -1670,9 +1670,9 @@ See also the variables `ffap-dired-wildcards', `ffap-newfile-prompt',
        ((or (not ffap-newfile-prompt)
            (file-exists-p filename)
            (y-or-n-p "File does not exist, create buffer? "))
-       (funcall ffap-file-finder
-                ;; expand-file-name fixes "~/~/.emacs" bug sent by CHUCKR.
-                (expand-file-name filename)))
+       (find-file
+        ;; expand-file-name fixes "~/~/.emacs" bug sent by CHUCKR.
+        (expand-file-name filename)))
        ;; User does not want to find a non-existent file:
        ((signal 'file-missing (list "Opening file buffer"
                                    "No such file or directory"
index 3ceb392d7fbe0785551431aa7fb118484af6dff6..4fb4c90e76d68777a9a2ce0337bebc0a826c2178 100644 (file)
@@ -123,6 +123,21 @@ left alone when opening a URL in an external browser."
      (save-excursion (insert "type="))
      (ffap-guess-file-name-at-point))))
 
+(ert-deftest ffap-ido-mode ()
+  (require 'ido)
+  (with-temp-buffer
+    (let ((ido-mode t)
+          (read-filename-function read-file-name-function)
+          (read-buffer-function read-buffer-function))
+      (ido-everywhere)
+      (let ((read-file-name-function (lambda (&rest args)
+                                     (expand-file-name
+                                      (nth 4 args)
+                                      (nth 1 args)))))
+        (save-excursion (insert "ffap-tests.el"))
+        (let (kill-buffer-query-functions)
+          (kill-buffer (call-interactively #'find-file-at-point)))))))
+
 (provide 'ffap-tests)
 
 ;;; ffap-tests.el ends here