all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* On controlling rectangle-preview
@ 2016-07-19 23:32 Mark Oteiza
  2016-07-20  1:32 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Oteiza @ 2016-07-19 23:32 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier


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)))
-- 



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-07-21 20:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 23:32 On controlling rectangle-preview Mark Oteiza
2016-07-20  1:32 ` Stefan Monnier
2016-07-20  2:25   ` Mark Oteiza
2016-07-20 12:37     ` Stefan Monnier
2016-07-20 23:00       ` Mark Oteiza
2016-07-21  7:03         ` John Wiegley
2016-07-21 14:28           ` Eli Zaretskii
     [not found]             ` <CAKyxw136-9VCuSJMJ4qW4tunhUqvgpTDtjGjXf7vFxh52=9vdQ@mail.gmail.com>
     [not found]               ` <CAKyxw12WcYDBdEkOc3qMf6MOeC+npxVpVdzVz=hByNUObxw6tw@mail.gmail.com>
2016-07-21 14:54                 ` Mark Oteiza
2016-07-21 15:20                   ` Stefan Monnier
2016-07-21 16:06                   ` Eli Zaretskii
2016-07-21 20:57                     ` Mark Oteiza

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.