emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs unconditionally loads tramp.el


From: Stefan Monnier
Subject: Re: Emacs unconditionally loads tramp.el
Date: Tue, 25 Apr 2006 14:44:00 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> So how about if move the Tramp completion function to files.el
>> in the same way?

> That would solve this problem. `tramp-completion-file-name-handler´ is
> sufficiently stable (last change on 2002-10-11). Shall I apply this patch?

BTW if you'd rather keep all the code in tramp.el rather than spread a bit
of it in files.el, you can use the ;;;###autoload trick.

That is, place in tramp.el either

;;;###autoload (defun tramp-completion-file-name-handler (operation &rest args)
;;;###autoload   "Invoke tramp file name completion handler.
;;;###autoload Falls back to normal file name handler if no tramp file name 
handler exists."
;;;###autoload ;;   (setq tramp-debug-buffer t)
;;;###autoload ;;   (tramp-message 1 "%s %s" operation args)
;;;###autoload ;;   (tramp-message 1 "%s %s\n%s"
;;;###autoload ;;                operation args (with-output-to-string 
(backtrace)))
;;;###autoload   (let ((fn (assoc operation 
tramp-completion-file-name-handler-alist)))
;;;###autoload     (if fn
;;;###autoload  (save-match-data (apply (cdr fn) args))
;;;###autoload       (tramp-completion-run-real-handler operation args))))

or

;;;###autoload
(progn
 (defun tramp-completion-file-name-handler (operation &rest args)
  "Invoke tramp file name completion handler.
Falls back to normal file name handler if no tramp file name handler exists."
;;   (setq tramp-debug-buffer t)
;;   (tramp-message 1 "%s %s" operation args)
;;   (tramp-message 1 "%s %s\n%s"
;;               operation args (with-output-to-string (backtrace)))
  (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
    (if fn
        (save-match-data (apply (cdr fn) args))
      (tramp-completion-run-real-handler operation args)))))

so that the complete function gets copied to loaddefs.el (not just a short
`autoload statement).  We use this in vc-*.el so that the code that
determines whether a file is under CVS or not can be in vc-cvs.el and
preloaded even though vc-cvs.el is not itself preloaded.


        Stefan




reply via email to

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