From dac381f258943d9b47414e52e6029c4982c61934 Mon Sep 17 00:00:00 2001 From: Peter Mao Date: Fri, 30 Jun 2023 21:52:41 -0700 Subject: [PATCH] add optional decoration to headline title With `entitiespretty`, underscores in titles look terrible, but org's emphasis decorations make them readable again with minimal disturbance. --- org-noter-core.el | 18 +++++++++++++++++- org-noter.el | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/org-noter-core.el b/org-noter-core.el index 302f3c5..a945131 100644 --- a/org-noter-core.el +++ b/org-noter-core.el @@ -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 diff --git a/org-noter.el b/org-noter.el index f464214..620da67 100644 --- a/org-noter.el +++ b/org-noter.el @@ -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)))))