From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: Re: fill function: Put a newline at the end of each sentence in paragraph. Date: Tue, 01 Oct 2019 19:02:22 +0300 Message-ID: <8736gc5u9d.fsf@mat.ucm.es> References: <871rvx9dpd.fsf@mat.ucm.es> <87eezwqzfu.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:51753) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFKbk-0001Jv-Tt for emacs-orgmode@gnu.org; Tue, 01 Oct 2019 12:02:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFKbj-0003pJ-EF for emacs-orgmode@gnu.org; Tue, 01 Oct 2019 12:02:36 -0400 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:36000 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFKbi-0003n3-H6 for emacs-orgmode@gnu.org; Tue, 01 Oct 2019 12:02:35 -0400 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1iFKbd-000jvk-Qi for emacs-orgmode@gnu.org; Tue, 01 Oct 2019 18:02:29 +0200 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: emacs-orgmode@gnu.org >>> "MB" == Marcin Borkowski writes: > On 2019-10-01, at 08:34, Uwe Brauer 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) #) 1) ad-Advice-fill-paragraph(#f(compiled-function (arg) (interactive "*P") #)) apply(ad-Advice-fill-paragraph #f(compiled-function (arg) (interactive "*P") #) 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,