unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Proposal: ls-lisp.el handle --group-directories-first flag
@ 2021-07-15  9:19 Arthur Miller
  2021-07-16 11:57 ` Eli Zaretskii
  0 siblings, 1 reply; 19+ messages in thread
From: Arthur Miller @ 2021-07-15  9:19 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 786 bytes --]

Just a minor 'out-of-the-box' quality of life improvement mostly for
MS Windows users. ls-lisp.el is default on MS Windows, and some users
might share their init configuration between their Gnu/Linux and MS
Windows systems, it might be nice to have ls-lisp.el recognize
`--group-directories-first' flag of Gnu ls program.

I have just piggy-back on existing code here; I am not sure if I can
actually set `ls-lisp-dirs-firs' var to `t' when
`--group-directories-first' is found, so I am just converting this flag
to `y' so we can per-use existing machinery. But I would happily skip
`y' if it is acceptable to change users choice for `ls-lisp-dirs-first'
variable when `--group-directories-first' is present.

If this would be acceptable, I can also add some notice to docs and
news. 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ls-lisp.patch --]
[-- Type: text/x-patch, Size: 1190 bytes --]

--- ../emacs/lisp/ls-lisp.el	2021-06-06 23:11:38.317648694 +0200
+++ ./ls-lisp.el	2021-07-15 11:08:02.233434792 +0200
@@ -291,6 +291,10 @@
 	;; Remove --dired switch
 	(if (string-match "--dired " switches)
 	    (setq switches (replace-match "" nil nil switches)))
+        ;; Convert --group-directories-first to `y' (`y' and `Y' does not seem to
+        ;; be used by any ls prog currently so we can per-use it here)
+        (if (string-match "--group-directories-first " switches)
+            (setq switches (replace-match "y" nil nil switches)))
 	;; Convert SWITCHES to a list of characters.
 	(setq switches (delete ?\  (delete ?- (append switches nil))))
 	;; Sometimes we get ".../foo*/" as FILE.  While the shell and
@@ -682,7 +686,7 @@
 	       (ding) (sit-for 2))))	; to show user the message!
   (if (memq ?F switches)		; classify switch
       (setq file-alist (mapcar 'ls-lisp-classify file-alist)))
-  (if ls-lisp-dirs-first
+  (if (or ls-lisp-dirs-first (memq ?y switches))
   ;; Re-sort directories first, without otherwise changing the
   ;; ordering, and reverse whole list.  cadr of each element of
   ;; `file-alist' is t for directory, string (name linked to) for

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-07-25 12:44 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-15  9:19 Proposal: ls-lisp.el handle --group-directories-first flag Arthur Miller
2021-07-16 11:57 ` Eli Zaretskii
2021-07-16 13:20   ` Arthur Miller
2021-07-16 13:44     ` Eli Zaretskii
2021-07-16 14:58       ` Arthur Miller
2021-07-17 11:57         ` Eli Zaretskii
2021-07-19 20:59           ` Arthur Miller
2021-07-24 11:13             ` Eli Zaretskii
2021-07-24 11:27               ` Eli Zaretskii
2021-07-24 11:54                 ` Arthur Miller
2021-07-24 12:07                   ` Eli Zaretskii
2021-07-24 14:58                     ` Arthur Miller
2021-07-24 15:43                       ` Eli Zaretskii
2021-07-24 19:02                         ` Arthur Miller
2021-07-25  7:46                           ` Eli Zaretskii
2021-07-25  8:29                             ` Arthur Miller
2021-07-25  9:11                               ` Eli Zaretskii
2021-07-25  9:31                                 ` Arthur Miller
2021-07-25 12:44                                 ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).