* fill paragraph: break after sentence.
@ 2016-09-06 8:23 Uwe Brauer
2016-09-06 10:38 ` Aaron Ecay
2016-09-09 11:27 ` Andreas Röhler
0 siblings, 2 replies; 6+ messages in thread
From: Uwe Brauer @ 2016-09-06 8:23 UTC (permalink / raw)
To: emacs-orgmode
Hello
I would like to modify the auto-fill function such that after every
sentence a new line starts like this
In order to prove our nonlinear instability result, we want to use the
linear growing mode in Proposition to construct small initial data for
the nonlinear problem.
Since we are involved in the higher-order regularity context, we
cannot simply set the initial data for the nonlinear problem to be a
small constant times the linear growing modes.
I know about functions doing that for auctex, but does anybody know
about a similar functionality for orgmode?
Uwe Brauer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fill paragraph: break after sentence.
2016-09-06 8:23 fill paragraph: break after sentence Uwe Brauer
@ 2016-09-06 10:38 ` Aaron Ecay
2016-09-06 12:06 ` Uwe Brauer
2016-09-09 11:27 ` Andreas Röhler
1 sibling, 1 reply; 6+ messages in thread
From: Aaron Ecay @ 2016-09-06 10:38 UTC (permalink / raw)
To: Uwe Brauer, emacs-orgmode
Hi Uwe,
The following code is what I use. It uses filladapt mode, but doesn’t
work with auto-fill (I manually refill paragraphs with M-q as I’m
writing). I wrote the code a long time ago, it works for me, YMMV,
etc. Hope it is helpful.
#+BEGIN_SRC emacs-lisp
(defun awe-org-fill-paragraph-function (&rest ignore)
(let ((bounds (cons (save-excursion (backward-paragraph) (point))
(save-excursion (forward-paragraph) (point))))
beg end end-marker)
(save-excursion
(goto-char (cdr bounds))
(skip-chars-backward "\n")
(setq end-marker (point-marker))
(setq end (make-marker))
(goto-char (car bounds))
(skip-chars-forward "\n")
(catch 'exit
(while t
(setq beg (point))
(forward-sentence)
(move-marker end (point))
(save-excursion
(goto-char beg)
(when (and fill-prefix
(not (looking-at-p (regexp-quote fill-prefix))))
(insert fill-prefix))
(while (re-search-forward "\n *" end t)
(replace-match " ")))
(setq beg (point))
(skip-chars-forward " \n")
(move-marker end (point))
(when (>= (point) end-marker)
(throw 'exit t))
(when (/= beg end)
(delete-region beg end))
(insert "\n"))))
(set-marker end-marker nil)
(set-marker end nil)))
(defun awe-org-setup-fill-hook ()
(setq-local sentence-end-base
(rx (any ".?!")
(? "[fn:" (+ (any "0-9" "a-f")) "]")
(* (any "]\"'”)}"))))
(when (featurep 'filladapt)
(setq-local fill-paragraph-function #'awe-org-fill-paragraph-function)
(make-local-variable 'filladapt-token-table)
(make-local-variable 'filladapt-token-match-table)
(make-local-variable 'filladapt-token-conversion-table)
(cl-pushnew `(,(rx "#+" (or "caption" "CAPTION") ": ") org-caption)
filladapt-token-table :test #'equal)
(cl-pushnew '(org-caption org-caption)
filladapt-token-match-table :test #'equal)
(cl-pushnew '(org-caption . exact)
filladapt-token-conversion-table :test #'equal))
(visual-line-mode 1)
(auto-fill-mode 0))
(add-hook 'org-mode-hook #'awe-org-setup-fill-hook)
#+END_SRC
--
Aaron Ecay
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fill paragraph: break after sentence.
2016-09-06 10:38 ` Aaron Ecay
@ 2016-09-06 12:06 ` Uwe Brauer
2016-09-06 15:52 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2016-09-06 12:06 UTC (permalink / raw)
To: emacs-orgmode
>>> "Aaron" == Aaron Ecay <aaronecay@gmail.com> writes:
Hi Aaron
> Hi Uwe,
> The following code is what I use. It uses filladapt mode, but doesn’t
> work with auto-fill (I manually refill paragraphs with M-q as I’m
> writing). I wrote the code a long time ago, it works for me, YMMV,
> etc. Hope it is helpful.
Thanks a lot. This was precisely what I was looking for.
IMHO should be included somehow in vanilla org, or at least added to
some addon-pkg.
Uwe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fill paragraph: break after sentence.
2016-09-06 12:06 ` Uwe Brauer
@ 2016-09-06 15:52 ` Nicolas Goaziou
2016-09-06 19:30 ` Uwe Brauer
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-09-06 15:52 UTC (permalink / raw)
To: emacs-orgmode
Hello,
Uwe Brauer <oub@mat.ucm.es> writes:
> IMHO should be included somehow in vanilla org,
It seems only remotely related to Org. If robust enough, I might go to
something like "fill.el" instead.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fill paragraph: break after sentence.
2016-09-06 15:52 ` Nicolas Goaziou
@ 2016-09-06 19:30 ` Uwe Brauer
0 siblings, 0 replies; 6+ messages in thread
From: Uwe Brauer @ 2016-09-06 19:30 UTC (permalink / raw)
To: emacs-orgmode
>>> "Nicolas" == Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
> Uwe Brauer <oub@mat.ucm.es> writes:
>> IMHO should be included somehow in vanilla org,
> It seems only remotely related to Org. If robust enough, I might go to
> something like "fill.el" instead.
There are org related lines such as
(cl-pushnew '(org-caption org-caption)
filladapt-token-match-table :test #'equal)
(cl-pushnew '(org-caption . exact)
But you are right, these are fews. @Aaron I think such a function would
be appreciated in general. I have a particular solution for auctex
provide to me by
Ingo Lohmar
http://pleasefindattached.blogspot.com/2011/12/emacsauctex-sentence-fill-greatly.html
But your code seems much more general. May I suggest to present that
code in GNU emacs devel?
Uwe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: fill paragraph: break after sentence.
2016-09-06 8:23 fill paragraph: break after sentence Uwe Brauer
2016-09-06 10:38 ` Aaron Ecay
@ 2016-09-09 11:27 ` Andreas Röhler
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2016-09-09 11:27 UTC (permalink / raw)
To: emacs-orgmode
On 06.09.2016 10:23, Uwe Brauer wrote:
> Hello
>
> I would like to modify the auto-fill function such that after every
> sentence a new line starts like this
>
> In order to prove our nonlinear instability result, we want to use the
> linear growing mode in Proposition to construct small initial data for
> the nonlinear problem.
> Since we are involved in the higher-order regularity context, we
> cannot simply set the initial data for the nonlinear problem to be a
> small constant times the linear growing modes.
>
> I know about functions doing that for auctex, but does anybody know
> about a similar functionality for orgmode?
>
> Uwe Brauer
>
In use here is ar-forward-sentence-atpt as part of thing-at-point-utils
toolkit
https://github.com/andreas-roehler/werkstatt/tree/master/thing-at-point-utils
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-09-09 11:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06 8:23 fill paragraph: break after sentence Uwe Brauer
2016-09-06 10:38 ` Aaron Ecay
2016-09-06 12:06 ` Uwe Brauer
2016-09-06 15:52 ` Nicolas Goaziou
2016-09-06 19:30 ` Uwe Brauer
2016-09-09 11:27 ` Andreas Röhler
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.