aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorLiu Hui2025-07-07 17:45:18 +0800
committerEli Zaretskii2025-07-12 11:38:27 +0300
commitae46edff68e8d5729207ed849df83ecb039e11bb (patch)
treefe5cc59038ab5ad916e17c9bb4c192fb38097371 /test/lisp
parentf746762e74adeac8beaa73abcf20ee5e74298597 (diff)
downloademacs-ae46edff68e8d5729207ed849df83ecb039e11bb.tar.gz
emacs-ae46edff68e8d5729207ed849df83ecb039e11bb.zip
Add option 'ffap-prefer-remote-file' (bug#78925)
This option only affects absolute filenames that are found by ffap-file-at-point in buffers with remote default directory. The handling of relative filenames in above buffers remains unchanged: ffap-file-at-point returns the relative filename, which can be converted to a remote absolute filename by subsequent callers (e.g. ffap) using expand-file-name. * lisp/ffap.el (ffap-prefer-remote-file): New user option. (ffap-file-exists-string): Add an optional argument to allow the check of existence of absolute filename on the remote host. (ffap-file-at-point): Always find remote files in remote context if the new option is non-nil. * test/lisp/ffap-tests.el (ffap-test-remote): Add a test. * etc/NEWS: Announce the change.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/ffap-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index ea5e745bfaf..2bf5d8c79cd 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -25,6 +25,7 @@
25 25
26(require 'cl-lib) 26(require 'cl-lib)
27(require 'ert) 27(require 'ert)
28(require 'tramp)
28(require 'ert-x) 29(require 'ert-x)
29(require 'ffap) 30(require 'ffap)
30 31
@@ -289,6 +290,27 @@ End of search list.
289 (should (member (expand-file-name "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include") 290 (should (member (expand-file-name "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include")
290 (ffap--c-path))))) 291 (ffap--c-path)))))
291 292
293(ert-deftest ffap-test-remote ()
294 (skip-unless
295 (ignore-errors
296 (and
297 (file-remote-p ert-remote-temporary-file-directory)
298 (file-directory-p ert-remote-temporary-file-directory)
299 (file-writable-p ert-remote-temporary-file-directory))))
300 (let* ((ffap-prefer-remote-file t)
301 (default-directory
302 (expand-file-name ert-remote-temporary-file-directory))
303 (test-file (expand-file-name "ffap-test" default-directory)))
304 (with-temp-buffer
305 (ignore-errors (make-empty-file test-file))
306 (insert (file-local-name test-file))
307 (should (equal (ffap-file-at-point) test-file))
308 (erase-buffer)
309 (insert (concat "/usr/bin:" (file-local-name test-file)))
310 (should (equal (ffap-file-at-point) test-file))
311 (delete-file test-file)
312 (should (equal (ffap-file-at-point) default-directory)))))
313
292(provide 'ffap-tests) 314(provide 'ffap-tests)
293 315
294;;; ffap-tests.el ends here 316;;; ffap-tests.el ends here