emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#29513: closed (sorting find-dired)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#29513: closed (sorting find-dired)
Date: Tue, 11 Jun 2019 21:17:02 +0000

Your message dated Tue, 11 Jun 2019 16:15:44 -0500
with message-id <address@hidden>
and subject line Re: bug#29513: 25.2; find-dired-centinel
has caused the debbugs.gnu.org bug report #29513,
regarding sorting find-dired
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
29513: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29513
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 25.2; find-dired-centinel Date: Thu, 30 Nov 2017 18:50:22 -0600
Following a discussion on help-gnu-emacs

https://lists.gnu.org/archive/html/help-gnu-emacs/2017-11/msg00415.html

I request to replace the function find-dired-sentinel by something
like the following that will sort the output of find
lexicographically.  I have tested that the function below works for me.
Yet there might be corner cases I do not know about where it might fail.

(defun find-dired-sentinel (proc state)
  "Sentinel for \\[find-dired] processes."
  (let ((buf (process-buffer proc)))
    (if (buffer-name buf)
        (with-current-buffer buf
          (let ((inhibit-read-only t))
            (save-excursion
              (save-restriction
                (widen)
                ;; `find-dired-filter' puts two whitespace characters
                ;; at the beginning of every line.
                (narrow-to-region (point) (- (point-max) 2))
                ;; Sort file names lexicographically.
                (sort-subr nil 'forward-line 'end-of-line
                           (lambda ()
                             (buffer-substring-no-properties
                              (next-single-property-change
                               (point) 'dired-filename)
                              (line-end-position))))
                (widen)
                (let ((point (point-max)))
                  (goto-char point)
                  (insert "\n  find "
                          (substring state 0 -1) ; omit \n at end of STATE.
                          " at " (substring (current-time-string) 0 19))
                  (dired-insert-set-properties point (point))))
              (setq mode-line-process
                    (format ":%s" (process-status proc)))
              ;; Since the buffer and mode line will show that the
              ;; process is dead, we can delete it now.  Otherwise it
              ;; will stay around until M-x `list-processes'.
              (delete-process proc)
              (force-mode-line-update))))
          (message "find-dired %s finished." buf))))




In GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2017-03-03 built on regnitz
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:     Ubuntu 16.04.3 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: 
  locale-coding-system: utf-8-unix

Major mode: Dired



--- End Message ---
--- Begin Message --- Subject: Re: bug#29513: 25.2; find-dired-centinel Date: Tue, 11 Jun 2019 16:15:44 -0500
On Fri Dec 1 2017 Roland Winkler wrote:
> On Fri Dec 1 2017 Eli Zaretskii wrote:
> > Maybe we should simply provide a defcustom, which is a function called
> > by the sentinel.  Then users could customize what happens after the
> > files are all collected, be it sort the results or anything else.  The
> > advantage will be that we won't need to support every possible tweak
> > of post-processing in core.
> 
> Again: fine with me.  This could be done such that the *Find* buffer
> is narrowed to the portion containing the output of the shell
> command (as in my patch).  Also, as a further option (or default
> value of the defcustom) we could provide a function that sorts by
> file name (thus providing a real-world example of how this new
> defcustom can be used).

See commit 249902d5ad5d3ae3e25323c23a2f442913729ceb.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]