diff options
| author | Lars Ingebrigtsen | 2019-10-01 15:39:59 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-01 15:40:05 +0200 |
| commit | ad33e3e549e24c48259c6bdfb069e41be0a31f98 (patch) | |
| tree | c77263f9968d7cd85662d99b6de8a37627d57ea7 | |
| parent | 7b87e73ddc007d1ddebd65effe8c1ac0d4eb5530 (diff) | |
| download | emacs-ad33e3e549e24c48259c6bdfb069e41be0a31f98.tar.gz emacs-ad33e3e549e24c48259c6bdfb069e41be0a31f98.zip | |
Add a new command in *Compile-Log* buffers to re-byte-compile
* lisp/emacs-lisp/bytecomp.el (emacs-lisp-compilation-recompile):
New command (bug#4516).
(emacs-lisp-compilation--current-file)
(emacs-lisp-compilation-mode-map): New variables with new `g'
binding.
(byte-compile-log-file): Set variable so that `g' can recompile it.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 21 |
2 files changed, 25 insertions, 1 deletions
| @@ -582,6 +582,11 @@ This is because on the one hand it suffers from various misbehaviors in corner | |||
| 582 | cases that have plagued it for years, and on the other experiments indicated | 582 | cases that have plagued it for years, and on the other experiments indicated |
| 583 | that it doesn't bring any measurable benefit. | 583 | that it doesn't bring any measurable benefit. |
| 584 | 584 | ||
| 585 | --- | ||
| 586 | *** The 'g' keystroke in *Compile-Log* buffers has been bound to a new | ||
| 587 | command that will recompile the file previously compiled with 'M-x | ||
| 588 | byte-compile-file' and the like. | ||
| 589 | |||
| 585 | ** compile.el | 590 | ** compile.el |
| 586 | --- | 591 | --- |
| 587 | *** In 'compilation-error-regexp-alist', 'line' (and 'end-line') can | 592 | *** In 'compilation-error-regexp-alist', 'line' (and 'end-line') can |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 44a65ed4c6a..2b26390b180 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1045,8 +1045,26 @@ message buffer `default-directory'." | |||
| 1045 | :type '(repeat (choice (const :tag "Default" nil) | 1045 | :type '(repeat (choice (const :tag "Default" nil) |
| 1046 | (string :tag "Directory")))) | 1046 | (string :tag "Directory")))) |
| 1047 | 1047 | ||
| 1048 | (defvar emacs-lisp-compilation-mode-map | ||
| 1049 | (let ((map (make-sparse-keymap))) | ||
| 1050 | (set-keymap-parent map compilation-minor-mode-map) | ||
| 1051 | (define-key map "g" 'emacs-lisp-compilation-recompile) | ||
| 1052 | map)) | ||
| 1053 | |||
| 1054 | (defvar emacs-lisp-compilation--current-file nil) | ||
| 1055 | |||
| 1048 | (define-compilation-mode emacs-lisp-compilation-mode "elisp-compile" | 1056 | (define-compilation-mode emacs-lisp-compilation-mode "elisp-compile" |
| 1049 | "The variant of `compilation-mode' used for emacs-lisp compilation buffers.") | 1057 | "The variant of `compilation-mode' used for emacs-lisp compilation buffers." |
| 1058 | (setq-local emacs-lisp-compilation--current-file nil)) | ||
| 1059 | |||
| 1060 | (defun emacs-lisp-compilation-recompile () | ||
| 1061 | "Recompile the previously byte-compiled file." | ||
| 1062 | (interactive) | ||
| 1063 | (unless emacs-lisp-compilation--current-file | ||
| 1064 | (error "No previously compiled file")) | ||
| 1065 | (unless (stringp emacs-lisp-compilation--current-file) | ||
| 1066 | (error "Only files can be recompiled")) | ||
| 1067 | (byte-compile-file emacs-lisp-compilation--current-file)) | ||
| 1050 | 1068 | ||
| 1051 | (defvar byte-compile-current-form nil) | 1069 | (defvar byte-compile-current-form nil) |
| 1052 | (defvar byte-compile-dest-file nil) | 1070 | (defvar byte-compile-dest-file nil) |
| @@ -1236,6 +1254,7 @@ message buffer `default-directory'." | |||
| 1236 | ;; Do this after setting default-directory. | 1254 | ;; Do this after setting default-directory. |
| 1237 | (unless (derived-mode-p 'compilation-mode) | 1255 | (unless (derived-mode-p 'compilation-mode) |
| 1238 | (emacs-lisp-compilation-mode)) | 1256 | (emacs-lisp-compilation-mode)) |
| 1257 | (setq emacs-lisp-compilation--current-file byte-compile-current-file) | ||
| 1239 | (compilation-forget-errors) | 1258 | (compilation-forget-errors) |
| 1240 | pt)))) | 1259 | pt)))) |
| 1241 | 1260 | ||