all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: p.gardner@stanleyassociates.com (Paul G. Gardner)
Subject: Adding a popup menu option to close the current buffer
Date: 22 Jan 2004 18:10:19 -0800	[thread overview]
Message-ID: <d60b2dcb.0401221810.3ba36f87@posting.google.com> (raw)

I've got EMACS v21.3.1 and I've added EMacro to the start up. 
Everything is fine until I tried to add a menu item to the default
popup menu.  For some reason, I am unable to do so, and I'm not sure
why.  I'm not very familiar with ELisp (used it in college for a year,
but that's it) so I'm assuming that's the problem.

Here is the code:
In EMacro, here is the relavant parts of the definition of the popup
menu.
;;_________________________________________________________________________(defvar
right-popup-menu
  (let ((menu (make-sparse-keymap "Commands")))
    (define-key menu [dabbrev-expand] (cons "Complete word"
'dabbrev-expand))
    (define-key menu [undo] (cons "Undo" 'undo))
    (define-key menu [redo] (cons "Redo" 'redo))

    (define-key menu [--] (cons "--" 'nil)) ;separator
 
    (define-key menu [menu-paste] (cons "Paste" 'yank))
    (define-key menu [menu-copy] (cons "Copy" 'copy-region-as-kill))
    (define-key menu [menu-cut] (cons "Cut" 'kill-region))

    (define-key menu [-] (cons "-" 'nil)) ;separator
    (define-key menu [emacro-help]
      (cons (concat (concat "EMacro v" emacro-version) " help")
'emacro-help))
    menu))

(defun right-popup() "Run the command selected from
`right-popup-menu'."
  (interactive)
  (call-interactively (or (car (x-popup-menu t right-popup-menu))
'ignore)))

(global-set-key [mouse-3] 'right-popup)
;;_________________________________________________________________________


I've tried to add the following:
    (define-key menu [menu-close-buffer] ( cons "Close-buffer" 
'kill-this-buffer))

both in the the original definition, and separately ('menu' replaced
by 'right-popup-menu').  However, while I don't receive any errors,
when I select the option, which does show up, all I get is a beep, and
the buffer stays open.

Can someone point me in the right direction?  I've tried to read the
manuals, but keep getting stumped.

Thanks!
Paul

                 reply	other threads:[~2004-01-23  2:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=d60b2dcb.0401221810.3ba36f87@posting.google.com \
    --to=p.gardner@stanleyassociates.com \
    /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.