help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: insert name of current file


From: Steven W. Orr
Subject: Re: insert name of current file
Date: Tue, 25 Jan 2011 22:41:37 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]