From unknown Fri Aug 15 21:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14791: 24.3.50; [PATCH] find-dired doesn't work correctly Resent-From: Shigeru Fukaya Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jul 2013 17:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14791 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 14791@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13729580013820 (code B ref -1); Thu, 04 Jul 2013 17:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Jul 2013 17:13:21 +0000 Received: from localhost ([127.0.0.1]:57707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uun5s-0000zY-G8 for submit@debbugs.gnu.org; Thu, 04 Jul 2013 13:13:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60312) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uun5p-0000z8-82 for submit@debbugs.gnu.org; Thu, 04 Jul 2013 13:13:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uun5g-0000zu-Li for submit@debbugs.gnu.org; Thu, 04 Jul 2013 13:13:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uun5g-0000zo-Ij for submit@debbugs.gnu.org; Thu, 04 Jul 2013 13:13:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uun5d-00056t-FJ for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2013 13:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uun5a-0000y5-Av for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2013 13:13:05 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:37866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uun5a-0000xw-3U for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2013 13:13:02 -0400 Received: by mail-pa0-f52.google.com with SMTP id kq13so1467174pab.39 for ; Thu, 04 Jul 2013 10:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:mime-version:content-type :content-transfer-encoding:x-mailer:message-id; bh=EhkK3CajjxBF1OPUE4aPbc26DLqumxOPAzEVOZ+UYAA=; b=Dqm3aBeVYyG0SaotYEyQ7YJdBeSeKBP536j9OP4MxxzkfAPwsHSvcpJwit1b0MSeTf AWXt12Ku/y+TEplKPFKxYZ6kQR9LlNx8geWaAHYvYHSgBzUnH0WJuAd9XRzzbJ7sYxfA TH+akW3iqqikeYyN1WwltOicZAObVehfg5ndQfjVCa5d4matUkiNlebuiAUI8pGR3Omq yenkuMhFvhcu9kRfbiDldypyaV3R+hvIxlGNuZD06EzVVp3inpIR07lwGuHbYcZl3R4q ExOWxsRFLMkE8RhxuexX0mAssUQluqlQSoF1YEZ8Hui07JQibZy7vCRPzEFtVqgdpB3t GxEA== X-Received: by 10.68.192.103 with SMTP id hf7mr6286491pbc.168.1372957981021; Thu, 04 Jul 2013 10:13:01 -0700 (PDT) Received: from gmail.com (115x125x38x6.ap115.ftth.ucom.ne.jp. [115.125.38.6]) by mx.google.com with ESMTPSA id eg3sm4226975pac.1.2013.07.04.10.12.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Jul 2013 10:13:00 -0700 (PDT) From: Shigeru Fukaya Date: Fri, 05 Jul 2013 02:12:56 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: HidemaruMail 6.00 (WinNT,601) Message-Id: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) find-dired doesn't work well, at least for GNU find and ls output. It is `find-dired-filter' doesn't format the process output correctly. Its hard-coded regexp never match `find DIR -ls' output. The function also fails right-adjusting filesize columns of `ls -ld' output. The following sample is a changed code that handles GNU find and ls output. Regards, Shigeru ;;; find-dired.el (defun find-dired-filter (proc string) ;; Filter for \\[find-dired] processes. (let ((buf (process-buffer proc)) (inhibit-read-only t)) (if (buffer-name buf) (with-current-buffer buf (save-excursion (save-restriction (widen) (let ((beg (point-max)) (l-opt (and (consp find-ls-option) (string-match "l" (cdr find-ls-option)))) ls-regexp ls-replace) (when l-opt (if (equal "-ls" (car find-ls-option)) (setq ls-regexp (concat ;; 1 - inode,allocSize to remove "^ +\\([0-9]+ +[0-9]+ +\\)" ;; modes "[^ \t\r\n]+" ;; 3 - # of links "\\( +\\([0-9]+\\) +\\)" ;; 5 - uid,gid "\\(\\([^ \t\r\n]+ +[^ \t\r\n]+\\)" ;; 6 - filesize " +\\([0-9.]+[^ ]?\\)\\)") ls-replace #'(lambda () (replace-match "" nil t nil 1) (replace-match (format " %3s " (match-string 3)) nil t nil 2) ;; Try justification of uid,gid and filesize (let ((len (+ (- (match-end 5) (match-beginning 5)) (- (match-end 6) (match-beginning 6))))) (replace-match (concat (match-string 5) (make-string (max (- 30 len) 1) ?\s) (match-string 6)) nil t nil 4)))) (setq ls-regexp ;; modes, 2 - # of links "^ +[^ \t\r\n]+\\( +\\([0-9]+\\) +\\)" ls-replace #'(lambda () (replace-match (format " %3s " (match-string 2)) nil t nil 1))))) (goto-char beg) (insert string) (goto-char beg) (while (re-search-forward "^." nil t) (backward-char) (insert " ")) ;; Convert ` ./FILE' to ` FILE' ;; This would lose if the current chunk of output ;; starts or ends within the ` ./', so back up a bit: (goto-char (- beg 3)) ; no error if < 0 (while (search-forward " ./" nil t) (delete-char -2)) ;; Pad the number of links and file size. This is a ;; quick and dirty way of getting the columns to line up ;; most of the time, but it's not foolproof. (when l-opt (goto-char beg) (goto-char (line-beginning-position)) (while (re-search-forward ls-regexp nil t) (funcall ls-replace))) ;; Find all the complete lines in the unprocessed ;; output and process it to add text properties. (goto-char (point-max)) (if (search-backward "\n" (process-mark proc) t) (progn (dired-insert-set-properties (process-mark proc) (1+ (point))) (move-marker (process-mark proc) (1+ (point))))))))) ;; The buffer has been killed. (delete-process proc)))) From unknown Fri Aug 15 21:23:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14791: 24.3.50; [PATCH] find-dired doesn't work correctly Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Feb 2016 04:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14791 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Shigeru Fukaya Cc: 14791@debbugs.gnu.org Received: via spool by 14791-submit@debbugs.gnu.org id=B14791.145628936430893 (code B ref 14791); Wed, 24 Feb 2016 04:50:01 +0000 Received: (at 14791) by debbugs.gnu.org; 24 Feb 2016 04:49:24 +0000 Received: from localhost ([127.0.0.1]:42177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYRO8-00082D-0o for submit@debbugs.gnu.org; Tue, 23 Feb 2016 23:49:24 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:54060) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYRO6-000825-N2 for 14791@debbugs.gnu.org; Tue, 23 Feb 2016 23:49:22 -0500 Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYRNi-0000ka-0p; Wed, 24 Feb 2016 05:48:58 +0100 From: Lars Ingebrigtsen References: Date: Wed, 24 Feb 2016 15:48:54 +1100 In-Reply-To: (Shigeru Fukaya's message of "Fri, 05 Jul 2013 02:12:56 +0900") Message-ID: <87lh6ahfwp.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1aYRNi-0000ka-0p X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1456894139.05562@hEr+v5jZlfHJeGtsmgcXMQ X-Spam-Status: No X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Shigeru Fukaya writes: > find-dired doesn't work well, at least for GNU find and ls output. > > It is `find-dired-filter' doesn't format the process output correctly. > Its hard-coded regexp never match `find DIR -ls' output. > The function also fails right-adjusting filesize columns of `ls -ld' > output. > > The following sample is a changed code that handles GNU find and ls > output. It seems to work for me in Emacs 25 on Ubuntu, which surely uses GNU find and ls. Are you still seeing this problem? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 08 15:43:42 2019 Received: (at control) by debbugs.gnu.org; 8 Jan 2019 20:43:43 +0000 Received: from localhost ([127.0.0.1]:50487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggyDu-0004WO-NI for submit@debbugs.gnu.org; Tue, 08 Jan 2019 15:43:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49141) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggyDt-0004WA-1z for control@debbugs.gnu.org; Tue, 08 Jan 2019 15:43:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggyDm-0006IV-2B for control@debbugs.gnu.org; Tue, 08 Jan 2019 15:43:35 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggyDc-0006FM-Rs for control@debbugs.gnu.org; Tue, 08 Jan 2019 15:43:27 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ggyDb-0000Cz-SK for control@debbugs.gnu.org; Tue, 08 Jan 2019 15:43:24 -0500 Subject: control message for bug 14791 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Tue, 08 Jan 2019 15:43:23 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:470:142:3::e X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tag 14791 + wontfix close 14791