Skip to content

Commit

Permalink
add optional decoration to headline title
Browse files Browse the repository at this point in the history
With `entitiespretty`, underscores in titles look terrible, but org's emphasis
decorations make them readable again with minimal disturbance.
  • Loading branch information
petermao committed Jul 1, 2023
1 parent 3e88084 commit dac381f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 17 additions & 1 deletion org-noter-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,23 @@ If it exists, it will be listed as a candidate that `org-noter'
will have the user select to use as the note file of the
document."
:group 'org-noter
:type 'hook)
:type 'hook
:version "28.2")

(defcustom org-noter-headline-title-decoration ""
"Decoration (emphasis) for the headline title string.
If you use the Org STARTUP option 'entitiespretty', filenames
with underscores will end up looking ugly. This string is
prepended and appended to the document title in the top-level
headline, making it look nicer.
Reasonable choices are: /, *, =, ~, _
With '/', 'The_Title' would become '/The_Title/'."
:group 'org-noter
:type 'string
:version "28.2")

(defface org-noter-no-notes-exist-face
'((t
Expand Down
5 changes: 4 additions & 1 deletion org-noter.el
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ DOCUMENT-FILE-NAME is the document filename."
(with-current-buffer (find-file-noselect (car notes-files))
(goto-char (point-max))
(insert (if (save-excursion (backward-char) (looking-at-p "\n")) "" "\n")
"* " document-base)
"* "
org-noter-headline-title-decoration
document-base
org-noter-headline-title-decoration)
(org-entry-put nil org-noter-property-doc-file
(file-relative-name document-used-path
(file-name-directory (car notes-files)))))
Expand Down

0 comments on commit dac381f

Please sign in to comment.