emacs-devel
[Top][All Lists]
Advanced

[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: Sun, 17 Feb 2019 08:09:40 +0100
User-agent: mu4e 1.1.0; emacs 27.0.50

On 2019-02-09, at 15:39, Alexander Klimov <address@hidden> wrote:

> It is quite common to insert the name of the current file into the 
> argument of shell-command or compile command (both use 
> read-shell-command). I wonder what it the preferred way to do it?
>
> I currently use the following to allow M-. or C-u M-. to be used to
> insert the file name or its full path:
>
> (defun insert-file-name-into-minibuffer (full-path)
>   (interactive "P")
>   (let ((path (buffer-file-name (window-buffer 
> (minibuffer-selected-window)))))
>     (insert (if full-path
>                 path
>               (file-name-nondirectory path)))))
> (define-key minibuffer-local-map (kbd "M-.") 
> 'insert-file-name-into-minibuffer)

Hi, it seems I reinvented your code and written about it on my blog:
http://mbork.pl/2019-02-17_Inserting_the_current_file_name_at_point
(don't worry, you get the credit).  Thanks again!

Best,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]