emacs-devel
[Top][All Lists]
Advanced

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

Re: info inconsistency about "Shell Commands in Dired"


From: Luc Teirlinck
Subject: Re: info inconsistency about "Shell Commands in Dired"
Date: Sat, 21 Aug 2004 17:49:38 -0500 (CDT)

David Kastrup wrote:

   If everybody is finished laughing...  Maybe one should allow it
   surrounded by quotes, something like

     '?'.uu

Using '?' for this purpose is counterintuitive.  '?' has a well
established meaning of "literal ?".

Why not handle this problem in complete symmetry with the opposite problem?

>From `(emacs)Shell Commands in Dired':

     If you want to use `*' as a shell wildcard with whitespace around
     it, write `*""'.  In the shell, this is equivalent to `*'; but
     since the `*' is not surrounded by whitespace, Dired does not
     treat it specially.

This does not take care of the case where the `*' or `?'  occurs
within single quotes, in which case it is probably meant to be taken
literally.  (_Neither_ to be expanded by Emacs _nor_ treated as a
shell wildcard.)  It actually _does_ take care of the similar double
quote situation.

In these cases, one probably has to do:  "... *"" ..."
or: '... *'' ...' to prevent expansion by Emacs.

Maybe that should be pointed out in `(emacs)Shell Commands in Dired'.

My proposed generic solution handles the opposite problem (which we
are now considering) analogously: Emacs allows '' as a substitute for
whitespace in deciding whether to replace the ? or * with the file name.

Unless the * or ? occurs within double quotes, the '' does not matter
to the shell.  If one wants to use a literal <SPC>?'' or such, the above
happens to do the right thing anyway for single quotes, as it does for
the opposite problem with double quotes.  If one is using double
quotes, one has to do: "... ?""''...".

The manual example would become:

          uuencode ? ? > ?''.uu

Complete symmetry between both sides of the problem.

Here is the patch, in case the above would be OK:

===File /home/teirllm/dired-aux-diff-b======================
*** dired-aux.el        19 Jul 2004 11:13:15 -0500      1.126
--- dired-aux.el        21 Aug 2004 16:28:30 -0500      
***************
*** 43,50 ****
  ;;;###begin dired-cmd.el
  ;; Diffing and compressing
  
! (defconst dired-star-subst-regexp "\\(^\\|[ \t]\\)\\*\\([ \t]\\|$\\)")
! (defconst dired-quark-subst-regexp "\\(^\\|[ \t]\\)\\?\\([ \t]\\|$\\)")
  
  ;;;###autoload
  (defun dired-diff (file &optional switches)
--- 43,52 ----
  ;;;###begin dired-cmd.el
  ;; Diffing and compressing
  
! (defconst dired-star-subst-regexp
!   "\\(^\\|[ \t]\\|''\\)\\*\\([ \t]\\|''\\|$\\)")
! (defconst dired-quark-subst-regexp
!   "\\(^\\|[ \t]\\|''\\)\\?\\([ \t]\\|''\\|$\\)")
  
  ;;;###autoload
  (defun dired-diff (file &optional switches)
***************
*** 540,546 ****
             (lambda (x)
               (let ((retval command))
                 (while (string-match
!                        "\\(^\\|[ \t]\\)\\([*?]\\)\\([ \t]\\|$\\)" retval)
                   (setq retval (replace-match x t t retval 2)))
                 retval))
           (lambda (x) (concat command dired-mark-separator x)))))
--- 542,549 ----
             (lambda (x)
               (let ((retval command))
                 (while (string-match
!                        "\\(^\\|[ \t]\\|''\\)\\([*?]\\)\\([ \t]\\|''\\|$\\)"
!                        retval)
                   (setq retval (replace-match x t t retval 2)))
                 retval))
           (lambda (x) (concat command dired-mark-separator x)))))
============================================================




reply via email to

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