emacs-diffs
[Top][All Lists]
Advanced

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

master 99ad65e: Configure info-look.el to recognize Tramp symbols


From: Michael Albinus
Subject: master 99ad65e: Configure info-look.el to recognize Tramp symbols
Date: Fri, 6 Dec 2019 13:28:13 -0500 (EST)

branch: master
commit 99ad65eda44e3b6edcc51cf0fb70ea499c3ccb07
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Configure info-look.el to recognize Tramp symbols
    
    * lisp/net/tramp-integration.el (info-lookup->cache)
    (info-lookup->mode-value, info-lookup->other-modes)
    (info-lookup->topic-value, info-lookup-maybe-add-help)
    (info-lookup-cache): Declare.
    (info-look): Configure info-look.el to recognize Tramp symbols.
---
 lisp/net/tramp-integration.el | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 0c31076..f1d9f39 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -31,12 +31,18 @@
 
 ;; Pacify byte-compiler.
 (require 'cl-lib)
+(declare-function info-lookup->cache "info-look")
+(declare-function info-lookup->mode-value "info-look")
+(declare-function info-lookup->other-modes "info-look")
+(declare-function info-lookup->topic-value "info-look")
+(declare-function info-lookup-maybe-add-help "info-look")
 (declare-function recentf-cleanup "recentf")
 (declare-function tramp-dissect-file-name "tramp")
 (declare-function tramp-file-name-equal-p "tramp")
 (declare-function tramp-tramp-file-p "tramp")
 (defvar eshell-path-env)
 (defvar ido-read-file-name-non-ido)
+(defvar info-lookup-cache)
 (defvar ivy-completing-read-handlers-alist)
 (defvar recentf-exclude)
 (defvar tramp-current-connection)
@@ -186,6 +192,35 @@ NAME must be equal to `tramp-current-connection'."
   (add-to-list 'ivy-completing-read-handlers-alist
               '(tramp-these-rename-files . completing-read-default)))
 
+;;; Integration of info-look.el:
+
+(with-eval-after-load 'info-look
+  ;; Create a pseudo mode `tramp-info-lookup-mode' for Tramp symbol lookup.
+  (info-lookup-maybe-add-help
+   :mode 'tramp-info-lookup-mode :topic 'symbol
+   :regexp "[^][()`'‘’,\" \t\n]+"
+   :doc-spec '(("(tramp)Function Index" nil "^ -+ .*: " "\\( \\|$\\)")
+              ("(tramp)Variable Index" nil "^ -+ .*: " "\\( \\|$\\)")))
+
+  ;; Add it as `other-modes' to `emacs-lisp-mode' itself, and all
+  ;; modes which use it as `other-modes'.
+  (dolist (mode (mapcar 'car (info-lookup->topic-value 'symbol)))
+    (when (and (or (equal mode 'emacs-lisp-mode)
+                  (member
+                   'emacs-lisp-mode (info-lookup->other-modes 'symbol mode)))
+              (not (member
+                    'tramp-info-lookup-mode
+                    (info-lookup->other-modes 'symbol mode))))
+      (setcdr
+       (info-lookup->mode-value 'symbol mode)
+       (append
+       (butlast (cdr (info-lookup->mode-value 'symbol mode)))
+       `(,(cons 'tramp-info-lookup-mode
+                (info-lookup->other-modes 'symbol mode)))))))
+
+  ;; Reset cache.
+  (setq info-lookup-cache nil))
+
 ;;; Default connection-local variables for Tramp:
 
 (defconst tramp-connection-local-default-profile



reply via email to

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