From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sharon Kimble Subject: Re: new rule to capitalise the first word in a sentence? but how? Date: Thu, 28 Apr 2016 12:00:51 +0100 Message-ID: <87lh3y576k.fsf@skimble.plus.com> References: <871t5qq1xt.fsf@skimble.plus.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avjgq-0005hQ-5l for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 07:01:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avjgk-0004xv-Ju for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 07:01:00 -0400 Received: from avasout01.plus.net ([84.93.230.227]:44228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avjgk-0004xl-Ds for emacs-orgmode@gnu.org; Thu, 28 Apr 2016 07:00:54 -0400 In-Reply-To: (Samuel Wales's message of "Wed, 27 Apr 2016 14:15:37 -0700") 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: Samuel Wales Cc: org-mode-email --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Samuel Wales writes: > 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)))) Thanks for this Samuel, it does work, but I'm trying to find a way of auto-capitalising my sentences as I write, whereas this only does it when its called 'after' the event. But thanks anyway. Thanks Sharon. =2D-=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk Debian 8.4, fluxbox 1.3.7, emacs 25.0.93 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXIe1jAAoJEDaBgBkK+INb4gYQAIYCkdzDJvOIke++rnC+U1fE QzAKPmJ0LmgFkPUMq/YxbUgvnuOcBVmCxUUpoq68HeA1FxFwrUstfy70pmhmX8xw qfTabhChPkREQ/TMnB+JBceoC7MXV79Py9IPsgfOAzOKLmtop1/tjCyk06NS6PS7 Eh1zPlHGSM+yyUyTWCfE3HdOoxQPf+tj0A4Y7cZBzdYWglgAWEOcFF/8Sks8lfWT cgaNFrtjoBDAgCZUGK74X6+2HMN8WjDydeWq4MJnUMe0gcEqLd+AY1cphweZLjTs ggFO5P1SgNJ3aLDu/RhpfDwRh+UxEnDueUqjEVX/T0MwL7BuQVXqSTzfT7uCB/K+ LpBDkeW/sZlrTHPAC+NpjZHgCP0/x2g5dyxlxrFxxgdq3I1TxF8Q86OwF+HBHIFU Jcf7HZqte8OvmFPZJYLhvREk/94u2kxBuv9ofn2LLP1p4ANvdeOJ9F34OWK/OylM 2pu3RY++bW5QpDjpnbM9W1upB65jf2f0whpyjrBj4oSPteaJXEauwNxLuIaZ41eO NXwqX7TrfV8M3Jg3HVzOtrHKG+jXQ/2vnWQ/OAyd1KvmtFTEs5JI4gw+n8iIC3C6 pZObjmSY7OS8/WbqjRp0bMHG+fDH7dDSqLXA/3mIYiqUYb/4fmnZ3Pkd/tMphoLB /paAa5b2Rv7z6BHdvQln =w3Pr -----END PGP SIGNATURE----- --=-=-=--