unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
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 22:36:01 +0300	[thread overview]
Message-ID: <uzm58i02m.fsf@gnu.org> (raw)
In-Reply-To: <87abx93pr8.fsf@offby1.atm01.sea.blarg.net> (message from Eric Hanchrow on Sun, 15 Apr 2007 21:30:19 -0700)

> From: Eric Hanchrow <offby1@blarg.net>
> Date: Sun, 15 Apr 2007 21:30:19 -0700
> 
> (defun copy-buffer-file-name (use-backslashes)
>   "Puts the file name of the current buffer (or the current directory,
> if the buffer isn't visiting a file) onto the kill ring, so that it
> can be retrieved with \\[yank], or by another program.  With argument,
> uses backslashes instead of forward slashes."
>   (interactive "P")
>   (let ((fn (subst-char-in-string
>              ?/
>              (if use-backslashes ?\\ ?/)

It's easier to use convert-standard-filename to mirror slashes into
backslashes.  The nice side effect is that the code that calls
copy-buffer-file-name will now become 100% portable, because you no
longer need the use-backslashes flag to DTRT.

  reply	other threads:[~2007-04-16 19:36 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 [this message]
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
     [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=uzm58i02m.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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).