[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: M-! M-n should fetch filename (Re: FFAP)
From: |
Juri Linkov |
Subject: |
Re: M-! M-n should fetch filename (Re: FFAP) |
Date: |
Tue, 10 Nov 2009 02:59:18 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) |
>> What is missing is an ability of M-! M-n to fetch the filename as the
>> default in Dired mode using `dired-get-filename'.
>
> I don't have an opinion on whether that's good/bad/useful/...
It is useful when there is a need to prepare and run a command
from Dired with a file name in the middle of the command line,
i.e. instead of fiddling with `*' and `?' surrounded by whitespace
and hoping to get the right result with the `!' command,
it is easier just to type `M-! M-n' and build the explicit
command line based on the file name at point.
> If people find it to be a good feature, please rework the patch so
> there's only one call to file-relative-name, rather than one in each
> branch of the test.
Below is a version with only one call to file-relative-name:
Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.1022
diff -c -r1.1022 simple.el
*** lisp/simple.el 30 Oct 2009 02:00:30 -0000 1.1022
--- lisp/simple.el 10 Nov 2009 00:57:27 -0000
***************
*** 2136,2143 ****
(interactive
(list
(read-shell-command "Shell command: " nil nil
! (and buffer-file-name
! (file-relative-name buffer-file-name)))
current-prefix-arg
shell-command-default-error-buffer))
;; Look for a handler in case default-directory is a remote file name.
--- 2152,2163 ----
(interactive
(list
(read-shell-command "Shell command: " nil nil
! (let ((filename
! (cond
! ((eq major-mode 'dired-mode)
! (dired-get-filename nil t))
! (buffer-file-name))))
! (and filename (file-relative-name filename))))
current-prefix-arg
shell-command-default-error-buffer))
;; Look for a handler in case default-directory is a remote file name.
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: find-file-read-args, (continued)
- Re: find-file-read-args, Juri Linkov, 2009/11/23
- Re: find-file-read-args, Stefan Monnier, 2009/11/23
- Re: find-file-read-args, Juri Linkov, 2009/11/23
- Re: find-file-read-args, Stefan Monnier, 2009/11/23
- Re: find-file-read-args, Juri Linkov, 2009/11/24
- Re: find-file-read-args, Stefan Monnier, 2009/11/24
- find-file-literally (was: find-file-read-args), Juri Linkov, 2009/11/23
- Re: find-file-literally, Stefan Monnier, 2009/11/24
- M-! M-n should fetch filename (Re: FFAP), Juri Linkov, 2009/11/09
- Re: M-! M-n should fetch filename (Re: FFAP), Stefan Monnier, 2009/11/09
- Re: M-! M-n should fetch filename (Re: FFAP),
Juri Linkov <=
- Re: M-! M-n should fetch filename (Re: FFAP), Stefan Monnier, 2009/11/10
- Re: M-! M-n should fetch filename (Re: FFAP), Juri Linkov, 2009/11/10
- dired-dwim-target (was: FFAP), Juri Linkov, 2009/11/15
- dired-dwim-target-defaults (was: dired-dwim-target), Juri Linkov, 2009/11/23
Re: find-file-literally-at-point, Juri Linkov, 2009/11/08
utf-8-with-signature (was: find-file-literally-at-point), Juri Linkov, 2009/11/09
Re: find-file-literally-at-point, Eduard Wiebe, 2009/11/06