[Top][All Lists]

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

How to best use the display-buffer-function?

From: Klaus Berndl
Subject: How to best use the display-buffer-function?
Date: 05 Feb 2004 08:50:10 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Suppose i want to some checks before `display-buffer'. If the checks are true
then i always want to display the buffer in a special window at my frame, if
the checks fail i want to proceed with standard display-buffer, i.e.
`display-buffer' should choose the window according to all its rules.

Currently i have something like (simplified):

(defun my-display-buffer-function (buffer not-this-window)
  (if (my-pre-checks)
      ;; then display the BUFFER in a special window at the frame
      (my-display-buffer-in-special-window buffer)
    ;; otherwise delegate the buffer-display to the original `display-buffer'
    (let ((display-buffer-function nil))
      (display-buffer buffer not-this-window))))

(setq display-buffer-function my-display-buffer-function)
Is this a good way to do this?

Another question: Why a display-buffer-function gets only two args and not
three like the `display-buffer'?

Thanks for comments, hints and help,

Klaus Berndl                    mailto: address@hidden
sd&m AG               
software design & management    
Carl-Wery-Str. 42, 81739 Muenchen, Germany
Tel +49 89 63812-392, Fax -220

reply via email to

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