GNU bug report logs - #14791
24.3.50; [PATCH] find-dired doesn't work correctly

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Thu, 4 Jul 2013 17:14:02 UTC

Severity: normal

Tags: moreinfo, wontfix

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14791 in the body.
You can then email your comments to 14791 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14791; Package emacs. (Thu, 04 Jul 2013 17:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shigeru Fukaya <shigeru.fukaya <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 04 Jul 2013 17:14:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; [PATCH] find-dired doesn't work correctly
Date: Fri, 05 Jul 2013 02:12:56 +0900
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))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14791; Package emacs. (Wed, 24 Feb 2016 04:50:01 GMT) Full text and rfc822 format available.

Message #8 received at 14791 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 14791 <at> debbugs.gnu.org
Subject: Re: bug#14791: 24.3.50; [PATCH] find-dired doesn't work correctly
Date: Wed, 24 Feb 2016 15:48:54 +1100
Shigeru Fukaya <shigeru.fukaya <at> gmail.com> 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




Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 08 Jan 2019 20:44:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 14791 <at> debbugs.gnu.org and Shigeru Fukaya <shigeru.fukaya <at> gmail.com> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 08 Jan 2019 20:44:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Feb 2019 12:24:19 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 192 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.