unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* teach emacs to capitalize at the beginning of a sentence?
@ 2010-08-16 19:42 Matt Price
  2010-08-17  7:40 ` Tassilo Horn
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Price @ 2010-08-16 19:42 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

Hi Folks,

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!

matt

[-- Attachment #2: Type: text/html, Size: 478 bytes --]

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

* Re: teach emacs to capitalize at the beginning of a sentence?
  2010-08-16 19:42 teach emacs to capitalize at the beginning of a sentence? Matt Price
@ 2010-08-17  7:40 ` Tassilo Horn
  0 siblings, 0 replies; 2+ messages in thread
From: Tassilo Horn @ 2010-08-17  7:40 UTC (permalink / raw)
  To: help-gnu-emacs

Matt Price <moptop99@gmail.com> 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




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

end of thread, other threads:[~2010-08-17  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 19:42 teach emacs to capitalize at the beginning of a sentence? Matt Price
2010-08-17  7:40 ` Tassilo Horn

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).