summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-integration.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2022-06-03 19:54:31 +0200
committerMichael Albinus <michael.albinus@gmx.de>2022-06-03 19:54:31 +0200
commit9ea5628b18563a224013b3519f70c54c1989ff2f (patch)
treed0572241ee9a37c53eb76761af4c1f79d80b815a /lisp/net/tramp-integration.el
parente4611107e5b20e9a0c25c61a360220a48e970efd (diff)
downloademacs-9ea5628b18563a224013b3519f70c54c1989ff2f.tar.gz
Add remote file functions to shortdoc
* lisp/net/tramp-integration.el (shortdoc-add-function) (shortdoc--groups): Declare. (shortdoc): Configure shortdoc.el to recognize file name functions for remote access.
Diffstat (limited to 'lisp/net/tramp-integration.el')
-rw-r--r--lisp/net/tramp-integration.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index b7f82770c40..5e51074c494 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -39,6 +39,7 @@
(declare-function info-lookup->topic-value "info-look")
(declare-function info-lookup-maybe-add-help "info-look")
(declare-function recentf-cleanup "recentf")
+(declare-function shortdoc-add-function "shortdoc")
(declare-function tramp-dissect-file-name "tramp")
(declare-function tramp-file-name-equal-p "tramp")
(declare-function tramp-tramp-file-p "tramp")
@@ -49,6 +50,7 @@
(defvar info-lookup-alist)
(defvar ivy-completing-read-handlers-alist)
(defvar recentf-exclude)
+(defvar shortdoc--groups)
(defvar tramp-current-connection)
(defvar tramp-postfix-host-format)
(defvar tramp-use-ssh-controlmaster-options)
@@ -257,6 +259,33 @@ NAME must be equal to `tramp-current-connection'."
(delete (info-lookup->mode-cache 'symbol ',mode)
(info-lookup->topic-cache 'symbol))))))))
+;;; Integration of shortdoc.el:
+
+(with-eval-after-load 'shortdoc
+ (dolist (elem '((file-remote-p
+ :eval (file-remote-p "/ssh:user@host:/tmp/foo")
+ :eval (file-remote-p "/ssh:user@host:/tmp/foo" 'method))
+ (file-local-name
+ :eval (file-local-name "/ssh:user@host:/tmp/foo"))
+ (file-local-copy
+ :no-eval (file-local-copy "/ssh:user@host:/tmp/foo")
+ :eg-result "/tmp/tramp.8ihLbO"
+ :eval (file-local-copy "/tmp/foo"))))
+ (unless (assoc (car elem)
+ (member "Remote Files" (assq 'file shortdoc--groups)))
+ (shortdoc-add-function 'file "Remote Files" elem)))
+
+ (add-hook
+ 'tramp-integration-unload-hook
+ (lambda ()
+ (let ((glist (assq 'file shortdoc--groups)))
+ (while (and (consp glist)
+ (not (and (stringp (cadr glist))
+ (string-equal (cadr glist) "Remote Files"))))
+ (setq glist (cdr glist)))
+ (when (consp glist)
+ (setcdr glist nil))))))
+
;;; Integration of compile.el:
;; Compilation processes use `accept-process-output' such a way that