[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addition to lisp/misc.el

From: Jérôme Marant
Subject: Re: Addition to lisp/misc.el
Date: Tue, 23 Sep 2003 13:54:10 +0200
User-agent: Internet Messaging Program (IMP) 3.2.1


(Back from vacation)

Quoting Lute Kamstra <address@hidden>:

> This way, point is moved forward by one character if the
> search-forward fails.  Seems undesirable to me.  I think this
> implementation would be better:
> (defun zap-up-to-char (arg char)
>   "Kill up to, but not including ARG'th occurrence of CHAR.
> Case is ignored if `case-fold-search' is non-nil in the current buffer.
> Goes backward if ARG is negative; error if CHAR not found.
> Ignores CHAR at point."
>   (interactive "p\ncZap up to char: ")
>   (let ((direction (if (>= arg 0) 1 -1)))
>     (kill-region (point)
>                (progn
>                  (forward-char direction)
>                  (unwind-protect
>                      (search-forward (char-to-string char) nil nil arg)
>                    (backward-char direction))
>                  (point)))))
> If nobody objects, I'll put it in lisp/misc.el.

This one works for me as well. Could you please commit it?

Thanks in advance.

Jérôme Marant

reply via email to

[Prev in Thread] Current Thread [Next in Thread]