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

* Re: patch for long options in dired-listing-switches
  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-06-08  7:31 ` Glenn Morris
  2011-06-09  6:08 ` Glenn Morris
  2 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2011-05-31  8:52 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

> Date: Tue, 31 May 2011 11:07:20 +0300
> From: Alexander Klimov <alserkli@inbox.ru>
> 
> 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

Thanks.  Could someone who uses Windows please see if this does TRT
with ls-lisp.el emulation of `ls'?  Long options are not currently
supported by it, but the question is will appending " -t" work?



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

* Re: patch for long options in dired-listing-switches
  2011-05-31  8:52 ` Eli Zaretskii
@ 2011-05-31  9:27   ` Alexander Klimov
  2011-05-31  9:43     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Klimov @ 2011-05-31  9:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Tue, 31 May 2011, Eli Zaretskii wrote:
> Could someone who uses Windows please see if this does TRT with
> ls-lisp.el emulation of `ls'?  Long options are not currently
> supported by it, but the question is will appending " -t" work?

Yes,

 Eval: (dired "." "-la -t")

works on Windows.

-- 
Regards,
ASK



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

* Re: patch for long options in dired-listing-switches
  2011-05-31  9:27   ` Alexander Klimov
@ 2011-05-31  9:43     ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-05-31  9:43 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

> Date: Tue, 31 May 2011 12:27:55 +0300
> From: Alexander Klimov <alserkli@inbox.ru>
> cc: emacs-devel@gnu.org
> 
> Yes,
> 
>  Eval: (dired "." "-la -t")
> 
> works on Windows.

Thanks.



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

* Re: patch for long options in dired-listing-switches
  2011-05-31  8:07 patch for long options in dired-listing-switches Alexander Klimov
  2011-05-31  8:52 ` Eli Zaretskii
@ 2011-06-08  7:31 ` Glenn Morris
  2011-06-08  9:07   ` Alexander Klimov
  2011-06-09  6:08 ` Glenn Morris
  2 siblings, 1 reply; 8+ messages in thread
From: Glenn Morris @ 2011-06-08  7:31 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel


Alexander Klimov wrote:

> 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{=}.

The manual used to say:

  No matter how they are specified, the @code{ls} switches should all be
  short options (that is, single characters) requiring no arguments.

but was changed to the current form 2006-03-31 with a log that just says
"Many cleanups."

I wonder if it would be better to change the manual back to what it used
to be, since basically nowhere in the code is set up to handle long
options correctly, nor is it documented in the doc-string of
dired-listing-switches.


PS It is much better to report these kinds of things on the bug mailing
list; but we are here now.



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

* Re: patch for long options in dired-listing-switches
  2011-06-08  7:31 ` Glenn Morris
@ 2011-06-08  9:07   ` Alexander Klimov
  2011-06-08 16:30     ` Glenn Morris
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Klimov @ 2011-06-08  9:07 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

On Wed, 8 Jun 2011, Glenn Morris wrote:
> I wonder if it would be better to change the manual back to what it
> used to be, since basically nowhere in the code is set up to handle
> long options correctly, nor is it documented in the doc-string of
> dired-listing-switches.

It will certainly be easier to implement, but consider the user: the
current version of `C-u s' (dired-sort-toggle-or-edit) asks for

 ls switches (must contain -l)

and already makes the user frown upon a program that cannot add `-l'
by itself, imagine that it says

 ls switches (must contain -l, no long options)

and thus does not allow to use

 --time-style
 --group-directories-first
 --si

and forces the user to remember the short equivalents for the rest of
them.

By the way, the documentation of dired-listing-switches does not say
that the long options are supported, but it also does not say that
they are not supported.

-- 
Regards,
ASK



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

* Re: patch for long options in dired-listing-switches
  2011-06-08  9:07   ` Alexander Klimov
@ 2011-06-08 16:30     ` Glenn Morris
  0 siblings, 0 replies; 8+ messages in thread
From: Glenn Morris @ 2011-06-08 16:30 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

Alexander Klimov wrote:

> By the way, the documentation of dired-listing-switches does not say
> that the long options are supported, but it also does not say that
> they are not supported.

I know. On reflection, I guess using long options does occur in practice
and so should indeed be handled.



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

* Re: patch for long options in dired-listing-switches
  2011-05-31  8:07 patch for long options in dired-listing-switches Alexander Klimov
  2011-05-31  8:52 ` Eli Zaretskii
  2011-06-08  7:31 ` Glenn Morris
@ 2011-06-09  6:08 ` Glenn Morris
  2 siblings, 0 replies; 8+ messages in thread
From: Glenn Morris @ 2011-06-09  6:08 UTC (permalink / raw)
  To: Alexander Klimov; +Cc: emacs-devel

Alexander Klimov wrote:

> The following patch solves the most obvious cases in lisp/files.el and
> lisp/mail/sendmail.el,

Thanks; applied.

>  but in lisp/net/ange-ftp.el

Hopefully fixed.



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