[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
30 Apr 2002 17:18:32 +0100
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.95
I think there are some fairly complicated approaches to
auto-capitalization around, but you can do it simply with abbrevs.
I'm sure this technique isn't new, but I don't recall seeing a recipe.
Here's one people might find useful. No need to doff your caps.
I use the following functions, along with these sorts of abbrev
(define-abbrev text-mode-abbrev-table "emacs" "Emacs")
(define-abbrev text-mode-abbrev-table "i" "I" #'abbrev-not-at-stop)
(define-abbrev text-mode-abbrev-table "i'm" "I'm") ; ... egocentric
(defun maybe-capitalize-bos ()
"If point is at the end of the first word in a sentence, capitalize it."
(if (= (point)
;; Capitalize words at beginning of sentence.
(add-hook 'text-mode-hook (lambda ()
(defun abbrev-not-at-stop () ; avoid `i.e.' -> `I.e.'
"Unexpand abbrev if it was just expanded by a full stop.
Intended as an abbrev hook function."
(if (eq ?. last-command-char)
|[Prev in Thread]
||[Next in Thread]|
- auto-capitalization snippets,
Dave Love <=