From: Harry Putnam <reader@newsguy.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Help with upcasing words first char
Date: Mon, 24 Aug 2009 08:59:21 -0500 [thread overview]
Message-ID: <878wh9s47a.fsf@newsguy.com> (raw)
In-Reply-To: 87fxbjwquk.fsf@galatea.local
pjb@informatimago.com (Pascal J. Bourguignon) writes:
> Now you are ready to write an emacs lisp command doing the same:
>
> (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 "\\s-+" end t)
> (delete-region (match-beginning 0) (match-end 0))))
> (set-marker m nil))))
That works nicely but does throw an error when it finishes. My
non-existent lisp skills were not able to determine what is causing
it.
(From *Messages* Buffer)
Mark set
unwind-protect: Symbol's value as variable is void: m
Mark set
Also I tried it on a larger region consisting of several lines and
again it worked but in that case also removed the newlines.
I don't really understand what the regex you used (\s-+) means. I
understand `\s' to mean any single occurrence of any whitespace.
And also understand the `+' operator to mean `at least one plus any
number of matches to preceding regex. But again ... not sure what the
`-' operator does.
But I wondered if that `\s' could be changed to something a little more
exclusive.... like maybe tabs and spaces only.. and if that would
allow the function to work on more than one line?
next prev parent reply other threads:[~2009-08-24 13:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-22 15:46 Help with upcasing words first char Harry Putnam
2009-08-22 18:40 ` Harry Putnam
2009-08-24 13:01 ` Harry Putnam
[not found] ` <mailman.5160.1250966493.2239.help-gnu-emacs@gnu.org>
2009-08-22 19:02 ` A.Politz
2009-08-22 19:32 ` Joost Kremers
2009-08-22 21:29 ` John A Pershing Jr
2009-08-22 20:12 ` Pascal J. Bourguignon
2009-08-24 13:08 ` Harry Putnam
2009-08-24 13:59 ` Harry Putnam [this message]
[not found] ` <mailman.5250.1251122398.2239.help-gnu-emacs@gnu.org>
2009-08-24 15:20 ` Pascal J. Bourguignon
2009-08-24 22:49 ` Harry Putnam
2009-08-24 23:03 ` Harry Putnam
[not found] ` <mailman.5277.1251155045.2239.help-gnu-emacs@gnu.org>
2009-08-24 23:52 ` Pascal J. Bourguignon
2009-08-25 15:34 ` Harry Putnam
2009-08-25 19:35 ` Harry Putnam
[not found] ` <mailman.5347.1251228972.2239.help-gnu-emacs@gnu.org>
2009-08-25 21:02 ` Pascal J. Bourguignon
2009-08-30 1:42 ` Harry Putnam
2009-08-23 18:14 ` B. T. Raven
[not found] <mailman.5143.1250956067.2239.help-gnu-emacs@gnu.org>
2009-08-22 17:42 ` Joost Kremers
2009-08-22 18:15 ` Xah Lee
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878wh9s47a.fsf@newsguy.com \
--to=reader@newsguy.com \
--cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).