[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: insert-file-name-into-minibuffer
From: |
Marcin Borkowski |
Subject: |
Re: insert-file-name-into-minibuffer |
Date: |
Wed, 13 Feb 2019 19:49:07 +0100 |
User-agent: |
mu4e 1.1.0; emacs 27.0.50 |
On 2019-02-09, at 23:19, Alexander Klimov <address@hidden> wrote:
> On Sat, 9 Feb 2019, Marcin Borkowski wrote:
>> > Yes (M-0 w), but opening Dired (BTW, dired-jump is not bound to C-x
>> > C-j in `emacs -Q') is likely even less direct.
>>
>> Of course, but I thought it might be useful for others reading this.
>
> I use
>
> (defun copy-buffer-file-name-as-kill (&optional nondirectory)
> (interactive "P")
> (let ((f (buffer-file-name)))
> (when nondirectory
> (setq f (file-name-nondirectory f)))
> (kill-new f)
> (message "%s" f)))
Nice, and really useful! I'm going to put it in my init.el, thanks.
> IMO it would be nice to have something like this bound to some key in
> `emacs -Q'; as well as something like insert-file-name-into-minibuffer
> because it is common to recall that you need the buffer file name only
> once you already started typing the compilation command. Furthermore,
> M-n does not insert buffer file name in M-x compile.
+1
--
Marcin Borkowski
http://mbork.pl
Re: insert-file-name-into-minibuffer, Marcin Borkowski, 2019/02/17