From: "Jérôme Marant" <jerome.marant@free.fr>
Cc: emacs-devel@gnu.org
Subject: Re: Addition to lisp/misc.el
Date: Tue, 23 Sep 2003 13:54:10 +0200 [thread overview]
Message-ID: <1064318050.3f70346232fdf@imp3-l.free.fr> (raw)
In-Reply-To: <sgd4qznk0r0.fsf@occarina.pna.cwi.nl>
Hi,
(Back from vacation)
Quoting Lute Kamstra <Lute.Kamstra@cwi.nl>:
> 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
prev parent reply other threads:[~2003-09-23 11:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-31 9:14 Addition to lisp/misc.el Jérôme Marant
2003-09-08 10:55 ` Lute Kamstra
2003-09-11 21:30 ` Miles Bader
2003-09-12 5:01 ` Lute Kamstra
2003-09-12 21:05 ` Richard Stallman
2003-09-23 11:54 ` Jérôme Marant [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1064318050.3f70346232fdf@imp3-l.free.fr \
--to=jerome.marant@free.fr \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.