From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#22457: 24.5; [PATCH] `dired-mark-if' should not count non-changes Date: Tue, 25 Jun 2019 08:33:14 -0700 (PDT) Message-ID: References: <2a6ff247-2b75-4f85-9a4c-889576ed7b34@default> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="__1561476795443103899abhmp0018.oracle.com" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="66359"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 22457@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 17:43:38 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfnbc-000H7o-EN for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 17:43:36 +0200 Original-Received: from localhost ([::1]:33293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfnbb-0000jB-9D for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 11:43:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33368) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfnSR-0008GK-Cw for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 11:34:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hfnSP-0004Q5-Vp for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 11:34:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47965) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hfnSL-0004MT-MN for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 11:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hfnSL-0006ei-JH for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 11:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2019 15:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22457 X-GNU-PR-Package: emacs Original-Received: via spool by 22457-submit@debbugs.gnu.org id=B22457.156147680625516 (code B ref 22457); Tue, 25 Jun 2019 15:34:01 +0000 Original-Received: (at 22457) by debbugs.gnu.org; 25 Jun 2019 15:33:26 +0000 Original-Received: from localhost ([127.0.0.1]:33272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnRl-0006dS-MW for submit@debbugs.gnu.org; Tue, 25 Jun 2019 11:33:25 -0400 Original-Received: from userp2130.oracle.com ([156.151.31.86]:55644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnRj-0006dA-QU for 22457@debbugs.gnu.org; Tue, 25 Jun 2019 11:33:24 -0400 Original-Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5PFIibR008049; Tue, 25 Jun 2019 15:33:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type; s=corp-2018-07-02; bh=h8ByHh6RQT7MyGvwBiBZBHn7DdfrN39TzZ5eJXZE4LA=; b=BmGBFVbxPzsKfe+8gLlpQbYAbtMxjIbpK4WKgwzVpv8xhulzniO7jHMaAMe9rJG+rqKd +75D1pfBrzha6nTeorr0O3DgDWFZTWMvxUl/RVTZVRUXzkqH3uBLr3Nqc3l6Ls+rhPv2 8utWzJ7Z9+1PKu0DYAxoo9aJsiV8VGh6Q0X1WmvVk9WeNgHGibfVNis7TE0/fmd75RRY nBfA/iTOI8M3OaiuamnbcqJErModTy/LD49jAwU4Yur0N6F4Q6z+Q4PCx+bes99opqES 6CefUR8zBwGtLE6+UeiAbcldaEqQPhLrMhsZLKSwqlzk8OoKdjCMszr28UtNGJ8OHtzs sQ== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 2t9brt56kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2019 15:33:17 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5PFWi6j109304; Tue, 25 Jun 2019 15:33:16 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 2t9p6u8hrs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Jun 2019 15:33:16 +0000 Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5PFXF34027403; Tue, 25 Jun 2019 15:33:15 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4861.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906250117 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9299 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906250117 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161388 Archived-At: --__1561476795443103899abhmp0018.oracle.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable > > Here is a fixed version of the macro. The diff is trivial. >=20 > No diff was included, which, as usual, is a shame, because the macro has > changed slightly in the meantime. That makes no difference. ;-) And the diff is still trivial. ("The macro has changed slightly" =3D=3D ?\040 became ?\s. Nothing more) > Your lines are also too wide; they should be less than 80 characters > wide. Oh, lines 92 chars are too wide for dired.el? Then why does it have lots of lines wider than 80 chars, including lines up to 103 chars wide? > Could you re-spin your change and submit a patch? diff -u dired.el dired-2019-06-25a-patched.el --- dired.el=092019-06-25 07:57:35.886354900 -0700 +++ dired-2019-06-25a-patched.el=092019-06-25 08:09:23.058466400 -0700 @@ -538,7 +538,7 @@ ;;; Macros must be defined before they are used, for the byte compiler. =20 (defmacro dired-mark-if (predicate msg) - "Mark all files for which PREDICATE evals to non-nil. + "Mark files for PREDICATE, according to `dired-marker-char'. PREDICATE is evaluated on each line, with point at beginning of line. MSG is a noun phrase for the type of files being marked. It should end with a noun that can be pluralized by adding `s'. @@ -558,13 +558,11 @@ =09=09 ""))) (goto-char (point-min)) (while (not (eobp)) - (if ,predicate - (progn - (delete-char 1) - (insert dired-marker-char) - (setq count (1+ count)))) + (when ,predicate + (unless (looking-at-p (char-to-string dired-marker-char)) + (delete-char 1) (insert dired-marker-char) (setq count (1+ cou= nt)))) (forward-line 1)) - (if ,msg (message "%s %s%s %s%s." + (when ,msg (message "%s %s%s %s%s" count ,msg (dired-plural-s count) ---- Actually, the _attached_ definition is much better than this - it's what I use in `dired+.el'. The value returned and the message indicate both the number matched and the number changed. And it has optional arg PLURAL, for irregular plurals (e.g. "directories"). But if you want this one you'll have to do your own line shortening, `diff', and adjustment of any callers you might to want to pass an irregular PLURAL form. --__1561476795443103899abhmp0018.oracle.com Content-Type: application/octet-stream; name="throw-dired-mark-if.el" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="throw-dired-mark-if.el" OzsgMS4gVmFsdWUgcmV0dXJuZWQgYW5kIG1lc3NhZ2UgaW5kaWNhdGUgYm90aCB0aGUgbnVtYmVy IG1hdGNoZWQgYW5kIHRoZSBudW1iZXIgY2hhbmdlZC4KOzsgMi4gQWRkZWQgb3B0aW9uYWwgYXJn IFBMVVJBTCwgZm9yIGlycmVndWxhciBwbHVyYWxzIChlLmcuICJkaXJlY3RvcmllcyIpLgo7Owoo ZGVmbWFjcm8gZGlyZWQtbWFyay1pZiAocHJlZGljYXRlIHNpbmd1bGFyICZvcHRpb25hbCBwbHVy YWwpCiAgIk1hcmsgZmlsZXMgZm9yIFBSRURJQ0FURSwgYWNjb3JkaW5nIHRvIGBkaXJlZC1tYXJr ZXItY2hhcicuClBSRURJQ0FURSBpcyBldmFsdWF0ZWQgb24gZWFjaCBsaW5lLCB3aXRoIHBvaW50 IGF0IGJlZ2lubmluZyBvZiBsaW5lLgpTSU5HVUxBUiBpcyBhIHNpbmd1bGFyIG5vdW4gcGhyYXNl IGZvciB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ICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICJNYXJraW5nIikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg KG9yICxwbHVyYWwgIChjb25jYXQgLHNpbmd1bGFyICJzIikpCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGlmIChlcSBkaXJlZC1kZWwtbWFya2VyIGRpcmVkLW1hcmtlci1jaGFyKSAi IGZvciBkZWxldGlvbiIgIiIpKSkKICAgICAgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpCiAgICAg ICAod2hpbGUgKG5vdCAoZW9icCkpCiAgICAgICAgICh3aGVuICxwcmVkaWNhdGUKICAgICAgICAg ICAoc2V0cSBtYXRjaGVkICAoMSsgbWF0Y2hlZCkpCiAgICAgICAgICAgKHVubGVzcyAoZGlyZWRw LWxvb2tpbmctYXQtcCAoY2hhci10by1zdHJpbmcgZGlyZWQtbWFya2VyLWNoYXIpKQogICAgICAg ICAgICAgKGRlbGV0ZS1jaGFyIDEpIChpbnNlcnQgZGlyZWQtbWFya2VyLWNoYXIpIChzZXRxIGNo YW5nZWQgICgxKyBjaGFuZ2VkKSkpKQogICAgICAgICAoZm9yd2FyZC1saW5lIDEpKQogICAgICAg KHdoZW4gLHNpbmd1bGFyIChtZXNzYWdlICIlcyAlcyVzJXMgbmV3bHkgJXMlcyIKICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBtYXRjaGVkCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgKGlmICg9IG1hdGNoZWQgMSkgLHNpbmd1bGFyIChvciAscGx1cmFsICAoY29uY2F0ICxz aW5ndWxhciAicyIpKSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaWYgKG5vdCAo PSBtYXRjaGVkIGNoYW5nZWQpKSAiIG1hdGNoZWQsICIgIiIpCiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgKGlmIChub3QgKD0gbWF0Y2hlZCBjaGFuZ2VkKSkgY2hhbmdlZCAiIikKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaWYgKGVxIGRpcmVkLW1hcmtlci1jaGFyID9c MDQwKSAidW4iICIiKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpZiAoZXEgZGly ZWQtbWFya2VyLWNoYXIgZGlyZWQtZGVsLW1hcmtlcikgImZsYWdnZWQiICJtYXJrZWQiKSkpKQog ICAgIChhbmQgKD4gbWF0Y2hlZCAwKSAgKGNvbnMgY2hhbmdlZCBtYXRjaGVkKSkpKQo= --__1561476795443103899abhmp0018.oracle.com--