emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* new rule to capitalise the first word in a sentence? but how?
@ 2016-04-27 19:36 Sharon Kimble
  2016-04-27 20:26 ` Marcin Borkowski
  2016-04-27 21:15 ` Samuel Wales
  0 siblings, 2 replies; 6+ messages in thread
From: Sharon Kimble @ 2016-04-27 19:36 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

How can I have a rule that will capitalise the first word of a new
sentence, with the previous sentence concluding with a full stop and
then one space please? This would be extremely useful for me as I tend
to forget to capitalise the first word, but how can it be done please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.93

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: new rule to capitalise the first word in a sentence? but how?
  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
  1 sibling, 2 replies; 6+ messages in thread
From: Marcin Borkowski @ 2016-04-27 20:26 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: org-mode-email


On 2016-04-27, at 19:36, Sharon Kimble <boudiccas@skimble.plus.com> wrote:

> How can I have a rule that will capitalise the first word of a new
> sentence, with the previous sentence concluding with a full stop and
> then one space please? This would be extremely useful for me as I tend
> to forget to capitalise the first word, but how can it be done please?

Would this help?

https://www.emacswiki.org/emacs/auto-capitalize.el

> Thanks
> Sharon.

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: new rule to capitalise the first word in a sentence? but how?
  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-27 21:15 ` Samuel Wales
  2016-04-28 11:00   ` Sharon Kimble
  1 sibling, 1 reply; 6+ messages in thread
From: Samuel Wales @ 2016-04-27 21:15 UTC (permalink / raw)
  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))))

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: new rule to capitalise the first word in a sentence? but how?
  2016-04-27 20:26 ` Marcin Borkowski
@ 2016-04-28 10:58   ` Sharon Kimble
  2016-04-28 13:11   ` Uwe Brauer
  1 sibling, 0 replies; 6+ messages in thread
From: Sharon Kimble @ 2016-04-28 10:58 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2016-04-27, at 19:36, Sharon Kimble <boudiccas@skimble.plus.com> wrote:
>
>> How can I have a rule that will capitalise the first word of a new
>> sentence, with the previous sentence concluding with a full stop and
>> then one space please? This would be extremely useful for me as I tend
>> to forget to capitalise the first word, but how can it be done please?
>
> Would this help?
>
> https://www.emacswiki.org/emacs/auto-capitalize.el
>

Thanks Marcin, this *did* work, on first start of emacs it worked
everywhere, but on a subsequent start of emacs it started complaining
about the 'emacs.desktop' files and played merry hell with them! So I
then set it up to just work in org-mode, and again it did work on first
start. But when I tried a second start it started playing hell with my
emacs.desktop files again. So I've disabled it from working until I can
find a work-around.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.93

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: new rule to capitalise the first word in a sentence? but how?
  2016-04-27 21:15 ` Samuel Wales
@ 2016-04-28 11:00   ` Sharon Kimble
  0 siblings, 0 replies; 6+ messages in thread
From: Sharon Kimble @ 2016-04-28 11:00 UTC (permalink / raw)
  To: Samuel Wales; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1662 bytes --]

Samuel Wales <samologist@gmail.com> 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.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
Debian 8.4, fluxbox 1.3.7, emacs 25.0.93

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: new rule to capitalise the first word in a sentence? but how?
  2016-04-27 20:26 ` Marcin Borkowski
  2016-04-28 10:58   ` Sharon Kimble
@ 2016-04-28 13:11   ` Uwe Brauer
  1 sibling, 0 replies; 6+ messages in thread
From: Uwe Brauer @ 2016-04-28 13:11 UTC (permalink / raw)
  To: emacs-orgmode

>>> "Marcin" == Marcin Borkowski <mbork@mbork.pl> writes:

   > On 2016-04-27, at 19:36, Sharon Kimble <boudiccas@skimble.plus.com> wrote:

   >> How can I have a rule that will capitalise the first word of a new
   >> sentence, with the previous sentence concluding with a full stop and
   >> then one space please? This would be extremely useful for me as I tend
   >> to forget to capitalise the first word, but how can it be done please?

   > Would this help?

   > https://www.emacswiki.org/emacs/auto-capitalize.el

This is even in MELPA!

Uwe Brauer 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-28 13:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-04-28 11:00   ` Sharon Kimble

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