diff options
| author | Lars Ingebrigtsen | 2019-07-23 19:49:48 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-23 19:49:56 +0200 |
| commit | 3479ec7332a474b3400cbc6b681c2a1f5637db94 (patch) | |
| tree | 17d7e4135eccd410cf703d623f2b5a63957986c2 | |
| parent | f9337bc36d17a8819c0d05be8d3a1edcc34c6c79 (diff) | |
| download | emacs-3479ec7332a474b3400cbc6b681c2a1f5637db94.tar.gz emacs-3479ec7332a474b3400cbc6b681c2a1f5637db94.zip | |
Make "Compiling" in the mode line a clickable command
* lisp/progmodes/compile.el (compilation-goto-in-progress-buffer):
New command.
(compilation-in-progress): Don't put the in-progress mode-line
marker among the minor modes (because it's not a minor mode), and
add a command that allows you to switch to the in-progress
compilation buffer (bug#27252).
| -rw-r--r-- | lisp/progmodes/compile.el | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 4b2fc516c3d..f4750c00590 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -107,9 +107,30 @@ and a string describing how the process finished.") | |||
| 107 | 107 | ||
| 108 | (defvar compilation-in-progress nil | 108 | (defvar compilation-in-progress nil |
| 109 | "List of compilation processes now running.") | 109 | "List of compilation processes now running.") |
| 110 | (or (assq 'compilation-in-progress minor-mode-alist) | 110 | (or (assq 'compilation-in-progress mode-line-modes) |
| 111 | (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") | 111 | (add-to-list 'mode-line-modes |
| 112 | minor-mode-alist))) | 112 | (list 'compilation-in-progress |
| 113 | (propertize "[Compiling] " | ||
| 114 | 'help-echo "Compiling; mouse-2: Goto Buffer" | ||
| 115 | 'mouse-face 'mode-line-highlight | ||
| 116 | 'local-map | ||
| 117 | (make-mode-line-mouse-map | ||
| 118 | 'mouse-2 | ||
| 119 | #'compilation-goto-in-progress-buffer))))) | ||
| 120 | |||
| 121 | (defun compilation-goto-in-progress-buffer () | ||
| 122 | "Switch to the compilation buffer." | ||
| 123 | (interactive) | ||
| 124 | (cond | ||
| 125 | ((> (length compilation-in-progress) 1) | ||
| 126 | (switch-to-buffer (completing-read | ||
| 127 | "Several compilation buffers; switch to: " | ||
| 128 | (mapcar #'buffer-name compilation-in-progress) | ||
| 129 | nil t))) | ||
| 130 | (compilation-in-progress | ||
| 131 | (switch-to-buffer (process-buffer (car compilation-in-progress)))) | ||
| 132 | (t | ||
| 133 | (error "No ongoing compilations")))) | ||
| 113 | 134 | ||
| 114 | (defvar compilation-error "error" | 135 | (defvar compilation-error "error" |
| 115 | "Stem of message to print when no matches are found.") | 136 | "Stem of message to print when no matches are found.") |