all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to convert the case for a single letter
@ 2008-11-20 10:58 Anand S. Dhankshirur
  2008-11-20 11:10 ` Peter Dyballa
  2008-11-22 19:32 ` Rancier, Jeffrey
  0 siblings, 2 replies; 10+ messages in thread
From: Anand S. Dhankshirur @ 2008-11-20 10:58 UTC (permalink / raw)
  To: GnuEmacs Help

Hi,
How do i convert the case of the letter (in the word) from lower to 
upper or vice versa.
I know M-L and M-U do that for the word.
Rgds
Anand




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
  2008-11-20 10:58 Anand S. Dhankshirur
@ 2008-11-20 11:10 ` Peter Dyballa
  2008-11-20 11:29   ` Anand S. Dhankshirur
  2008-11-22 19:32 ` Rancier, Jeffrey
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Dyballa @ 2008-11-20 11:10 UTC (permalink / raw)
  To: asd; +Cc: GnuEmacs Help


Am 20.11.2008 um 11:58 schrieb Anand S. Dhankshirur:

> How do i convert the case of the letter (in the word) from lower to  
> upper or vice versa.

Upcase-region, downcase-region. Or create something own.

--
Greetings

   Pete

The human animal differs from the lesser primates in his passion for  
lists of "Ten Best."
				– H. Allen Smith







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
  2008-11-20 11:10 ` Peter Dyballa
@ 2008-11-20 11:29   ` Anand S. Dhankshirur
  0 siblings, 0 replies; 10+ messages in thread
From: Anand S. Dhankshirur @ 2008-11-20 11:29 UTC (permalink / raw)
  To: Peter Dyballa, help-gnu-emacs

That almost does the job.
Peter Dyballa wrote:
>
> Am 20.11.2008 um 11:58 schrieb Anand S. Dhankshirur:
>
>> How do i convert the case of the letter (in the word) from lower to 
>> upper or vice versa.
>
> Upcase-region, downcase-region. Or create something own.
>
> -- 
> Greetings
>
>   Pete
>
> The human animal differs from the lesser primates in his passion for 
> lists of "Ten Best."
>                 – H. Allen Smith
>
>
>





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
       [not found] <mailman.824.1227178431.26697.help-gnu-emacs@gnu.org>
@ 2008-11-20 11:48 ` Xah
  2008-11-20 23:50 ` Joe Casadonte
  2008-11-21 11:12 ` Niels Giesen
  2 siblings, 0 replies; 10+ messages in thread
From: Xah @ 2008-11-20 11:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 20, 2:58 am, "Anand S. Dhankshirur" <a...@cdotb.ernet.in>
wrote:
> Hi,
> How do i convert the case of the letter (in the word) from lower to
> upper or vice versa.
> I know M-L and M-U do that for the word.

you might be interested in this function:

(defun toggle-letter-case ()
  "Toggle the letter case of current word or text selection.
Toggles from 3 cases: UPPER CASE, lower case, Title Case,
in that cyclic order."
(interactive)
(let (pos1 pos2 (deactivate-mark nil) (case-fold-search nil))
  (if (and transient-mark-mode mark-active)
      (setq pos1 (region-beginning)
            pos2 (region-end))
    (setq pos1 (car (bounds-of-thing-at-point 'word))
          pos2 (cdr (bounds-of-thing-at-point 'word))))

  (when (not (eq last-command this-command))
    (save-excursion
      (goto-char pos1)
      (cond
       ((looking-at "[[:lower:]][[:lower:]]") (put this-command 'state
"all lower"))
       ((looking-at "[[:upper:]][[:upper:]]") (put this-command 'state
"all caps") )
       ((looking-at "[[:upper:]][[:lower:]]") (put this-command 'state
"init caps") )
       (t (put this-command 'state "all lower") )
       )
      )
    )

  (cond
   ((string= "all lower" (get this-command 'state))
    (upcase-initials-region pos1 pos2) (put this-command 'state "init
caps"))
   ((string= "init caps" (get this-command 'state))
    (upcase-region pos1 pos2) (put this-command 'state "all caps"))
   ((string= "all caps" (get this-command 'state))
    (downcase-region pos1 pos2) (put this-command 'state "all lower"))
   )
)
)

You can assign it a keyboard shortcut so you can reduce the need for
Alt+u, Alt+l, Alt+c, Ctrl+x Ctrl+u, Ctrl+x Ctrl+l to just one.

For detail, see:

• Usability Problems With Emacs's Letter-Case Commands
http://xahlee.org/emacs/modernization_upcase-word.html

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
       [not found] <mailman.824.1227178431.26697.help-gnu-emacs@gnu.org>
  2008-11-20 11:48 ` How to convert the case for a single letter Xah
@ 2008-11-20 23:50 ` Joe Casadonte
  2008-11-21 11:12 ` Niels Giesen
  2 siblings, 0 replies; 10+ messages in thread
From: Joe Casadonte @ 2008-11-20 23:50 UTC (permalink / raw)
  To: help-gnu-emacs

On 20 Nov 2008, Anand S. Dhankshirur wrote:

> How do i convert the case of the letter (in the word) from lower to
> upper or vice versa.
> I know M-L and M-U do that for the word.

I wrote toggle-case.el to do that.  You can find it here:

    http://www.northbound-train.com/emacs.html

Let me know if you have problems.

--
Regards,


joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
    Ramblings of a Gay Man => http://www.northbound-train.com/ramblings
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
       [not found] <mailman.824.1227178431.26697.help-gnu-emacs@gnu.org>
  2008-11-20 11:48 ` How to convert the case for a single letter Xah
  2008-11-20 23:50 ` Joe Casadonte
@ 2008-11-21 11:12 ` Niels Giesen
  2008-11-21 12:53   ` Peter Dyballa
       [not found]   ` <mailman.932.1227272034.26697.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 10+ messages in thread
From: Niels Giesen @ 2008-11-21 11:12 UTC (permalink / raw)
  To: help-gnu-emacs

"Anand S. Dhankshirur" <asd@cdotb.ernet.in> writes:

> Hi,
> How do i convert the case of the letter (in the word) from lower to
> upper or vice versa.
> I know M-L and M-U do that for the word.
> Rgds
> Anand

capitalize-word (M-c)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
  2008-11-21 11:12 ` Niels Giesen
@ 2008-11-21 12:53   ` Peter Dyballa
       [not found]   ` <mailman.932.1227272034.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2008-11-21 12:53 UTC (permalink / raw)
  To: Niels Giesen; +Cc: help-gnu-emacs


Am 21.11.2008 um 12:12 schrieb Niels Giesen:

> "Anand S. Dhankshirur" writes:
>
>> Hi,
>> How do i convert the case of the letter (in the word) from lower to
>> upper or vice versa.
>> I know M-L and M-U do that for the word.
>> Rgds
>> Anand
>
> capitalize-word (M-c)



Right! This and downcase-word (M-l) work also for the rest of the  
word – and Both Will Fail On A Word That Has A Few Upper-Case Letters  
In It.

--
Mit friedvollen Grüßen

   Pete

The best way to accelerate a PC is 9.8 m/s2





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
       [not found]   ` <mailman.932.1227272034.26697.help-gnu-emacs@gnu.org>
@ 2008-11-21 14:29     ` Niels Giesen
  2008-11-21 15:08       ` Peter Dyballa
  0 siblings, 1 reply; 10+ messages in thread
From: Niels Giesen @ 2008-11-21 14:29 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 21.11.2008 um 12:12 schrieb Niels Giesen:
>
>> "Anand S. Dhankshirur" writes:
>>
>>> Hi,
>>> How do i convert the case of the letter (in the word) from lower to
>>> upper or vice versa.
>>> I know M-L and M-U do that for the word.
>>> Rgds
>>> Anand
>>
>> capitalize-word (M-c)
>
>
>
> Right! This and downcase-word (M-l) work also for the rest of the word
> – and Both Will Fail On A Word That Has A Few Upper-Case Letters  In
> It.

Right, that is annoying. How about something like

(defun upcase-char (arg)
  (interactive "P")
  (upcase-region
   (point)
   (+ (point) arg)))




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to convert the case for a single letter
  2008-11-21 14:29     ` Niels Giesen
@ 2008-11-21 15:08       ` Peter Dyballa
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2008-11-21 15:08 UTC (permalink / raw)
  To: Niels Giesen; +Cc: help-gnu-emacs


Am 21.11.2008 um 15:29 schrieb Niels Giesen:

>> Right! This and downcase-word (M-l) work also for the rest of the  
>> word
>> – and Both Will Fail On A Word That Has A Few Upper-Case Letters  In
>> It.
>
> Right, that is annoying. How about something like
>
> (defun upcase-char (arg)
>   (interactive "P")
>   (upcase-region
>    (point)
>    (+ (point) arg)))


Yes, something simple like this, or a keyboard macro of his own, was  
part of my recommendation to Anand. (For me it happens so rarely that  
I can do this manually, once needed. With a keyboard of six or seven  
modifiers an unused key binding could be determined, s-~, for example)

--
Mit friedvollen Grüßen

   Pete

Heißt 'Wegwerfgesellschaft', dass mensch diese Gesellschaft weg  
werfen *kann* oder *muss*?






^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: How to convert the case for a single letter
  2008-11-20 10:58 Anand S. Dhankshirur
  2008-11-20 11:10 ` Peter Dyballa
@ 2008-11-22 19:32 ` Rancier, Jeffrey
  1 sibling, 0 replies; 10+ messages in thread
From: Rancier, Jeffrey @ 2008-11-22 19:32 UTC (permalink / raw)
  To: asd, GnuEmacs Help

You could mark the letter/region and us upcase-region 

>-----Original Message-----
>From: help-gnu-emacs-bounces+jeffrey.rancier=xerox.com@gnu.org 
>[mailto:help-gnu-emacs-bounces+jeffrey.rancier=xerox.com@gnu.or
>g] On Behalf Of Anand S. Dhankshirur
>Sent: Thursday, November 20, 2008 5:59 AM
>To: GnuEmacs Help
>Subject: How to convert the case for a single letter
>
>Hi,
>How do i convert the case of the letter (in the word) from 
>lower to upper or vice versa.
>I know M-L and M-U do that for the word.
>Rgds
>Anand
>
>
>




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-11-22 19:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.824.1227178431.26697.help-gnu-emacs@gnu.org>
2008-11-20 11:48 ` How to convert the case for a single letter Xah
2008-11-20 23:50 ` Joe Casadonte
2008-11-21 11:12 ` Niels Giesen
2008-11-21 12:53   ` Peter Dyballa
     [not found]   ` <mailman.932.1227272034.26697.help-gnu-emacs@gnu.org>
2008-11-21 14:29     ` Niels Giesen
2008-11-21 15:08       ` Peter Dyballa
2008-11-20 10:58 Anand S. Dhankshirur
2008-11-20 11:10 ` Peter Dyballa
2008-11-20 11:29   ` Anand S. Dhankshirur
2008-11-22 19:32 ` Rancier, Jeffrey

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.