[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to prevent Emacs from translating beginning of file path into "~
From: |
tomas |
Subject: |
Re: How to prevent Emacs from translating beginning of file path into "~"? |
Date: |
Fri, 10 Apr 2015 11:22:33 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Apr 10, 2015 at 03:16:07PM +0600, Yuri Khan wrote:
> On Fri, Apr 10, 2015 at 2:49 PM, <tomas@tuxteam.de> wrote:
>
> > What can be modified too is the value copied to the kill ring
> > (mumble mumble "clipboard" mumble) when the current buffer has
> > no obvious file name -- I'm doing "" here
>
> Might be beneficial to use dired-directory for dired buffers.
Yep. Nice idea. Expanded version:
(defun copy-current-filename-as-kill ()
(interactive)
(let ((filename (or buffer-file-name
dired-directory)))
(kill-new
(or (and filename
(expand-file-name filename))
""))))
Just extend the (or ...) to taste for more cases :-)
Thanks
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAlUnllkACgkQBcgs9XrR2kYyEACfVbmdPmhhRjAh0vDFrL4l4VFB
QhIAn2FiUIxdCTiKHhKQVqQpR+cbtTZn
=8YHw
-----END PGP SIGNATURE-----
Re: How to prevent Emacs from translating beginning of file path into "~"?, Stefan Monnier, 2015/04/10