emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Visuwesh <visuweshm@gmail.com>
To: emacs-orgmode@gnu.org
Subject: FR: support hard-newlines [9.5.5 (release_9.5.5 @ /home/viz/lib/ports/emacs/lisp/org/)]
Date: Sun, 18 Sep 2022 11:43:54 +0530	[thread overview]
Message-ID: <87pmftqkf1.fsf@gmail.com> (raw)


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

     https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------

Hard-newlines [1] are an excellent way to inform Emacs to stop refilling
lines.  In a way, this serves a similar purpose to org's \\ but with a
major difference being that hard-newlines are not saved to file.  There
are several cases where this is the desired behaviour:
    1. When you want to end a line with a link and continue text in the
       next line.  You don't care about the export since it will be
       taken care of properly.
    2. When reflowing text with inline latex in them.  You adjust the
       line width so that it looks like 80 columns are present in a
       single line.  With hard-newlines, this becomes a very easy job
       without with you have to isolate the line of interest into a
       separate paragraph, then do the manual reflow, rinse and repeat.
    3. When writing a list, you give a short description at the top.
       Then continue writing down below like this without the need to
       insert a empty line after the first line.

My point is that there are several instances where you need a solution
that is less aggressive than \\ and hard-newlines hit that sweet spot
perfectly.
I currently don't have a git checkout of org-mode handy so cannot
produce a patch wrt master branch but changing
`fill-region-as-paragraph' to `fill-region' does the job, as in

diff --git a/lisp/org/org.el b/lisp/org/org.el
index 6f92cdeab5..d53c8c0243 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -19580,7 +19580,7 @@ org-fill-element
 					      (org-element-context))))
 		     (push (point) cuts)))
 		 (dolist (c (delq end cuts))
-		   (fill-region-as-paragraph c end justify)
+		   (fill-region c end justify)
 		   (setq end c))))
 	     t)))
 	;; Contents of `comment-block' type elements should be

       
1. See C-h f use-hard-newlines RET

Emacs  : GNU Emacs 29.0.50 (build 12, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
 of 2022-09-17
Package: Org mode version 9.5.5 (release_9.5.5 @ /home/viz/lib/ports/emacs/lisp/org/)


             reply	other threads:[~2022-09-18  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18  6:13 Visuwesh [this message]
2022-09-20 12:16 ` FR: support hard-newlines [9.5.5 (release_9.5.5 @ /home/viz/lib/ports/emacs/lisp/org/)] Ihor Radchenko
2022-09-20 12:39   ` Visuwesh
2022-09-20 13:37     ` Ihor Radchenko
2022-09-20 14:03       ` Visuwesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmftqkf1.fsf@gmail.com \
    --to=visuweshm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).