unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to find commands run by menu?
@ 2009-12-08 20:42 kj
  2009-12-08 21:19 ` Pascal J. Bourguignon
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: kj @ 2009-12-08 20:42 UTC (permalink / raw)
  To: help-gnu-emacs





Is there any way to determine the exact command that gets run when
one invokes a particular menu item?

TIA!

kynnjo

P.S.  Here's why I want this.  It's a bit convoluted.  For mysterious
reasons, the latest version of Emacs on my system does not offer
any "print region" commands when run in X11 mode (these commands
do show in the File menu, but are permanently disabled, irrespective
of whether a region is defined or not).

I determined that if instead I run Emacs in text mode, now the
menus do offer the "print region" commands.

But I don't want to run Emacs in text mode.  Therefore, I want to
be able to execute *while on X11 mode* the same commands that get
triggered when I choose (in text mode) one of the "print region"
commands from the File menu.  Make sense?

I thought that the desired commands would be ones like ps-print-region,
but the ones I've guessed produce different-looking printed results
from those obtained by using the menus under text mode, and I prefer
the latter by far.  Therefore, I have to conclude that using the
menus does something more than just calling, say, ps-print-region.


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

* Re: How to find commands run by menu?
  2009-12-08 20:42 How to find commands run by menu? kj
@ 2009-12-08 21:19 ` Pascal J. Bourguignon
  2009-12-08 22:13   ` kj
  2009-12-09  9:22 ` Peter Dyballa
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-08 21:19 UTC (permalink / raw)
  To: help-gnu-emacs

kj <no.email@please.post> writes:

> Is there any way to determine the exact command that gets run when
> one invokes a particular menu item?

Yes.  You do that with C-h k and select the command in the menu.

Notice also that if you get the documentation of a command that is
accessible from a menu, this is signaled as "It is bound to ...".

-- 
__Pascal Bourguignon__


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

* Re: How to find commands run by menu?
  2009-12-08 21:19 ` Pascal J. Bourguignon
@ 2009-12-08 22:13   ` kj
  2009-12-08 23:29     ` Pascal J. Bourguignon
  0 siblings, 1 reply; 11+ messages in thread
From: kj @ 2009-12-08 22:13 UTC (permalink / raw)
  To: help-gnu-emacs

In <87638hb1uf.fsf@galatea.local> pjb@informatimago.com (Pascal J. Bourguignon) writes:

>      oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9

>      033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac

>      l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR

>      mV+hO/VvFAAAAABJRU5ErkJggg==
>X-Accept-Language:         fr, es, en
>X-Disabled: X-No-Archive: no
>User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin)
>Xref: panix gnu.emacs.help:180899

>kj <no.email@please.post> writes:

>> Is there any way to determine the exact command that gets run when
>> one invokes a particular menu item?

>Yes.  You do that with C-h k and select the command in the menu.

I can't figure out how to do this when I'm in text mode.  In text
mode, to select the command I want from the menu (File > Postscript
Print Region (B+W)), the entire keystroke sequence is M-` f 3.  If
I prefix this sequence with C-h k, then the info command responds
with:

  M-` runs the command tmm-menubar, which is an interactive compiled
  Lisp function in `tmm.el'.

  It is bound to M-`.

  (tmm-menubar &optional X-POSITION)

  Text-mode emulation of looking and choosing from a menubar.
  See the documentation for `tmm-prompt'.
  X-POSITION, if non-nil, specifies a horizontal position within the menu bar;
  we make that menu bar item (the one at that position) the default choice.

So I never get to the point of querying the meaning of the last
keystroke of the sequence (3).

I also tried to hit C-h k after having hit M-` f but before hitting
3.  In this case the info message is

  3 runs the command tmm-shortcut, which is an interactive compiled Lisp
  function in `tmm.el'.

  It is bound to many ordinary text characters.

  (tmm-shortcut)

  Choose the shortcut that the user typed.


...which is not what I'm looking for.

Kynn




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

* Re: How to find commands run by menu?
  2009-12-08 22:13   ` kj
@ 2009-12-08 23:29     ` Pascal J. Bourguignon
  0 siblings, 0 replies; 11+ messages in thread
From: Pascal J. Bourguignon @ 2009-12-08 23:29 UTC (permalink / raw)
  To: help-gnu-emacs

kj <no.email@please.post> writes:
> I can't figure out how to do this when I'm in text mode.  In text
> mode, to select the command I want from the menu (File > Postscript
> Print Region (B+W)), the entire keystroke sequence is M-` f 3.  If
> I prefix this sequence with C-h k, then the info command responds
> with:
>
>   M-` runs the command tmm-menubar, which is an interactive compiled
>   Lisp function in `tmm.el'.
>
>   It is bound to M-`.
>
>   (tmm-menubar &optional X-POSITION)

Well, then you will have to see what's put in the menu.  I don't know
how this is done, but using apropos, or scanning the sources, you may
find either functions to get the menus and menu items, and see what
function is associated with what menu, or you may find in the sources
where the menus are created what function is associated.


-- 
__Pascal Bourguignon__


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

* Re: How to find commands run by menu?
  2009-12-08 20:42 How to find commands run by menu? kj
  2009-12-08 21:19 ` Pascal J. Bourguignon
@ 2009-12-09  9:22 ` Peter Dyballa
       [not found] ` <mailman.12591.1260350574.2239.help-gnu-emacs@gnu.org>
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Peter Dyballa @ 2009-12-09  9:22 UTC (permalink / raw)
  To: kj; +Cc: help-gnu-emacs


Am 08.12.2009 um 21:42 schrieb kj:

> For mysterious
> reasons, the latest version of Emacs on my system does not offer
> any "print region" commands when run in X11 mode (these commands
> do show in the File menu, but are permanently disabled, irrespective
> of whether a region is defined or not).


Did you think of creating the region first? When nothing is marked,  
why should an obviously useless command, which only works on marked  
regions, be displayed?

--
Greetings

   Pete

There's no place like ~
			– (UNIX Guru)





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

* Re: How to find commands run by menu?
       [not found] ` <mailman.12591.1260350574.2239.help-gnu-emacs@gnu.org>
@ 2009-12-09 15:57   ` kj
  0 siblings, 0 replies; 11+ messages in thread
From: kj @ 2009-12-09 15:57 UTC (permalink / raw)
  To: help-gnu-emacs

In <mailman.12591.1260350574.2239.help-gnu-emacs@gnu.org> Peter Dyballa <Peter_Dyballa@Web.DE> writes:


>Am 08.12.2009 um 21:42 schrieb kj:

>> For mysterious
>> reasons, the latest version of Emacs on my system does not offer
>> any "print region" commands when run in X11 mode (these commands
>> do show in the File menu, but are permanently disabled, irrespective
                                                           ^^^^^^^^^^^^
>> of whether a region is defined or not).
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>Did you think of creating the region first?


Please, read what I wrote.

kj


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

* Re: How to find commands run by menu?
  2009-12-08 20:42 How to find commands run by menu? kj
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.12591.1260350574.2239.help-gnu-emacs@gnu.org>
@ 2009-12-09 16:06 ` Andreas Röhler
       [not found] ` <mailman.12600.1260374782.2239.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Andreas Röhler @ 2009-12-09 16:06 UTC (permalink / raw)
  To: help-gnu-emacs

kj wrote:
> Is there any way to determine the exact command that gets run when
> one invokes a particular menu item?
> 
> TIA!
> 
> kynnjo
> 
> P.S.  Here's why I want this.  It's a bit convoluted.  For mysterious
> reasons, the latest version of Emacs on my system does not offer
> any "print region" commands when run in X11 mode (these commands
> do show in the File menu, but are permanently disabled, irrespective
> of whether a region is defined or not).
> 
> I determined that if instead I run Emacs in text mode, now the
> menus do offer the "print region" commands.
> 
> But I don't want to run Emacs in text mode.  Therefore, I want to
> be able to execute *while on X11 mode* the same commands that get
> triggered when I choose (in text mode) one of the "print region"
> commands from the File menu.  Make sense?
> 
> I thought that the desired commands would be ones like ps-print-region,
> but the ones I've guessed produce different-looking printed results
> from those obtained by using the menus under text mode, and I prefer
> the latter by far.  Therefore, I have to conclude that using the
> menus does something more than just calling, say, ps-print-region.
> 


Hi,

seems no easy way to solve your question. Which is an
inconvenience AFAIS. For the moment here a possible
proceeding relying at the tooltip shown:

From to the source-code directory,

with M-x grep-find and the command

find . -type f -name "*.el" -print0 | xargs -0 -e grep -nH -e "Print region between mark"

it displays

./lisp/menu-bar.el:125:	      :help ,(purecopy "Print region between mark and current position")))

with RET at the link the source is shown:

(define-key menu-bar-file-menu [print-region]
  `(menu-item ,(purecopy "Print Region") print-region
	      :enable mark-active
	      :help ,(purecopy "Print region between mark and current position")))

From there I guess "print-region" is the command looked for...

HTH


Andreas

--
https://code.launchpad.net/s-x-emacs-werkstatt/
http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/





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

* Re: How to find commands run by menu?
       [not found] ` <mailman.12600.1260374782.2239.help-gnu-emacs@gnu.org>
@ 2009-12-09 16:35   ` harven
  0 siblings, 0 replies; 11+ messages in thread
From: harven @ 2009-12-09 16:35 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> kj wrote:
>> Is there any way to determine the exact command that gets run when
>> one invokes a particular menu item?
>> 
>> TIA!
>> 
>> kynnjo
>> 
>> P.S.  Here's why I want this.  It's a bit convoluted.  For mysterious
>> reasons, the latest version of Emacs on my system does not offer
>> any "print region" commands when run in X11 mode (these commands
>> do show in the File menu, but are permanently disabled, irrespective
>> of whether a region is defined or not).
>> 
>> I determined that if instead I run Emacs in text mode, now the
>> menus do offer the "print region" commands.
>> 
>> But I don't want to run Emacs in text mode.  Therefore, I want to
>> be able to execute *while on X11 mode* the same commands that get
>> triggered when I choose (in text mode) one of the "print region"
>> commands from the File menu.  Make sense?
>> 
>> I thought that the desired commands would be ones like ps-print-region,
>> but the ones I've guessed produce different-looking printed results
>> from those obtained by using the menus under text mode, and I prefer
>> the latter by far.  Therefore, I have to conclude that using the
>> menus does something more than just calling, say, ps-print-region.

I think that it actually calls ps-print-region-with-faces


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

* Re: How to find commands run by menu?
  2009-12-08 20:42 How to find commands run by menu? kj
                   ` (4 preceding siblings ...)
       [not found] ` <mailman.12600.1260374782.2239.help-gnu-emacs@gnu.org>
@ 2009-12-09 18:44 ` J. David Boyd
  2009-12-10 13:30 ` Jason Rumney
  6 siblings, 0 replies; 11+ messages in thread
From: J. David Boyd @ 2009-12-09 18:44 UTC (permalink / raw)
  To: help-gnu-emacs

kj <no.email@please.post> writes:

> Is there any way to determine the exact command that gets run when
> one invokes a particular menu item?
>
> TIA!
>
> kynnjo
>
> P.S.  Here's why I want this.  It's a bit convoluted.  For mysterious
> reasons, the latest version of Emacs on my system does not offer
> any "print region" commands when run in X11 mode (these commands
> do show in the File menu, but are permanently disabled, irrespective
> of whether a region is defined or not).
>
> I determined that if instead I run Emacs in text mode, now the
> menus do offer the "print region" commands.
>
> But I don't want to run Emacs in text mode.  Therefore, I want to
> be able to execute *while on X11 mode* the same commands that get
> triggered when I choose (in text mode) one of the "print region"
> commands from the File menu.  Make sense?
>
> I thought that the desired commands would be ones like ps-print-region,
> but the ones I've guessed produce different-looking printed results
> from those obtained by using the menus under text mode, and I prefer
> the latter by far.  Therefore, I have to conclude that using the
> menus does something more than just calling, say, ps-print-region.


C-h k, then place the mouse on the appropriate menu item.

When I do C-h k, then work my way down to the 'Postscript Print Buffer'
item, and release the mouse button, emacs tells me that the function is
(ps-print-buffer-with-faces)





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

* Re: How to find commands run by menu?
  2009-12-08 20:42 How to find commands run by menu? kj
                   ` (5 preceding siblings ...)
  2009-12-09 18:44 ` J. David Boyd
@ 2009-12-10 13:30 ` Jason Rumney
  2009-12-11 15:44   ` kj
  6 siblings, 1 reply; 11+ messages in thread
From: Jason Rumney @ 2009-12-10 13:30 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 9, 4:42 am, kj <no.em...@please.post> wrote:

> P.S.  Here's why I want this.  It's a bit convoluted.  For mysterious
> reasons, the latest version of Emacs on my system does not offer
> any "print region" commands when run in X11 mode (these commands
> do show in the File menu, but are permanently disabled, irrespective
> of whether a region is defined or not).

I suspect you are being affected by bug#4122:

http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4122

See the workaround posted there, or use the 23.2 pretest where this
should be fixed.


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

* Re: How to find commands run by menu?
  2009-12-10 13:30 ` Jason Rumney
@ 2009-12-11 15:44   ` kj
  0 siblings, 0 replies; 11+ messages in thread
From: kj @ 2009-12-11 15:44 UTC (permalink / raw)
  To: help-gnu-emacs




Many thanks for all your help.  (As usual, I end up learning a lot
more useful stuff from your answers than what my original question
required!)

Indeed, the commands I was looking for are

print-region
ps-print-region-with-faces
ps-print-region

Cheers,

-K


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

end of thread, other threads:[~2009-12-11 15:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 20:42 How to find commands run by menu? kj
2009-12-08 21:19 ` Pascal J. Bourguignon
2009-12-08 22:13   ` kj
2009-12-08 23:29     ` Pascal J. Bourguignon
2009-12-09  9:22 ` Peter Dyballa
     [not found] ` <mailman.12591.1260350574.2239.help-gnu-emacs@gnu.org>
2009-12-09 15:57   ` kj
2009-12-09 16:06 ` Andreas Röhler
     [not found] ` <mailman.12600.1260374782.2239.help-gnu-emacs@gnu.org>
2009-12-09 16:35   ` harven
2009-12-09 18:44 ` J. David Boyd
2009-12-10 13:30 ` Jason Rumney
2009-12-11 15:44   ` kj

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