unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Karl Voit <devnull@Karl-Voit.at>
To: emacs-devel@gnu.org
Subject: Re: Proper English Title Capitalization
Date: Thu, 11 Jun 2015 22:10:53 +0200	[thread overview]
Message-ID: <2015-06-11T22-09-59@devnull.Karl-Voit.at> (raw)
In-Reply-To: m37frv2vsq.fsf@barry_fishman.acm.org

* Barry Fishman <barry_fishman@acm.org> wrote:
>
>
> If you are looking for more alternative coding:
>
> --8<---------------cut here---------------start------------->8---
> ;; This is probably subject for debate and tuning.
> (defvar own-stop-words '("a" "an" "the" "at" "by" "for" "in"
>                          "of" "on" "to" "up" "and" "as" "but"
>                          "it" "or" "nor" "n" "t" "es" "s")
>   "Words that are not capitalized in titles.")
>
> (defun own-title-region (beg end)
>   "Capitalize region as a title,"
>   (interactive "r")
>   (save-excursion
>     (goto-char beg)
>     (capitalize-word 1)
>     (while (< (point) end)
>       (skip-syntax-forward "^w" end)
>       (let ((word (thing-at-point 'word t)))
>         (if (stringp word)
>             (if (member (downcase word) own-stop-words)
>                 (downcase-word 1)
>               (capitalize-word 1)))))
>     (backward-word 1)
>     (if (and (>= (point) beg)
>              (not (member (or (thing-at-point 'word t) "s")
>                           '("n" "t" "es" "s"))))
>         (capitalize-word 1))))
> --8<---------------cut here---------------end--------------->8---

Thanks for your version. I tested it and it worked great. I added
your input to my solution and to my blog entry.

-- 
All in all, one of the most disturbing things today is the definitive
fact that the NSA, GCHQ, and many more government organizations are
massively terrorizing the freedom of us and the next generations.
                                                  http://Karl-Voit.at




  reply	other threads:[~2015-06-11 20:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 11:10 Proper English Title Capitalization Karl Voit
2015-05-24 21:00 ` Emanuel Berg
2015-05-25 10:13   ` Karl Voit
2015-05-25 10:36     ` Rasmus
2015-05-25 10:47     ` Karl Voit
2015-05-25 12:22       ` Karl Voit
2015-05-25 16:18         ` Rasmus
2015-05-26 15:38       ` Barry Fishman
2015-06-11 20:10         ` Karl Voit [this message]
2015-06-03 15:05       ` Karl Voit
2015-05-25 16:59     ` Emanuel Berg
2015-06-17 13:48 ` Karl Voit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2015-06-11T22-09-59@devnull.Karl-Voit.at \
    --to=devnull@karl-voit.at \
    --cc=emacs-devel@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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