all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: juri@jurta.org, emacs-devel@gnu.org
Subject: Re: ! in Dired--what was the outcome?
Date: Mon, 4 Oct 2004 12:27:36 -0500 (CDT)	[thread overview]
Message-ID: <200410041727.i94HRa507230@raven.dms.auburn.edu> (raw)
In-Reply-To: <E1CEUbd-0003W3-28@fencepost.gnu.org> (message from Richard Stallman on Mon, 04 Oct 2004 11:18:29 -0400)

What is wrong with the solution I proposed earlier?

Currently ? and * expand if and only if they are surrounded on both
sides by whitespace.

There are two problems.

One might want to use an isolated * (or less likely ?) as a wildcard.
The Emacs manual recommends using *"" (or ?"") in those cases.  The *
(or ?) is no longer surrounded by whitespace, so Emacs does not
expand.  To the shell, "" does not make any difference.

Our discussion was concerned with the opposite problem.  One wants to
expand ? in cases where it is not surrounded by whitespace, to add
prefixes or extensions to a bunch of file names.  I proposed to solve
this problem in a similar way to the opposite problem.  Namely make *
and ?  expand if and only if they are surrounded on both sides by
whitespace _or_ ''.  That is, we would treat a pair of single-quotes
as equivalent to whitespace for expansion purposes.  As for "", ''
does not make any difference for the shell.

So one could do

mv ? .''?

or:

mv ? ?''.uu

to prepend . or append .uu to a bunch of marked files.

The corresponding trick for * will very seldom be useful, but it
probably is better to make it work for * too, just for consistency.

Here is the patch to dired-aux (which I proposed earlier) that
implements the above:

===File ~/dired-aux-diff====================================
*** 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)))))
============================================================

  parent reply	other threads:[~2004-10-04 17:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-21 18:30 ! in Dired--what was the outcome? Richard Stallman
2004-09-21 19:48 ` Jose E. Marchesi
2004-09-22  1:44 ` Luc Teirlinck
2004-09-22  2:05 ` Luc Teirlinck
2004-10-03  1:19   ` Richard Stallman
2004-10-03  1:44     ` Juri Linkov
2004-10-04 15:18       ` Richard Stallman
2004-10-04 15:41         ` David Kastrup
2004-10-04 15:50           ` Stefan Monnier
2004-10-04 17:27         ` Luc Teirlinck [this message]
2004-10-04  2:43     ` Luc Teirlinck
2004-10-05 18:04       ` Richard Stallman
2004-10-06 23:03         ` Luc Teirlinck
2004-10-07 16:45           ` Richard Stallman
2004-10-12 15:12 ` Juri Linkov
2004-10-13  3:01   ` Luc Teirlinck
2004-10-13  8:40     ` David Kastrup
2004-10-14  0:43     ` Richard Stallman
2004-10-14  8:26       ` Johan Vromans
2004-10-14  9:45         ` Andreas Schwab
2004-10-14  9:56           ` Miles Bader
2004-10-14 16:37             ` Andreas Schwab
2004-10-15 10:08             ` Richard Stallman
2004-10-15 18:06               ` Juri Linkov
2004-10-16 13:52                 ` Richard Stallman
2004-10-14 23:30         ` Reinhard Kotucha
2004-10-15  4:13           ` Miles Bader
2004-10-15  8:12           ` David Kastrup
2004-10-14  8:56       ` David Kastrup
2004-10-14  9:45         ` Kim F. Storm
2004-10-14 23:48         ` Reinhard Kotucha
2004-10-15  8:15           ` David Kastrup
2004-10-13 14:42   ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200410041727.i94HRa507230@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.