[Top][All Lists]

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

Re: display-buffer-alist simplifications

From: Chong Yidong
Subject: Re: display-buffer-alist simplifications
Date: Fri, 12 Aug 2011 14:03:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>     "Specifications of user preferences for `display-buffer'.
>>   This is a list of elements of the form (CONDITION . ACTION)
>>   where CONDITION is either a regexp matching buffer names, or a function
>>   that takes a buffer and returns a boolean.
>>   ACTION is a list of the form (FUNCTION . ALIST) where FUNCTION can be
>>   either a function or a list of functions.

This is probably more simply stated as

  This is a list of elements of the form (CONDITION FUNCTIONS ACTION-ARGS...)

>>   (defun display-buffer (&optional buffer action)
>>     "Display BUFFER in some window."
>>     (let* ((user-action
>>             (assq-regexp (buffer-name buffer) display-buffer-alist))
>>           (functions (append (car display-buffer-overriding-action)
>>                              (car user-action)
>>                              (car action)
> Here the user has only two choices: Either accept the (car action) with
> its alist or use its own (car user-action) with its own alist.
>>                              (car display-buffer-default-action)))

I don't see any problem with that.

> As a next step suppose Chong wants to adjust the height of the new
> window created by `display-buffer-near-minibuffer' calling, for
> example, `fit-window-to-buffer'.  We'll soon find someone who dislikes
> this behavior and wants `display-buffer' to leave the new height
> alone.  So someone will propose to add a new user option to turn that
> behavior off.

It's not necessary for a new option.  This can be handled with an
element in display-buffer-default-action, since the alist of arguments
passed to the display function is constructed by

>>           (alist (append (cdr display-buffer-overriding-action)
>>                          (cdr user-action)
>>                          (cdr action)
>>                          (cdr display-buffer-default-action))))

The display function just needs to know about that alist element.  So I
don't think this objection is valid.

reply via email to

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