From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: On controlling rectangle-preview Date: Tue, 19 Jul 2016 19:32:41 -0400 Message-ID: <87wpkhgq5i.fsf@udel.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1468971216 985 80.91.229.3 (19 Jul 2016 23:33:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Jul 2016 23:33:36 +0000 (UTC) Cc: Stefan Monnier To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 20 01:33:30 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bPeVy-0007lG-GH for ged-emacs-devel@m.gmane.org; Wed, 20 Jul 2016 01:33:26 +0200 Original-Received: from localhost ([::1]:59534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPeVx-0005Kv-Ks for ged-emacs-devel@m.gmane.org; Tue, 19 Jul 2016 19:33:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPeVN-0005Jq-9f for emacs-devel@gnu.org; Tue, 19 Jul 2016 19:32:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPeVH-0000jl-8h for emacs-devel@gnu.org; Tue, 19 Jul 2016 19:32:48 -0400 Original-Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:34856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPeVH-0000jf-4Z for emacs-devel@gnu.org; Tue, 19 Jul 2016 19:32:43 -0400 Original-Received: by mail-qk0-x22b.google.com with SMTP id s63so30787586qkb.2 for ; Tue, 19 Jul 2016 16:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version; bh=T3gSlf3lKXD+vUBC8e6tG7ZSELm46NN85KTMpLddlUc=; b=ZgsGtewnG6yTuCn759LMA1EjTmV/+ekgOx/Y0jMwdjD+G+exHUVDiyaUUDkJmZUC+R R2S03vKgcnUku4n0fc0S1ekmAq6qjwFiyOO1IwWfp5BWFlcxnSTn4sDDuEvmuNENTLYB vQzmw5wDnK4VMd6hs3I3sLXpST7QkYnTwKsd3ua6+N3M6M5vCjNjiJ4zbfgZ6Xqtcmqa qLJxnEaNY9eq5BkHWtIM9XNWp2QCBz99SvY9qy4ag+wjpmDFiTxVk3eUSLYSlkaNyoOa 3oNBvkpp5FmNnuBwbIitJbKjvOTtI7/UW3C+p8KkIykj7pT8eTrB5VsI8Bk7J2nAJTHG YEnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=T3gSlf3lKXD+vUBC8e6tG7ZSELm46NN85KTMpLddlUc=; b=ejn6lOnqW2GwQHdSlbTBSnGbh7kro6/Z39EVTiPvushgv1FttIfI9TQibUAZiendqp MsKbK15di0PRpwkc11VxXgFy4iQyBQkYN/EMqvDoPoKu+jD6wZ+73Uv1IXVfCvw9/swM L3bPRv2oYKP+oTcHUyIKXMgY+M04dHkqbc+DpoA4tdj2BqYZ8AQSndagHO0JyR2Im+AQ JSrAs21SsRLLTomcR+iUx2wPxj4Aw5CeltN1wx+FhppgceYCLk+79HnhLIBIvW1ngP0a 98udVu+ENxInH1mPnBTzCFJtVRpyO+TXYkIg5jqNrm7RDi7FP/77P2oOUqThe9Jmh98M GJHQ== X-Gm-Message-State: ALyK8tJDcOlMJHq3VUguLTuYjSAYpghimAemekhIPrv33H5JIFXa5bcMcQFta9eZLgCH8PMW X-Received: by 10.55.76.201 with SMTP id z192mr56827373qka.182.1468971162555; Tue, 19 Jul 2016 16:32:42 -0700 (PDT) Original-Received: from holos.localdomain (ip68-100-200-121.dc.dc.cox.net. [68.100.200.121]) by smtp.gmail.com with ESMTPSA id z64sm2882946qkb.3.2016.07.19.16.32.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 16:32:41 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 451CC66C35; Tue, 19 Jul 2016 19:32:41 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:205850 Archived-At: 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))) --