* Misc. minor compile.el issues
@ 2002-12-06 0:34 Kim F. Storm
2002-12-06 16:55 ` Stefan Monnier
2002-12-07 21:26 ` Richard Stallman
0 siblings, 2 replies; 10+ messages in thread
From: Kim F. Storm @ 2002-12-06 0:34 UTC (permalink / raw)
The doc string for compilation-process-setup-function starts with a
`*' identifying it as a user option. Does that really make sense?
IMO, it is similar to compilation-buffer-name-function which is
not a user option.
Related to this, I would like the setup function to be able to
access the buffer and/or window for the compilation process (e.g.
to set buffer-local variables).
Currently, this can be achieved by accessing the dynamic bound
variables `outbuf' and `outwin' from the setup function, but that
seems like a gross hack.
It would make more sense to provide `outwin' as argument to the setup
function, but that would break existing code.
Alternatively, we could dynamically bind `compilation-window' and
`compilation-buffer' around the call to the setup function (and
document this "interface" in the compilation-process-setup-function
doc string).
This is still a hack, but using well-defined names.
As a final issue, I think that although the documentation for
compilation-process-setup-function says it is run just before the
process is started, it makes more sense to swap the following two
forms, to allow the setup function to control the
compilation-window-height:
(compilation-set-window-height outwin)
(if compilation-process-setup-function
(funcall compilation-process-setup-function))
In any case, I don't see any ill effects of swapping them.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-06 0:34 Misc. minor compile.el issues Kim F. Storm
@ 2002-12-06 16:55 ` Stefan Monnier
2002-12-06 20:15 ` Kim F. Storm
2002-12-07 21:26 ` Richard Stallman
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2002-12-06 16:55 UTC (permalink / raw)
Cc: emacs-devel
> Related to this, I would like the setup function to be able to
> access the buffer and/or window for the compilation process (e.g.
> to set buffer-local variables).
AFAIK, you can use (current-buffer). No need for `outbuf'.
Am I missing something ?
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-06 20:15 ` Kim F. Storm
@ 2002-12-06 20:14 ` Stefan Monnier
2002-12-07 1:49 ` Kim F. Storm
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2002-12-06 20:14 UTC (permalink / raw)
Cc: Stefan Monnier, emacs-devel
> > > Related to this, I would like the setup function to be able to
> > > access the buffer and/or window for the compilation process (e.g.
> > > to set buffer-local variables).
> >
> > AFAIK, you can use (current-buffer). No need for `outbuf'.
> > Am I missing something ?
>
> AFAICS, the setup function is (typically) not called with
> current-buffer == outbuf.
Huh? The only place where it is called seems to be in:
(with-current-buffer outbuf
(compilation-mode name-of-mode)
;; In what way is it non-ergonomic ? -stef
;; (toggle-read-only 1) ;;; Non-ergonomic.
(set (make-local-variable 'compilation-parse-errors-function) parser)
(set (make-local-variable 'compilation-error-message) error-message)
(set (make-local-variable 'compilation-error-regexp-alist)
error-regexp-alist)
(set (make-local-variable 'compilation-enter-directory-regexp-alist)
enter-regexp-alist)
(set (make-local-variable 'compilation-leave-directory-regexp-alist)
leave-regexp-alist)
(set (make-local-variable 'compilation-file-regexp-alist)
file-regexp-alist)
(set (make-local-variable 'compilation-nomessage-regexp-alist)
nomessage-regexp-alist)
(set (make-local-variable 'compilation-arguments)
(list command error-message
name-of-mode parser
error-regexp-alist name-function
enter-regexp-alist leave-regexp-alist
file-regexp-alist nomessage-regexp-alist))
;; This proves a good idea if the buffer's going to scroll
;; with lazy-lock on.
(set (make-local-variable 'lazy-lock-defer-on-scrolling) t)
(setq default-directory thisdir
compilation-directory-stack (list default-directory))
(set-window-start outwin (point-min))
(or (eq outwin (selected-window))
(set-window-point outwin (point-min)))
(compilation-set-window-height outwin)
(if compilation-process-setup-function
(funcall compilation-process-setup-function))
I don't see anything between the with-current-buffer and the call
to compilation-process-setup-function which could change current-buffer.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-06 16:55 ` Stefan Monnier
@ 2002-12-06 20:15 ` Kim F. Storm
2002-12-06 20:14 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Kim F. Storm @ 2002-12-06 20:15 UTC (permalink / raw)
Cc: emacs-devel
"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:
> > Related to this, I would like the setup function to be able to
> > access the buffer and/or window for the compilation process (e.g.
> > to set buffer-local variables).
>
> AFAIK, you can use (current-buffer). No need for `outbuf'.
> Am I missing something ?
AFAICS, the setup function is (typically) not called with
current-buffer == outbuf. We could of course change that, but maybe
there are some information in the source buffer (where M-x compile is
started) that could be accessed (e.g. default-directory, the buffer
name, or some buffer-local variable).
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-06 20:14 ` Stefan Monnier
@ 2002-12-07 1:49 ` Kim F. Storm
2002-12-09 15:31 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Kim F. Storm @ 2002-12-07 1:49 UTC (permalink / raw)
Cc: emacs-devel
"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:
> > > > Related to this, I would like the setup function to be able to
> > > > access the buffer and/or window for the compilation process (e.g.
> > > > to set buffer-local variables).
> > >
> > > AFAIK, you can use (current-buffer). No need for `outbuf'.
> > > Am I missing something ?
> >
> > AFAICS, the setup function is (typically) not called with
> > current-buffer == outbuf.
>
> Huh? The only place where it is called seems to be in:
>
> (with-current-buffer outbuf
[...]
> (set-window-start outwin (point-min))
> (or (eq outwin (selected-window))
> (set-window-point outwin (point-min)))
> (compilation-set-window-height outwin)
> (if compilation-process-setup-function
> (funcall compilation-process-setup-function))
>
> I don't see anything between the with-current-buffer and the call
> to compilation-process-setup-function which could change current-buffer.
Absolutely true... I was confusing outbuf/current-buffer [which are
identical] with outwin/selected-window which are not necessarily the
same. But I guess we can live without accessing the outwin...
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-06 0:34 Misc. minor compile.el issues Kim F. Storm
2002-12-06 16:55 ` Stefan Monnier
@ 2002-12-07 21:26 ` Richard Stallman
2002-12-08 1:38 ` Kim F. Storm
1 sibling, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2002-12-07 21:26 UTC (permalink / raw)
Cc: emacs-devel
The doc string for compilation-process-setup-function starts with a
`*' identifying it as a user option. Does that really make sense?
That depends on where we draw the line about what is a user option.
The line as currently drawn includes many similar variables. For
instance, 76 normal hooks are marked as user options, although the
usual place for them to be set is certainly in Lisp code.
Perhaps we should move the line and none of these should be user
options.
Related to this, I would like the setup function to be able to
access the buffer and/or window for the compilation process (e.g.
to set buffer-local variables).
Can we make them current while the hook runs?
As a final issue, I think that although the documentation for
compilation-process-setup-function says it is run just before the
process is started, it makes more sense to swap the following two
forms, to allow the setup function to control the
compilation-window-height:
(compilation-set-window-height outwin)
(if compilation-process-setup-function
(funcall compilation-process-setup-function))
Isn't it easier to do that with the current order? Currently,
compilation-process-setup-function could enlarge the window.
If it is called first, what would it do to alter the height?
Locally set compilation-window-height, perhaps?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-07 21:26 ` Richard Stallman
@ 2002-12-08 1:38 ` Kim F. Storm
2002-12-09 20:21 ` Richard Stallman
0 siblings, 1 reply; 10+ messages in thread
From: Kim F. Storm @ 2002-12-08 1:38 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> The doc string for compilation-process-setup-function starts with a
> `*' identifying it as a user option. Does that really make sense?
>
> That depends on where we draw the line about what is a user option.
> The line as currently drawn includes many similar variables. For
> instance, 76 normal hooks are marked as user options, although the
> usual place for them to be set is certainly in Lisp code.
I guess there are some hooks which are typically set by users (like
the various ...-mode-hook variables), while other hook variables (like
the above ...-setup-function) rarely has any meaning as a user option.
> Perhaps we should move the line and none of these should be user
> options.
The mode hook variables should be user options, the rest probably
should not. But I'll leave that decision to you :-)
>
> Related to this, I would like the setup function to be able to
> access the buffer and/or window for the compilation process (e.g.
> to set buffer-local variables).
>
> Can we make them current while the hook runs?
Stefan pointed out that the buffer is already current when the hook
is called ... so that's ok.
>
> As a final issue, I think that although the documentation for
> compilation-process-setup-function says it is run just before the
> process is started, it makes more sense to swap the following two
> forms, to allow the setup function to control the
> compilation-window-height:
>
> (compilation-set-window-height outwin)
> (if compilation-process-setup-function
> (funcall compilation-process-setup-function))
>
> Isn't it easier to do that with the current order? Currently,
> compilation-process-setup-function could enlarge the window.
> If it is called first, what would it do to alter the height?
> Locally set compilation-window-height, perhaps?
>
The problem is that compilation-set-window-height is also called
elsewhere, and in its current form does NOT look at the buffer-local
value of compilation-window-height in the compilation buffer if it is
not the current buffer. [I've fixed that, but not committed the
change yet].
And as I pointed out above, the setup-function does not have access to the
compilation window, only the compilation buffer (the current buffer).
For my purpose, the setup function does not need access to the window
if it is called before compilation-set-window-height (which _is_
called with the compilation window as argument).
So although it's a waste to first set the window height, and then call
the setup hook which sets it again, it isn't actually possible with the
current code!
IMHO, it makes more sense to let the hook set compilation-window-height
before compilation-set-window-height is called. And as I said, there
really isn't any practical reason why we should not change the order
[i.e. doing so will not break any existing code].
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-07 1:49 ` Kim F. Storm
@ 2002-12-09 15:31 ` Stefan Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2002-12-09 15:31 UTC (permalink / raw)
Cc: Stefan Monnier
> Absolutely true... I was confusing outbuf/current-buffer [which are
> identical] with outwin/selected-window which are not necessarily the
> same. But I guess we can live without accessing the outwin...
outwin will most of the time be the same
as (get-buffer-window (current-buffer)).
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-08 1:38 ` Kim F. Storm
@ 2002-12-09 20:21 ` Richard Stallman
2002-12-10 0:51 ` Kim F. Storm
0 siblings, 1 reply; 10+ messages in thread
From: Richard Stallman @ 2002-12-09 20:21 UTC (permalink / raw)
Cc: emacs-devel
And as I pointed out above, the setup-function does not have access to the
compilation window, only the compilation buffer (the current buffer).
Use get-buffer-window to find it?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Misc. minor compile.el issues
2002-12-09 20:21 ` Richard Stallman
@ 2002-12-10 0:51 ` Kim F. Storm
0 siblings, 0 replies; 10+ messages in thread
From: Kim F. Storm @ 2002-12-10 0:51 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> And as I pointed out above, the setup-function does not have access to the
> compilation window, only the compilation buffer (the current buffer).
>
> Use get-buffer-window to find it?
Yes, that will work most of the time.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-12-10 0:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-06 0:34 Misc. minor compile.el issues Kim F. Storm
2002-12-06 16:55 ` Stefan Monnier
2002-12-06 20:15 ` Kim F. Storm
2002-12-06 20:14 ` Stefan Monnier
2002-12-07 1:49 ` Kim F. Storm
2002-12-09 15:31 ` Stefan Monnier
2002-12-07 21:26 ` Richard Stallman
2002-12-08 1:38 ` Kim F. Storm
2002-12-09 20:21 ` Richard Stallman
2002-12-10 0:51 ` Kim F. Storm
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.