From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Voit Newsgroups: gmane.emacs.devel Subject: Re: Proper English Title Capitalization Date: Thu, 11 Jun 2015 22:10:53 +0200 Organization: www.karl-voit.at Message-ID: <2015-06-11T22-09-59@devnull.Karl-Voit.at> References: <2015-05-24T13-06-14@devnull.Karl-Voit.at> <87fv6lelmr.fsf@debian.uxu> <2015-05-25T12-05-49@devnull.Karl-Voit.at> <2015-05-25T12-45-36@devnull.Karl-Voit.at> Reply-To: Karl Voit NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1434053517 20014 80.91.229.3 (11 Jun 2015 20:11:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Jun 2015 20:11:57 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 11 22:11:50 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z38pI-0005n6-SZ for ged-emacs-devel@m.gmane.org; Thu, 11 Jun 2015 22:11:49 +0200 Original-Received: from localhost ([::1]:48502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z38pI-0000xE-7r for ged-emacs-devel@m.gmane.org; Thu, 11 Jun 2015 16:11:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z38p3-0000wy-VS for emacs-devel@gnu.org; Thu, 11 Jun 2015 16:11:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z38p0-00069o-MN for emacs-devel@gnu.org; Thu, 11 Jun 2015 16:11:33 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:46030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z38p0-000699-FF for emacs-devel@gnu.org; Thu, 11 Jun 2015 16:11:30 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z38oy-0005ce-LX for emacs-devel@gnu.org; Thu, 11 Jun 2015 22:11:28 +0200 Original-Received: from friends.grml.info ([136.243.234.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Jun 2015 22:11:28 +0200 Original-Received: from news1142 by friends.grml.info with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Jun 2015 22:11:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: friends.grml.info X-GPG-Key: http://www.Karl-Voit.at/Karl_Voit_GnuPG_public_key.gpg X-Registered-Linux-User: 224337 X-Confession: Pastafarian http://www.venganza.org/ User-Agent: slrn/pre1.0.0-18 (Linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187155 Archived-At: * Barry Fishman 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