aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-04-16 14:53:06 -0400
committerGlenn Morris2012-04-16 14:53:06 -0400
commit5a0978ce61cc768c55d621d3f17e6f2c035caebc (patch)
tree4f2d2c881dc4aeb10a576995bafc3ab4b2aec592
parent5934c3782fcfb59498d415a74fe3df902cf99d0e (diff)
downloademacs-5a0978ce61cc768c55d621d3f17e6f2c035caebc.tar.gz
emacs-5a0978ce61cc768c55d621d3f17e6f2c035caebc.zip
picture.el small cleanup
* lisp/textmodes/picture.el (picture-desired-column) (picture-update-desired-column): Convert comments to doc-strings. (picture-substitute): Remove function. (picture-mode-map): Initialize in the defvar.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/textmodes/picture.el131
2 files changed, 70 insertions, 66 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ee34ce1827e..3bed71495e5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12012-04-16 Glenn Morris <rgm@gnu.org> 12012-04-16 Glenn Morris <rgm@gnu.org>
2 2
3 * textmodes/picture.el (picture-desired-column)
4 (picture-update-desired-column): Convert comments to doc-strings.
5 (picture-substitute): Remove function.
6 (picture-mode-map): Initialize in the defvar.
7
3 * woman.el: Remove eval-after-load for tar-mode. 8 * woman.el: Remove eval-after-load for tar-mode.
4 * tar-mode.el (tar-mode-map): Add woman binding and menu entry. 9 * tar-mode.el (tar-mode-map): Add woman binding and menu entry.
5 (woman-tar-extract-file): Autoload it. 10 (woman-tar-extract-file): Autoload it.
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 9e8cbb216d1..3e2ab7892da 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -63,15 +63,17 @@
63 63
64;; Picture Movement Commands 64;; Picture Movement Commands
65 65
66;; When a cursor is on a wide-column character (e.g. Chinese, 66(defvar picture-desired-column 0
67;; Japanese, Korean), this variable tells the desired current column 67 "Desired current column for Picture mode.
68;; which may be different from (current-column). 68When a cursor is on a wide-column character (e.g. Chinese,
69(defvar picture-desired-column 0) 69Japanese, Korean), this may may be different from `current-column'.")
70 70
71;; If the value of picture-desired-column is far from the current 71
72;; column, or if the arg ADJUST-TO-CURRENT is non-nil, set it to the
73;; current column. Return the current column.
74(defun picture-update-desired-column (adjust-to-current) 72(defun picture-update-desired-column (adjust-to-current)
73 "Maybe update `picture-desired-column'.
74If the value of `picture-desired-column' is more than one column
75from `current-column', or if the argument ADJUST-TO-CURRENT is
76non-nil, set it to the current column. Return `current-column'."
75 (let ((current-column (current-column))) 77 (let ((current-column (current-column)))
76 (if (or adjust-to-current 78 (if (or adjust-to-current
77 (< picture-desired-column (1- current-column)) 79 (< picture-desired-column (1- current-column))
@@ -606,64 +608,61 @@ Leaves the region surrounding the rectangle."
606 608
607(defalias 'picture-delete-char 'delete-char) 609(defalias 'picture-delete-char 'delete-char)
608 610
609(defvar picture-mode-map nil) 611(defvar picture-mode-map
610 612 (let ((map (make-keymap)))
611(defun picture-substitute (oldfun newfun) 613 (define-key map [remap self-insert-command] 'picture-self-insert)
612 (define-key picture-mode-map (vector 'remap oldfun) newfun)) 614 (define-key map [remap self-insert-command] 'picture-self-insert)
613 615 (define-key map [remap completion-separator-self-insert-command]
614(if (not picture-mode-map) 616 'picture-self-insert)
615 (progn 617 (define-key map [remap completion-separator-self-insert-autofilling]
616 (setq picture-mode-map (make-keymap)) 618 'picture-self-insert)
617 (picture-substitute 'self-insert-command 'picture-self-insert) 619 (define-key map [remap forward-char] 'picture-forward-column)
618 (picture-substitute 'completion-separator-self-insert-command 620 (define-key map [remap backward-char] 'picture-backward-column)
619 'picture-self-insert) 621 (define-key map [remap delete-char] 'picture-clear-column)
620 (picture-substitute 'completion-separator-self-insert-autofilling 622 ;; There are two possibilities for what is normally on DEL.
621 'picture-self-insert) 623 (define-key map [remap backward-delete-char-untabify]
622 (picture-substitute 'forward-char 'picture-forward-column) 624 'picture-backward-clear-column)
623 (picture-substitute 'backward-char 'picture-backward-column) 625 (define-key map [remap delete-backward-char] 'picture-backward-clear-column)
624 (picture-substitute 'delete-char 'picture-clear-column) 626 (define-key map [remap kill-line] 'picture-clear-line)
625 ;; There are two possibilities for what is normally on DEL. 627 (define-key map [remap open-line] 'picture-open-line)
626 (picture-substitute 'backward-delete-char-untabify 'picture-backward-clear-column) 628 (define-key map [remap newline] 'picture-newline)
627 (picture-substitute 'delete-backward-char 'picture-backward-clear-column) 629 (define-key map [remap newline-and-indent] 'picture-duplicate-line)
628 (picture-substitute 'kill-line 'picture-clear-line) 630 (define-key map [remap next-line] 'picture-move-down)
629 (picture-substitute 'open-line 'picture-open-line) 631 (define-key map [remap previous-line] 'picture-move-up)
630 (picture-substitute 'newline 'picture-newline) 632 (define-key map [remap move-beginning-of-line] 'picture-beginning-of-line)
631 (picture-substitute 'newline-and-indent 'picture-duplicate-line) 633 (define-key map [remap move-end-of-line] 'picture-end-of-line)
632 (picture-substitute 'next-line 'picture-move-down) 634 (define-key map [remap mouse-set-point] 'picture-mouse-set-point)
633 (picture-substitute 'previous-line 'picture-move-up) 635 (define-key map "\C-c\C-d" 'picture-delete-char)
634 (picture-substitute 'move-beginning-of-line 'picture-beginning-of-line) 636 (define-key map "\e\t" 'picture-toggle-tab-state)
635 (picture-substitute 'move-end-of-line 'picture-end-of-line) 637 (define-key map "\t" 'picture-tab)
636 (picture-substitute 'mouse-set-point 'picture-mouse-set-point) 638 (define-key map "\e\t" 'picture-tab-search)
637 639 (define-key map "\C-c\t" 'picture-set-tab-stops)
638 (define-key picture-mode-map "\C-c\C-d" 'picture-delete-char) 640 (define-key map "\C-c\C-k" 'picture-clear-rectangle)
639 (define-key picture-mode-map "\e\t" 'picture-toggle-tab-state) 641 (define-key map "\C-c\C-w" 'picture-clear-rectangle-to-register)
640 (define-key picture-mode-map "\t" 'picture-tab) 642 (define-key map "\C-c\C-y" 'picture-yank-rectangle)
641 (define-key picture-mode-map "\e\t" 'picture-tab-search) 643 (define-key map "\C-c\C-x" 'picture-yank-rectangle-from-register)
642 (define-key picture-mode-map "\C-c\t" 'picture-set-tab-stops) 644 (define-key map "\C-c\C-r" 'picture-draw-rectangle)
643 (define-key picture-mode-map "\C-c\C-k" 'picture-clear-rectangle) 645 (define-key map "\C-c\C-c" 'picture-mode-exit)
644 (define-key picture-mode-map "\C-c\C-w" 'picture-clear-rectangle-to-register) 646 (define-key map "\C-c\C-f" 'picture-motion)
645 (define-key picture-mode-map "\C-c\C-y" 'picture-yank-rectangle) 647 (define-key map "\C-c\C-b" 'picture-motion-reverse)
646 (define-key picture-mode-map "\C-c\C-x" 'picture-yank-rectangle-from-register) 648 (define-key map "\C-c<" 'picture-movement-left)
647 (define-key picture-mode-map "\C-c\C-r" 'picture-draw-rectangle) 649 (define-key map "\C-c>" 'picture-movement-right)
648 (define-key picture-mode-map "\C-c\C-c" 'picture-mode-exit) 650 (define-key map "\C-c^" 'picture-movement-up)
649 (define-key picture-mode-map "\C-c\C-f" 'picture-motion) 651 (define-key map "\C-c." 'picture-movement-down)
650 (define-key picture-mode-map "\C-c\C-b" 'picture-motion-reverse) 652 (define-key map "\C-c`" 'picture-movement-nw)
651 (define-key picture-mode-map "\C-c<" 'picture-movement-left) 653 (define-key map "\C-c'" 'picture-movement-ne)
652 (define-key picture-mode-map "\C-c>" 'picture-movement-right) 654 (define-key map "\C-c/" 'picture-movement-sw)
653 (define-key picture-mode-map "\C-c^" 'picture-movement-up) 655 (define-key map "\C-c\\" 'picture-movement-se)
654 (define-key picture-mode-map "\C-c." 'picture-movement-down) 656 (define-key map [(control ?c) left] 'picture-movement-left)
655 (define-key picture-mode-map "\C-c`" 'picture-movement-nw) 657 (define-key map [(control ?c) right] 'picture-movement-right)
656 (define-key picture-mode-map "\C-c'" 'picture-movement-ne) 658 (define-key map [(control ?c) up] 'picture-movement-up)
657 (define-key picture-mode-map "\C-c/" 'picture-movement-sw) 659 (define-key map [(control ?c) down] 'picture-movement-down)
658 (define-key picture-mode-map "\C-c\\" 'picture-movement-se) 660 (define-key map [(control ?c) home] 'picture-movement-nw)
659 (define-key picture-mode-map [(control ?c) left] 'picture-movement-left) 661 (define-key map [(control ?c) prior] 'picture-movement-ne)
660 (define-key picture-mode-map [(control ?c) right] 'picture-movement-right) 662 (define-key map [(control ?c) end] 'picture-movement-sw)
661 (define-key picture-mode-map [(control ?c) up] 'picture-movement-up) 663 (define-key map [(control ?c) next] 'picture-movement-se)
662 (define-key picture-mode-map [(control ?c) down] 'picture-movement-down) 664 map)
663 (define-key picture-mode-map [(control ?c) home] 'picture-movement-nw) 665 "Keymap used in `picture-mode'.")
664 (define-key picture-mode-map [(control ?c) prior] 'picture-movement-ne)
665 (define-key picture-mode-map [(control ?c) end] 'picture-movement-sw)
666 (define-key picture-mode-map [(control ?c) next] 'picture-movement-se)))
667 666
668(defcustom picture-mode-hook nil 667(defcustom picture-mode-hook nil
669 "If non-nil, its value is called on entry to Picture mode. 668 "If non-nil, its value is called on entry to Picture mode.