mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-12 16:23:57 +00:00
Add Tramp recompilation
* doc/misc/tramp.texi (Frequently Asked Questions): Refer to GNU ELPA Tramp README. * lisp/net/tramp-cmds.el (tramp-recompile-elpa-command-completion-p) (tramp-recompile-elpa): New defuns. Add property `completion-predicate'.
This commit is contained in:
parent
07bb2cbf55
commit
518312346d
@ -5095,32 +5095,18 @@ two forms in your @file{~/.emacs} after loading the @code{tramp} and
|
||||
|
||||
@item
|
||||
I get a warning @samp{Tramp has been compiled with Emacs a.b, this is Emacs c.d}
|
||||
|
||||
@value{tramp} comes with compatibility code for different Emacs
|
||||
versions. When you see this warning, you don't use the Emacs built-in
|
||||
version of @value{tramp}. In case you have installed @value{tramp}
|
||||
from GNU ELPA, you must delete and reinstall it.
|
||||
@ifset installchapter
|
||||
In case you have installed it from its Git repository, @ref{Recompilation}.
|
||||
@end ifset
|
||||
|
||||
|
||||
@item
|
||||
I get an error @samp{tramp-file-name-handler: Invalid function:
|
||||
tramp-compat-with-mutex}
|
||||
|
||||
Likely, you have a running Emacs session with loaded @value{tramp},
|
||||
and you try to upgrade it to another version from GNU ELPA. Since
|
||||
@value{tramp} is not forward compatible, you must unload / reload it.
|
||||
Try the following steps:
|
||||
|
||||
@example
|
||||
@kbd{M-x tramp-unload-tramp @key{RET}}
|
||||
@kbd{M-x load-library @key{RET} tramp @key{RET}}
|
||||
@end example
|
||||
|
||||
If this doesn't work, you must restart Emacs with proper
|
||||
@code{load-path} for the new @value{tramp} version.
|
||||
@value{tramp} comes with compatibility code for different Emacs
|
||||
versions. When you see this warning, you don't use the Emacs built-in
|
||||
version of @value{tramp}. In case you have installed @value{tramp}
|
||||
from GNU ELPA, see the package README file for instructions how to
|
||||
recompile it.
|
||||
@ifset installchapter
|
||||
In case you have installed it from its Git repository, @ref{Recompilation}.
|
||||
@end ifset
|
||||
|
||||
|
||||
@item
|
||||
|
@ -472,6 +472,48 @@ For details, see `tramp-rename-files'."
|
||||
(function-put
|
||||
#'tramp-rename-these-files 'completion-predicate #'tramp-command-completion-p)
|
||||
|
||||
;; This function takes action since Emacs 28.1, when
|
||||
;; `read-extended-command-predicate' is set to
|
||||
;; `command-completion-default-include-p'.
|
||||
;;;###tramp-autoload
|
||||
(defun tramp-recompile-elpa-command-completion-p (_symbol _buffer)
|
||||
"A predicate for `tramp-recompile-elpa'.
|
||||
It is completed by \"M-x TAB\" only if package.el is loaded, and
|
||||
Tramp is an installed ELPA package."
|
||||
;; We cannot apply `package-installed-p', this would also return the
|
||||
;; builtin package.
|
||||
(tramp-compat-funcall 'package--user-installed-p 'tramp))
|
||||
|
||||
;;;###tramp-autoload
|
||||
(defun tramp-recompile-elpa ()
|
||||
"Recompile the installed Tramp ELPA package.
|
||||
This is needed if there are compatibility problems."
|
||||
;; (declare (completion tramp-recompile-elpa-command-completion-p))
|
||||
(interactive)
|
||||
;; We expect just one Tramp package is installed.
|
||||
(when-let
|
||||
((dir (tramp-compat-funcall
|
||||
'package-desc-dir
|
||||
(car (alist-get 'tramp (bound-and-true-p package-alist))))))
|
||||
(dolist (elc (directory-files dir 'full "\\.elc$"))
|
||||
(delete-file elc))
|
||||
(with-current-buffer (get-buffer-create byte-compile-log-buffer)
|
||||
(let ((inhibit-read-only t))
|
||||
(compilation-mode)
|
||||
(goto-char (point-max))
|
||||
(insert "\f\n")
|
||||
(call-process
|
||||
(expand-file-name invocation-name invocation-directory) nil t t
|
||||
"-Q" "-batch" "-L" dir
|
||||
"--eval" (format "(byte-recompile-directory %S 0 t)" dir))
|
||||
(message "Package `tramp' recompiled.")))))
|
||||
|
||||
;; Starting with Emacs 28.1, this can be replaced by the "(declare ...)" form.
|
||||
;;;###tramp-autoload
|
||||
(function-put
|
||||
#'tramp-recompile-elpa 'completion-predicate
|
||||
#'tramp-recompile-elpa-command-completion-p)
|
||||
|
||||
;; Tramp version is useful in a number of situations.
|
||||
|
||||
;;;###tramp-autoload
|
||||
|
Loading…
Reference in New Issue
Block a user