From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#25942: 26.0.50; dired-mark-extension prepend '.' to suffix if not present Date: Fri, 03 Mar 2017 12:40:33 +0900 Message-ID: <87d1dzjadq.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488512472 31138 195.159.176.226 (3 Mar 2017 03:41:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2017 03:41:12 +0000 (UTC) To: 25942@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 03 04:41:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cje5a-0007c9-SE for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Mar 2017 04:41:07 +0100 Original-Received: from localhost ([::1]:55944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cje5h-0003Uw-00 for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 Mar 2017 22:41:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cje5b-0003Uq-BT for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:41:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cje5W-00078S-FB for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:41:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39054) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cje5W-00078B-B9 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cje5W-0004cs-51 for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Mar 2017 03:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25942 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148851245417760 (code B ref -1); Fri, 03 Mar 2017 03:41:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Mar 2017 03:40:54 +0000 Original-Received: from localhost ([127.0.0.1]:37253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cje5N-0004cN-W5 for submit@debbugs.gnu.org; Thu, 02 Mar 2017 22:40:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56791) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cje5L-0004cB-O3 for submit@debbugs.gnu.org; Thu, 02 Mar 2017 22:40:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cje5F-000765-HD for submit@debbugs.gnu.org; Thu, 02 Mar 2017 22:40:46 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cje5F-00075u-Cd for submit@debbugs.gnu.org; Thu, 02 Mar 2017 22:40:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cje5E-0003PV-3z for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:40:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cje59-00075A-5w for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:40:44 -0500 Original-Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]:35047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cje59-000751-0h for bug-gnu-emacs@gnu.org; Thu, 02 Mar 2017 22:40:39 -0500 Original-Received: by mail-pf0-x22f.google.com with SMTP id j5so28789889pfb.2 for ; Thu, 02 Mar 2017 19:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=xVxZIT1NcgSom/iiH14I7DtTgtNgsn98HNYNGLoDfOk=; b=uZlaL/EH5BTN8bFMQq915FBc9QouHx1jJL/47SgShEglpTZ/sh7dr5Sh0OX31p1Auj kgaDIm/SL8Q5sXRImjNzsriyfltMSWGY3By3qK+zd3XB5b8ib4iSBCL/1iWT/IFqSpZU y7oRJrhSI4OhN73NAyHktLUqA7u8yGM7yagqbQRiojldnWIG+u2Jb2XaU7DVY7kOg5RV /sG9lhVpAoDkvIp5YVnoEyuIT/lPFMQGL9tqlOqnVxWpAwiUg7Zj9KPTyKpCwYwvj+DN jEjI33tXrFuuuyOtPjtJxCCNuQJAZPFzhNxy4a2ka6KHecWD0QMd3X1ru0rYbV/IaSly 68vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=xVxZIT1NcgSom/iiH14I7DtTgtNgsn98HNYNGLoDfOk=; b=j2fad06jcUTfi5HbSvvJsg3UmqieV/NwDuzRLOBn3mRpzlhKsGtJZyLA15m3D3ARXO G3Tz7H1gRujBB4l/WB83HXTMVSN8xQOAIWamOdJ8T48cXYchlA6z8drP8bkQ+6x2OJdm ciqIu3xPz6cRl2koug01KqPunFEiVYde3TSofEfvtSWLI6rWMbEk2bju9mE0imQBmYWD 4GnvU7L4ftR8uPnQw0sqLT4H8dKVu4CWXEEp6Zhe6KEjWj22LFOYD0qMBni6TCGltirE i3uA4PhFR+2aoH3jE3oAcDO97mFgVHghh4JzifwI0r/wWnKlq3TvAlDy9iPrhinVUOmv S9cg== X-Gm-Message-State: AMke39n+m0HnK9iDiFymn+PHDotKdXUtgZ6lJiCPMz1qjlPVLYZ8/T3uLVoVRBst5XEwhg== X-Received: by 10.98.65.148 with SMTP id g20mr888048pfd.44.1488512437868; Thu, 02 Mar 2017 19:40:37 -0800 (PST) Original-Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id y21sm19825658pgh.52.2017.03.02.19.40.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2017 19:40:37 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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: 208.118.235.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:130082 Archived-At: emacs -Q /tmp (require 'dired-x) (require 'ert) ;; Evaluate following sexp: (let ((dirs '("Public" "Music")) (files '(".bashrc" "bar.c" "foo.c")) (dir (make-temp-file "Bug25942" 'dir))) (unwind-protect (progn (dolist (d dirs) (make-directory (expand-file-name d dir))) (dolist (f files) (write-region nil nil (expand-file-name f dir))) (dired dir) (dired-mark-extension "c") (should (= 2 (length (dired-get-marked-files))))) (delete-directory dir 'recursive))) IMO, in this example looks better if just those files ending with '.c' are marked i.e., to not mark 'Public' or 'Music'. If the user really wish to mark all files ending with 'c', then would be easy to do: % M c \ ' RET --8<-----------------------------cut here---------------start------------->8--- >From a91a7ccdb98eff3ad520092944e6b23042d42e8f Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 3 Mar 2017 12:12:53 +0900 Subject: [PATCH] Automaticaly prepend a '.' to extension if not present * lisp/dired-x.el (dired-mark-extension): Bug#25942. --- lisp/dired-x.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 6c8fb0e7da..eb228ce541 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -335,7 +335,7 @@ dired-extra-startup ;; Mark files with some extension. (defun dired-mark-extension (extension &optional marker-char) "Mark all files with a certain EXTENSION for use in later commands. -A `.' is *not* automatically prepended to the string entered. +A `.' before EXTENSION is automatically prepended when not present. EXTENSION may also be a list of extensions instead of a single one. Optional MARKER-CHAR is marker to use. Interactively, ask for EXTENSION. @@ -371,7 +371,10 @@ dired-mark-extension (dired-mark-files-regexp (concat ".";; don't match names with nothing but an extension "\\(" - (mapconcat 'regexp-quote extension "\\|") + (mapconcat (lambda (x) + (regexp-quote + (if (string-prefix-p "." x) x (concat "." x)))) + extension "\\|") "\\)$") marker-char)) -- 2.11.0 --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.22.8) of 2017-03-03 Repository revision: 55c0c3e31bc3dff83753cdba6288228bd025ac84