[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quick deleting from a comma separated list
From: |
Joakim Hove |
Subject: |
Re: Quick deleting from a comma separated list |
Date: |
Thu, 18 Dec 2003 13:08:33 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
Urban Gabor <gabaux@freemail.hu> writes:
> The cursor point is at the 'a' of the second argument. I
> want to delete the arg2 and the separating comma. What is
> solution if there are spaces after or before the comma?
Try this - *not* extensively tested!! Observe that it starts deleting
from point - ignoring where you stand, see comment in code?
(defun csv-kill ()
(interactive)
;;
;; Should maybe start here with searching backwards for the beginning "," ??
;;
(let ((p0 (point)))
(if (search-forward "," (save-excursion (end-of-line) (point)) 't)
(progn
(while (looking-at "[ \t]")
(forward-char 1))
(kill-region p0 (point)))
(message "No further comma"))))
HTH - Joakim
--
/--------------------------------------------------------------------\
/ Joakim Hove / hove@bccs.no / (55 5) 84076 | \
| Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
| CMU | 5231 Paradis |
\ Thormøhlensgt.55, 5020 Bergen. | 55 91 28 18 /
\--------------------------------------------------------------------/