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 13:39:00 +0200	[thread overview]
Message-ID: <87wt0cft0r.fsf@voyager.informatimago.com> (raw)
In-Reply-To: mailman.2121.1176714130.7795.help-gnu-emacs@gnu.org

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

  parent reply	other threads:[~2007-04-16 11:39 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
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 [this message]
     [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=87wt0cft0r.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).