comparison lisp/textmodes/picture.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents f47ff7e8f5f5
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model 1 ;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model
2 2
3 ;; Copyright (C) 1985, 1994, 2002, 2003 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 1994, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
4 5
5 ;; Author: K. Shane Hartman 6 ;; Author: K. Shane Hartman
6 ;; Maintainer: FSF 7 ;; Maintainer: FSF
7 ;; Keywords: convenience wp 8 ;; Keywords: convenience wp
8 9
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details. 20 ;; GNU General Public License for more details.
20 21
21 ;; You should have received a copy of the GNU General Public License 22 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02111-1307, USA. 25 ;; Boston, MA 02110-1301, USA.
25 26
26 ;;; Commentary: 27 ;;; Commentary:
27 28
28 ;; This code provides the picture-mode commands documented in the Emacs 29 ;; This code provides the picture-mode commands documented in the Emacs
29 ;; manual. The screen is treated as a semi-infinite quarter-plane with 30 ;; manual. The screen is treated as a semi-infinite quarter-plane with
357 (progn 358 (progn
358 (move-to-column (+ change (current-column)) t) 359 (move-to-column (+ change (current-column)) t)
359 (point)))) 360 (point))))
360 (replace-match newtext fixedcase literal) 361 (replace-match newtext fixedcase literal)
361 (if (< change 0) 362 (if (< change 0)
362 (insert-char ?\ (- change))))) 363 (insert-char ?\s (- change)))))
363 364
364 ;; Picture Tabs 365 ;; Picture Tabs
365 366
366 (defcustom picture-tab-chars "!-~" 367 (defcustom picture-tab-chars "!-~"
367 "*A character set which controls behavior of commands. 368 "*A character set which controls behavior of commands.
634 (define-key picture-mode-map "\C-c^" 'picture-movement-up) 635 (define-key picture-mode-map "\C-c^" 'picture-movement-up)
635 (define-key picture-mode-map "\C-c." 'picture-movement-down) 636 (define-key picture-mode-map "\C-c." 'picture-movement-down)
636 (define-key picture-mode-map "\C-c`" 'picture-movement-nw) 637 (define-key picture-mode-map "\C-c`" 'picture-movement-nw)
637 (define-key picture-mode-map "\C-c'" 'picture-movement-ne) 638 (define-key picture-mode-map "\C-c'" 'picture-movement-ne)
638 (define-key picture-mode-map "\C-c/" 'picture-movement-sw) 639 (define-key picture-mode-map "\C-c/" 'picture-movement-sw)
639 (define-key picture-mode-map "\C-c\\" 'picture-movement-se))) 640 (define-key picture-mode-map "\C-c\\" 'picture-movement-se)
641 (define-key picture-mode-map [(control ?c) left] 'picture-movement-left)
642 (define-key picture-mode-map [(control ?c) right] 'picture-movement-right)
643 (define-key picture-mode-map [(control ?c) up] 'picture-movement-up)
644 (define-key picture-mode-map [(control ?c) down] 'picture-movement-down)
645 (define-key picture-mode-map [(control ?c) home] 'picture-movement-nw)
646 (define-key picture-mode-map [(control ?c) prior] 'picture-movement-ne)
647 (define-key picture-mode-map [(control ?c) end] 'picture-movement-sw)
648 (define-key picture-mode-map [(control ?c) next] 'picture-movement-se)))
640 649
641 (defcustom picture-mode-hook nil 650 (defcustom picture-mode-hook nil
642 "If non-nil, its value is called on entry to Picture mode. 651 "If non-nil, its value is called on entry to Picture mode.
643 Picture mode is invoked by the command \\[picture-mode]." 652 Picture mode is invoked by the command \\[picture-mode]."
644 :type 'hook 653 :type 'hook
650 (defvar picture-mode-old-truncate-lines) 659 (defvar picture-mode-old-truncate-lines)
651 660
652 ;;;###autoload 661 ;;;###autoload
653 (defun picture-mode () 662 (defun picture-mode ()
654 "Switch to Picture mode, in which a quarter-plane screen model is used. 663 "Switch to Picture mode, in which a quarter-plane screen model is used.
664 \\<picture-mode-map>
655 Printing characters replace instead of inserting themselves with motion 665 Printing characters replace instead of inserting themselves with motion
656 afterwards settable by these commands: 666 afterwards settable by these commands:
657 C-c < Move left after insertion. 667
658 C-c > Move right after insertion. 668 Move left after insertion: \\[picture-movement-left]
659 C-c ^ Move up after insertion. 669 Move right after insertion: \\[picture-movement-right]
660 C-c . Move down after insertion. 670 Move up after insertion: \\[picture-movement-up]
661 C-c ` Move northwest (nw) after insertion. 671 Move down after insertion: \\[picture-movement-down]
662 C-c ' Move northeast (ne) after insertion. 672
663 C-c / Move southwest (sw) after insertion. 673 Move northwest (nw) after insertion: \\[picture-movement-nw]
664 C-c \\ Move southeast (se) after insertion. 674 Move northeast (ne) after insertion: \\[picture-movement-ne]
665 C-u C-c ` Move westnorthwest (wnw) after insertion. 675 Move southwest (sw) after insertion: \\[picture-movement-sw]
666 C-u C-c ' Move eastnortheast (ene) after insertion. 676 Move southeast (se) after insertion: \\[picture-movement-se]
667 C-u C-c / Move westsouthwest (wsw) after insertion. 677
668 C-u C-c \\ Move eastsoutheast (ese) after insertion. 678 Move westnorthwest (wnw) after insertion: C-u \\[picture-movement-nw]
679 Move eastnortheast (ene) after insertion: C-u \\[picture-movement-ne]
680 Move westsouthwest (wsw) after insertion: C-u \\[picture-movement-sw]
681 Move eastsoutheast (ese) after insertion: C-u \\[picture-movement-se]
682
669 The current direction is displayed in the mode line. The initial 683 The current direction is displayed in the mode line. The initial
670 direction is right. Whitespace is inserted and tabs are changed to 684 direction is right. Whitespace is inserted and tabs are changed to
671 spaces when required by movement. You can move around in the buffer 685 spaces when required by movement. You can move around in the buffer
672 with these commands: 686 with these commands:
673 \\[picture-move-down] Move vertically to SAME column in previous line. 687
674 \\[picture-move-up] Move vertically to SAME column in next line. 688 Move vertically to SAME column in previous line: \\[picture-move-down]
675 \\[picture-end-of-line] Move to column following last non-whitespace character. 689 Move vertically to SAME column in next line: \\[picture-move-up]
676 \\[picture-forward-column] Move right inserting spaces if required. 690 Move to column following last
677 \\[picture-backward-column] Move left changing tabs to spaces if required. 691 non-whitespace character: \\[picture-end-of-line]
678 C-c C-f Move in direction of current picture motion. 692 Move right, inserting spaces if required: \\[picture-forward-column]
679 C-c C-b Move in opposite direction of current picture motion. 693 Move left changing tabs to spaces if required: \\[picture-backward-column]
680 Return Move to beginning of next line. 694 Move in direction of current picture motion: \\[picture-motion]
695 Move opposite to current picture motion: \\[picture-motion-reverse]
696 Move to beginning of next line: \\[next-line]
697
681 You can edit tabular text with these commands: 698 You can edit tabular text with these commands:
682 M-Tab Move to column beneath (or at) next interesting character. 699
683 `Indents' relative to a previous line. 700 Move to column beneath (or at) next interesting
684 Tab Move to next stop in tab stop list. 701 character (see variable `picture-tab-chars'): \\[picture-tab-search]
685 C-c Tab Set tab stops according to context of this line. 702 Move to next stop in tab stop list: \\[picture-tab]
686 With ARG resets tab stops to default (global) value. 703 Set tab stops according to context of this line: \\[picture-set-tab-stops]
687 See also documentation of variable picture-tab-chars 704 (With ARG, resets tab stops to default value.)
688 which defines \"interesting character\". You can manually 705 Change the tab stop list: \\[edit-tab-stops]
689 change the tab stop list with command \\[edit-tab-stops]. 706
690 You can manipulate text with these commands: 707 You can manipulate text with these commands:
691 C-d Clear (replace) ARG columns after point without moving. 708 Clear ARG columns after point without moving: \\[picture-clear-column]
692 C-c C-d Delete char at point - the command normally assigned to C-d. 709 Delete char at point: \\[delete-char]
693 \\[picture-backward-clear-column] Clear (replace) ARG columns before point, moving back over them. 710 Clear ARG columns backward: \\[picture-backward-clear-column]
694 \\[picture-clear-line] Clear ARG lines, advancing over them. The cleared 711 Clear ARG lines, advancing over them: \\[picture-clear-line]
695 text is saved in the kill ring. 712 (the cleared text is saved in the kill ring)
696 \\[picture-open-line] Open blank line(s) beneath current line. 713 Open blank line(s) beneath current line: \\[picture-open-line]
714
697 You can manipulate rectangles with these commands: 715 You can manipulate rectangles with these commands:
698 C-c C-k Clear (or kill) a rectangle and save it. 716 Clear a rectangle and save it: \\[picture-clear-rectangle]
699 C-c C-w Like C-c C-k except rectangle is saved in named register. 717 Clear a rectangle, saving in a named register: \\[picture-clear-rectangle-to-register]
700 C-c C-y Overlay (or insert) currently saved rectangle at point. 718 Insert currently saved rectangle at point: \\[picture-yank-rectangle]
701 C-c C-x Like C-c C-y except rectangle is taken from named register. 719 Insert rectangle from named register: \\[picture-yank-rectangle-from-register]
702 C-c C-r Draw a rectangular box around mark and point. 720 Draw a rectangular box around mark and point: \\[picture-draw-rectangle]
703 \\[copy-rectangle-to-register] Copies a rectangle to a register. 721 Copies a rectangle to a register: \\[copy-rectangle-to-register]
704 \\[advertised-undo] Can undo effects of rectangle overlay commands 722 Undo effects of rectangle overlay commands: \\[advertised-undo]
705 commands if invoked soon enough. 723
706 You can return to the previous mode with: 724 You can return to the previous mode with \\[picture-mode-exit], which
707 C-c C-c Which also strips trailing whitespace from every line. 725 also strips trailing whitespace from every line. Stripping is suppressed
708 Stripping is suppressed by supplying an argument. 726 by supplying an argument.
709 727
710 Entry to this mode calls the value of `picture-mode-hook' if non-nil. 728 Entry to this mode calls the value of `picture-mode-hook' if non-nil.
711 729
712 Note that Picture mode commands will work outside of Picture mode, but 730 Note that Picture mode commands will work outside of Picture mode, but
713 they are not defaultly assigned to keys." 731 they are not defaultly assigned to keys."
753 (setq truncate-lines picture-mode-old-truncate-lines) 771 (setq truncate-lines picture-mode-old-truncate-lines)
754 (force-mode-line-update))) 772 (force-mode-line-update)))
755 773
756 (provide 'picture) 774 (provide 'picture)
757 775
776 ;;; arch-tag: e452d08d-a470-4fbf-896e-ea276698d1ca
758 ;;; picture.el ends here 777 ;;; picture.el ends here