all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Cross <theophilusx@gmail.com>
To: emacs-devel@gnu.org
Subject: Modify menu-bar help
Date: Fri, 25 Feb 2011 10:16:27 +1100	[thread overview]
Message-ID: <AANLkTimAuSxHuVF=ixTmBdhUhEB6UTz0XOKtr5ospwNv@mail.gmail.com> (raw)

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

Hi all,

hoping someone can help me with a problem I'm having when trying to add a
new item to a top level menu. The item is an action rather than another
menu. I'm doing this to fix some code that worked in emacs 21, but does not
work in emacs 23 (or emacs 22 I believe). I've tried to boil it down to a
basic recipe shown below.

I'm experimenting in the scratch buffer. This is in emacs 24.0.50 on Linux,
but the problem occurs under windows as well.

; a simple test action
(defun tx-greet ()
  (interactive)
  (message "Hello Tim!"))

If I execute

(defun tx-menu ()
  (interactive)
  (define-key lisp-interaction-mode-map [menu-bar tx]
    (cons "TX" (make-sparse-keymap)))
  (define-key lisp-interaction-mode-map [menu-bar tx tx-test]
    '(menu-item "TX Test" tx-greet)))

I get a new menu item "TX" and clicking on that gives a sub-menu with one
item "TX Test". Clicking on this item and the message "Hello Tim!" appears
in the minibuffer. All works as expected.

However, if I just define the function as

(defun tx-menu ()
  (interactive)
  (define-key lisp-interaction-mode-map [menu-bar tx]
    '(menu-item "TX Test" tx-greet)))

I get the expected menu item at the top level, but clicking on it does
nothing - well, it grabs focus, the item is highlighted and you have to
click again to release focus.

So, what am I doing wrong? I've looked at menu-bar.el and I believe my code
is the same as other examples in that file which add a top level menu action
i.e. quit for the ns port etc. According to the manual, the definition looks
OK and presumably a similar definition use to work in emacs 21. I've checked
the NEWS files and cannot see anything which looks relevant. Can someone
give me some clues as at this point, I'm stumped!

thanks,

Tim

[-- Attachment #2: Type: text/html, Size: 2379 bytes --]

             reply	other threads:[~2011-02-24 23:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 23:16 Tim Cross [this message]
2011-02-25  0:52 ` Modify menu-bar help Drew Adams
2011-02-25  5:14   ` Tim Cross
2011-02-25  7:15     ` Drew Adams
2011-02-25  9:31       ` Eli Zaretskii
2011-02-25  9:30     ` Eli Zaretskii
2011-02-25 10:03     ` Jan Djärv
2011-02-25 14:49       ` Tim Cross
2011-02-25 15:29         ` Drew Adams
2011-02-25 15:31         ` Eli Zaretskii
2011-02-25 15:38           ` Drew Adams
2011-02-25 15:54             ` Eli Zaretskii
2011-02-25 17:08               ` Jan Djärv
2011-02-25 17:22                 ` Drew Adams
2011-02-25  9:27   ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2011-02-25 20:33 Ben Key
2011-02-25 23:58 ` Tim Cross
2011-02-26  1:04   ` Tim Cross
2011-02-26 10:21     ` Jan Djärv
2011-02-26 10:22   ` Jan Djärv
2011-02-26 22:27     ` Tim Cross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimAuSxHuVF=ixTmBdhUhEB6UTz0XOKtr5ospwNv@mail.gmail.com' \
    --to=theophilusx@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.