comparison lisp/simple.el @ 2215:a7d915ce7676

src/ * simple.el (quoted-insert): In overwrite mode, don't read digits as an octal character code. In binary overwrite mode, overwrite the characters instead of inserting them. (overwrite-mode-textual, overwrite-mode-binary): New symbols, for use in the mode line. (overwrite-mode): Doc fix. Use force-mode-line-update. (binary-overwrite-mode): New function. * loaddefs.el (minor-mode-alist): Make the mode line element for overwrite-mode be the symbol `overwrite-mode'.
author Jim Blandy <jimb@redhat.com>
date Tue, 16 Mar 1993 18:18:47 +0000
parents d38d32084c15
children 53abb56a18fa
comparison
equal deleted inserted replaced
2214:e5928bec8d5d 2215:a7d915ce7676
58 58
59 (defun quoted-insert (arg) 59 (defun quoted-insert (arg)
60 "Read next input character and insert it. 60 "Read next input character and insert it.
61 This is useful for inserting control characters. 61 This is useful for inserting control characters.
62 You may also type up to 3 octal digits, to insert a character with that code. 62 You may also type up to 3 octal digits, to insert a character with that code.
63 `quoted-insert' inserts the character even in overstrike mode; if you 63
64 use overstrike as your normal editing mode, you can use this function 64 In overwrite mode, this function inserts the character anyway, and
65 to insert characters when necessary." 65 does not handle octal digits specially. This means that if you use
66 overwrite as your normal editing mode, you can use this function to
67 insert characters when necessary.
68
69 In binary overwrite mode, this function does overwrite, and octal
70 digits are interpreted as a character code. This is supposed to make
71 this function useful in editing binary files."
66 (interactive "*p") 72 (interactive "*p")
67 (let ((char (read-quoted-char))) 73 (let ((char (if (or (not overwrite-mode)
74 (eq overwrite-mode 'overwrite-mode-binary))
75 (read-quoted-char)
76 (read-char))))
77 (if (eq overwrite-mode 'overwrite-mode-binary)
78 (delete-char arg))
68 (insert-char char arg))) 79 (insert-char char arg)))
69 80
70 (defun delete-indentation (&optional arg) 81 (defun delete-indentation (&optional arg)
71 "Join this line to previous and fix up whitespace at join. 82 "Join this line to previous and fix up whitespace at join.
72 If there is a fill prefix, delete it from the beginning of this line. 83 If there is a fill prefix, delete it from the beginning of this line.
1807 (set-window-start (selected-window) (window-start (selected-window))) 1818 (set-window-start (selected-window) (window-start (selected-window)))
1808 (princ "selective-display set to " t) 1819 (princ "selective-display set to " t)
1809 (prin1 selective-display t) 1820 (prin1 selective-display t)
1810 (princ "." t)) 1821 (princ "." t))
1811 1822
1823 (defconst overwrite-mode-textual " Ovwrt"
1824 "The string displayed in the mode line when in overwrite mode.")
1825 (defconst overwrite-mode-binary " Bin Ovwrt"
1826 "The string displayed in the mode line when in binary overwrite mode.")
1827
1812 (defun overwrite-mode (arg) 1828 (defun overwrite-mode (arg)
1813 "Toggle overwrite mode. 1829 "Toggle overwrite mode.
1814 With arg, turn overwrite mode on iff arg is positive. 1830 With arg, turn overwrite mode on iff arg is positive.
1815 In overwrite mode, printing characters typed in replace existing text 1831 In overwrite mode, printing characters typed in replace existing text
1816 on a one-for-one basis, rather than pushing it to the right." 1832 on a one-for-one basis, rather than pushing it to the right. At the
1833 end of a line, such characters extend the line. Before a tab,
1834 such characters insert until the tab is filled in.
1835 \\[quoted-insert] still inserts characters in overwrite mode; this
1836 is supposed to make it easier to insert characters when necessary."
1817 (interactive "P") 1837 (interactive "P")
1818 (setq overwrite-mode 1838 (setq overwrite-mode
1819 (if (null arg) (not overwrite-mode) 1839 (if (if (null arg) (not overwrite-mode)
1820 (> (prefix-numeric-value arg) 0))) 1840 (> (prefix-numeric-value arg) 0))
1821 (set-buffer-modified-p (buffer-modified-p))) ;No-op, but updates mode line. 1841 'overwrite-mode-textual))
1842 (force-mode-line-update))
1843
1844 (defun binary-overwrite-mode (arg)
1845 "Toggle binary overwrite mode.
1846 With arg, turn binary overwrite mode on iff arg is positive.
1847 In binary overwrite mode, printing characters typed in replace
1848 existing text. Newlines are not treated specially, so typing at the
1849 end of a line joins the line to the next, with the typed character
1850 between them. Typing before a tab character simply replaces the tab
1851 with the character typed.
1852 \\[quoted-insert] replaces the text at the cursor, just as ordinary
1853 typing characters do.
1854
1855 Note that binary overwrite mode is not its own minor mode; it is a
1856 specialization of overwrite-mode, entered by setting the
1857 `overwrite-mode' variable to `overwrite-mode-binary'."
1858 (interactive "P")
1859 (setq overwrite-mode
1860 (if (if (null arg)
1861 (not (eq (overwrite-mode 'overwrite-mode-binary)))
1862 (> (prefix-numeric-value arg) 0))
1863 'overwrite-mode-binary))
1864 (force-mode-line-update))
1822 1865
1823 (defvar blink-matching-paren t 1866 (defvar blink-matching-paren t
1824 "*Non-nil means show matching open-paren when close-paren is inserted.") 1867 "*Non-nil means show matching open-paren when close-paren is inserted.")
1825 1868
1826 (defconst blink-matching-paren-distance 4000 1869 (defconst blink-matching-paren-distance 4000