]> code.delx.au - gnu-emacs/blobdiff - lisp/rect.el
* lisp/emacs-lisp/bytecomp.el: Require cl-extra.
[gnu-emacs] / lisp / rect.el
index be29517e0879ce950494bf644937580a85fa9742..e798b07b556f46a13ed276ebbff727fc627ef7a9 100644 (file)
@@ -1,6 +1,6 @@
 ;;; rect.el --- rectangle functions for GNU Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1999-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1999-2014 Free Software Foundation, Inc.
 
 ;; Maintainer: Didier Verna <didier@xemacs.org>
 ;; Keywords: internal
@@ -418,9 +418,6 @@ with a prefix argument, prompt for START-AT and FORMAT."
 ;; - lots of commands handle the region without paying attention to its
 ;;   rectangular shape.
 
-(add-hook 'deactivate-mark-hook
-          (lambda () (rectangle-mark-mode -1)))
-
 (add-function :around redisplay-highlight-region-function
               #'rectangle--highlight-for-redisplay)
 (add-function :around redisplay-unhighlight-region-function
@@ -443,9 +440,12 @@ with a prefix argument, prompt for START-AT and FORMAT."
 Activates the region if needed.  Only lasts until the region is deactivated."
   nil nil nil
   (when rectangle-mark-mode
+    (add-hook 'deactivate-mark-hook
+              (lambda () (rectangle-mark-mode -1)))
     (unless (region-active-p)
       (push-mark)
-      (activate-mark))))
+      (activate-mark)
+      (message "Mark set (rectangle mode)"))))
 
 (defun rectangle--extract-region (orig &optional delete)
   (if (not rectangle-mark-mode)
@@ -554,10 +554,10 @@ Activates the region if needed.  Only lasts until the region is deactivated."
                     (overlay-put ol 'after-string str))))
                ((overlay-get ol 'after-string)
                 (overlay-put ol 'after-string nil)))
-              (when (= leftcol rightcol)
+              (when (and (= leftcol rightcol) (display-graphic-p))
                 ;; Make zero-width rectangles visible!
-                (overlay-put ol 'after-string
-                             (concat (propertize " "
+               (overlay-put ol 'after-string
+                            (concat (propertize " "
                                                  'face '(region (:height 0.2)))
                                      (overlay-get ol 'after-string))))
               (push ol nrol)