unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* dired listg & dired-sort-menu.el
@ 2013-06-17 13:24 Harry Putnam
  2013-06-17 14:25 ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Harry Putnam @ 2013-06-17 13:24 UTC (permalink / raw)
  To: help-gnu-emacs

   Running 
   Emacs 24.0.92.1 on Debian (testing)

Just tinkering with the sorting in dired and ran across Francis J
Wright's 'dired-sort-menu.el' (and menu+)... The following site shows
the menu that is produced:

  http://www.emacswiki.org/emacs/DiredSortMenu

But when I load the library and press 'M-x dired-sort-dialogue' I get
a less extensive menu and wondered if this is a result of the library
being quite old (or possibly changes in the gnu 'ls' command..) 

  ( dired-sort-menu.el,v 1.26 2001-07-26 21:22:48+01 )

compared to the emacs version I'm running or if
I've done something to cause this.

If it matters I tried with and without dired-x.




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

* RE: dired listg & dired-sort-menu.el
  2013-06-17 13:24 dired listg & dired-sort-menu.el Harry Putnam
@ 2013-06-17 14:25 ` Drew Adams
  2013-06-21 19:33   ` Harry Putnam
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-06-17 14:25 UTC (permalink / raw)
  To: Harry Putnam, help-gnu-emacs

>    Running
>    Emacs 24.0.92.1 on Debian (testing)
> 
> Just tinkering with the sorting in dired and ran across Francis J
> Wright's 'dired-sort-menu.el' (and menu+)... The following site shows
> the menu that is produced:
> 
>   http://www.emacswiki.org/emacs/DiredSortMenu
> 
> But when I load the library and press 'M-x dired-sort-dialogue' I get
> a less extensive menu and wondered if this is a result of the library
> being quite old (or possibly changes in the gnu 'ls' command..)
> 
>   ( dired-sort-menu.el,v 1.26 2001-07-26 21:22:48+01 )
> 
> compared to the emacs version I'm running or if
> I've done something to cause this.
> 
> If it matters I tried with and without dired-x.

You do not say what the differences are between what you see and what is
shown on wiki page DiredSortMenu.

That page shows a popup menu initiated via `S-mouse-2' (in Dired).
You used `M-x dired-sort-dialogue' instead, which does not provide submenu 
Configuration and provides a `Reverse' checkbox instead of a `Reversed Sort
By' submenu.  If this is the difference you are seeing then it is expected.

[The menu from menu-bar menu `Immediate > Sort By' (or `Dir > Sort By' if you use Dired+) is essentially the same as the `S-mouse-2' popup menu.]



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

* Re: dired listg & dired-sort-menu.el
  2013-06-17 14:25 ` Drew Adams
@ 2013-06-21 19:33   ` Harry Putnam
  2013-06-21 21:08     ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Harry Putnam @ 2013-06-21 19:33 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

>>    Running
>>    Emacs 24.0.92.1 on Debian (testing)
>> 
>> Just tinkering with the sorting in dired and ran across Francis J
>> Wright's 'dired-sort-menu.el' (and menu+)... The following site shows
>> the menu that is produced:
>> o
>>   http://www.emacswiki.org/emacs/DiredSortMenu
>> 
>> But when I load the library and press 'M-x dired-sort-dialogue' I get
>> a less extensive menu and wondered if this is a result of the library
>> being quite old (or possibly changes in the gnu 'ls' command..)

[...]

> You do not say what the differences are between what you see and what is
> shown on wiki page DiredSortMenu.

I left out quite a bit I should have included... trying to correct
that below.

Thank you for taking time to coach me along on this.

> That page shows a popup menu initiated via `S-mouse-2' (in Dired).
> You used `M-x dired-sort-dialogue' instead, which does not provide submenu 
> Configuration and provides a `Reverse' checkbox instead of a `Reversed Sort
> By' submenu.  If this is the difference you are seeing then it is expected.

I probably should start from the top as this may not even be the way
to do what I'm after.  But first:

I did try `S-mouse-2'.  But somehow a veil of shear idiocy fell over
me and I was reading it <shift>+S+mouse+2, so naturally emacs started
the `symlink' dialog...  I then assumed things had changes since the
dired-sort-menu was written.

Once I managed to use S-mouse-2 correctly I noticed there are a couple
things missing still.

What I'm really after is a way to have 2 things extra going on in the
regular dired buffer.  

  1) hide dot files
  2) sort directories first.

The menu on your pages on the wiki 

  http://www.emacswiki.org/emacs/DrewsEmacsDiredSortMenu

show a menu with an item

   "Dirs first   (W)"

so that is what got me looking at that program.

I had already googled up code to hide dot files and a setq to list
dirs first 

  (I've lost track of the exact sources online, the code is included
  inline at the end), 

but with them both in ~/.emacs the hiding dot files part gets canceled
out... so I was thinking maybe getting your program in there might
solve that.

Getting back to subject.  I've posted three images, now that I broke
out of the idiocy veil.

1) menu produced by S-Mouse-2
2) Menu produced by Menu / Immediate / Sort by
3) Menu posted on webpages.

You'll see that even though the first two pop up with a little
different look, they seem to contain the same items.

Whereas, the menu from your wikipages (The bottom image), have two
different items.... `Ignore Case' and `Dirs First'

  www.jtan.com/~reader/vu1/disp.cgi

(Should produce 3 stacked images in the order shown above)

But to repeat my reason for query... In my default dired view I want
to have dot files hidden and Dirs sorted first... but be able to
toggle dot files.

-------        ---------       ---=---       ---------      -------- 
-------        ---------       ---=---       ---------      -------- 
Hide dot files
,----
| (require 'dired-x)
| 
| (setq-default dired-omit-files-p t) ; this is buffer-local variable
| 
| (setq dired-omit-files
|      (concat dired-omit-files "\\|^\\..+$"))
`----

Sort directories first

,----
| (setq dired-listing-switches "-lXGh --group-directories-first")
`----




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

* RE: dired listg & dired-sort-menu.el
  2013-06-21 19:33   ` Harry Putnam
@ 2013-06-21 21:08     ` Drew Adams
  2013-06-29  1:51       ` Harry Putnam
  2013-06-29  2:09       ` Harry Putnam
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2013-06-21 21:08 UTC (permalink / raw)
  To: Harry Putnam, help-gnu-emacs

> What I'm really after is a way to have 2 things extra going on in the
> regular dired buffer.
>   1) hide dot files
>   2) sort directories first.
> 
> The menu on your pages on the wiki
>   http://www.emacswiki.org/emacs/DrewsEmacsDiredSortMenu
> show a menu with an item
>    "Dirs first   (W)"
> so that is what got me looking at that program.

That menu item is from dired-sort-menu+.el, which is an add-on to dired-sort-menu.el.  Both files are available on Emacs Wiki:

http://www.emacswiki.org/emacs-en/download/dired-sort-menu.el

http://www.emacswiki.org/emacs-en/download/dired-sort-menu%2b.el 

> I had already googled up code to hide dot files

Yes, Dired Omit is good for that. But `dired-omit-mode' is the supported name now, instead of `dired-omit-files-p'.  It is probably better to use this to turn it on, instead of just setting the mode variable:

(dired-omit-mode 1)

You can also toggle omit mode interactively, using `M-o'.

> and a setq to list dirs first

You don't need that if you use dired-sort-menu[+].el.

> but with them both in ~/.emacs the hiding dot files part gets canceled
> out... 

It shouldn't.

> so I was thinking maybe getting your program in there might
> solve that.
> 
> Getting back to subject.  I've posted three images, now that I broke
> out of the idiocy veil.
> 1) menu produced by S-Mouse-2
> 2) Menu produced by Menu / Immediate / Sort by
> 3) Menu posted on webpages.
> 
> You'll see that even though the first two pop up with a little
> different look, they seem to contain the same items.
> 
> Whereas, the menu from your wikipages (The bottom image), have two
> different items.... `Ignore Case' and `Dirs First'

See above - you need (require 'dired-sort-menu+)

>   www.jtan.com/~reader/vu1/disp.cgi
> (Should produce 3 stacked images in the order shown above)
> 
> But to repeat my reason for query... In my default dired view I want
> to have dot files hidden and Dirs sorted first... but be able to
> toggle dot files.

Should just work.  You toggle omit mode with `M-o'.

> Hide dot files
> (require 'dired-x)
> (setq-default dired-omit-files-p t)
> (setq dired-omit-files (concat dired-omit-files "\\|^\\..+$"))

OK.

> Sort directories first
> (setq dired-listing-switches "-lXGh --group-directories-first")

Not needed, but might also work (depending on your platform etc.), as an alternative to Dired Sort Menu.  (FWIW, it doesn't work for me, on Windows with Cygwin.)



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

* Re: dired listg & dired-sort-menu.el
  2013-06-21 21:08     ` Drew Adams
@ 2013-06-29  1:51       ` Harry Putnam
  2013-06-29  3:02         ` Drew Adams
  2013-06-29  2:09       ` Harry Putnam
  1 sibling, 1 reply; 8+ messages in thread
From: Harry Putnam @ 2013-06-29  1:51 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Drew Adams <drew.adams@oracle.com> writes:

>> Whereas, the menu from your wikipages (The bottom image), have two
>> different items.... `Ignore Case' and `Dirs First'
>
> See above - you need (require 'dired-sort-menu+)
>

I must be having some other problem here.

With this in emacs:

  (require 'dired-x)
  (require 'dired-sort-menu)
 (require 'dired-sort-menu+)

I should see 'Dirs first' as part of the menu right?

But what I see when pressing S-mouse-2 is this (No 'Dirs First' is listed):


[-- Attachment #2: Menu_006.png --]
[-- Type: image/png, Size: 12728 bytes --]

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

* Re: dired listg & dired-sort-menu.el
  2013-06-21 21:08     ` Drew Adams
  2013-06-29  1:51       ` Harry Putnam
@ 2013-06-29  2:09       ` Harry Putnam
  1 sibling, 0 replies; 8+ messages in thread
From: Harry Putnam @ 2013-06-29  2:09 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

Sorry to keep pounding away on this

Harry wrote:
>> I had already googled up code to hide dot files
>

Drew responded:
> Yes, Dired Omit is good for that. But `dired-omit-mode' is the
> supported name now, instead of `dired-omit-files-p'.  It is probably
> better to use this to turn it on, instead of just setting the mode
> variable:
>
> (dired-omit-mode 1)
>

I find a bit of peculiarity on this too.

If I have 

  (dired-omit-mode 1)
  (setq dired-omit-files
         (concat dired-omit-files "\\|^\\..+$"))

Dired opens with the dot files still visible (Yes they can be toggled
to hidden)

But if I have:
  (setq-default dired-omit-files-p t)
  (setq dired-omit-files
          (concat dired-omit-files "\\|^\\..+$"))

Then Dired opens with dot files hidden (Which is what I wanted).  And
of they can be toggled showing.




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

* RE: dired listg & dired-sort-menu.el
  2013-06-29  1:51       ` Harry Putnam
@ 2013-06-29  3:02         ` Drew Adams
  2013-06-29 16:16           ` Harry Putnam
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-06-29  3:02 UTC (permalink / raw)
  To: Harry Putnam, help-gnu-emacs

> >> Whereas, the menu from your wikipages (The bottom image), have two
> >> different items.... `Ignore Case' and `Dirs First'
> >
> > See above - you need (require 'dired-sort-menu+)
> 
> I must be having some other problem here.
> With this in emacs:
>  (require 'dired-x)
>  (require 'dired-sort-menu)
>  (require 'dired-sort-menu+)

You don't need to require `dired-sort-menu'; that is done by
`dired-sort-menu+'.  (But it doesn't hurt anything to do so.)

> I should see 'Dirs first' as part of the menu right?
> But what I see when pressing S-mouse-2 is this (No 'Dirs First' is listed):

Right.  It depends on your setup.  In what I see, I do not see the
`Time Accessed' menu item (which you see), for instance.

If you check the Lisp code you will see that `Dirs First' and
`Ignore Case' are supported only if (ls-lisp-var-p 'ls-lisp-dirs-first)
and (ls-lisp-var-p 'ls-lisp-ignore-case) return non-nil.
`C-h f ls-lisp-var-p' says this:

 Return non-nil if ls-lisp variable VAR should be used.

And in this case the VAR is `ls-lisp-dirs-first'.  The Commentary in
dired-sort-menu.el says this:

;; The menu also supports two Emacs 21 `ls-lisp' switches:
;; `ls-lisp-ignore-case' ignores case in alphanumeric sorts and
;; `ls-lisp-dirs-first' lists all directories first.  (These latter
;; two switches improve compatibility with Microsoft Windows
;; Explorer.)

Bottom line: those two `lisp-var-p' sexps that guard those menu items
return nil for you but non-nil for me.  Those two variables (user
options, actually) are provided by library `ls-lisp.el'.

If your Emacs does not use library ls-lisp.el then you will not have
those menu items.  You can try loading ls-lisp.el, but that will likely
change some other things that you might not like (dunno).

ls-lisp.el is an emulation library: it emulates Unix command `ls' using
Lisp.

HTH.





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

* Re: dired listg & dired-sort-menu.el
  2013-06-29  3:02         ` Drew Adams
@ 2013-06-29 16:16           ` Harry Putnam
  0 siblings, 0 replies; 8+ messages in thread
From: Harry Putnam @ 2013-06-29 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams <drew.adams@oracle.com> writes:

[...]

> Right.  It depends on your setup.  In what I see, I do not see the
> `Time Accessed' menu item (which you see), for instance.

Ok, I see, and thank you for the detailed explanation.  It was very
helpful. 




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

end of thread, other threads:[~2013-06-29 16:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 13:24 dired listg & dired-sort-menu.el Harry Putnam
2013-06-17 14:25 ` Drew Adams
2013-06-21 19:33   ` Harry Putnam
2013-06-21 21:08     ` Drew Adams
2013-06-29  1:51       ` Harry Putnam
2013-06-29  3:02         ` Drew Adams
2013-06-29 16:16           ` Harry Putnam
2013-06-29  2:09       ` Harry Putnam

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