[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kill-compilation failing when there are several compilation buffers
From: |
Edward Welbourne |
Subject: |
Re: kill-compilation failing when there are several compilation buffers |
Date: |
Tue, 07 Aug 2007 11:30:01 +0200 |
ah !
I tried evaluating sub-expressions, albeit not in a compile-buffer.
When I evaluate
(compilation-buffer-internal-p (current-buffer))
I get thrown to the debugger: <quote src="*Backtrace*">
Debugger entered--Lisp error: (wrong-number-of-arguments #[nil "ÀÁ!"
[local-variable-p compilation-locs] 2
("/usr/share/emacs/22.1/lisp/progmodes/compile.elc" . 48467)] 1)
compilation-buffer-internal-p(#<buffer *temp*>)
eval((compilation-buffer-internal-p (current-buffer)))
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp)
</quote> so the problem's there. C-h f says <quote>
compilation-buffer-internal-p is a compiled Lisp function in `compile.el'.
(compilation-buffer-internal-p)
Test if inside a compilation buffer.
</quote> and /usr/share/emacs/22.1/lisp/progmodes/compile.el.gz
(helpfully uncompressed on the fly by emacs) says: <quote>
;;; test if a buffer is a compilation buffer, assuming we're in the buffer
(defsubst compilation-buffer-internal-p ()
"Test if inside a compilation buffer."
(local-variable-p 'compilation-locs))
;;; test if a buffer is a compilation buffer, using
compilation-buffer-internal-p
(defsubst compilation-buffer-p (buffer)
"Test if BUFFER is a compilation buffer."
(with-current-buffer buffer
(compilation-buffer-internal-p)))
</quote> so it looks like a typo in your patch - it should either call
compilation-buffer-p or omit the (current-buffer) parameter to
compilation-buffer-internal-p. (I should also note that the error
message produced, claiming and got the wrong number of arguments, was
was not so helpful !)
Changing the defun to <quote>
(defun compilation-find-buffer (&optional avoid-current)
"Return a compilation buffer.
If AVOID-CURRENT is nil, and
the current buffer is a compilation buffer, return it.
If AVOID-CURRENT is non-nil, return the current buffer
only as a last resort."
(if (and (compilation-buffer-internal-p)
(not avoid-current))
(current-buffer)
(next-error-find-buffer avoid-current 'compilation-buffer-internal-p)))
</quote> and doing C-c C-e to that fixes the bug :-)
Eddy.