all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Adding a popup menu option to close the current buffer
@ 2004-01-23  2:10 Paul G. Gardner
  0 siblings, 0 replies; only message in thread
From: Paul G. Gardner @ 2004-01-23  2:10 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-23  2:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-23  2:10 Adding a popup menu option to close the current buffer Paul G. Gardner

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.