[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3479ec7: Make "Compiling" in the mode line a clicka
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 3479ec7: Make "Compiling" in the mode line a clickable command |
Date: |
Tue, 23 Jul 2019 13:50:05 -0400 (EDT) |
branch: master
commit 3479ec7332a474b3400cbc6b681c2a1f5637db94
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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).
---
lisp/progmodes/compile.el | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 4b2fc51..f4750c0 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -107,9 +107,30 @@ and a string describing how the process finished.")
(defvar compilation-in-progress nil
"List of compilation processes now running.")
-(or (assq 'compilation-in-progress minor-mode-alist)
- (setq minor-mode-alist (cons '(compilation-in-progress " Compiling")
- minor-mode-alist)))
+(or (assq 'compilation-in-progress mode-line-modes)
+ (add-to-list 'mode-line-modes
+ (list 'compilation-in-progress
+ (propertize "[Compiling] "
+ 'help-echo "Compiling; mouse-2: Goto Buffer"
+ 'mouse-face 'mode-line-highlight
+ 'local-map
+ (make-mode-line-mouse-map
+ 'mouse-2
+ #'compilation-goto-in-progress-buffer)))))
+
+(defun compilation-goto-in-progress-buffer ()
+ "Switch to the compilation buffer."
+ (interactive)
+ (cond
+ ((> (length compilation-in-progress) 1)
+ (switch-to-buffer (completing-read
+ "Several compilation buffers; switch to: "
+ (mapcar #'buffer-name compilation-in-progress)
+ nil t)))
+ (compilation-in-progress
+ (switch-to-buffer (process-buffer (car compilation-in-progress))))
+ (t
+ (error "No ongoing compilations"))))
(defvar compilation-error "error"
"Stem of message to print when no matches are found.")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 3479ec7: Make "Compiling" in the mode line a clickable command,
Lars Ingebrigtsen <=