From: Arthur Miller <arthur.miller@live.com>
To: emacs-devel@gnu.org
Subject: Proposal: ls-lisp.el handle --group-directories-first flag
Date: Thu, 15 Jul 2021 11:19:52 +0200 [thread overview]
Message-ID: <AM9PR09MB497798B73B2039841681FCA796129@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
[-- 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
next reply other threads:[~2021-07-15 9:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 9:19 Arthur Miller [this message]
2021-07-16 11:57 ` Proposal: ls-lisp.el handle --group-directories-first flag 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AM9PR09MB497798B73B2039841681FCA796129@AM9PR09MB4977.eurprd09.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).