all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "B. T. Raven" <nihil@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Help with upcasing words first char
Date: Sun, 23 Aug 2009 13:14:51 -0500	[thread overview]
Message-ID: <3-OdndnFQsSKGgzXnZ2dnUVZ_radnZ2d@sysmatrix.net> (raw)
In-Reply-To: <mailman.5160.1250966493.2239.help-gnu-emacs@gnu.org>

Harry Putnam wrote:
> Harry Putnam <reader@newsguy.com> writes:
> 
>> I need to do a pile of editing that involves:
>>
>> Removing a space between words and upcasing the first letter of the
>> next word like:
>>
>>  Some example
>>   to
>>  SomeExample
>>
>> I went thru M-x apropos <RET> <case> <RET>
>>
>> But didn't find a likely candidate ... or at least none appeared to be
>> the right thing for what I want.
>>
>> So far I've been
>>
>>  Ctrl <right arrow>  To get to the space between words
>>  Ctrl-d Ctrl-d  To remove the space and the leading lowercase char of 
>>                 the next word
>>
>>  Shift <Char>   to replace with uppercase
>>
>> Then back to Ctrl <right arrow>
>>
>> Where can I save some keyboard strokes?  
> 
> Just to add a bit here... 
> 
> I realize that upcase-region can do the above but its actually more
> cumbersome that what I described above and appears to need more
> keystrokes too
> 
>     create region/call upcase region
> 
> Maybe its the same number of strokes but more inconvenient in that it
> breaks the movements up in a different way than 
> 
> My current method:
>    ctrl-<right arrow> | Ctrl-d | ctrl-d | shift <type char> 
> 
> Using upcase-region
>    ctrl-<right arrow | ctrl-d | ctrl-spc | right arrow | upcase-region 
> 
> It even looks more awkward in writting.
> 
> But really, either of those above seems too time consuming when I have
> hundreds of edits to make in that manner.
> 
> Incidentally ... it appears `Ctrl-<arrow key>' keystrokes to move
> to next space between words, is only available on windows UI.  At
> least I don't see it on my linux OS.
> 
> 
> Any suggestions about how to automate or reduce time on these edits?
> 
> 
> Once more... the edit:
> 
>   Some words similar to this
> 
> I need to remove the space and upcase the next Char.
> 
>   SomeWordsSimilarToThis
> 
> 
> 


This almost works:

(defun cap-n-crunch-region (beg end)
(interactive "r")
(capitalize-region beg end)
(goto-char beg)
(while (search-forward " " end t)
     (replace-match "" nil t))
)

It produced (only when quoted in the buffer!):

"OneTwoThreeFour"

Someone who knows elisp could fix it and then the interactive function 
could be assigned to key combo or alias:

(global-set-key [(super c)] 'cap-n-crunch-region)

(defalias 'ccr 'cap-n-crunch-region)

Ed




  parent reply	other threads:[~2009-08-23 18:14 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
     [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 [this message]
     [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3-OdndnFQsSKGgzXnZ2dnUVZ_radnZ2d@sysmatrix.net \
    --to=nihil@nihilo.net \
    --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.
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.