summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/byte-run.el12
-rw-r--r--lisp/emacs-lisp/easymenu.el24
2 files changed, 24 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 60fc862676d..ab7259b667f 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -129,6 +129,18 @@ was first made obsolete, for example a date or a release number."
(put variable 'byte-obsolete-variable (cons new when))
variable)
+(defmacro define-obsolete-variable-alias (variable new
+ &optional when docstring)
+ "Make VARIABLE a variable alias for NEW and warn that VARIABLE is obsolete.
+If provided, WHEN should be a string indicating when VARIABLE was
+first made obsolete, for example a date or a release number. The
+optional argument DOCSTRING specifies the documentation string
+for VARIABLE; if DOCSTRING is omitted or nil, VARIABLE uses the
+documentation string of NEW unless it already has one."
+ `(progn
+ (defvaralias ,variable ,new ,docstring)
+ (make-obsolete-variable ,variable ,new ,when)))
+
(defmacro dont-compile (&rest body)
"Like `progn', but the body always runs interpreted (not compiled).
If you think you need this, you're probably making a mistake somewhere."
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index b0f3b9b9d3e..78ba1fe27bf 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -160,18 +160,18 @@ A menu item can be a list with the same format as MENU. This is a submenu."
(let ((keymap (easy-menu-create-menu (car menu) (cdr menu))))
(when symbol
(set symbol keymap)
- (fset symbol
- `(lambda (event) ,doc (interactive "@e")
- ;; FIXME: XEmacs uses popup-menu which calls the binding
- ;; while x-popup-menu only returns the selection.
- (x-popup-menu event
- (or (and (symbolp ,symbol)
- (funcall
- (or (plist-get (get ,symbol 'menu-prop)
- :filter)
- 'identity)
- (symbol-function ,symbol)))
- ,symbol)))))
+ (defalias symbol
+ `(lambda (event) ,doc (interactive "@e")
+ ;; FIXME: XEmacs uses popup-menu which calls the binding
+ ;; while x-popup-menu only returns the selection.
+ (x-popup-menu event
+ (or (and (symbolp ,symbol)
+ (funcall
+ (or (plist-get (get ,symbol 'menu-prop)
+ :filter)
+ 'identity)
+ (symbol-function ,symbol)))
+ ,symbol)))))
(mapcar (lambda (map)
(define-key map (vector 'menu-bar (easy-menu-intern (car menu)))
(cons 'menu-item