1 |
;;; misc.el --- some nonstandard basic editing commands for Emacs |
;;; misc.el --- some nonstandard basic editing commands for Emacs |
2 |
|
|
3 |
;; Copyright (C) 1989 Free Software Foundation, Inc. |
;; Copyright (C) 1989, 2003 Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Maintainer: FSF |
;; Maintainer: FSF |
6 |
;; Keywords: convenience |
;; Keywords: convenience |
58 |
(+ n (point))))))) |
(+ n (point))))))) |
59 |
(insert string))) |
(insert string))) |
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 |
|
|
78 |
;; These were added with an eye to making possible a more CCA-compatible |
;; These were added with an eye to making possible a more CCA-compatible |
79 |
;; command set; but that turned out not to be interesting. |
;; command set; but that turned out not to be interesting. |
80 |
|
|
89 |
(push-mark (point-max))) |
(push-mark (point-max))) |
90 |
|
|
91 |
(defun upcase-char (arg) |
(defun upcase-char (arg) |
92 |
"Uppercasify ARG chars starting from point. Point doesn't move" |
"Uppercasify ARG chars starting from point. Point doesn't move." |
93 |
(interactive "p") |
(interactive "p") |
94 |
(save-excursion |
(save-excursion |
95 |
(upcase-region (point) (progn (forward-char arg) (point))))) |
(upcase-region (point) (progn (forward-char arg) (point))))) |