From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: ! in Dired--what was the outcome? Date: Mon, 4 Oct 2004 12:27:36 -0500 (CDT) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <200410041727.i94HRa507230@raven.dms.auburn.edu> References: <200409220205.i8M25YO10544@raven.dms.auburn.edu> <87zn343792.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1096910977 10351 80.91.229.6 (4 Oct 2004 17:29:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 4 Oct 2004 17:29:37 +0000 (UTC) Cc: juri@jurta.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 04 19:29:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CEWeN-0003ou-00 for ; Mon, 04 Oct 2004 19:29:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEWky-0004tS-4s for ged-emacs-devel@m.gmane.org; Mon, 04 Oct 2004 13:36:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CEWkb-0004iY-Ia for emacs-devel@gnu.org; Mon, 04 Oct 2004 13:35:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CEWka-0004i8-Hk for emacs-devel@gnu.org; Mon, 04 Oct 2004 13:35:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CEWka-0004hc-FS for emacs-devel@gnu.org; Mon, 04 Oct 2004 13:35:52 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CEWdJ-0002Dw-9E; Mon, 04 Oct 2004 13:28:21 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i94HSKiU006182; Mon, 4 Oct 2004 12:28:20 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id i94HRa507230; Mon, 4 Oct 2004 12:27:36 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Mon, 04 Oct 2004 11:18:29 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:27896 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:27896 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))))) ============================================================