Add new package.el commands for recompilation
* doc/emacs/package.texi (Package Installation): Document them. * lisp/emacs-lisp/package.el (package-recompile): (package-recompile-all): New commands (bug#27253).
This commit is contained in:
parent
217c41c7b0
commit
feb654b460
3 changed files with 43 additions and 0 deletions
|
@ -483,6 +483,16 @@ The default value is just @code{'(all)}.
|
|||
installed will be ignored. The @samp{muse} package will be listed in
|
||||
the package menu with the @samp{held} status.
|
||||
|
||||
@findex package-recompile
|
||||
@findex package-recompile-all
|
||||
Emacs byte code is quite stable, but it's possible for byte code to
|
||||
become outdated, or for the compiled files to rely on macros that have
|
||||
changed in new versions of Emacs. You can use the @kbd{M-x
|
||||
package-recompile} command to recompile a particular package, or
|
||||
@kbd{M-x package-recompile-all} to rebuild all the packages. (The
|
||||
latter command might take quite a while to run if you have many
|
||||
installed packages.)
|
||||
|
||||
@node Package Files
|
||||
@section Package Files and Directory Layout
|
||||
@cindex package directory
|
||||
|
|
5
etc/NEWS
5
etc/NEWS
|
@ -982,6 +982,11 @@ list-packages'.
|
|||
*** New command 'package-update-all'.
|
||||
This command allows updating all packages without any queries.
|
||||
|
||||
+++
|
||||
*** New commands 'package-recompile' and 'package-recompile-all'.
|
||||
These commands can be useful if the .elc files are out of date
|
||||
(invalid byte code and macros).
|
||||
|
||||
+++
|
||||
*** New DWIM action on 'x' in "*Packages*" buffer.
|
||||
If no packages are marked, 'x' will install the package under point if
|
||||
|
|
|
@ -2422,6 +2422,34 @@ object."
|
|||
'force 'nosave)
|
||||
(package-install pkg 'dont-select))
|
||||
|
||||
;;;###autoload
|
||||
(defun package-recompile (pkg)
|
||||
"Byte-compile package PKG again.
|
||||
PKG should be either a symbol, the package name, or a `package-desc'
|
||||
object."
|
||||
(interactive (list (intern (completing-read
|
||||
"Recompile package: "
|
||||
(mapcar #'symbol-name
|
||||
(mapcar #'car package-alist))))))
|
||||
(let ((pkg-desc (if (package-desc-p pkg)
|
||||
pkg
|
||||
(cadr (assq pkg package-alist)))))
|
||||
;; Delete the old .elc files to ensure that we don't inadvertently
|
||||
;; load them (in case they contain byte code/macros that are now
|
||||
;; invalid).
|
||||
(dolist (elc (directory-files (package-desc-dir pkg-desc) t "\\.elc\\'"))
|
||||
(delete-file elc))
|
||||
(package--compile pkg-desc)))
|
||||
|
||||
;;;###autoload
|
||||
(defun package-recompile-all ()
|
||||
"Byte-compile all installed packages.
|
||||
This is meant to be used only in the case the byte-compiled files
|
||||
are invalid due to changed byte-code, macros or the like."
|
||||
(interactive)
|
||||
(pcase-dolist (`(_ ,pkg-desc) package-alist)
|
||||
(package-recompile pkg-desc)))
|
||||
|
||||
;;;###autoload
|
||||
(defun package-autoremove ()
|
||||
"Remove packages that are no longer needed.
|
||||
|
|
Loading…
Add table
Reference in a new issue