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

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

Re: How to get current filename and absolute path of the file in emacs?


From: Pascal Bourguignon
Subject: Re: How to get current filename and absolute path of the file in emacs?
Date: Mon, 16 Apr 2007 13:39:00 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (gnu/linux)

Matthew Flaschen <matthew.flaschen@gatech.edu> writes:

> Pascal Bourguignon wrote:
>> QinGW <dealover@21cn.com> writes:
>> 
>>> I want to put current filename and file path to clipboard and I cant
>>> get it by short key.how can I implement it?
>>> Thank a lot.
>> 
>> M-x apropos RET file name RET
>> 
>> We find a buffer-file-name function... interesting!
>> 
> I'd kind of just like to make buffer-file-name an interactive function
> (not create a wrapper function with a different name).  Anyone know how
> to do this?

Well, you can call all function with: M-: (fun args...) RET
like:

M-: (buffer-file-name) RET

So it's hardly worth it.
If you want to bind it to a key:

(global-set-key (kbd "<f5>") (lambda ()
                                (interactive)
                                (buffer-file-name)))

If you really want a command:

(defun command-buffer-file-name ()
    (interactive)
    (buffer-file-name))

and:

M-x command-buffer-file-name RET

or:

(global-set-key (kbd "<f5>") 'command-buffer-file-name)

and:

<f5>


If the function takes arguments read the doc of interactive and add
them to the command.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Pour moi, la grande question n'a jamais été: «Qui suis-je? Où vais-je?» 
comme l'a formulé si adroitement notre ami Pascal, mais plutôt: 
«Comment vais-je m'en tirer?» -- Jean Yanne


reply via email to

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