2

In order to separate paragraphs in text-mode, I have to add an extra empty line between two paragraphs.

Is there a way to set paragraph spacing in Emacs? Because it's a common variable in typesetting system/software (like InDesign, Word, Scrivener). The extra empty line will cause additional space in these software.

lispython
  • 21
  • 1
  • Sounds like you want a word processor, rather than a text editor? Plain text doesn't have variable height lines. Or do you mean just when displaying? – asjo Jul 19 '14 at 09:41
  • lispython: are you asking how to treat every line as a paragraph? – phils Jul 19 '14 at 11:14
  • @asjo I mean just when displaying. – lispython Jul 19 '14 at 12:35
  • @phils maybe something like that, I know there's a variable line-spacing, but it's not for paragraph (or a logic line) – lispython Jul 19 '14 at 12:39
  • @lispython Maybe if you describe why you want this, in a text editor, it will be easier to help you. – asjo Jul 19 '14 at 13:04
  • @asjo If I write an article or some text, I'd like to do my writing and editing work all in emacs, since it is the most convenient text editor. But after that, I hope to export the text to typesetting software (like InDesign) to do professional typesetting, then the extra empty line becomes a problem. Or even if I don't need typesetting software, if there's a method that could set paragraph spacing in emacs, I could have more flexibility and fine control to display the text in emacs. The display result in emacs itself will be much prettier, and I don't need the press the additional Enter key. – lispython Jul 19 '14 at 14:11
  • @lispython Thanks for the explanation. If I were you, I would remove the empty lines separating the paragraphs by search and replace, perhaps, before importing the text into your DTP/word processor. – asjo Jul 19 '14 at 14:35

1 Answers1

5

The following code alters the visual display by adding an additional new visual line, but does not actually add new lines to the current document:

(aset (or buffer-display-table
  (setq buffer-display-table (make-display-table))) ?\n [?\n?\n])

To restore it back the way it was:

(aset (or buffer-display-table
  (setq buffer-display-table (make-display-table))) ?\n [?\n])

EDIT:

Here is a convenient method using keyboard shortcuts to implement this idea:

(defun one-carriage-return-looks-like-two ()
(interactive)
  (aset (or buffer-display-table
    (setq buffer-display-table (make-display-table))) ?\n [?\n?\n]))

(defun one-carriage-return-looks-like-one ()
(interactive)
  (aset (or buffer-display-table
    (setq buffer-display-table (make-display-table))) ?\n [?\n]))

(global-set-key (kbd "C-c 1") 'one-carriage-return-looks-like-one)

(global-set-key (kbd "C-c 2") 'one-carriage-return-looks-like-two)
lawlist
  • 13,099
  • 3
  • 49
  • 158