* Shrinking grep/compile window to fit contents of buffer
@ 2007-11-13 8:18 Nordlöw
2007-11-13 8:52 ` Lennart Borgman (gmail)
[not found] ` <mailman.3418.1194943989.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Nordlöw @ 2007-11-13 8:18 UTC (permalink / raw)
To: help-gnu-emacs
How can I make emacs call shrink-window-if-larger-than-buffer() in the
message buffer upon completion of compile/grep?
Thanks in advance,
Nordlöw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Shrinking grep/compile window to fit contents of buffer
2007-11-13 8:18 Shrinking grep/compile window to fit contents of buffer Nordlöw
@ 2007-11-13 8:52 ` Lennart Borgman (gmail)
[not found] ` <mailman.3418.1194943989.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2007-11-13 8:52 UTC (permalink / raw)
To: Nordlöw; +Cc: help-gnu-emacs
Nordlöw wrote:
> How can I make emacs call shrink-window-if-larger-than-buffer() in the
> message buffer upon completion of compile/grep?
>
> Thanks in advance,
> Nordlöw
(info "(elisp) Standard Hooks")
Look at compilation-finish-functions.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Shrinking grep/compile window to fit contents of buffer
[not found] ` <mailman.3418.1194943989.18990.help-gnu-emacs@gnu.org>
@ 2007-11-13 9:38 ` Nordlöw
2007-11-13 9:56 ` Juanma Barranquero
[not found] ` <mailman.3423.1194947780.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Nordlöw @ 2007-11-13 9:38 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 13, 9:52 am, "Lennart Borgman (gmail)"
<lennart.borg...@gmail.com> wrote:
> Nordlöw wrote:
> > How can I make emacs call shrink-window-if-larger-than-buffer() in the
> > message buffer upon completion of compile/grep?
>
> > Thanks in advance,
> > Nordlöw
>
> (info "(elisp) Standard Hooks")
>
> Look at compilation-finish-functions.
I thought the following code should work:
(defun shrink-compilation-window-if-larger-than-buffer (buf str)
(shrink-window-if-larger-than-buffer)
)
(if t
(add-hook 'compilation-finish-functions
'shrink-compilation-window-if-larger-than-buffer)
)
but nothing happens. I believe I am missing a way to convert the BUF
argument to its window since shrink-window-if-larger-than-buffer()
needs a window as argument the above code does nothing yet.
/Nordlöw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Shrinking grep/compile window to fit contents of buffer
2007-11-13 9:38 ` Nordlöw
@ 2007-11-13 9:56 ` Juanma Barranquero
[not found] ` <mailman.3423.1194947780.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2007-11-13 9:56 UTC (permalink / raw)
To: Nordlöw; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
On 11/13/07, Nordlöw <per.nordlow@gmail.com> wrote:
> I believe I am missing a way to convert the BUF
> argument to its window
Try (get-buffer-window buf)
Juanma
[-- Attachment #2: Type: text/plain, Size: 152 bytes --]
_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Shrinking grep/compile window to fit contents of buffer
[not found] ` <mailman.3423.1194947780.18990.help-gnu-emacs@gnu.org>
@ 2007-11-13 10:06 ` Nordlöw
2007-11-14 9:26 ` David Rod
0 siblings, 1 reply; 6+ messages in thread
From: Nordlöw @ 2007-11-13 10:06 UTC (permalink / raw)
To: help-gnu-emacs
Great! Thanks! Here is the code that solves my problem:
;;;
---------------------------------------------------------------------------
;; Compilation Autoshrink
(defun shrink-compilation-window-if-larger-than-buffer (buf str)
(shrink-window-if-larger-than-buffer (get-buffer-window buf))
)
(defcustom compilation-window-shrink-to-fit t
"Define to non-nil to make compilation/grep-window shrink to fit its
contents.")
(if compilation-window-shrink-to-fit
(progn
(add-hook 'compilation-finish-functions
'shrink-compilation-window-if-larger-than-buffer)
(setq compilation-window-height nil)
(setq grep-window-height nil)
)
(progn
;; set to a specific height or nil if we use half of buffer height
(setq compilation-window-height 10)
(setq grep-window-height 20)
))
/Nordlöw
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Shrinking grep/compile window to fit contents of buffer
2007-11-13 10:06 ` Nordlöw
@ 2007-11-14 9:26 ` David Rod
0 siblings, 0 replies; 6+ messages in thread
From: David Rod @ 2007-11-14 9:26 UTC (permalink / raw)
To: help-gnu-emacs
an excellent link. base url describes mule and everything useful
--
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-11-14 9:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-13 8:18 Shrinking grep/compile window to fit contents of buffer Nordlöw
2007-11-13 8:52 ` Lennart Borgman (gmail)
[not found] ` <mailman.3418.1194943989.18990.help-gnu-emacs@gnu.org>
2007-11-13 9:38 ` Nordlöw
2007-11-13 9:56 ` Juanma Barranquero
[not found] ` <mailman.3423.1194947780.18990.help-gnu-emacs@gnu.org>
2007-11-13 10:06 ` Nordlöw
2007-11-14 9:26 ` David Rod
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).