emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] fill function: Put a newline at the end of each sentence in para


From: Uwe Brauer
Subject: Re: [O] fill function: Put a newline at the end of each sentence in paragraph.
Date: Tue, 01 Oct 2019 19:02:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> "MB" == Marcin Borkowski <address@hidden> writes:

   > On 2019-10-01, at 08:34, Uwe Brauer <address@hidden> wrote:

   >> Hi 
   >> 
   >> I am looking for a filling function, which puts a newline at the end of
   >> each sentence. I have one for LaTeX mode but it does not work in org
   >> mode.
   >> 
   >> Anybody has a pointer?

   > How about these?

   > http://mbork.pl/2019-01-20_Filling_and_version_control and the two links 
there
aha, your code works, but not the code in the links you posted.

Small disadvantage of your code. If I execute it twice several  (unwanted)
newlines are  inserted after each sentence! But anyhow it works, if I
keep this in mind, it is almost perfect.

   > 
https://emacs.stackexchange.com/questions/443/editing-files-with-one-sentence-per-line

The second one does not help.

The coded posted there 

(defun ospl/fill-paragraph ()

Does not work in org mode.

I obtain 

Debugger entered--Lisp error: (wrong-number-of-arguments
  #f(compiled-function (ad--addoit-function arg) #<bytecode 0xfa2a39>)
  1) ad-Advice-fill-paragraph(#f(compiled-function (arg) (interactive
  "*P") #<bytecode 0xb1b619>)) apply(ad-Advice-fill-paragraph
  #f(compiled-function (arg) (interactive "*P") #<bytecode 0xb1b619>)
  nil) fill-paragraph() (save-excursion (fill-paragraph)
  (ospl/unfill-paragraph) (let ((end-of-paragraph (make-marker)))
  (save-excursion (forward-paragraph) (backward-sentence)
  (forward-sentence) (set-marker end-of-paragraph (point)))
  (forward-sentence) (while (< (point) end-of-paragraph)
  (just-one-space) (delete-backward-char 1) (newline)
  (forward-sentence)) (set-marker end-of-paragraph nil)))
  ospl/fill-paragraph() funcall-interactively(ospl/fill-paragraph)
  call-interactively(ospl/fill-paragraph record nil)
  command-execute(ospl/fill-paragraph record)
  execute-extended-command(nil "ospl/fill-paragraph" "ospl/f")
  funcall-interactively(execute-extended-command nil
  "ospl/fill-paragraph" "ospl/f")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)


And the github packages 
https://github.com/andersjohansson/tex-fold-linebreaks

Works for tex files, but for these I have a solution already, it is org
mode where the filling fails.


   > Hth,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]