From: "Steven W. Orr" <steveo@syslang.net>
To: help-gnu-emacs@gnu.org
Subject: Re: insert name of current file
Date: Tue, 25 Jan 2011 22:41:37 -0500 [thread overview]
Message-ID: <4D3F97F1.3050904@syslang.net> (raw)
In-Reply-To: <AANLkTimdhrV-LssjDyV0rKXXDR0_+gYxxTKi6UMTjWvh@mail.gmail.com>
On 1/25/2011 4:59 PM, Gradivus wrote:
>
> Hi,
>
> Sorry I'm a noob.
>
> I wonder if someone knows how I can insert the current file's name
> (i.e., the name of the file I'm editing) at the cursor, and without the full path.
>
> Thanks,
>
> O
>
I know this isn't what you asked, but I've used this to death for years:
(defun insert-filename (fn)
"Use filename completion to insert a filename into current buffer."
(interactive "FFilename to insert: ")
(insert fn))
(define-key global-map [?\C-x ?\C-j] 'insert-filename)
Why limit yourself to just one filename? One other thing: This will insert the
whole pathname. Just get the filename you want and then just back up to the
beginning of the name, then M-Backspace to get rid of the offending prefix.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
next prev parent reply other threads:[~2011-01-26 3:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 21:59 insert name of current file Gradivus
2011-01-25 22:09 ` Dirk-Jan C. Binnema
2011-01-25 22:10 ` Deniz Dogan
2011-01-25 22:33 ` Oleksandr Gavenko
2011-01-26 3:41 ` Steven W. Orr [this message]
[not found] <mailman.7.1295992748.30245.help-gnu-emacs@gnu.org>
2011-01-25 23:15 ` Tim X
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=4D3F97F1.3050904@syslang.net \
--to=steveo@syslang.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).