unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Shrinking grep/compile window to fit contents of buffer
Date: Tue, 13 Nov 2007 02:06:10 -0800	[thread overview]
Message-ID: <1194948370.123761.38960@57g2000hsv.googlegroups.com> (raw)
In-Reply-To: <mailman.3423.1194947780.18990.help-gnu-emacs@gnu.org>

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

  parent reply	other threads:[~2007-11-13 10:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-11-14  9:26         ` David Rod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194948370.123761.38960@57g2000hsv.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).