emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 0392f94: Turn on lexical-binding in mb-depth.el


From: Mark Oteiza
Subject: [Emacs-diffs] master 0392f94: Turn on lexical-binding in mb-depth.el
Date: Thu, 5 Jan 2017 03:34:08 +0000 (UTC)

branch: master
commit 0392f942c787f1a42b3e5d9516a447687ed3baef
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    Turn on lexical-binding in mb-depth.el
    
    * lisp/mb-depth.el: Turn on lexical-binding.
    (minibuffer-depth-setup): Bind things used multiple times.
---
 lisp/mb-depth.el |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el
index a16557b..57fe7ab 100644
--- a/lisp/mb-depth.el
+++ b/lisp/mb-depth.el
@@ -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



reply via email to

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