help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: teach emacs to capitalize at the beginning of a sentence?


From: Tassilo Horn
Subject: Re: teach emacs to capitalize at the beginning of a sentence?
Date: Tue, 17 Aug 2010 09:40:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Matt Price <address@hidden> writes:

Hi Matt,

> I'm using abbrev-mode and loving it but wondered whether it was
> possible to teach emacs to capitalize words atthe beginning of a
> sentence?  This would be a big help as it's a major source of errors
> in my typing.  If anyone has any ideas, either of an existing package
> that does this, or how to write a simple function that checks for ".
> [a-z] and changes it to ".  [A-Z]" I'd appreciate it.  thanks very
> much!

Ok, here we go.

--8<---------------cut here---------------start------------->8---
(defun th-captialize-sentences-first-word ()
  (interactive)
  (save-excursion
    (beginning-of-thing 'sentence)
    (capitalize-word 1)))
--8<---------------cut here---------------end--------------->8---

Simply bind it to some convenient key like `M-C'.  When pressed, the
first word of the current sentence will be capitalized.  You might need
to add a (require 'thingatpt) before that function in case that's not
already loaded.

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]