emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c77b816: * lisp/calculator.el (calculator-define-ke


From: Stefan Monnier
Subject: [Emacs-diffs] master c77b816: * lisp/calculator.el (calculator-define-key): Silence warning
Date: Mon, 30 Nov 2015 13:03:02 +0000

branch: master
commit c77b816bc3d8fc242b95c04859803ffff5bb8210
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/calculator.el (calculator-define-key): Silence warning
    
    ...about unknown calculator-mode-map.
---
 lisp/calculator.el |   64 ++++++++++++++++++++++++++--------------------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/lisp/calculator.el b/lisp/calculator.el
index f2e6a88..1d3715b 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -379,38 +379,6 @@ Used for repeating operations in calculator-repR/L.")
 ;;;---------------------------------------------------------------------
 ;;; Key bindings
 
-(defun calculator-define-key (key cmd &optional map)
-  ;; arranges for unbound alphabetic keys to be used as their un/shifted
-  ;; versions if those are bound (mimics the usual Emacs global
-  ;; bindings)
-  (let* ((key  (if (stringp key) (kbd key) key))
-         (map  (or map calculator-mode-map))
-         (omap (keymap-parent map)))
-    (define-key map key cmd)
-    ;; "other" map, used for case-flipped bindings
-    (unless omap
-      (setq omap (make-sparse-keymap))
-      (suppress-keymap omap t)
-      (set-keymap-parent map omap))
-    (let ((m omap))
-      ;; bind all case-flipped versions
-      (dotimes (i (length key))
-        (let* ((c (aref key i))
-               (k (vector c))
-               (b (lookup-key m k))
-               (defkey (lambda (x)
-                         (define-key m k x)
-                         (when (and (characterp c)
-                                    (or (<= ?A c ?Z) (<= ?a c ?z)))
-                           (define-key m (vector (logxor 32 c)) x)))))
-          (cond ((= i (1- (length key)))
-                 ;; prefer longer sequences
-                 (unless (keymapp b) (funcall defkey cmd)))
-                ((keymapp b) (setq m b))
-                (t (let ((sub (make-sparse-keymap)))
-                     (funcall defkey sub)
-                     (setq m sub)))))))))
-
 (defvar calculator-mode-map
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map t)
@@ -594,6 +562,38 @@ Used for repeating operations in calculator-repR/L.")
     map)
   "The calculator key map.")
 
+(defun calculator-define-key (key cmd &optional map)
+  ;; Arranges for unbound alphabetic keys to be used as their un/shifted
+  ;; versions if those are bound (mimics the usual Emacs global
+  ;; bindings).
+  (let* ((key  (if (stringp key) (kbd key) key))
+         (map  (or map calculator-mode-map))
+         (omap (keymap-parent map)))
+    (define-key map key cmd)
+    ;; "other" map, used for case-flipped bindings
+    (unless omap
+      (setq omap (make-sparse-keymap))
+      (suppress-keymap omap t)
+      (set-keymap-parent map omap))
+    (let ((m omap))
+      ;; Bind all case-flipped versions.
+      (dotimes (i (length key))
+        (let* ((c (aref key i))
+               (k (vector c))
+               (b (lookup-key m k))
+               (defkey (lambda (x)
+                         (define-key m k x)
+                         (when (and (characterp c)
+                                    (or (<= ?A c ?Z) (<= ?a c ?z)))
+                           (define-key m (vector (logxor 32 c)) x)))))
+          (cond ((= i (1- (length key)))
+                 ;; Prefer longer sequences.
+                 (unless (keymapp b) (funcall defkey cmd)))
+                ((keymapp b) (setq m b))
+                (t (let ((sub (make-sparse-keymap)))
+                     (funcall defkey sub)
+                     (setq m sub)))))))))
+
 ;;;---------------------------------------------------------------------
 ;;; Startup and mode stuff
 



reply via email to

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