all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* list-buffers behavior customization
@ 2016-05-05 20:47 Carlos Konstanski
  2016-05-05 22:46 ` Michael Heerdegen
  2016-05-07  0:55 ` Bernardo
  0 siblings, 2 replies; 7+ messages in thread
From: Carlos Konstanski @ 2016-05-05 20:47 UTC (permalink / raw)
  To: help-gnu-emacs

I quite often have 3 or 4 emacs frames open. Whenever I do a
list-buffers, it opens in whatever frame it appeared last. This is
usually not what I want. I want it to open in the frame that is
currently in focus.

The implementation looks like the following:

(defun list-buffers-noselect (&optional files-only buffer-list)
  (let ((old-buffer (current-buffer))
	(buffer (get-buffer-create "*Buffer List*")))
    (with-current-buffer buffer
      (Buffer-menu-mode)
      (setq Buffer-menu-files-only
	    (and files-only (>= (prefix-numeric-value files-only) 0)))
      (list-buffers--refresh buffer-list old-buffer)
      (tabulated-list-print))
    buffer))

The sexp (get-buffer-create "*Buffer List*") is where this behavior is
coming from.

Before I try to find some way to hack this function so that it deletes
the pre-existing buffer first, is there a hook where I can do this?

Thank you,
Carlos Konstanski



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-05 20:47 list-buffers behavior customization Carlos Konstanski
@ 2016-05-05 22:46 ` Michael Heerdegen
  2016-05-06 13:03   ` Carlos Konstanski
  2016-05-07  0:55 ` Bernardo
  1 sibling, 1 reply; 7+ messages in thread
From: Michael Heerdegen @ 2016-05-05 22:46 UTC (permalink / raw)
  To: help-gnu-emacs

Carlos Konstanski <ckonstanski@pippiandcarlos.com> writes:

> I quite often have 3 or 4 emacs frames open. Whenever I do a
> list-buffers, it opens in whatever frame it appeared last. This is
> usually not what I want. I want it to open in the frame that is
> currently in focus.
>
> [...]
> The sexp (get-buffer-create "*Buffer List*") is where this behavior is
> coming from.

`get-buffer-create' may return an existing buffer of that name, but
nothing more: it doesn't decide where to display it etc.  That is done
by `display-buffer'.  So I think you just want to customize
`display-buffer-alist'?


Regards,

Michael.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-05 22:46 ` Michael Heerdegen
@ 2016-05-06 13:03   ` Carlos Konstanski
  2016-05-06 19:18     ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Carlos Konstanski @ 2016-05-06 13:03 UTC (permalink / raw)
  To: help-gnu-emacs

Am 05.05.2016 um 16:46 schrieb Michael Heerdegen:
> Carlos Konstanski <ckonstanski@pippiandcarlos.com> writes:
> 
>> I quite often have 3 or 4 emacs frames open. Whenever I do a
>> list-buffers, it opens in whatever frame it appeared last. This is
>> usually not what I want. I want it to open in the frame that is
>> currently in focus.
>>
>> [...]
>> The sexp (get-buffer-create "*Buffer List*") is where this behavior is
>> coming from.
> 
> `get-buffer-create' may return an existing buffer of that name, but
> nothing more: it doesn't decide where to display it etc.  That is done
> by `display-buffer'.  So I think you just want to customize
> `display-buffer-alist'?
> 
> 
> Regards,
> 
> Michael.

Thanks! This solution works:


 '(display-buffer-alist
   (quote
    (("*Buffer*" display-buffer-same-window
      (allow-no-window . t)))))

Carlos



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-06 13:03   ` Carlos Konstanski
@ 2016-05-06 19:18     ` Stefan Monnier
  2016-05-06 19:29       ` Carlos Konstanski
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2016-05-06 19:18 UTC (permalink / raw)
  To: help-gnu-emacs

> Thanks! This solution works:

>  '(display-buffer-alist
>    (quote
>     (("*Buffer*" display-buffer-same-window
>       (allow-no-window . t)))))

I assume you mean

    (setq display-buffer-alist
          '(("*Buffer*" display-buffer-same-window
            (allow-no-window . t))))

because the code you quoted above does nothing at all in itself (it's
just a constant list, not a command/instruction).


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-06 19:18     ` Stefan Monnier
@ 2016-05-06 19:29       ` Carlos Konstanski
  2016-05-06 19:36         ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Carlos Konstanski @ 2016-05-06 19:29 UTC (permalink / raw)
  To: help-gnu-emacs

Am 06.05.2016 um 13:18 schrieb Stefan Monnier:
>> Thanks! This solution works:
> 
>>  '(display-buffer-alist
>>    (quote
>>     (("*Buffer*" display-buffer-same-window
>>       (allow-no-window . t)))))
> 
> I assume you mean
> 
>     (setq display-buffer-alist
>           '(("*Buffer*" display-buffer-same-window
>             (allow-no-window . t))))
> 
> because the code you quoted above does nothing at all in itself (it's
> just a constant list, not a command/instruction).
> 
> 
>         Stefan

I copied and pasted from .emacs after using the customize-variable
doohickey within emacs. This felt like the right way to customize this
variable.

Carlos



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-06 19:29       ` Carlos Konstanski
@ 2016-05-06 19:36         ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-05-06 19:36 UTC (permalink / raw)
  To: help-gnu-emacs

> I copied and pasted from .emacs after using the customize-variable
> doohickey within Emacs.

So you took it out of context.  That context says:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.

If you use customize-variable, then the better way is to tell the other
user to do the same ;-)


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: list-buffers behavior customization
  2016-05-05 20:47 list-buffers behavior customization Carlos Konstanski
  2016-05-05 22:46 ` Michael Heerdegen
@ 2016-05-07  0:55 ` Bernardo
  1 sibling, 0 replies; 7+ messages in thread
From: Bernardo @ 2016-05-07  0:55 UTC (permalink / raw)
  To: help-gnu-emacs


> I quite often have 3 or 4 emacs frames open. Whenever I do a
> list-buffers, it opens in whatever frame it appeared last. This is
> usually not what I want. I want it to open in the frame that is
> currently in focus.

did you try adding "*Buffer List*" to the same-window-buffer-names ?




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-05-07  0:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-05 20:47 list-buffers behavior customization Carlos Konstanski
2016-05-05 22:46 ` Michael Heerdegen
2016-05-06 13:03   ` Carlos Konstanski
2016-05-06 19:18     ` Stefan Monnier
2016-05-06 19:29       ` Carlos Konstanski
2016-05-06 19:36         ` Stefan Monnier
2016-05-07  0:55 ` Bernardo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.