32
32
; ; Pacify byte-compiler.
33
33
(require 'cl-lib )
34
34
(declare-function info-lookup->cache " info-look" )
35
+ (declare-function info-lookup->mode-cache " info-look" )
35
36
(declare-function info-lookup->mode-value " info-look" )
36
37
(declare-function info-lookup->other-modes " info-look" )
38
+ (declare-function info-lookup->topic-cache " info-look" )
37
39
(declare-function info-lookup->topic-value " info-look" )
38
40
(declare-function info-lookup-maybe-add-help " info-look" )
39
41
(declare-function recentf-cleanup " recentf" )
42
44
(declare-function tramp-tramp-file-p " tramp" )
43
45
(defvar eshell-path-env )
44
46
(defvar ido-read-file-name-non-ido )
45
- (defvar info-lookup-cache )
47
+ (defvar info-lookup-alist )
46
48
(defvar ivy-completing-read-handlers-alist )
47
49
(defvar recentf-exclude )
48
50
(defvar tramp-current-connection )
@@ -182,15 +184,32 @@ NAME must be equal to `tramp-current-connection'."
182
184
183
185
(with-eval-after-load 'ido
184
186
(add-to-list 'ido-read-file-name-non-ido 'tramp-rename-files )
185
- (add-to-list 'ido-read-file-name-non-ido 'tramp-these-rename-files ))
187
+ (add-to-list 'ido-read-file-name-non-ido 'tramp-these-rename-files )
188
+ (add-hook 'tramp-integration-unload-hook
189
+ (lambda ()
190
+ (setq ido-read-file-name-non-ido
191
+ (delq 'tramp-these-rename-files ido-read-file-name-non-ido)
192
+ ido-read-file-name-non-ido
193
+ (delq 'tramp-rename-files ido-read-file-name-non-ido)))))
186
194
187
195
; ;; Integration of ivy.el:
188
196
189
197
(with-eval-after-load 'ivy
190
198
(add-to-list 'ivy-completing-read-handlers-alist
191
199
'(tramp-rename-files . completing-read-default))
192
200
(add-to-list 'ivy-completing-read-handlers-alist
193
- '(tramp-these-rename-files . completing-read-default)))
201
+ '(tramp-these-rename-files . completing-read-default))
202
+ (add-hook
203
+ 'tramp-integration-unload-hook
204
+ (lambda ()
205
+ (setq ivy-completing-read-handlers-alist
206
+ (delete
207
+ (assq 'tramp-these-rename-files ivy-completing-read-handlers-alist)
208
+ ivy-completing-read-handlers-alist)
209
+ ivy-completing-read-handlers-alist
210
+ (delete
211
+ (assq 'tramp-rename-files ivy-completing-read-handlers-alist)
212
+ ivy-completing-read-handlers-alist)))))
194
213
195
214
; ;; Integration of info-look.el:
196
215
@@ -202,24 +221,45 @@ NAME must be equal to `tramp-current-connection'."
202
221
:doc-spec '((" (tramp)Function Index" nil " ^ -+ .*: " " \\ ( \\ |$\\ )" )
203
222
(" (tramp)Variable Index" nil " ^ -+ .*: " " \\ ( \\ |$\\ )" )))
204
223
205
- ; ; Add it as `other-modes' to `emacs-lisp-mode' itself, and all
206
- ; ; modes which use it as `other-modes' .
224
+ (add-hook
225
+ 'tramp-integration-unload-hook
226
+ (lambda ()
227
+ (setcdr (assq 'symbol info-lookup-alist)
228
+ (delete (info-lookup->mode-value 'symbol 'tramp-info-lookup-mode )
229
+ (info-lookup->topic-value 'symbol )))
230
+ (setcdr (info-lookup->cache 'symbol )
231
+ (delete (info-lookup->mode-cache 'symbol 'tramp-info-lookup-mode )
232
+ (info-lookup->topic-cache 'symbol )))))
233
+
207
234
(dolist (mode (mapcar 'car (info-lookup->topic-value 'symbol )))
235
+ ; ; Add `tramp-info-lookup-mode' to `other-modes' for either
236
+ ; ; `emacs-lisp-mode' itself, or to modes which use
237
+ ; ; `emacs-lisp-mode' as `other-modes' . Reset `info-lookup-cache' .
208
238
(when (and (or (equal mode 'emacs-lisp-mode )
209
- (member
239
+ (memq
210
240
'emacs-lisp-mode (info-lookup->other-modes 'symbol mode)))
211
- (not (member
212
- 'tramp-info-lookup-mode
213
- (info-lookup->other-modes 'symbol mode))))
214
- (setcdr
215
- (info-lookup->mode-value 'symbol mode)
216
- (append
217
- (butlast (cdr (info-lookup->mode-value 'symbol mode)))
218
- `(,(cons 'tramp-info-lookup-mode
219
- (info-lookup->other-modes 'symbol mode)))))))
220
-
221
- ; ; Reset cache.
222
- (setq info-lookup-cache nil ))
241
+ (not (memq 'tramp-info-lookup-mode
242
+ (info-lookup->other-modes 'symbol mode))))
243
+ (setcdr (info-lookup->mode-value 'symbol mode)
244
+ (append (butlast (cdr (info-lookup->mode-value 'symbol mode)))
245
+ `((tramp-info-lookup-mode
246
+ . ,(info-lookup->other-modes 'symbol mode)))))
247
+ (setcdr (info-lookup->cache 'symbol )
248
+ (delete (info-lookup->mode-cache 'symbol mode)
249
+ (info-lookup->topic-cache 'symbol )))
250
+
251
+ (add-hook
252
+ 'tramp-integration-unload-hook
253
+ `(lambda ()
254
+ (setcdr (info-lookup->mode-value 'symbol ', mode )
255
+ (append (butlast
256
+ (cdr (info-lookup->mode-value 'symbol ', mode )))
257
+ (list
258
+ (delq 'tramp-info-lookup-mode
259
+ (info-lookup->other-modes 'symbol ', mode )))))
260
+ (setcdr (info-lookup->cache 'symbol )
261
+ (delete (info-lookup->mode-cache 'symbol ', mode )
262
+ (info-lookup->topic-cache 'symbol ))))))))
223
263
224
264
; ;; Default connection-local variables for Tramp:
225
265
0 commit comments