[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 07:07:06 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.94 (gnu/linux) |
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!
Now, how to put that in the clipboard? We know that when you type
C-w, the selection is put in the clipboard, so:
C-h k C-w
then click on simple.el (or type C-x o TAB RET) and read the source of
kill-region. We see that it calls kill-new; we move the cursor on
kill-new and type C-h f RET
(global-set-key (kbd "M-z")
(lambda ()
(interactive)
(kill-new (buffer-file-name))))
--
__Pascal Bourguignon__