emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107851: * lisp/tmm.el: Use dolist


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107851: * lisp/tmm.el: Use dolist, remove left over hook.
Date: Fri, 02 Nov 2012 02:30:29 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 107851
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-04-10 16:12:07 -0400
message:
  * lisp/tmm.el: Use dolist, remove left over hook.
  (tmm-prompt, tmm-define-keys, tmm-shortcut, tmm-get-keybind): Use dolist.
  (calendar-load-hook): Don't mess with it.
modified:
  lisp/ChangeLog
  lisp/tmm.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-10 20:08:43 +0000
+++ b/lisp/ChangeLog    2012-04-10 20:12:07 +0000
@@ -1,5 +1,10 @@
 2012-04-10  Stefan Monnier  <address@hidden>
 
+       * tmm.el: Use dolist, remove left over hook.
+       (tmm-prompt, tmm-define-keys, tmm-shortcut, tmm-get-keybind):
+       Use dolist.
+       (calendar-load-hook): Don't mess with it.
+
        * vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal):
        Use derived-mode-p.  Run the diff asynchronously.
 

=== modified file 'lisp/tmm.el'
--- a/lisp/tmm.el       2012-01-19 07:21:25 +0000
+++ b/lisp/tmm.el       2012-04-10 20:12:07 +0000
@@ -165,14 +165,13 @@
     ;; tmm-km-list is an alist of (STRING . MEANING).
     ;; It has no other elements.
     ;; The order of elements in tmm-km-list is the order of the menu bar.
-    (mapc (lambda (elt)
-            (cond
-             ((stringp elt) (setq gl-str elt))
-             ((listp elt) (tmm-get-keymap elt not-menu))
-             ((vectorp elt)
-              (dotimes (i (length elt))
-                (tmm-get-keymap (cons i (aref elt i)) not-menu)))))
-          menu)
+    (dolist (elt menu)
+      (cond
+       ((stringp elt) (setq gl-str elt))
+       ((listp elt) (tmm-get-keymap elt not-menu))
+       ((vectorp elt)
+        (dotimes (i (length elt))
+          (tmm-get-keymap (cons i (aref elt i)) not-menu)))))
     ;; Choose an element of tmm-km-list; put it in choice.
     (if (and not-menu (= 1 (length tmm-km-list)))
        ;; If this is the top-level of an x-popup-menu menu,
@@ -313,15 +312,13 @@
 (defun tmm-define-keys (minibuffer)
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map t)
-    (mapc
-     (lambda (c)
-       (if (listp tmm-shortcut-style)
-          (define-key map (char-to-string c) 'tmm-shortcut)
-        ;; only one kind of letters are shortcuts, so map both upcase and
-        ;; downcase input to the same
-        (define-key map (char-to-string (downcase c)) 'tmm-shortcut)
-        (define-key map (char-to-string (upcase c)) 'tmm-shortcut)))
-     tmm-short-cuts)
+    (dolist (c tmm-short-cuts)
+      (if (listp tmm-shortcut-style)
+          (define-key map (char-to-string c) 'tmm-shortcut)
+        ;; only one kind of letters are shortcuts, so map both upcase and
+        ;; downcase input to the same
+        (define-key map (char-to-string (downcase c)) 'tmm-shortcut)
+        (define-key map (char-to-string (upcase c)) 'tmm-shortcut)))
     (if minibuffer
        (progn
           (define-key map [pageup] 'tmm-goto-completions)
@@ -401,14 +398,13 @@
              (choose-completion))
          ;; In minibuffer
          (delete-region (minibuffer-prompt-end) (point-max))
-         (mapc (lambda (elt)
-                 (if (string=
-                      (substring (car elt) 0
-                                 (min (1+ (length tmm-mid-prompt))
-                                      (length (car elt))))
-                      (concat (char-to-string c) tmm-mid-prompt))
-                     (setq s (car elt))))
-                 tmm-km-list)
+         (dolist (elt tmm-km-list)
+            (if (string=
+                 (substring (car elt) 0
+                            (min (1+ (length tmm-mid-prompt))
+                                 (length (car elt))))
+                 (concat (char-to-string c) tmm-mid-prompt))
+                (setq s (car elt))))
          (insert s)
          (exit-minibuffer)))))
 
@@ -540,20 +536,16 @@
          (setq allbind (cons globalbind (cons localbind minorbind)))
 
          ;; Merge all the elements of ALLBIND into one keymap.
-         (mapc (lambda (in)
-                 (if (and (symbolp in) (keymapp in))
-                     (setq in (symbol-function in)))
-                 (and in (keymapp in)
-                      (if (keymapp bind)
-                          (setq bind (nconc bind (copy-sequence (cdr in))))
-                        (setq bind (copy-sequence in)))))
-                 allbind)
+         (dolist (in allbind)
+            (if (and (symbolp in) (keymapp in))
+                (setq in (symbol-function in)))
+            (and in (keymapp in)
+                 (setq bind (if (keymapp bind)
+                                (nconc bind (copy-sequence (cdr in)))
+                              (copy-sequence in)))))
          ;; Return that keymap.
          bind))))
 
-;; Huh?  What's that about?  --Stef
-(add-hook 'calendar-load-hook (lambda () (require 'cal-menu)))
-
 (provide 'tmm)
 
 ;;; tmm.el ends here


reply via email to

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