[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: M-x compile should tell its status (a little bit better)..

From: Kevin Rodgers
Subject: Re: M-x compile should tell its status (a little bit better)..
Date: Fri, 23 Apr 2004 12:01:55 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv: Gecko/20020406 Netscape6/6.2.2

Richard Stallman wrote:

    Right know when starting compile it shows "Compiling" in the mode line.
    When i started several compilations in parallel i found it confusing that
    i could not find out if one of them has already finished. Execpt by
    switching to that buffer and looking at its mode line...
    So how about to change compile to reflect that info in its mode name so

Could you say more precisely what change you have in mind
in the mode line contents?

I think the idea is not to change the mode line, but to change the mode name

so that the status is apparent from `M-x list-buffers'.  I think the following
provides the desired effect, but it's just for illustration:

(defvar compilation-mode-name nil)

;; change `after' to `before', to avoid stomping on compilation-handle-exit:
(defadvice compilation-sentinel (after mode-name activate)
  "Set `mode-name' instead of `mode-line-process' to reflect the PROCess 
  (let ((buffer (process-buffer (ad-get-arg 0)))
        (status (process-status (ad-get-arg 0))))
    (when (buffer-live-p buffer)
        (set-buffer buffer)
        ;; save the original mode name:
        (unless compilation-mode-name
          (set (make-local-variable 'compilation-mode-name) mode-name))
        ;; construct a mode name from the original plus the status:
        (setq mode-name
              (format "%s:%s)" compilation-mode-name status))
        ;; remove redundant status from the mode line:
        (setq mode-line-process nil)))))

(defadvice compile-internal (after compilation-sentinel activate)
  "Call `compilation-sentinel' to set `mode-name'."
  (compilation-sentinel (get-buffer-process compilation-last-buffer)

Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]