]> git.eshelyaron.com Git - emacs.git/commitdiff
Turn on lexical-binding in mb-depth.el
authorMark Oteiza <mvoteiza@udel.edu>
Thu, 5 Jan 2017 03:31:26 +0000 (22:31 -0500)
committerMark Oteiza <mvoteiza@udel.edu>
Thu, 5 Jan 2017 03:31:26 +0000 (22:31 -0500)
* lisp/mb-depth.el: Turn on lexical-binding.
(minibuffer-depth-setup): Bind things used multiple times.

lisp/mb-depth.el

index a16557b0630e16369237c12b37e6a8eeae95e918..57fe7abde51c9c61be26a8b184d4d33343590c88 100644 (file)
@@ -1,4 +1,4 @@
-;;; mb-depth.el --- Indicate minibuffer-depth in prompt
+;;; mb-depth.el --- Indicate minibuffer-depth in prompt -*- lexical-binding: t -*-
 ;;
 ;; Copyright (C) 2006-2017 Free Software Foundation, Inc.
 ;;
@@ -45,13 +45,15 @@ and must return a string.")
 (defun minibuffer-depth-setup ()
   "Set up a minibuffer for `minibuffer-depth-indicate-mode'.
 The prompt should already have been inserted."
-  (when (> (minibuffer-depth) 1)
-    (setq minibuffer-depth-overlay (make-overlay (point-min) (1+ (point-min))))
-    (overlay-put minibuffer-depth-overlay 'before-string
-                (if minibuffer-depth-indicator-function
-                    (funcall minibuffer-depth-indicator-function (minibuffer-depth))
-                  (propertize (format "[%d]" (minibuffer-depth)) 'face 'highlight)))
-    (overlay-put minibuffer-depth-overlay 'evaporate t)))
+  (let ((depth (minibuffer-depth)))
+    (when (> depth 1)
+      (let ((pos (point-min)))
+        (setq minibuffer-depth-overlay (make-overlay pos (1+ pos))))
+      (overlay-put minibuffer-depth-overlay 'before-string
+                   (if minibuffer-depth-indicator-function
+                       (funcall minibuffer-depth-indicator-function depth)
+                     (propertize (format "[%d]" depth) 'face 'highlight)))
+      (overlay-put minibuffer-depth-overlay 'evaporate t))))
 
 ;;;###autoload
 (define-minor-mode minibuffer-depth-indicate-mode