From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: Re: new rule to capitalise the first word in a sentence? but how? Date: Wed, 27 Apr 2016 14:15:37 -0700 Message-ID: References: <871t5qq1xt.fsf@skimble.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avWo6-0000YD-Jx for emacs-orgmode@gnu.org; Wed, 27 Apr 2016 17:15:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avWo5-0007EP-PM for emacs-orgmode@gnu.org; Wed, 27 Apr 2016 17:15:38 -0400 Received: from mail-vk0-x22a.google.com ([2607:f8b0:400c:c05::22a]:32993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avWo5-0007EJ-Ik for emacs-orgmode@gnu.org; Wed, 27 Apr 2016 17:15:37 -0400 Received: by mail-vk0-x22a.google.com with SMTP id a5so9341356vkg.0 for ; Wed, 27 Apr 2016 14:15:37 -0700 (PDT) In-Reply-To: <871t5qq1xt.fsf@skimble.plus.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Sharon Kimble Cc: org-mode-email very old code, maybe can be adjusted slightly to do what you want. (defun alpha-capitalize-sentences () (interactive) (let ((b (region-beginning)) (e (region-end)) ;;i always use double spaces but i want sentence movement ;;to be liberal -- that is to count more things as ;;sentences. (sentence-end-double-space nil) ;;need to make it understand org headlines etc. also. ;;don't know if this will help. will fail on *bold*. ;;non-idempotent. use a vector function. (sentence-end-without-space (concat sentence-end-without-space "*"))) (save-excursion (goto-char b) (loop while (< (point) (max b e)) do (when (y-or-n-p "capitalize this sentence?") (capitalize-word 1)) ;;forward-sentence-incl-org (headlines, items, other) do (let ((sentence-end-without-period t)) (forward-sentence)))) ;;; (replace-regexp "i" "I" t (region-beginning) (region-end)) (save-excursion (perform-replace "i" "I" nil t t nil nil b e))))