[Top][All Lists]

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

patch for long options in dired-listing-switches

From: Alexander Klimov
Subject: patch for long options in dired-listing-switches
Date: Tue, 31 May 2011 11:07:20 +0300

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 @@
                 (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")))
     (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)
        (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"))))
               (select-window (display-buffer dispbuf t))
               (goto-char (point-min))


reply via email to

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