help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: dired-sort-menu fails


From: Drew Adams
Subject: RE: dired-sort-menu fails
Date: Mon, 29 Sep 2014 21:42:51 -0700 (PDT)

> trying to sort directory listings in a dired+ buffer using
> dired-sort-menu fails in multiple ways for me:
> 
> 1) while the doc states that the ‘dired-sort-menu’ popup menu would
> be bound to S-mouse-2, for me S-mouse-2 will always open the file under
> the cursor in the dired listing and no popup menu shows up.

What version of dired-sort-menu.el do you have?  I have version
2001.07.26, which has a Time-stamp of <26 July 2001>.  In it I see
this: 

;; Popup menu on "Shift Mouse 2":
(define-key                             ; (keymap key def)
  dired-mode-map [S-down-mouse-2] 'dired-sort-menu-popup)

Do you have that?  If so, then probably something else in your setup
is overriding that key binding.  What does `C-h k S-mouse-2' tell
you in Dired?

Have you tried starting Emacs without your init file: emacs -Q.
then putting dired-sort-menu.el and dired-sort-menu+.el in your
`load-path', and then loading dired-sort-menu+.el?  Is S-mouse-2
still not popping up the menu in that case?

Does it make any difference whether you change the value of option
`dired-sort-dialogue-own-frame'?  I don't think it should, but it
might be worth seeing whether that is involved.

But see below - I think your S-mouse-2 problem is simply that you
did not require library dired-sort-menu[*].el.

> 2) When invoking the dired-sort-dialog with 'M-x dired-sort-dialog'
> I do get a an emacs widget library window, which allows me to request
> for various sorting options via mouse clicks, but for all of such
> requests the listing of the (hopefully?) sorted directories will
> not display, instead it fails with:
> 
> insert-directory: Listing directory failed but `access-file' worked
> 
> upon which the dired buffer window turns empty

That's a real problem.

Do `C-h f insert-directory' to see what file it is defined in
(see next, but the answer is probably files.el).  Then load that
source file (not *.elc).  E.g., `M-x load-library files.el'
(don't forget the .el).

Then do `M-x debug-on-entry' and try again to provoke the error.
When the debugger opens, do `e' followed by `file', to see what
the value of arg FILE is.

You can quit the debugger with `q', unless you want to
try to step through it (using `d', and `c' if you don't care to
step through some part of it).

The error means that the program that is the value of variable
`insert-directory-program', which is probably "ls", failed,
signalling an error.  What is your value of that variable?

If you do step through the debugger, the most important
thing to watch is what happens to local variable `result':
what value it is given.  And you can see what error message
is returned by `insert-directory-program'.

To understand more about what went wrong, you will probably
need to step through the debugger.  When doing that, keep
a copy of the source code, opened to show the definition
of `insert-directory', so you can easily follow along.

[Are you using library `files+.el'?  It has a slightly different
version of `insert-directory'.  The difference should not make
a difference here, but it's good to know what code you are dealing
with.]

> 3) After playing around for some time I found out, that I can
> actually get a popup menu to show up on S-mouse-2, however only
> if I open a sorting dialog widget window at least once using
> 'M-x dired-sort-dialog' before trying to use S-mouse-2

That's because `dired-sort-dialog' has an autoload cookie.
When you invoke it, library `dires-sort-menu.el' gets loaded,
binding `S-mouse-2'.

This indicates that you did not in fact load library
dired-sort-menu beforehand.  If you want `S-mouse-2' to be
bound from the outset in Dired, then you need to load that
library.  Put (require 'dired-sort-menu) in your init file.
Or if you use also dired-sort-menu+.el, then require that
instead - it will require dired-sort-menu.el.

> Any help, in particular on point 2) would be most appreciated

Yes, #2 indicates a problem with your `ls' command (or whatever
program is bound to `insert-directory-program'.  That's clearly
the most serious problem you describe.

Try some of what I suggested.  Probably the most important
thing is to try starting from `emacs -Q', and eliminating extra
code.  Try, for example, with only dired-sort-menu.el, not
dired+.el or dired-sort-menu+.el, for now.  If you see the
same problem then we can concentrate on just dired-sort-menu.el.

You can follow up with me off list if you like, unless someone
else here has a suggestion.



reply via email to

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