diff options
| author | Lute Kamstra | 2003-09-24 08:52:09 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2003-09-24 08:52:09 +0000 |
| commit | 2fd8a18a9ad52c78c4a3cdc032badb81678a67f4 (patch) | |
| tree | 0e02d444dcdec7e3e6f13364f5c182c2c88baf46 /lisp/misc.el | |
| parent | 41beda59dd0be296535241c6f1d021d321cb6ea9 (diff) | |
| download | emacs-2fd8a18a9ad52c78c4a3cdc032badb81678a67f4.tar.gz emacs-2fd8a18a9ad52c78c4a3cdc032badb81678a67f4.zip | |
(upcase-char): Fix docstring.
(zap-up-to-char): New command.
Diffstat (limited to 'lisp/misc.el')
| -rw-r--r-- | lisp/misc.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/misc.el b/lisp/misc.el index 2ca39f7b1e5..31a35affad0 100644 --- a/lisp/misc.el +++ b/lisp/misc.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; misc.el --- some nonstandard basic editing commands for Emacs | 1 | ;;; misc.el --- some nonstandard basic editing commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1989 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1989, 2003 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Maintainer: FSF | 5 | ;; Maintainer: FSF |
| 6 | ;; Keywords: convenience | 6 | ;; Keywords: convenience |
| @@ -58,6 +58,23 @@ The characters copied are inserted in the buffer before point." | |||
| 58 | (+ n (point))))))) | 58 | (+ n (point))))))) |
| 59 | (insert string))) | 59 | (insert string))) |
| 60 | 60 | ||
| 61 | ;; Variation of `zap-to-char'. | ||
| 62 | |||
| 63 | (defun zap-up-to-char (arg char) | ||
| 64 | "Kill up to, but not including ARG'th occurrence of CHAR. | ||
| 65 | Case is ignored if `case-fold-search' is non-nil in the current buffer. | ||
| 66 | Goes backward if ARG is negative; error if CHAR not found. | ||
| 67 | Ignores CHAR at point." | ||
| 68 | (interactive "p\ncZap up to char: ") | ||
| 69 | (let ((direction (if (>= arg 0) 1 -1))) | ||
| 70 | (kill-region (point) | ||
| 71 | (progn | ||
| 72 | (forward-char direction) | ||
| 73 | (unwind-protect | ||
| 74 | (search-forward (char-to-string char) nil nil arg) | ||
| 75 | (backward-char direction)) | ||
| 76 | (point))))) | ||
| 77 | |||
| 61 | ;; These were added with an eye to making possible a more CCA-compatible | 78 | ;; These were added with an eye to making possible a more CCA-compatible |
| 62 | ;; command set; but that turned out not to be interesting. | 79 | ;; command set; but that turned out not to be interesting. |
| 63 | 80 | ||
| @@ -72,7 +89,7 @@ The characters copied are inserted in the buffer before point." | |||
| 72 | (push-mark (point-max))) | 89 | (push-mark (point-max))) |
| 73 | 90 | ||
| 74 | (defun upcase-char (arg) | 91 | (defun upcase-char (arg) |
| 75 | "Uppercasify ARG chars starting from point. Point doesn't move" | 92 | "Uppercasify ARG chars starting from point. Point doesn't move." |
| 76 | (interactive "p") | 93 | (interactive "p") |
| 77 | (save-excursion | 94 | (save-excursion |
| 78 | (upcase-region (point) (progn (forward-char arg) (point))))) | 95 | (upcase-region (point) (progn (forward-char arg) (point))))) |