From: Marcin Borkowski <mbork@mbork.pl>
To: Alexander Klimov <alserkli@inbox.ru>
Cc: emacs-devel@gnu.org
Subject: Re: insert-file-name-into-minibuffer
Date: Sun, 17 Feb 2019 08:09:40 +0100 [thread overview]
Message-ID: <87tvh2q4az.fsf@mbork.pl> (raw)
In-Reply-To: <bc04f1103f3dafb699ac56ac638f0b81@03dd7a6a0829ff12ab856207062826fb7>
On 2019-02-09, at 15:39, Alexander Klimov <alserkli@inbox.ru> 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
prev parent reply other threads:[~2019-02-17 7:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 14:39 insert-file-name-into-minibuffer Alexander Klimov
2019-02-09 14:50 ` insert-file-name-into-minibuffer Eli Zaretskii
2019-02-09 21:30 ` insert-file-name-into-minibuffer Alexander Klimov
2019-02-09 21:38 ` insert-file-name-into-minibuffer Marcin Borkowski
2019-02-09 21:50 ` insert-file-name-into-minibuffer Alexander Klimov
2019-02-09 21:59 ` insert-file-name-into-minibuffer Marcin Borkowski
2019-02-09 22:19 ` insert-file-name-into-minibuffer Alexander Klimov
2019-02-13 18:49 ` insert-file-name-into-minibuffer Marcin Borkowski
2019-02-17 7:09 ` Marcin Borkowski [this message]
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=87tvh2q4az.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=alserkli@inbox.ru \
--cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).