unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pascal Bourguignon <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to get current filename and absolute path of the file in emacs?
Date: Mon, 16 Apr 2007 07:07:06 +0200	[thread overview]
Message-ID: <87r6qkhpqd.fsf@voyager.informatimago.com> (raw)
In-Reply-To: m3k5wdhtwj.fsf@qingw.com

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__

  parent reply	other threads:[~2007-04-16  5:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-16  3:37 How to get current filename and absolute path of the file in emacs? QinGW
2007-04-16  4:30 ` Eric Hanchrow
2007-04-16 19:36   ` Eli Zaretskii
2007-04-16 20:09     ` Eric Hanchrow
2007-04-16  5:07 ` Pascal Bourguignon [this message]
2007-04-16  8:57   ` Matthew Flaschen
2007-04-16  9:32   ` qingwuking
2007-04-16  9:33   ` qingwuking
     [not found]   ` <mailman.2121.1176714130.7795.help-gnu-emacs@gnu.org>
2007-04-16 11:39     ` Pascal Bourguignon
     [not found] ` <mailman.2113.1176698595.7795.help-gnu-emacs@gnu.org>
2007-04-16  9:35   ` qingwuking

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r6qkhpqd.fsf@voyager.informatimago.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).