From: Aaron Maxwell <amax@redsymbol.net>
To: help-gnu-emacs@gnu.org
Subject: (source) Anything like this exist already? (buffer name intelligence)
Date: Fri, 11 Jan 2008 11:01:27 -0800 [thread overview]
Message-ID: <200801111101.27609.amax@redsymbol.net> (raw)
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
next reply other threads:[~2008-01-11 19:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 19:01 Aaron Maxwell [this message]
2008-01-11 19:48 ` (source) Anything like this exist already? (buffer name intelligence) Juanma Barranquero
[not found] ` <mailman.6054.1200080936.18990.help-gnu-emacs@gnu.org>
2008-01-11 20:10 ` Aaron Maxwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200801111101.27609.amax@redsymbol.net \
--to=amax@redsymbol.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).