emacs-devel
[Top][All Lists]
Advanced

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

On controlling rectangle-preview


From: Mark Oteiza
Subject: On controlling rectangle-preview
Date: Tue, 19 Jul 2016 19:32:41 -0400

The automatic preview can be pretty jarring, especially when doing
rectangle-string in one place (some mode, language, what-have-you), then
going someplace else, doing rectangle-string and seeing the preview when
the plan is to enter something completely different.

To avoid this I'd like to prevent the preview unless text is entered
into the minibuffer by typing, M-{n,p}, or otherwise.

Not sure if there is a better way to control this other than introducing
a parameter. For the reasons above I'd prefer this to be nil by default,
but whatever:

diff --git a/lisp/rect.el b/lisp/rect.el
index 8803a47..9c8fb29 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -407,10 +407,15 @@ rectangle-preview
   :version "25.1"
   :type 'boolean)
 
+(defcustom rectangle-preview-default t
+  "If non-nil, `string-rectangle' shows the default without minibuffer input."
+  :version "25.2"
+  :type 'boolean)
+
 (defun rectangle--string-preview ()
   (when rectangle-preview
     (let ((str (minibuffer-contents)))
-      (when (equal str "")
+      (when (and rectangle-preview-default (equal str ""))
         (setq str (or (car-safe minibuffer-default)
                       (if (stringp minibuffer-default) minibuffer-default))))
       (when str (setq str (propertize str 'face 'rectangle-preview)))
-- 



reply via email to

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