1

I'm a writer (non-programmer) using org-mode mainly for prose notes/planning and writing.

I'm trying to enable first-line paragraph indents for text under Org headings. I discovered paragraph-indent-mode, and after enabling it to no effect, I finally realized that it doesn't work, and Org's normal ability to first-line indent also doesn't work, when org-indent-mode is enabled. With the latter enabled, M-i indents the whole paragraph.

Are the two features incompatible? Ideally I would have my text body indented under the headline as per normal org-indent-mode, and then M-i would allow me to further indent the first line of a paragraph from the new margin (if I wanted to).

E.g.,

  * org heading
    a paragraph nicely indented and aligned to the heading text (thx org-indent, you're really great, i'd hate to have to lose you just to enable first-line paragraph indents!). sentence sentence blah blah waffle waffle
        a new first-line indented prose paragraph starting here.

    and back to non-indented new paragraph still possible if i wanted to.

The idea is just to have the two types of paragraph breaks available.

I also have variable-pitch-mode and org-bullets-mode enabled.

edit: * M-i is bound to tab-to-tab-stop.

  • i'm running emacs 26.1 and org latest from melpa (9.3)

  • if i first run org-fill-paragraph, then the indentation works, but i don't at all like the idea of using that for my writing.

  • (i also have indent-tools installed (but disabled by default in org buffers). if i run indent-tools-indent, i also get whole paragraph indenting.)

user27075
  • 488
  • 3
  • 11
  • Paragraphs usually require an empty line between them. Try doing `M-x forward-paragraph` at various places in your buffer and see what you get. In particular, `a new first-line indented paragraph` is no such thing: it is still part of the first paragraph. – NickD Mar 04 '20 at 23:26
  • Other than that, I find that `M-i`, which is bound to `tab-to-tab-stop` in my case, indents the first line of a paragraph as you want and the indentation survives a `M-q` (`org-fill-paragraph`). – NickD Mar 04 '20 at 23:29
  • thanks for the tip. i wouldn’t mind it not “really” being a paragraph if i could actually still insert it. with org-indent-mode enabled, i cannot do anything but indent an entire paragraph, which is a feature i never actually need. it’s more the visual flexibility that i’m after. – user27075 Mar 05 '20 at 21:46
  • Is `M-i` bound to `tab-to-tab-stop` in your case as it is in my case? I cannot reproduce the problem you are seeing. You might also add the org version (and possibly the emacs version) to your question: it might depend on the version. – NickD Mar 05 '20 at 22:06
  • it is indeed. with org-ident-mode enabled that command indents a whole paragraph (or actually, seeing as you definied an emacs paragraph for me: technically it indents all text until a newline). only with org-indent-mode disable does it indent only the first line of text. i take it by your comment that what i'm trying to achieve is possible and even normal... maybe i have some other half-baked config messing it up. – user27075 Mar 06 '20 at 02:50

1 Answers1

1

What you're trying to do is not possible with org-indent-mode turned on. Maybe you can trick the mode by inserting some invisible character before inserting the space/tab:

(defun org-indent-paragraph ()
  (interactive)
  (forward-line 0)
  (if (looking-at "^¶")
      (while (looking-at "^¶\\|[ \t]")
        (delete-char 1))
    (insert (propertize "¶" 'font-lock-face 'org-hide))
    (insert "\t")))

(add-to-list 'org-export-filter-plain-text-functions
             (lambda (text _backend _info)
               (replace-regexp-in-string "¶" "" text)))
jagrg
  • 3,824
  • 4
  • 19
  • hm nice. this is fine for my needs. the only thing is that my init errors on org-export-filter-plain-list-functions. i gather that part of the function is to remove the invisible characters on export? – user27075 Mar 06 '20 at 14:05
  • What is the error you're seeing? – jagrg Mar 06 '20 at 15:03
  • "Symbol's value as variable is void: org-export-filter-plain-text-functions" – user27075 Mar 07 '20 at 14:48
  • You may have to require ox.el: `(require 'ox)`. – jagrg Mar 08 '20 at 00:06
  • still same issue with that. i'm unsure what's wrong there. i use org-export to various formats.... :/ – user27075 Mar 09 '20 at 02:09
  • You have to add the code *after* requiring ox.el. IOW you need to tell Emacs where that variable is defined before you can actually use it. – jagrg Mar 09 '20 at 11:24