diff options
| author | Jim Blandy | 1993-03-16 18:18:47 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-16 18:18:47 +0000 |
| commit | b6a22db05882c21726fbed1788a31f91fc714f9c (patch) | |
| tree | b30bbcf6bed973ef8f0521f8ec1769cf95525c29 | |
| parent | 6bbb0d4aaa68a2976cf3883fff8068c57f7a6bfa (diff) | |
| download | emacs-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.el | 59 |
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. |
| 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) |
| @@ -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. |
| 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." | ||
| 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. | ||
| 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'." | ||
| 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.") |