emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Sharon Kimble <boudiccas@skimble.plus.com>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: new rule to capitalise the first word in a sentence? but how?
Date: Wed, 27 Apr 2016 14:15:37 -0700	[thread overview]
Message-ID: <CAJcAo8ttHKUjeD5ZQkLwHboGdDVfjuk-3=RGdBONAtCcz8phKQ@mail.gmail.com> (raw)
In-Reply-To: <871t5qq1xt.fsf@skimble.plus.com>

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

  parent reply	other threads:[~2016-04-27 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-27 19:36 new rule to capitalise the first word in a sentence? but how? Sharon Kimble
2016-04-27 20:26 ` Marcin Borkowski
2016-04-28 10:58   ` Sharon Kimble
2016-04-28 13:11   ` Uwe Brauer
2016-04-27 21:15 ` Samuel Wales [this message]
2016-04-28 11:00   ` Sharon Kimble

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.orgmode.org/

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

  git send-email \
    --in-reply-to='CAJcAo8ttHKUjeD5ZQkLwHboGdDVfjuk-3=RGdBONAtCcz8phKQ@mail.gmail.com' \
    --to=samologist@gmail.com \
    --cc=boudiccas@skimble.plus.com \
    --cc=emacs-orgmode@gnu.org \
    /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/org-mode.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).