From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.bugs Subject: bug#23248: 25.1.50; user option rectangle-preview is unused Date: Thu, 14 Apr 2016 12:15:27 -0400 Message-ID: <87shyogo9s.fsf@udel.edu> References: <87shyvmxyn.fsf@udel.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1460650603 29387 80.91.229.3 (14 Apr 2016 16:16:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2016 16:16:43 +0000 (UTC) Cc: Stefan Monnier To: 23248@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 14 18:16:32 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1aqjwR-0004E4-Iu for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Apr 2016 18:16:27 +0200 Original-Received: from localhost ([::1]:42478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqjwQ-00085J-PZ for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Apr 2016 12:16:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqjwA-0007i5-7G for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2016 12:16:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqjw4-0000Sa-BK for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2016 12:16:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqjw2-0000SB-HM for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2016 12:16:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aqjw2-0000BU-8X for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2016 12:16:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87shyvmxyn.fsf@udel.edu> Resent-From: Mark Oteiza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Apr 2016 16:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23248 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23248-submit@debbugs.gnu.org id=B23248.1460650537672 (code B ref 23248); Thu, 14 Apr 2016 16:16:02 +0000 Original-Received: (at 23248) by debbugs.gnu.org; 14 Apr 2016 16:15:37 +0000 Original-Received: from localhost ([127.0.0.1]:35525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqjvc-0000Am-Lb for submit@debbugs.gnu.org; Thu, 14 Apr 2016 12:15:36 -0400 Original-Received: from mail-qg0-f42.google.com ([209.85.192.42]:33294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aqjvb-0000AY-MI for 23248@debbugs.gnu.org; Thu, 14 Apr 2016 12:15:36 -0400 Original-Received: by mail-qg0-f42.google.com with SMTP id j35so65841449qge.0 for <23248@debbugs.gnu.org>; Thu, 14 Apr 2016 09:15:35 -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=UUxIXFfjjMIc+H/rbwBZlSGNek2ypjiqL4ecrMqBKxc=; b=kcBj3++LDTKd7kJ7YWkB9UqZ0EfCZU6Tb+4VhhZnGI7glCt4WUyshlvC77rTQvXOvN m+nRHZVSYUv+cp8XAObLOxp7qF3BQkGE5cV5tNCLyZKIx7QPPEgBDMjT7/fXTae/f4xs zQzGSEbphv+L8JGSzqM7CjRz3J60rRpEc4hgqXxiCiLL7KuMUjHCrZPwRPt0vzCyj8z6 FjB30Qfsbx+CS6M1zijVxbKHcEHO3H6pSCWo5OA5OuHZ2dnvqh6u9ZRA9L8z4ZIH+Vtj +Wd48gsZXiEvbpTA+36x/Jt/oLeuHMQFYamHvwN2GIR3LmiMHPOjPc6f4koy9wi3t9st +lCA== 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=UUxIXFfjjMIc+H/rbwBZlSGNek2ypjiqL4ecrMqBKxc=; b=UDlBcjN11VBTVVou4yzX7rIG6fNjgKIYml1yIRN/SY4nvikUevuFewRQ7XV1kh4qFe r2M34fs1E0r1JNIlttSBZG5dNgbkOpi5mK7yfPFN5mvrugnMpuaYTTP2hjYfblofVHdV Uvljid0GBE340ydlh/q8mIWEf3Oz0AOhIZNpgmDBmt/PTXhq3uffJHmJlr1oDGsi5u9n 3O9t6LGSPKU+Ov8H+m9zCFvnrAqmWuFKMST32ysh+Axi0UjTaT9p0H71fkwbleru19vf Re9RM2SGMJpWzVvJPToclFdloxWMvzuZKH85IU6o/2V6bm5HcCA9XL/ntUT06v1OrDGs VCqA== X-Gm-Message-State: AOPr4FXi6zo5JLztWweWuQN/dP+mTH7e30nx+s4TzQx0NK0bJ2Oin8SZOYAKFfe9Hf8ggKEr X-Received: by 10.140.138.81 with SMTP id 78mr20471585qhk.44.1460650529937; Thu, 14 Apr 2016 09:15:29 -0700 (PDT) Original-Received: from holos.localdomain (wifi-roaming-128-4-65-40.host.udel.edu. [128.4.65.40]) by smtp.gmail.com with ESMTPSA id j103sm11198404qge.0.2016.04.14.09.15.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Apr 2016 09:15:28 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 9D9E56886A; Thu, 14 Apr 2016 12:15:27 -0400 (EDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:116465 Archived-At: --- This looks like the correct place for rectangle-preview to me. diff --git a/lisp/rect.el b/lisp/rect.el index 685213a..82e2297 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -408,40 +408,41 @@ defcustom rectangle-preview t :type 'boolean) (defun rectangle--string-preview () - (let ((str (minibuffer-contents))) - (when (equal str "") - (setq str (or (car-safe minibuffer-default) - (if (stringp minibuffer-default) minibuffer-default)))) - (when str (setq str (propertize str 'face 'region))) - (with-selected-window rectangle--string-preview-window - (unless (or (null rectangle--string-preview-state) - (equal str (car rectangle--string-preview-state))) - (rectangle--string-flush-preview) - (apply-on-rectangle - (lambda (startcol endcol) - (let* ((sc (move-to-column startcol)) - (start (if (<= sc startcol) (point) - (forward-char -1) - (setq sc (current-column)) - (point))) - (ec (move-to-column endcol)) - (end (point)) - (ol (make-overlay start end))) - (push ol (nthcdr 3 rectangle--string-preview-state)) - ;; FIXME: The extra spacing doesn't interact correctly with - ;; the extra spacing added by the rectangular-region-highlight. - (when (< sc startcol) - (overlay-put ol 'before-string (rectangle--space-to startcol))) - (let ((as (when (< endcol ec) - ;; (rectangle--space-to ec) - (spaces-string (- ec endcol)) - ))) - (if (= start end) - (overlay-put ol 'after-string (if as (concat str as) str)) - (overlay-put ol 'display str) - (if as (overlay-put ol 'after-string as)))))) - (nth 1 rectangle--string-preview-state) - (nth 2 rectangle--string-preview-state)))))) + (when rectangle-preview + (let ((str (minibuffer-contents))) + (when (equal str "") + (setq str (or (car-safe minibuffer-default) + (if (stringp minibuffer-default) minibuffer-default)))) + (when str (setq str (propertize str 'face 'region))) + (with-selected-window rectangle--string-preview-window + (unless (or (null rectangle--string-preview-state) + (equal str (car rectangle--string-preview-state))) + (rectangle--string-flush-preview) + (apply-on-rectangle + (lambda (startcol endcol) + (let* ((sc (move-to-column startcol)) + (start (if (<= sc startcol) (point) + (forward-char -1) + (setq sc (current-column)) + (point))) + (ec (move-to-column endcol)) + (end (point)) + (ol (make-overlay start end))) + (push ol (nthcdr 3 rectangle--string-preview-state)) + ;; FIXME: The extra spacing doesn't interact correctly with + ;; the extra spacing added by the rectangular-region-highlight. + (when (< sc startcol) + (overlay-put ol 'before-string (rectangle--space-to startcol))) + (let ((as (when (< endcol ec) + ;; (rectangle--space-to ec) + (spaces-string (- ec endcol)) + ))) + (if (= start end) + (overlay-put ol 'after-string (if as (concat str as) str)) + (overlay-put ol 'display str) + (if as (overlay-put ol 'after-string as)))))) + (nth 1 rectangle--string-preview-state) + (nth 2 rectangle--string-preview-state))))))) ;; FIXME: Should this be turned into inhibit-region-highlight and made to apply ;; to non-rectangular regions as well?