From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "qingwuking@gmail.com" Newsgroups: gmane.emacs.help Subject: Re: How to get current filename and absolute path of the file in emacs? Date: 16 Apr 2007 02:32:58 -0700 Organization: http://groups.google.com Message-ID: <1176715978.566506.130700@p77g2000hsh.googlegroups.com> References: <87r6qkhpqd.fsf@voyager.informatimago.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1176716158 3183 80.91.229.12 (16 Apr 2007 09:35:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Apr 2007 09:35:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 16 11:35:52 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdNcl-00071S-7l for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2007 11:35:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdNhL-00089m-KY for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2007 05:40:35 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!postnews.google.com!p77g2000hsh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: 220.231.9.237 Original-X-Trace: posting.google.com 1176715978 18328 127.0.0.1 (16 Apr 2007 09:32:58 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 16 Apr 2007 09:32:58 +0000 (UTC) In-Reply-To: <87r6qkhpqd.fsf@voyager.informatimago.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.8.1.1) Gecko/20061208 Firefox/2.0.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p77g2000hsh.googlegroups.com; posting-host=220.231.9.237; posting-account=uWH2pQ0AAAAEj7SeC_wHiwbnp9OYGRBR Original-Xref: shelby.stanford.edu gnu.emacs.help:147116 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42720 Archived-At: On 4=D4=C216=C8=D5, =CF=C2=CE=E71=CA=B107=B7=D6, Pascal Bourguignon wrote: > QinGW 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.