From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: Gradivus <mondifero@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: insert name of current file
Date: Tue, 25 Jan 2011 23:10:05 +0100 [thread overview]
Message-ID: <AANLkTikfdtmaZJO7t7+v8-g0Cgz-qXxVyj7qFihOycRQ@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimdhrV-LssjDyV0rKXXDR0_+gYxxTKi6UMTjWvh@mail.gmail.com>
2011/1/25 Gradivus <mondifero@gmail.com>:
>
> Hi,
>
> Sorry I'm a noob.
>
You're excused!
> 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.
>
As far as I know, there is no such functionality by default, but put
this in your init file to bind "C-c i f" to it:
(defun insert-buffer-file-name ()
"Inserts the name of the file for the current buffer."
(interactive)
(if buffer-file-name
(insert (file-name-nondirectory buffer-file-name))
(message "No file associated with buffer.")))
(global-set-key (kbd "C-c i f") 'insert-buffer-file-name)
Hope that helps,
Deniz Dogan
next prev parent reply other threads:[~2011-01-25 22:10 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 [this message]
2011-01-25 22:33 ` Oleksandr Gavenko
2011-01-26 3:41 ` Steven W. Orr
[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=AANLkTikfdtmaZJO7t7+v8-g0Cgz-qXxVyj7qFihOycRQ@mail.gmail.com \
--to=deniz.a.m.dogan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=mondifero@gmail.com \
/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).