unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Customize dired buffer names
@ 2010-01-16 14:48 Francis Moreau
  2010-01-16 21:04 ` Kevin Rodgers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Francis Moreau @ 2010-01-16 14:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I'd like to change the way that the dired buffers got their names.

For now it's juste the name of the directory, but I'd like to add
"<Dired>" as prefix for example.

Is it possible ?

Thanks


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

* Re: Customize dired buffer names
  2010-01-16 14:48 Customize dired buffer names Francis Moreau
@ 2010-01-16 21:04 ` Kevin Rodgers
  2010-01-16 23:09 ` Juri Linkov
       [not found] ` <mailman.1558.1263683378.18930.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2010-01-16 21:04 UTC (permalink / raw)
  To: help-gnu-emacs

Francis Moreau wrote:
> I'd like to change the way that the dired buffers got their names.
> 
> For now it's juste the name of the directory, but I'd like to add
> "<Dired>" as prefix for example.
> 
> Is it possible ?

It is not customizable by design, but it should be possible:

(defadvice dired-noselect (after rename-buffer activate)
   "Add <Dired> prefix to buffer name."
   (with-current-buffer ad-return-value
     (rename-buffer (concat "<Dired>" (buffer-name)))))

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: Customize dired buffer names
  2010-01-16 14:48 Customize dired buffer names Francis Moreau
  2010-01-16 21:04 ` Kevin Rodgers
@ 2010-01-16 23:09 ` Juri Linkov
       [not found] ` <mailman.1558.1263683378.18930.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2010-01-16 23:09 UTC (permalink / raw)
  To: help-gnu-emacs

> I'd like to change the way that the dired buffers got their names.
>
> For now it's juste the name of the directory, but I'd like to add
> "<Dired>" as prefix for example.
>
> Is it possible ?

I use the following snippet to name dired buffers with absolute names:

(add-hook 'dired-after-readin-hook
          (lambda ()
            ;; Name dired buffers by absolute directory names.
	    ;; Use `generate-new-buffer-name' for vc-directory
	    ;; which creates duplicate buffers.
            (rename-buffer (generate-new-buffer-name dired-directory))
            ))

You could use something like

  (rename-buffer (concat "<Dired>" (directory-file-name dired-directory)))

-- 
Juri Linkov
http://www.jurta.org/emacs/





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

* Re: Customize dired buffer names
       [not found] ` <mailman.1558.1263683378.18930.help-gnu-emacs@gnu.org>
@ 2010-01-17 20:43   ` Francis Moreau
  0 siblings, 0 replies; 4+ messages in thread
From: Francis Moreau @ 2010-01-17 20:43 UTC (permalink / raw)
  To: help-gnu-emacs

On 17 jan, 00:09, Juri Linkov <j...@jurta.org> wrote:
> > I'd like to change the way that the dired buffers got their names.
>
> > For now it's juste the name of the directory, but I'd like to add
> > "<Dired>" as prefix for example.
>
> > Is it possible ?
>
> I use the following snippet to name dired buffers with absolute names:
>
> (add-hook 'dired-after-readin-hook
>           (lambda ()
>             ;; Name dired buffers by absolute directory names.
>             ;; Use `generate-new-buffer-name' for vc-directory
>             ;; which creates duplicate buffers.
>             (rename-buffer (generate-new-buffer-name dired-directory))
>             ))
>
> You could use something like
>
>   (rename-buffer (concat "<Dired>" (directory-file-name dired-directory)))

Ok, I'll do that.

Thanks both for your suggestions.


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

end of thread, other threads:[~2010-01-17 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-16 14:48 Customize dired buffer names Francis Moreau
2010-01-16 21:04 ` Kevin Rodgers
2010-01-16 23:09 ` Juri Linkov
     [not found] ` <mailman.1558.1263683378.18930.help-gnu-emacs@gnu.org>
2010-01-17 20:43   ` Francis Moreau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).