chiark / gitweb /
el/dot-emacs.el: Use `dolist' or `mapc' rather than `mapcar' for effect.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 13 Sep 2019 18:53:33 +0000 (19:53 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 13 Sep 2019 18:59:24 +0000 (19:59 +0100)
Prefer the former where the compiler can macroexpand it reliably.

el/dot-emacs.el

index 12d0e72045911a53ff7bd56a936588f0dda51fe3..83e38912ee0a31a06481d3ef9d865f94fba51851 100644 (file)
@@ -535,13 +535,11 @@ (defun mdw-clobber-other-windows-showing-buffer (buffer-or-name)
   (let ((home-frame (selected-frame))
        (buffer (get-buffer buffer-or-name))
        (safe-buffer (get-buffer "*scratch*")))
-    (mapc (lambda (frame)
-           (or (eq frame home-frame)
-               (mapc (lambda (window)
-                       (and (eq (window-buffer window) buffer)
-                            (set-window-buffer window safe-buffer)))
-                     (window-list frame))))
-         (frame-list))))
+    (dolist (frame (frame-list))
+      (unless (eq frame home-frame)
+       (dolist (window (window-list frame))
+         (when (eq (window-buffer window) buffer)
+           (set-window-buffer window safe-buffer)))))))
 
 (defvar mdw-inhibit-walk-windows nil
   "If non-nil, then `walk-windows' does nothing.
@@ -3049,7 +3047,8 @@ (put 'asm-comment-char 'safe-local-variable 'characterp)
 ;;; TCL configuration.
 
 (defun mdw-fontify-tcl ()
-  (mapcar #'(lambda (ch) (modify-syntax-entry ch ".")) '(?$))
+  (dolist (ch '(?$))
+    (modify-syntax-entry ch "."))
   (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)")
   (make-local-variable 'font-lock-keywords)
   (setq font-lock-keywords
@@ -3189,10 +3188,8 @@ (defun mdw-fontify-rexx ()
   (setq mdw-auto-indent nil)
   (local-set-key [?\C-m] 'mdw-rexx-indent-newline-indent)
   (local-set-key [?*] 'mdw-rexx-electric-*)
-  (mapcar #'(lambda (ch) (modify-syntax-entry ch "w"))
-         '(?! ?? ?# ?@ ?$))
-  (mapcar #'(lambda (ch) (modify-syntax-entry ch "."))
-         '(?¬))
+  (dolist (ch '(?! ?? ?# ?@ ?$)) (modify-syntax-entry ch "w"))
+  (dolist (ch '(?¬)) (modify-syntax-entry ch "."))
   (mdw-standard-fill-prefix "\\([ \t]*/?\*[ \t]*\\)")
 
   ;; Set up keywords and things for fontification.
@@ -3589,8 +3586,8 @@ (defun mdw-fix-up-quote ()
           nil)
          (t
           (let ((table (copy-syntax-table (syntax-table))))
-            (mapc (lambda (ch) (modify-syntax-entry ch "." table))
-                  (if (listp flag) flag (list flag)))
+            (dolist (ch (if (listp flag) flag (list flag)))
+              (modify-syntax-entry ch "." table))
             (set-syntax-table table)
             (and font-lock-mode (font-lock-fontify-buffer)))))))
 (add-hook 'conf-mode-local-variables-hook 'mdw-fix-up-quote t t)