unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* patch for long options in dired-listing-switches
@ 2011-05-31  8:07 Alexander Klimov
  2011-05-31  8:52 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alexander Klimov @ 2011-05-31  8:07 UTC (permalink / raw)
  To: emacs-devel

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



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

end of thread, other threads:[~2011-06-09  6:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-31  8:07 patch for long options in dired-listing-switches Alexander Klimov
2011-05-31  8:52 ` 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

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).