help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Shrinking grep/compile window to fit contents of buffer


From: Nordlöw
Subject: Re: Shrinking grep/compile window to fit contents of buffer
Date: Tue, 13 Nov 2007 02:06:10 -0800
User-agent: G2/1.0

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



reply via email to

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