help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Java mixed case deletion


From: Kevin Rodgers
Subject: Re: Java mixed case deletion
Date: Tue, 26 Oct 2004 16:41:07 -0600
User-agent: Mozilla Thunderbird 0.8 (X11/20040916)

Benjamin Rutt wrote:
> (defun my-c-kill-forward-into-nomenclature (&optional arg)
>   "Kill forward to the end of a nomenclature section or word.  With
> arg, do it arg times."
>   (interactive "p")
>   (save-excursion
>     (set-mark (point))
>     (c-forward-into-nomenclature arg)
>     (kill-region (mark) (point))))
>
> (defun my-c-kill-backward-into-nomenclature (&optional arg)
>   "Kill backward to the beginning of a nomenclature section or word.
> th arg, do it arg times."
>   (interactive "p")
>   (save-excursion
>     (set-mark (point))
>     (c-backward-into-nomenclature arg)
>     (kill-region (mark) (point))))

I think you can avoid the (save-excursion (set-mark ...) ...) construction:

(defun my-c-kill-forward-into-nomenclature (&optional n)
  "Kill forward to the end of a nomenclature section or word.
With a prefix arg, kill N names."
  (interactive "p")
  (kill-region (point)
               (progn
                 (c-forward-into-nomenclature n)
                 (point))))

(defun my-c-kill-backward-into-nomenclature (&optional n)
  "Kill backward to the beginning of a nomenclature section or word.
With a prefix arg, kill N names."
  (interactive "p")
  (kill-region (point)
               (progn
                 (c-backward-into-nomenclature n)
                 (point))))

--
Kevin Rodgers


reply via email to

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