unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* (source) Anything like this exist already? (buffer name intelligence)
@ 2008-01-11 19:01 Aaron Maxwell
  2008-01-11 19:48 ` Juanma Barranquero
       [not found] ` <mailman.6054.1200080936.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron Maxwell @ 2008-01-11 19:01 UTC (permalink / raw)
  To: help-gnu-emacs

Here's the defun I refered to in my post a moment ago:
; Better handle similar buffer names
(defun extend-buffer-name (arg)
  "Extend the current buffer's name according to to its full file path.
With prefix arg, extend by N levels.  Default is one level."
  (interactive "P")
  (let ((path (buffer-file-name))
        (sep "/")
        (n (prefix-numeric-value arg)))
    (cond
     ((or (null path)
          (equal "" path))
      path)
     (t (let ((parts (reverse (split-string path sep))))
          (defun extend-once (sofar parts n)
            (cond
             ((or (< n 1)
                  (null parts))
              sofar)
             (t (extend-once (concatenate 'string (car parts) sep sofar)
                        (cdr parts)
                        (1- n)))))
          (rename-buffer (extend-once (car parts) (cdr parts) n)))))))



-- 
Aaron Maxwell
http://redsymbol.net

Business Owners and Self-Employed:  You're NOT Alone!
The Business Butler - http://businessbutler.us

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

* Re: (source) Anything like this exist already? (buffer name intelligence)
  2008-01-11 19:01 (source) Anything like this exist already? (buffer name intelligence) Aaron Maxwell
@ 2008-01-11 19:48 ` Juanma Barranquero
       [not found] ` <mailman.6054.1200080936.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Juanma Barranquero @ 2008-01-11 19:48 UTC (permalink / raw)
  To: Aaron Maxwell; +Cc: help-gnu-emacs

On Jan 11, 2008 8:01 PM, Aaron Maxwell <amax@redsymbol.net> wrote:

> Here's the defun I refered to in my post a moment ago:
> ; Better handle similar buffer names
> (defun extend-buffer-name (arg)
>   "Extend the current buffer's name according to to its full file path.
> With prefix arg, extend by N levels.  Default is one level."

Do you know about uniquify.el?

             Juanma

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

* Re: (source) Anything like this exist already? (buffer name  intelligence)
       [not found] ` <mailman.6054.1200080936.18990.help-gnu-emacs@gnu.org>
@ 2008-01-11 20:10   ` Aaron Maxwell
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Maxwell @ 2008-01-11 20:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 11, 11:48 am, "Juanma Barranquero" <lek...@gmail.com> wrote:
> Do you know about uniquify.el?

I did not. Thanks for pointing it out.

-A

>
>              Juanma

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

end of thread, other threads:[~2008-01-11 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 19:01 (source) Anything like this exist already? (buffer name intelligence) Aaron Maxwell
2008-01-11 19:48 ` Juanma Barranquero
     [not found] ` <mailman.6054.1200080936.18990.help-gnu-emacs@gnu.org>
2008-01-11 20:10   ` Aaron Maxwell

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).