From: Alexander Klimov <alserkli@inbox.ru>
To: emacs-devel@gnu.org
Subject: insert-file-name-into-minibuffer
Date: Sat, 9 Feb 2019 14:39:36 +0000 [thread overview]
Message-ID: <bc04f1103f3dafb699ac56ac638f0b81@03dd7a6a0829ff12ab856207062826fb7> (raw)
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)
--
Regards,
ASK
next reply other threads:[~2019-02-09 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 14:39 Alexander Klimov [this message]
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 ` insert-file-name-into-minibuffer Marcin Borkowski
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=bc04f1103f3dafb699ac56ac638f0b81@03dd7a6a0829ff12ab856207062826fb7 \
--to=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).