[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info inconsistency about "Shell Commands in Dired"

From: Kim F. Storm
Subject: Re: info inconsistency about "Shell Commands in Dired"
Date: 26 Aug 2004 09:28:12 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Luc Teirlinck <address@hidden> writes:

>    It is worth thinking about.
>    I saw people discussing other methods, %s and envvars.
>    The envvar method is too inconvenient.  %s might be acceptable;
>    people mainly discussed how to implement it.
> Actually, I now see one problem with the change I proposed.
> Somebody might have gotten the habit of using *'' or ?'' instead of the
> recommended *"" to _prevent_ expansion.  That will no longer work and
> this might confuse people, unless they read the NEWS carefully.
> If we go for a radically different syntax, then we could just take the
> example out of the manual for the time being and implement the new
> syntax for 21.5. 

IMHO, we should remove the feature all-together -- or just keep it
as is and give a better example in the manual, e.g

        mv ? newname.c

as well as warnings for things that does not work, e.g.

        mv ? ?-old

Instead, we should have a command that inserts the current buffer's
file name at point (e.g. in the minibuffer).

Suppose we bind it to M-? -- then you could write

        m v SPC M-? SPC M-? - o l d RET

and even be given a chance to edit the current buffer file name.

Here's an sample implementation.  It obviously need to be enhanced to
know when it is called in a dired originated command, but I'll leave
that to the dired experts...

(defun insert-buffer-file-name (&optional arg)
  "Insert current buffer's file name.
With \\[universal-argument], insert absolute file name."
  (interactive "P")
  (let ((fn (or (buffer-file-name
                     (or (minibuffer-selected-window)
   (unless arg
     (setq fn (file-name-nondirectory fn)))
   (insert fn)))

(global-set-key [?\M-?] 'insert-buffer-file-name)

Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

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