emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9ea5628b18 1/2: Add remote file functions to shortdoc


From: Michael Albinus
Subject: master 9ea5628b18 1/2: Add remote file functions to shortdoc
Date: Fri, 3 Jun 2022 13:55:41 -0400 (EDT)

branch: master
commit 9ea5628b18563a224013b3519f70c54c1989ff2f
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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.
---
 lisp/net/tramp-integration.el | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index b7f82770c4..5e51074c49 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]