/[emacs]/emacs/lisp/misc.el
ViewVC logotype

Diff of /emacs/lisp/misc.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by pj, Thu May 2 05:37:47 2002 UTC revision 1.8.2.1 by miles, Tue Oct 14 23:51:19 2003 UTC
# Line 1  Line 1 
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
# Line 58  The characters copied are inserted in th Line 58  The characters copied are inserted in th
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
79    ;; command set; but that turned out not to be interesting.
80    
81    (defun mark-beginning-of-buffer ()
82      "Set mark at the beginning of the buffer."
83      (interactive)
84      (push-mark (point-min)))
85    
86    (defun mark-end-of-buffer ()
87      "Set mark at the end of the buffer."
88      (interactive)
89      (push-mark (point-max)))
90    
91    (defun upcase-char (arg)
92      "Uppercasify ARG chars starting from point.  Point doesn't move."
93      (interactive "p")
94      (save-excursion
95        (upcase-region (point) (progn (forward-char arg) (point)))))
96    
97    (defun forward-to-word (arg)
98      "Move forward until encountering the beginning of a word.
99    With argument, do this that many times."
100      (interactive "p")
101      (or (re-search-forward (if (> arg 0) "\\W\\b" "\\b\\W") nil t arg)
102          (goto-char (if (> arg 0) (point-max) (point-min)))))
103    
104    (defun backward-to-word (arg)
105      "Move backward until encountering the end of a word.
106    With argument, do this that many times."
107      (interactive "p")
108      (forward-to-word (- arg)))
109    
110  (provide 'misc)  (provide 'misc)
111    
112    ;;; arch-tag: 908f7884-c19e-4388-920c-9cfa425e449b
113  ;;; misc.el ends here  ;;; misc.el ends here

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26