all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Zap-up-to-char in Emacs
@ 2002-12-05 22:56 Jiri Pejchal
  2002-12-05 23:10 ` Jesper Harder
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jiri Pejchal @ 2002-12-05 22:56 UTC (permalink / raw)


Hi,

function zap-to-char

`M-z CHAR'
     Kills through the next occurrence of CHAR (`zap-to-char'). 

is there a function in Emacs similar to zap-up-to-char in XEmacs that 
would kill up to and not including the next occurencce of CHAR?

Thanks.

Jiri Pejchal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Zap-up-to-char in Emacs
  2002-12-05 22:56 Zap-up-to-char in Emacs Jiri Pejchal
@ 2002-12-05 23:10 ` Jesper Harder
  2002-12-05 23:17 ` Benjamin Lewis
  2002-12-06 14:50 ` Kai Großjohann
  2 siblings, 0 replies; 5+ messages in thread
From: Jesper Harder @ 2002-12-05 23:10 UTC (permalink / raw)


Jiri Pejchal <xpejchal@nymfe33.fi.muni.cz> writes:

> function zap-to-char
>
> `M-z CHAR'
>      Kills through the next occurrence of CHAR (`zap-to-char'). 
>
> is there a function in Emacs similar to zap-up-to-char in XEmacs that 
> would kill up to and not including the next occurencce of CHAR?

Emacs (21) _has_ the function `zap-up-to-char' by default bound to the
same key as in XEmacs:

,----[ C-h k M-z ]
| M-z runs the command zap-to-char
|    which is an interactive compiled Lisp function in `simple'.
| (zap-to-char ARG CHAR)
| 
| Kill up to and 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.
`----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Zap-up-to-char in Emacs
  2002-12-05 22:56 Zap-up-to-char in Emacs Jiri Pejchal
  2002-12-05 23:10 ` Jesper Harder
@ 2002-12-05 23:17 ` Benjamin Lewis
  2002-12-06  6:34   ` Fredrik Staxeng
  2002-12-06 14:50 ` Kai Großjohann
  2 siblings, 1 reply; 5+ messages in thread
From: Benjamin Lewis @ 2002-12-05 23:17 UTC (permalink / raw)


On Thu, 5 Dec 2002, Jiri Pejchal wrote:

> Hi,
> 
> function zap-to-char
> 
> `M-z CHAR'
> Kills through the next occurrence of CHAR (`zap-to-char'). 
> 
> is there a function in Emacs similar to zap-up-to-char in XEmacs that 
> would kill up to and not including the next occurencce of CHAR?

Interactively, why not just do M-z CHAR CHAR ?

If you're writing a function, you could do
(zap-to-char CHAR)
(insert-char CHAR 1)

-- 
Benjamin Lewis

Seeing is deceiving.  It's eating that's believing.
                -- James Thurber

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Zap-up-to-char in Emacs
  2002-12-05 23:17 ` Benjamin Lewis
@ 2002-12-06  6:34   ` Fredrik Staxeng
  0 siblings, 0 replies; 5+ messages in thread
From: Fredrik Staxeng @ 2002-12-06  6:34 UTC (permalink / raw)


Benjamin Lewis <bclewis@cs.sfu.ca> writes:

>On Thu, 5 Dec 2002, Jiri Pejchal wrote:
>
>> Hi,
>> 
>> function zap-to-char
>> 
>> `M-z CHAR'
>> Kills through the next occurrence of CHAR (`zap-to-char'). 
>> 
>> is there a function in Emacs similar to zap-up-to-char in XEmacs that 
>> would kill up to and not including the next occurencce of CHAR?

From my .emacs:

(defun zap-upto-char (arg char)
  "Kill up to and including ARG'th occurrence of CHAR.
Goes backward if ARG is negative; error if CHAR not found."
  (interactive "*p\ncZap to char: ")
  (kill-region (point) (progn
			 (search-forward (char-to-string char) nil nil arg)
			 (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
			 (point))))
(define-key global-map "\M-z" 'zap-upto-char)

But I find I don't use it that much. There is no . command, so I 
use search and replace much more instead.

-- 
Fredrik Stax\"ang | rot13: sfgk@hcqngr.hh.fr

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Zap-up-to-char in Emacs
  2002-12-05 22:56 Zap-up-to-char in Emacs Jiri Pejchal
  2002-12-05 23:10 ` Jesper Harder
  2002-12-05 23:17 ` Benjamin Lewis
@ 2002-12-06 14:50 ` Kai Großjohann
  2 siblings, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2002-12-06 14:50 UTC (permalink / raw)


Jiri Pejchal <xpejchal@nymfe33.fi.muni.cz> writes:

> is there a function in Emacs similar to zap-up-to-char in XEmacs that 
> would kill up to and not including the next occurencce of CHAR?

Maybe M-z CHAR CHAR is easiest, but C-s CHAR C-b C-w is also possible.

-- 
~/.signature is: umop ap!sdn    (Frank Nobis)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-12-06 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-05 22:56 Zap-up-to-char in Emacs Jiri Pejchal
2002-12-05 23:10 ` Jesper Harder
2002-12-05 23:17 ` Benjamin Lewis
2002-12-06  6:34   ` Fredrik Staxeng
2002-12-06 14:50 ` Kai Großjohann

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.