unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mode-line menu for minor modes
@ 2008-02-19  8:09 Dan Nicolaescu
  2008-02-20  3:39 ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-02-19  8:09 UTC (permalink / raw)
  To: emacs-devel


The new feature to pop a menu when clicking on the mode-line :lighter for
minor modes is great.

But for minor modes that don't provide a menu, just an error message is
displayed: "No menu for minor mode `BLAH'".  This is not very helpful
for the user, it would be nicer to pop up a menu that has (at least) 2
entries: - one to turn off the minor mode
         - one to show the help for that minor mode.

Yes, these are available elsewhere, but it's better to provide something
useful and consistent for mouse-1 instead of just complaining that a
menu is not available.





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

* RE: mode-line menu for minor modes
  2008-02-19  8:09 mode-line menu for minor modes Dan Nicolaescu
@ 2008-02-20  3:39 ` Drew Adams
  2008-02-20  6:29   ` Dan Nicolaescu
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-02-20  3:39 UTC (permalink / raw)
  To: 'Dan Nicolaescu', emacs-devel

> The new feature to pop a menu when clicking on the mode-line 
> :lighter for
> minor modes is great.
> 
> But for minor modes that don't provide a menu, just an error 
> message is
> displayed: "No menu for minor mode `BLAH'".  This is not very helpful
> for the user, it would be nicer to pop up a menu that has (at least) 2
> entries: - one to turn off the minor mode
>          - one to show the help for that minor mode.
> 
> Yes, these are available elsewhere, but it's better to 
> provide something
> useful and consistent for mouse-1 instead of just complaining that a
> menu is not available.

Good idea.





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

* Re: mode-line menu for minor modes
  2008-02-20  3:39 ` Drew Adams
@ 2008-02-20  6:29   ` Dan Nicolaescu
  2008-02-21  0:11     ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-02-20  6:29 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

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

  > > The new feature to pop a menu when clicking on the mode-line 
  > > :lighter for
  > > minor modes is great.
  > > 
  > > But for minor modes that don't provide a menu, just an error 
  > > message is
  > > displayed: "No menu for minor mode `BLAH'".  This is not very helpful
  > > for the user, it would be nicer to pop up a menu that has (at least) 2
  > > entries: - one to turn off the minor mode
  > >          - one to show the help for that minor mode.
  > > 
  > > Yes, these are available elsewhere, but it's better to 
  > > provide something
  > > useful and consistent for mouse-1 instead of just complaining that a
  > > menu is not available.
  > 
  > Good idea.

Given that you wrote the rest of the minor mode menu popup code, do you
want to implement this too?




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

* RE: mode-line menu for minor modes
  2008-02-20  6:29   ` Dan Nicolaescu
@ 2008-02-21  0:11     ` Drew Adams
  2008-02-21  9:17       ` Dan Nicolaescu
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-02-21  0:11 UTC (permalink / raw)
  To: dann; +Cc: emacs-devel

>   > > The new feature to pop a menu when clicking on the mode-line 
>   > > :lighter for
>   > > minor modes is great.
>   > > 
>   > > But for minor modes that don't provide a menu, just an error 
>   > > message is
>   > > displayed: "No menu for minor mode `BLAH'".  This is 
>   > > not very helpful
>   > > for the user, it would be nicer to pop up a menu that 
>   > > has (at least) 2
>   > > entries: - one to turn off the minor mode
>   > >          - one to show the help for that minor mode.
>   > > 
>   > > Yes, these are available elsewhere, but it's better to 
>   > > provide something
>   > > useful and consistent for mouse-1 instead of just 
>   > > complaining that a menu is not available.
>   > 
>   > Good idea.
> 
> Given that you wrote the rest of the minor mode menu popup 
> code, do you
> want to implement this too?

OK - see below. I wanted to make a patch, but apparently I don't know how to
find the latest CVS version. When I look at what I think would be the latest
version, namely the first download link at
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/bindings.el?view=log, it
shows a version of bindings.el that does not have the changes I submitted.
But you are apparently seeing some version that does include that patch.

If you tell me how to find the right version to patch, I'll send a patch. If
not, here is the updated function definition - just substitute this for the
definition I sent in my September patch.

Note: I added (sleep-for 1) because the turned-off message is otherwise
erased immediately, at least in my environment. If it works for you without
the sleep-for, then go ahead and remove it.

(defun minor-mode-menu-from-indicator (indicator) ; e.g. " Icy"
  "Show menu for minor mode specified by INDICATOR.
Interactively, INDICATOR is read using completion.
If there is no menu defined for the minor mode, then create one with
items `Turn Off' and `Help'."
  (interactive (list (completing-read "Minor mode indicator: "
 
(describe-minor-mode-completion-table-for-indicator))))
  (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
    (unless minor-mode (error "Cannot find minor mode for `%s'" indicator))
    (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
           (menu (and (keymapp map) (lookup-key map [menu-bar]))))
      (if menu
          (popup-menu menu)
        (read-event)                    ; Swallow the mouse up event.
        (setq menu `(keymap
                     (,(intern indicator) ,indicator
                       keymap
                       (turn-off menu-item "Turn Off"
                                 (lambda ()
                                   (interactive)
                                   (,minor-mode -1)
                                   (message ,(format "`%S' turned OFF"
minor-mode))
                                   (sleep-for 1)))
                       (help menu-item "Help"
                             (lambda () (interactive) (describe-function
',minor-mode))))))
        (popup-menu menu)))))






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

* Re: mode-line menu for minor modes
  2008-02-21  0:11     ` Drew Adams
@ 2008-02-21  9:17       ` Dan Nicolaescu
  2008-02-21  9:27         ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-02-21  9:17 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

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

  > >   > > The new feature to pop a menu when clicking on the mode-line 
  > >   > > :lighter for
  > >   > > minor modes is great.
  > >   > > 
  > >   > > But for minor modes that don't provide a menu, just an error 
  > >   > > message is
  > >   > > displayed: "No menu for minor mode `BLAH'".  This is 
  > >   > > not very helpful
  > >   > > for the user, it would be nicer to pop up a menu that 
  > >   > > has (at least) 2
  > >   > > entries: - one to turn off the minor mode
  > >   > >          - one to show the help for that minor mode.
  > >   > > 
  > >   > > Yes, these are available elsewhere, but it's better to 
  > >   > > provide something
  > >   > > useful and consistent for mouse-1 instead of just 
  > >   > > complaining that a menu is not available.
  > >   > 
  > >   > Good idea.
  > > 
  > > Given that you wrote the rest of the minor mode menu popup 
  > > code, do you
  > > want to implement this too?
  > 
  > OK - see below. 

Thank you!

  > I wanted to make a patch, but apparently I don't know how to
  > find the latest CVS version. When I look at what I think would be the latest
  > version, namely the first download link at
  > http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/bindings.el?view=log, it
  > shows a version of bindings.el that does not have the changes I submitted.
  > But you are apparently seeing some version that does include that patch.

  > If you tell me how to find the right version to patch, I'll send a patch. If
  > not, here is the updated function definition - just substitute this for the
  > definition I sent in my September patch.

cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/emacs co emacs/lisp/mouse.el

  > Note: I added (sleep-for 1) because the turned-off message is otherwise
  > erased immediately, at least in my environment. If it works for you without
  > the sleep-for, then go ahead and remove it.

Works fine without it.
I also took out the read-event call.

I checked in your changes. Thanks!





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

* RE: mode-line menu for minor modes
  2008-02-21  9:17       ` Dan Nicolaescu
@ 2008-02-21  9:27         ` Drew Adams
  2008-02-21  9:32           ` Dan Nicolaescu
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-02-21  9:27 UTC (permalink / raw)
  To: dann; +Cc: emacs-devel

>   > If you tell me how to find the right version to patch, 
>   > I'll send a patch. If
>   > not, here is the updated function definition - just 
>   > substitute this for the
>   > definition I sent in my September patch.
> 
> cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/emacs 
> co emacs/lisp/mouse.el

I use the web interface, and I am on Windows, so no cvs command. I just
right-click one of the Download links and save the file. But I couldn't find
the right Download link - I was using the first one, which I thought was the
most current and at the top of the trunk (or whatever the terminology is).

I'd still like to know which link would give me the latest version that I
needed to patch. Thx.





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

* Re: mode-line menu for minor modes
  2008-02-21  9:27         ` Drew Adams
@ 2008-02-21  9:32           ` Dan Nicolaescu
  2008-02-25  7:48             ` Bastien Guerry
  0 siblings, 1 reply; 12+ messages in thread
From: Dan Nicolaescu @ 2008-02-21  9:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

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

  > >   > If you tell me how to find the right version to patch, 
  > >   > I'll send a patch. If
  > >   > not, here is the updated function definition - just 
  > >   > substitute this for the
  > >   > definition I sent in my September patch.
  > > 
  > > cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/emacs 
  > > co emacs/lisp/mouse.el
  > 
  > I use the web interface, and I am on Windows, so no cvs command. I just
  > right-click one of the Download links and save the file. But I couldn't find
  > the right Download link - I was using the first one, which I thought was the
  > most current and at the top of the trunk (or whatever the terminology is).
  > 
  > I'd still like to know which link would give me the latest version that I
  > needed to patch. Thx.

Sorry, no idea. I've never used the web interface...




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

* Re: mode-line menu for minor modes
  2008-02-21  9:32           ` Dan Nicolaescu
@ 2008-02-25  7:48             ` Bastien Guerry
  2008-02-25 15:22               ` Drew Adams
  2008-02-25 15:47               ` Stefan Monnier
  0 siblings, 2 replies; 12+ messages in thread
From: Bastien Guerry @ 2008-02-25  7:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: Dan Nicolaescu, emacs-devel

Dan Nicolaescu <dann@ics.uci.edu> writes:

> "Drew Adams" <drew.adams@oracle.com> writes:
>
>   > >   > If you tell me how to find the right version to patch, 
>   > >   > I'll send a patch. If
>   > >   > not, here is the updated function definition - just 
>   > >   > substitute this for the
>   > >   > definition I sent in my September patch.
>   > > 
>   > > cvs -d :pserver:anonymous@cvs.savannah.gnu.org:/cvsroot/emacs 
>   > > co emacs/lisp/mouse.el
>   > 
>   > I use the web interface, and I am on Windows, so no cvs command. I just
>   > right-click one of the Download links and save the file. But I couldn't find
>   > the right Download link - I was using the first one, which I thought was the
>   > most current and at the top of the trunk (or whatever the terminology is).
>   > 
>   > I'd still like to know which link would give me the latest version that I
>   > needed to patch. Thx.
>
> Sorry, no idea. I've never used the web interface...

This gives you the revision 1.328 for mouse.el in lisp/ :

  http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?revision=1.328&root=emacs&view=markup

You can reach this from:

  http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?root=emacs&view=log

I don't know if there is a way to request the "latest" revision, instead
of requesting a specific number.  

HTH

-- 
Bastien




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

* RE: mode-line menu for minor modes
  2008-02-25  7:48             ` Bastien Guerry
@ 2008-02-25 15:22               ` Drew Adams
  2008-02-25 15:37                 ` Bastien Guerry
  2008-02-25 15:47               ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Drew Adams @ 2008-02-25 15:22 UTC (permalink / raw)
  To: 'Bastien Guerry'; +Cc: 'Dan Nicolaescu', emacs-devel

> >   > I use the web interface, and I am on Windows, so no cvs 
> >   > command. I just right-click one of the Download links
> >   > and save the file. But I couldn't find the right
> >   > Download link - I was using the first one, which I
> >   > thought was the most current and at the top of the
> >   > trunk (or whatever the terminology is).
> >   > 
> >   > I'd still like to know which link would give me the 
> >   > latest version that I needed to patch. Thx.
> >
> > Sorry, no idea. I've never used the web interface...
> 
> This gives you the revision 1.328 for mouse.el in lisp/ :
> 
>   
> http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?revisio
> n=1.328&root=emacs&view=markup
> 
> You can reach this from:
> 
> http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?root=em
acs&view=log

Thanks, but that's exactly where I went. But I picked the top download link
on the page (marked HEAD), figuring that it would be the latest. There is no
date listed for that entry, BTW. 

Guess I don't know how the revisions are organized. Revision 1.328 is dated
Feb 21, but Revision 1.241.2.60, which is above it on the page and is the
first revision below the HEAD entry, is dated Feb 25.

> I don't know if there is a way to request the "latest" 
> revision, instead of requesting a specific number.  

Right. That was the question. Other than that, how do you know what specific
number to use?






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

* Re: mode-line menu for minor modes
  2008-02-25 15:22               ` Drew Adams
@ 2008-02-25 15:37                 ` Bastien Guerry
  2008-02-25 16:32                   ` Drew Adams
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien Guerry @ 2008-02-25 15:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: 'Dan Nicolaescu', emacs-devel

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

> Guess I don't know how the revisions are organized. Revision 1.328 is dated
> Feb 21, but Revision 1.241.2.60, which is above it on the page and is the
> first revision below the HEAD entry, is dated Feb 25.

Mhh...  I guess you need to add &pathrev=HEAD to the URL, so that you
only list revisions in the HEAD branch:

http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?view=log&root=emacs&pathrev=HEAD

-- 
Bastien




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

* Re: mode-line menu for minor modes
  2008-02-25  7:48             ` Bastien Guerry
  2008-02-25 15:22               ` Drew Adams
@ 2008-02-25 15:47               ` Stefan Monnier
  1 sibling, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2008-02-25 15:47 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Dan Nicolaescu, Drew Adams, emacs-devel

> This gives you the revision 1.328 for mouse.el in lisp/ :

>   http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?revision=1.328&root=emacs&view=markup

> You can reach this from:

>   http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?root=emacs&view=log

> I don't know if there is a way to request the "latest" revision, instead
> of requesting a specific number.  

Yes, replace "1.328" with "HEAD" in the above URL.


        Stefan




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

* RE: mode-line menu for minor modes
  2008-02-25 15:37                 ` Bastien Guerry
@ 2008-02-25 16:32                   ` Drew Adams
  0 siblings, 0 replies; 12+ messages in thread
From: Drew Adams @ 2008-02-25 16:32 UTC (permalink / raw)
  To: 'Bastien Guerry'; +Cc: 'Dan Nicolaescu', emacs-devel

Bastien:
> > Guess I don't know how the revisions are organized. 
> > Revision 1.328 is dated Feb 21, but Revision 1.241.2.60,
> > which is above it on the page and is the
> > first revision below the HEAD entry, is dated Feb 25.
> 
> Mhh...  I guess you need to add &pathrev=HEAD to the URL, so that you
> only list revisions in the HEAD branch:
> 
> http://cvs.savannah.gnu.org/viewvc/emacs/lisp/mouse.el?view=lo
g&root=emacs&pathrev=HEAD

Stefan:
> > I don't know if there is a way to request the "latest" 
> > revision, instead of requesting a specific number.  
> 
> Yes, replace "1.328" with "HEAD" in the above URL.

Those are both equivalent to what I thought I did: right-click the download
link next to HEAD on the first mouse.el page,
http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/mouse.el?view=log.

I think I must have not done what I thought I did. I must have clicked the
download link for the first listed revision, instead of for HEAD.

Thx, anyway.





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

end of thread, other threads:[~2008-02-25 16:32 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-19  8:09 mode-line menu for minor modes Dan Nicolaescu
2008-02-20  3:39 ` Drew Adams
2008-02-20  6:29   ` Dan Nicolaescu
2008-02-21  0:11     ` Drew Adams
2008-02-21  9:17       ` Dan Nicolaescu
2008-02-21  9:27         ` Drew Adams
2008-02-21  9:32           ` Dan Nicolaescu
2008-02-25  7:48             ` Bastien Guerry
2008-02-25 15:22               ` Drew Adams
2008-02-25 15:37                 ` Bastien Guerry
2008-02-25 16:32                   ` Drew Adams
2008-02-25 15:47               ` Stefan Monnier

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