GNU bug report logs - #16190
23.4; M-x captialize-word works incorrectly

Previous Next

Package: emacs;

Reported by: caleb <at> compwizard.net

Date: Thu, 19 Dec 2013 01:53:02 UTC

Severity: minor

Tags: notabug

Found in version 23.4

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 16190 <at> debbugs.gnu.org (full text, mbox):

From: Josh <josh <at> foxtail.org>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 16190 <at> debbugs.gnu.org
Subject: Re: bug#16190: 23.4; M-x captialize-word works incorrectly
Date: Fri, 27 Dec 2013 21:31:25 -0800
On Thu, Dec 26, 2013 at 7:30 PM, Kevin Rodgers
<kevin.d.rodgers <at> gmail.com> wrote:
> On 12/23/13 11:59 AM, Josh wrote:
>>
>> On Mon, Dec 23, 2013 at 8:12 AM, Eli Zaretskii<eliz <at> gnu.org>  wrote:
>>>
>>> If you want a function that capitalizes the word at point after
>>> looking back for its beginning, you need to code that using
>>> thing-at-point or some such.
>>
>>
>> When point is not already at the start of the word, `capitalize-word'
>> can already do this pretty easily via `M-- M-c'.
>
> (defun capitalize-word-at-point ()
>   "Capitalize the word at point (i.e. around point), without moving point."
>   (interactive)
>   (capitalize-word -1))

Unfortunately it's not quite that simple, because calling that function
when point is before the first character of a word will capitalize the
preceding word instead of the word following point.  Something like
  (defun capitalize-word-at-point ()
    "Capitalize the word at point."
    (interactive)
    (save-excursion
      (forward-word)
      (backward-word)
      (capitalize-word 1)))
should suffice, though there are probably more elegant approaches.




This bug report was last modified 11 years and 149 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.