emacs-devel
[Top][All Lists]
Advanced

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

Re: master 18b680cfd1: Fix bug#52467 by adding a new custom variable 'di


From: martin rudalics
Subject: Re: master 18b680cfd1: Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action'
Date: Mon, 3 Jan 2022 19:21:51 +0100

>> Perhaps the customized value structure should simply refer to major mode(s)?
>>
>> Then there won't be a need to create a predefined list with mappings.
>
> Indeed, this is what I use for the outbound buffer:

It's not sufficiently general.  For example, 'shell' first pops up the
buffer and then sets its major mode with an explanation that goes as

  ;; The buffer's window must be correctly set when we call comint
  ;; (so that comint sets the COLUMNS env var properly).
  (pop-to-buffer buffer)

Using the tools we have on board we could do something in the spirit of

(defun display-buffer-match-comint (_buffer action)
  (cadr (assq 'comint (cdr action))))

(customize-set-variable
 'display-buffer-alist
 '((display-buffer-match-comint
    display-buffer-same-window (nil))))

(pop-to-buffer "*shell*" '(nil . ((comint t))))

which means that customizing 'display-buffer-alist' with that value on
Emacs 28 will report a mismatch but that's the only mishap that should
happen.

We also could have 'display-buffer-assq-regexp' do

        (when (or (and (stringp key)
                       (string-match-p key buffer-name))
                  (and (functionp key)
                       (funcall key buffer-name action))
                  (and (symbolp key)
                       (cadr (assq key (cdr action)))))

so we could do away with 'display-buffer-match-comint' but then we would
have to change the custom type of 'display-buffer-alist' - no great deal
either.  WDYT?

martin



reply via email to

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