|
| From: | Harry Putnam |
| Subject: | Re: Help with upcasing words first char |
| Date: | Tue, 25 Aug 2009 14:35:35 -0500 |
| User-agent: | Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.96 (gnu/linux) |
If I might try your patience even further.. I wondered if you might
take time to explain what controls where the cursor ends up... in the
code you proposed earlier. (A slightly changed version is included at
the end)
What I see looks like this (Upcase X is where cursor ends up):
some more xrays
SomeMoreXrays
-
Is it this bit where that happens?
(delete-region (match-beginning 0) (match-end 0))))
(set-marker end nil))))
Can something be altered in there to make the cursor land at the end
of the line?
SomeMoreXrays[here]
Or is it done where `m' is assigned the value it holds?
It appears to my untrained eye that `m' is told to hold the position of
the end of the effected text... which would be the last place a space
or tab was removed... (I guess.)
Anyway... how would I go about making this useful function place the
cursor where I want it (at the end of the effected text (including
what ever string of text is past the last affected area [spc/\t] where
action is taken?
===== * ===== * ===== * =====
(defun camelize-region (start end)
(interactive "r")
(capitalize-region start end)
(let ((end (let ((m (make-marker))) (set-marker m end) m)))
(unwind-protect
(progn
(goto-char start)
(while (re-search-forward "[ \t]+" end t)
(delete-region (match-beginning 0) (match-end 0))))
(set-marker end nil))))
| [Prev in Thread] | Current Thread | [Next in Thread] |