-;; XEmacs change
-(defvar lisp-interaction-mode-popup-menu
- (purecopy '("Lisp-Interaction"
- ["Evaluate Last %_S-expression" eval-last-sexp]
- ["Evaluate %_Whole Buffer" eval-current-buffer]
- ["Evaluate Re%_gion" eval-region
- :active (region-exists-p)]
- "---"
- ["%_Evaluate This Defun" eval-defun]
- ["%_Instrument This Defun for Debugging" edebug-defun]
- "---"
- ["Find %_Function Source..." find-function
+(defun construct-lisp-mode-menu (popup-p emacs-lisp-p)
+ (flet ((popup-wrap (form)
+ (if popup-p `(menu-call-at-event ',form) form)))
+ `(,@(if emacs-lisp-p
+ `(["%_Byte-Compile This File" ,(popup-wrap
+ 'emacs-lisp-byte-compile)]
+ ["B%_yte-Compile/Load This File"
+ ,(popup-wrap 'emacs-lisp-byte-compile-and-load)]
+ ["Byte-%_Recompile Directory..."
+ ,(popup-wrap 'byte-recompile-directory)]
+ "---"))
+ ["%_Evaluate Region or Defun"
+ ,(popup-wrap '(if (region-exists-p)
+ (call-interactively 'eval-region)
+ (call-interactively 'eval-defun)))]
+ ["Evaluate %_Whole Buffer" ,(popup-wrap 'eval-current-buffer)]
+ ["Evaluate Last %_S-expression" ,(popup-wrap 'eval-last-sexp)]
+ "---"
+ ,@(if popup-p
+ '(["%_Find Function"
+ (find-function (menu-call-at-event '(function-at-point)))
+ :suffix (let ((fun (menu-call-at-event '(function-at-point))))
+ (if fun (symbol-name fun) ""))
+ :active (and (fboundp 'find-function)
+ (menu-call-at-event '(function-at-point)))]
+ ["%_Find Variable"
+ (find-variable (menu-call-at-event '(variable-at-point)))
+ :suffix (let ((fun (menu-call-at-event '(variable-at-point))))
+ (if fun (symbol-name fun) ""))
+ :active (and (fboundp 'find-variable)
+ (menu-call-at-event '(variable-at-point)))]
+ ["%_Help on Function"
+ (describe-function (menu-call-at-event '(function-at-point)))
+ :suffix (let ((fun (menu-call-at-event '(function-at-point))))
+ (if fun (symbol-name fun) ""))
+ :active (and (fboundp 'describe-function)
+ (menu-call-at-event '(function-at-point)))]
+ ["%_Help on Variable"
+ (describe-variable (menu-call-at-event '(variable-at-point)))
+ :suffix (let ((fun (menu-call-at-event '(variable-at-point))))
+ (if fun (symbol-name fun) ""))
+ :active (and (fboundp 'describe-variable)
+ (menu-call-at-event '(variable-at-point)))])
+ '(["Find %_Function..." find-function