emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114549: * lisp/emacs-lisp/easymenu.el (easy-menu-cr


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r114549: * lisp/emacs-lisp/easymenu.el (easy-menu-create-menu): Use closures.
Date: Mon, 07 Oct 2013 05:13:55 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114549
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-10-07 01:13:51 -0400
message:
  * lisp/emacs-lisp/easymenu.el (easy-menu-create-menu): Use closures.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/easymenu.el    easymenu.el-20091113204419-o5vbwnq5f7feedwu-733
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-10-07 05:11:50 +0000
+++ b/lisp/ChangeLog    2013-10-07 05:13:51 +0000
@@ -1,5 +1,7 @@
 2013-10-07  Stefan Monnier  <address@hidden>
 
+       * emacs-lisp/easymenu.el (easy-menu-create-menu): Use closures.
+
        * emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using 
lexical-binding.
 
        * emacs-lisp/tq.el (tq-create): Use a closure instead of `(lambda...).

=== modified file 'lisp/emacs-lisp/easymenu.el'
--- a/lisp/emacs-lisp/easymenu.el       2013-01-01 09:11:05 +0000
+++ b/lisp/emacs-lisp/easymenu.el       2013-10-07 05:13:51 +0000
@@ -1,4 +1,4 @@
-;;; easymenu.el --- support the easymenu interface for defining a menu
+;;; easymenu.el --- support the easymenu interface for defining a menu  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1994, 1996, 1998-2013 Free Software Foundation, Inc.
 
@@ -218,21 +218,22 @@
 possibly preceded by keyword pairs as described in `easy-menu-define'."
   (let ((menu (make-sparse-keymap menu-name))
         (easy-menu-avoid-duplicate-keys nil)
-       prop keyword arg label enable filter visible help)
+       prop keyword label enable filter visible help)
     ;; Look for keywords.
     (while (and menu-items
                (cdr menu-items)
                (keywordp (setq keyword (car menu-items))))
-      (setq arg (cadr menu-items))
-      (setq menu-items (cddr menu-items))
-      (pcase keyword
-       (`:filter
-       (setq filter `(lambda (menu)
-                       (easy-menu-filter-return (,arg menu) ,menu-name))))
-       ((or `:enable `:active) (setq enable (or arg ''nil)))
-       (`:label (setq label arg))
-       (`:help (setq help arg))
-       ((or `:included `:visible) (setq visible (or arg ''nil)))))
+      (let ((arg (cadr menu-items)))
+        (setq menu-items (cddr menu-items))
+        (pcase keyword
+          (`:filter
+           (setq filter (lambda (menu)
+                          (easy-menu-filter-return (funcall arg menu)
+                                                   menu-name))))
+          ((or `:enable `:active) (setq enable (or arg ''nil)))
+          (`:label (setq label arg))
+          (`:help (setq help arg))
+          ((or `:included `:visible) (setq visible (or arg ''nil))))))
     (if (equal visible ''nil)
        nil                             ; Invisible menu entry, return nil.
       (if (and visible (not (easy-menu-always-true-p visible)))
@@ -496,7 +497,7 @@
 
 \(fn MENU)")
 
-(defun easy-menu-add (menu &optional map)
+(defun easy-menu-add (_menu &optional _map)
   "Add the menu to the menubar.
 On Emacs, menus are already automatically activated when the
 corresponding keymap is activated.  On XEmacs this is needed to


reply via email to

[Prev in Thread] Current Thread [Next in Thread]