all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23248: 25.1.50; user option rectangle-preview is unused
@ 2016-04-09  0:23 Mark Oteiza
  2016-04-14 16:15 ` Mark Oteiza
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2016-04-09  0:23 UTC (permalink / raw)
  To: 23248


Hi,

The defcustom `rectangle-preview' in rect.el--for controlling whether the
preview is shown for C-x r t--is not used.

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2016-03-20 built on logos
Repository revision: 5283593ced29a2c98e4af3607a68ee7a6d10fcac
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --without-gconf --with-modules
 --with-x-toolkit=lucid 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
 -fstack-protector-strong --param=ssp-buffer-size=4 -g
 -fvar-tracking-assignments -g -fvar-tracking-assignments'
 CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'





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

* bug#23248: 25.1.50; user option rectangle-preview is unused
  2016-04-09  0:23 bug#23248: 25.1.50; user option rectangle-preview is unused Mark Oteiza
@ 2016-04-14 16:15 ` Mark Oteiza
  2016-04-14 16:38   ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2016-04-14 16:15 UTC (permalink / raw)
  To: 23248; +Cc: Stefan Monnier


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





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

* bug#23248: 25.1.50; user option rectangle-preview is unused
  2016-04-14 16:15 ` Mark Oteiza
@ 2016-04-14 16:38   ` Glenn Morris
  2016-04-16 16:06     ` Mark Oteiza
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2016-04-14 16:38 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: Stefan Monnier, 23248


Note that it does not use the dedicated face either, just 'region.





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

* bug#23248: 25.1.50; user option rectangle-preview is unused
  2016-04-14 16:38   ` Glenn Morris
@ 2016-04-16 16:06     ` Mark Oteiza
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Oteiza @ 2016-04-16 16:06 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Stefan Monnier, 23248

On 14/04/16 at 12:38pm, Glenn Morris wrote:
> 
> Note that it does not use the dedicated face either, just 'region.

Good catch, thanks. I pushed the previous patch and one for the face.





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

end of thread, other threads:[~2016-04-16 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-09  0:23 bug#23248: 25.1.50; user option rectangle-preview is unused Mark Oteiza
2016-04-14 16:15 ` Mark Oteiza
2016-04-14 16:38   ` Glenn Morris
2016-04-16 16:06     ` 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.