diff options
| author | Stefan Monnier | 2013-10-07 01:13:51 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-10-07 01:13:51 -0400 |
| commit | 731fc3aec85564ab026964dd4dee361f786bcfa3 (patch) | |
| tree | 71402dee419817f3d8a65e90c1837a90905eecb9 | |
| parent | a58332802b26fda1bc49cf409737e6fde71461b6 (diff) | |
| download | emacs-731fc3aec85564ab026964dd4dee361f786bcfa3.tar.gz emacs-731fc3aec85564ab026964dd4dee361f786bcfa3.zip | |
* lisp/emacs-lisp/easymenu.el (easy-menu-create-menu): Use closures.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/easymenu.el | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e6c0aaa671..bceb4959171 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2013-10-07 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2013-10-07 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/easymenu.el (easy-menu-create-menu): Use closures. | ||
| 4 | |||
| 3 | * emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using lexical-binding. | 5 | * emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using lexical-binding. |
| 4 | 6 | ||
| 5 | * emacs-lisp/tq.el (tq-create): Use a closure instead of `(lambda...). | 7 | * emacs-lisp/tq.el (tq-create): Use a closure instead of `(lambda...). |
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index f33ae54bf25..924ca7c0547 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; easymenu.el --- support the easymenu interface for defining a menu | 1 | ;;; easymenu.el --- support the easymenu interface for defining a menu -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1996, 1998-2013 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 1996, 1998-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -218,21 +218,22 @@ MENU-NAME is a string, the name of the menu. MENU-ITEMS is a list of items | |||
| 218 | possibly preceded by keyword pairs as described in `easy-menu-define'." | 218 | possibly preceded by keyword pairs as described in `easy-menu-define'." |
| 219 | (let ((menu (make-sparse-keymap menu-name)) | 219 | (let ((menu (make-sparse-keymap menu-name)) |
| 220 | (easy-menu-avoid-duplicate-keys nil) | 220 | (easy-menu-avoid-duplicate-keys nil) |
| 221 | prop keyword arg label enable filter visible help) | 221 | prop keyword label enable filter visible help) |
| 222 | ;; Look for keywords. | 222 | ;; Look for keywords. |
| 223 | (while (and menu-items | 223 | (while (and menu-items |
| 224 | (cdr menu-items) | 224 | (cdr menu-items) |
| 225 | (keywordp (setq keyword (car menu-items)))) | 225 | (keywordp (setq keyword (car menu-items)))) |
| 226 | (setq arg (cadr menu-items)) | 226 | (let ((arg (cadr menu-items))) |
| 227 | (setq menu-items (cddr menu-items)) | 227 | (setq menu-items (cddr menu-items)) |
| 228 | (pcase keyword | 228 | (pcase keyword |
| 229 | (`:filter | 229 | (`:filter |
| 230 | (setq filter `(lambda (menu) | 230 | (setq filter (lambda (menu) |
| 231 | (easy-menu-filter-return (,arg menu) ,menu-name)))) | 231 | (easy-menu-filter-return (funcall arg menu) |
| 232 | ((or `:enable `:active) (setq enable (or arg ''nil))) | 232 | menu-name)))) |
| 233 | (`:label (setq label arg)) | 233 | ((or `:enable `:active) (setq enable (or arg ''nil))) |
| 234 | (`:help (setq help arg)) | 234 | (`:label (setq label arg)) |
| 235 | ((or `:included `:visible) (setq visible (or arg ''nil))))) | 235 | (`:help (setq help arg)) |
| 236 | ((or `:included `:visible) (setq visible (or arg ''nil)))))) | ||
| 236 | (if (equal visible ''nil) | 237 | (if (equal visible ''nil) |
| 237 | nil ; Invisible menu entry, return nil. | 238 | nil ; Invisible menu entry, return nil. |
| 238 | (if (and visible (not (easy-menu-always-true-p visible))) | 239 | (if (and visible (not (easy-menu-always-true-p visible))) |
| @@ -496,7 +497,7 @@ Contrary to XEmacs, this is a nop on Emacs since menus are automatically | |||
| 496 | 497 | ||
| 497 | \(fn MENU)") | 498 | \(fn MENU)") |
| 498 | 499 | ||
| 499 | (defun easy-menu-add (menu &optional map) | 500 | (defun easy-menu-add (_menu &optional _map) |
| 500 | "Add the menu to the menubar. | 501 | "Add the menu to the menubar. |
| 501 | On Emacs, menus are already automatically activated when the | 502 | On Emacs, menus are already automatically activated when the |
| 502 | corresponding keymap is activated. On XEmacs this is needed to | 503 | corresponding keymap is activated. On XEmacs this is needed to |