]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/picture.el
Fix the MSDOS build
[gnu-emacs] / lisp / textmodes / picture.el
index e663c1b45f49af1df04408e60c326bf7ba31d9a9..b77f8e9717c975c8556ceb608b7a28cd23de11fc 100644 (file)
@@ -1,9 +1,9 @@
 ;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model
 
-;; Copyright (C) 1985, 1994, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
 ;; Keywords: convenience wp
 
 ;; This file is part of GNU Emacs.
@@ -272,7 +272,11 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio
        (or (eolp)
            (let ((pos (point)))
              (move-to-column col t)
-             (delete-region pos (point)))))
+             (let ((old-width (string-width (buffer-substring pos (point)))))
+               (delete-region pos (point))
+               (when (> old-width width)
+                 (insert-char ?  (- old-width width))
+                 (goto-char pos))))))
       (insert ch)
       (forward-char -1)
       (picture-move))))
@@ -418,7 +422,8 @@ stops computed are displayed in the minibuffer with `:' at each stop."
   (save-excursion
     (let (tabs)
       (if arg
-         (setq tabs (default-value 'tab-stop-list))
+         (setq tabs (or (default-value 'tab-stop-list)
+                        (indent-accumulate-tab-stops (window-width))))
        (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
          (beginning-of-line)
          (let ((bol (point)))
@@ -494,8 +499,12 @@ prefix argument, the rectangle is actually killed, shifting remaining text."
 (defun picture-clear-rectangle-to-register (start end register &optional killp)
   "Clear rectangle delineated by point and mark into REGISTER.
 The rectangle is saved in REGISTER and replaced with whitespace.  With
-prefix argument, the rectangle is actually killed, shifting remaining text."
-  (interactive "r\ncRectangle to register: \nP")
+prefix argument, the rectangle is actually killed, shifting remaining text.
+
+Interactively, reads the register using `register-read-with-preview'."
+  (interactive (list (region-beginning) (region-end)
+                    (register-read-with-preview "Rectangle to register: ")
+                    current-prefix-arg))
   (set-register register (picture-snarf-rectangle start end killp)))
 
 (defun picture-snarf-rectangle (start end &optional killp)
@@ -534,8 +543,11 @@ regardless of where you click."
 The rectangle is positioned with upper left corner at point, overwriting
 existing text.  With prefix argument, the rectangle is
 inserted instead, shifting existing text.  Leaves mark at one corner
-of rectangle and point at the other (diagonally opposed) corner."
-  (interactive "cRectangle from register: \nP")
+of rectangle and point at the other (diagonally opposed) corner.
+
+Interactively, reads the register using `register-read-with-preview'."
+  (interactive (list (register-read-with-preview "Rectangle from register: ")
+                    current-prefix-arg))
   (let ((rectangle (get-register register)))
     (if (not (consp rectangle))
        (error "Register %c does not contain a rectangle" register)