all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: On controlling rectangle-preview
Date: Tue, 19 Jul 2016 19:32:41 -0400	[thread overview]
Message-ID: <87wpkhgq5i.fsf@udel.edu> (raw)


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	other threads:[~2016-07-19 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 23:32 Mark Oteiza [this message]
2016-07-20  1:32 ` On controlling rectangle-preview 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpkhgq5i.fsf@udel.edu \
    --to=mvoteiza@udel.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.