[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: |
address@hidden |
Subject: |
Re: How to get current filename and absolute path of the file in emacs? |
Date: |
16 Apr 2007 02:32:58 -0700 |
User-agent: |
G2/1.0 |
On 4月16日, 下午1时07分, Pascal Bourguignon <p...@informatimago.com> wrote:
> QinGW <dealo...@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__
Thank you very much, this is very simple and useful.