unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Daniel P. Gomez" <d.gomez@posteo.org>
To: help-gnu-emacs@gnu.org
Subject: Displaying newlines as whitespaces on a region.
Date: Wed, 27 Mar 2019 00:35:44 +0100	[thread overview]
Message-ID: <m2pnqdgqen.fsf@posteo.org> (raw)

Dear Emacs friends,

I use Org mode for prose and keep my files under version control 
(VC).
To keep VC diffs simple and meaningful, I would like to write a 
single sentence in each line, as shown in the following example 
(between dashes):

---
* A heading

This is an example.
In the example each sentence is in a newline.
Sentences within a paragraph look ugly when separated by newlines, 
though.

Two newlines represent a paragraph, just as in LaTeX.
---

Although writing one sentence per line is good for VC, it is 
hardly convenient for reading and writing, because this is not how 
people are used to prose, generally.

Currently the question arose whether it'd be possible to have 
Emacs display newline characters as whitespaces. A naive solution 
could be achieved by tweaking the variable 
=whitespace-display-mappings= and activating 
=whitespace-newline-mode=, which is a part of Emacs.
Unfortunately, however, this solution has a series of drawbacks. 
First, it is no longer possible to visually differentiate between 
paragraphs, as they'd be displayed as sentences separated by two 
whitespaces. Second, headings and org src blocks get clumped.

Would anyone know how to have =whitespace-newline-mode= only 
substitute newlines for whitespaces in sentences outside of org 
blocks, tables and headings and only for sentences followed by 
other sentences (effectively allowing for paragraph breaks)? More 
generally, would anyone know of a solution to this problem even if 
using other packages other than whitespace.el?

Ideally the example above would be displayed in the buffer as:

---
* A heading

This is an example. In the example each sentence is in a newline. 
Sentences within a paragraph look ugly when separated by newlines, 
though.

Two newlines represent a paragraph, just as in LaTeX.
---

Thank you.

Yours,

Daniel Gomez



                 reply	other threads:[~2019-03-26 23:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2pnqdgqen.fsf@posteo.org \
    --to=d.gomez@posteo.org \
    --cc=help-gnu-emacs@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.
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).