unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Klimov <alserkli@inbox.ru>
To: emacs-devel@gnu.org
Subject: patch for long options in dired-listing-switches
Date: Tue, 31 May 2011 11:07:20 +0300	[thread overview]
Message-ID: <TheMailAgent.4bb27fc1b5b814@266298c4ea8437860e545> (raw)

Originally dired-listing-switches was supposed to be (etc/NEWS.1-17)

 a string containing `-' followed by letters,

but now (doc/emacs/dired.texi)

 No matter how they are specified, the @code{ls} switches can include
 short options (that is, single characters) requiring no arguments,
 and long options (starting with @samp{--}) whose arguments are
 specified with @samp{=}.

As a result, the code that assume the former definition is broken once
the user implements the latter. One example, is recover-session: if
the value of dired-listing-switches ends with "--time-style=long-iso",
then recover-session tries to add "t" to it and fails since ls does
not like "--time-style=long-isot".

The simplest solution is to concat with " -t" instead. The following
patch solves the most obvious cases in lisp/files.el and
lisp/mail/sendmail.el, but in lisp/net/ange-ftp.el

 (string-match "[aA]" dired-listing-switches)

is also a bug for long options that contain `a'.

=== modified file 'lisp/files.el'
--- lisp/files.el       2011-05-28 19:26:25 +0000
+++ lisp/files.el       2011-05-31 08:02:07 +0000
@@ -5256,7 +5256,7 @@
               (save-excursion
                 (let ((switches dired-listing-switches))
                   (if (file-symlink-p file)
-                      (setq switches (concat switches "L")))
+                      (setq switches (concat switches " -L")))
                   (set-buffer standard-output)
                   ;; Use insert-directory-safely, not insert-directory,
                   ;; because these files might not exist.  In particular,
@@ -5299,7 +5299,7 @@
       (error "No previous sessions to recover")))
   (let ((ls-lisp-support-shell-wildcards t))
     (dired (concat auto-save-list-file-prefix "*")
-          (concat dired-listing-switches "t")))
+          (concat dired-listing-switches " -t")))
   (save-excursion
     (goto-char (point-min))
     (or (looking-at " Move to the session you want to recover,")

=== modified file 'lisp/mail/sendmail.el'
--- lisp/mail/sendmail.el       2011-05-27 07:18:15 +0000
+++ lisp/mail/sendmail.el       2011-05-31 08:02:06 +0000
@@ -1800,7 +1800,7 @@
       ;; unbound on exit from the let.
       (require 'dired)
       (let ((dired-trivial-filenames t))
-       (dired-other-window wildcard (concat dired-listing-switches "t")))
+       (dired-other-window wildcard (concat dired-listing-switches " -t")))
       (rename-buffer "*Auto-saved Drafts*" t)
       (save-excursion
        (goto-char (point-min))
@@ -1880,7 +1880,7 @@
                  ;; `ls' is not a standard program (it will use
                  ;; ls-lisp instead).
                  (dired-noselect file-name
-                                 (concat dired-listing-switches "t"))))
+                                 (concat dired-listing-switches " -t"))))
             (save-selected-window
               (select-window (display-buffer dispbuf t))
               (goto-char (point-min))


-- 
Regards,
ASK



             reply	other threads:[~2011-05-31  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31  8:07 Alexander Klimov [this message]
2011-05-31  8:52 ` patch for long options in dired-listing-switches Eli Zaretskii
2011-05-31  9:27   ` Alexander Klimov
2011-05-31  9:43     ` Eli Zaretskii
2011-06-08  7:31 ` Glenn Morris
2011-06-08  9:07   ` Alexander Klimov
2011-06-08 16:30     ` Glenn Morris
2011-06-09  6:08 ` Glenn Morris

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=TheMailAgent.4bb27fc1b5b814@266298c4ea8437860e545 \
    --to=alserkli@inbox.ru \
    --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).