emacs-devel
[Top][All Lists]
Advanced

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

Re: Proper English Title Capitalization


From: Emanuel Berg
Subject: Re: Proper English Title Capitalization
Date: Sun, 24 May 2015 23:00:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Karl Voit <address@hidden> writes:

> I was looking for a method to capitalize
> headings/titles according to [1]. I found
> ~s-titleise-s~ which simply capitalizes every word.
> However, I was looking for a method which turns
> stopwords into lower case and non-stopwords into
> capitalized words.
>
> Is there something out there?
>
> No, I don't know enough Elisp to code it by myself
> and I have no idea if there is a set of English
> stopwords stored in Emacs.

Good idea, I can never memorize those goofy rules.
It could be a cool thing to have for example
in BibLaTeX.

You don't have to know a lot of Elisp to do that.
Here is a start. Only you'll have to insert the
"stopwords" yourself.

(setq do-not-capitalize '("ah" "oh" "eh"))

(defun make-a-title (beg end)
  (interactive "r")
  (save-excursion
    (goto-char beg)
    (forward-word)
    (backward-word)
    (while (< (point) end)
      (if (member (thing-at-point 'word t) do-not-capitalize)
          (forward-word)
        (capitalize-word 1) )
      (forward-word)
      (backward-word) )))

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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