aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-03-16 18:18:47 +0000
committerJim Blandy1993-03-16 18:18:47 +0000
commitb6a22db05882c21726fbed1788a31f91fc714f9c (patch)
treeb30bbcf6bed973ef8f0521f8ec1769cf95525c29
parent6bbb0d4aaa68a2976cf3883fff8068c57f7a6bfa (diff)
downloademacs-b6a22db05882c21726fbed1788a31f91fc714f9c.tar.gz
emacs-b6a22db05882c21726fbed1788a31f91fc714f9c.zip
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'.
-rw-r--r--lisp/simple.el59
1 files changed, 51 insertions, 8 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index b9b0883e372..adc10d59f1a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -60,11 +60,22 @@ With arg N, insert N newlines."
60 "Read next input character and insert it. 60 "Read next input character and insert it.
61This is useful for inserting control characters. 61This is useful for inserting control characters.
62You may also type up to 3 octal digits, to insert a character with that code. 62You 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
64use overstrike as your normal editing mode, you can use this function 64In overwrite mode, this function inserts the character anyway, and
65to insert characters when necessary." 65does not handle octal digits specially. This means that if you use
66overwrite as your normal editing mode, you can use this function to
67insert characters when necessary.
68
69In binary overwrite mode, this function does overwrite, and octal
70digits are interpreted as a character code. This is supposed to make
71this 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)
@@ -1809,16 +1820,48 @@ The variable `selective-display' has a separate value for each buffer."
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.
1814With arg, turn overwrite mode on iff arg is positive. 1830With arg, turn overwrite mode on iff arg is positive.
1815In overwrite mode, printing characters typed in replace existing text 1831In overwrite mode, printing characters typed in replace existing text
1816on a one-for-one basis, rather than pushing it to the right." 1832on a one-for-one basis, rather than pushing it to the right. At the
1833end of a line, such characters extend the line. Before a tab,
1834such characters insert until the tab is filled in.
1835\\[quoted-insert] still inserts characters in overwrite mode; this
1836is supposed to make it easier to insert characters when necessary."
1837 (interactive "P")
1838 (setq overwrite-mode
1839 (if (if (null arg) (not overwrite-mode)
1840 (> (prefix-numeric-value arg) 0))
1841 'overwrite-mode-textual))
1842 (force-mode-line-update))
1843
1844(defun binary-overwrite-mode (arg)
1845 "Toggle binary overwrite mode.
1846With arg, turn binary overwrite mode on iff arg is positive.
1847In binary overwrite mode, printing characters typed in replace
1848existing text. Newlines are not treated specially, so typing at the
1849end of a line joins the line to the next, with the typed character
1850between them. Typing before a tab character simply replaces the tab
1851with the character typed.
1852\\[quoted-insert] replaces the text at the cursor, just as ordinary
1853typing characters do.
1854
1855Note that binary overwrite mode is not its own minor mode; it is a
1856specialization of overwrite-mode, entered by setting the
1857`overwrite-mode' variable to `overwrite-mode-binary'."
1817 (interactive "P") 1858 (interactive "P")
1818 (setq overwrite-mode 1859 (setq overwrite-mode
1819 (if (null arg) (not overwrite-mode) 1860 (if (if (null arg)
1820 (> (prefix-numeric-value arg) 0))) 1861 (not (eq (overwrite-mode 'overwrite-mode-binary)))
1821 (set-buffer-modified-p (buffer-modified-p))) ;No-op, but updates mode line. 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.")