org-journal icon indicating copy to clipboard operation
org-journal copied to clipboard

[BUG] Possible "hide entries" behavior bug.

Open kizifumoli opened this issue 1 year ago • 2 comments

Describe the bug When using the monthly org-journal mode, when org-journal-hide-entries-p is nil, running org-journal-new-entry hides any expanded sections that are not in the current date.

To Reproduce Steps to reproduce the behavior:

  1. Set org-journal-file-type to monthly and org-journal-hide-entries-p to nil
  2. Create a couple of entries on different days (Alternatively, make several sections in the org-journal file, as below this list)
  3. Run org-journal-new-entry
* Thursday, 10/19/2023
:PROPERTIES:
:CREATED:  20231019
:END:
** 10:32
This is a test
Please don't hide me

* Friday, 10/20/2023
:PROPERTIES:
:CREATED:  20231020
:END:
** 10:36

This is a new entry

Running org-journal-new-entry leads to the Thursday entry being hidden, which shouldn't happen due to org-journal-hide-entries-p being nil.

Expected behavior Expected behavior is to have none of the sections collapsed when creating a new entry. The documentation states:

If true all but the current entry will be hidden when creating a new one.

Which makes me assume that no entries will be hidden / collapsed when creating a new one.

One possible solution to this is to change the function org-jounal--finalize-view (which is called in org-journal-new-entry) to the following:

(defun org-journal--finalize-view ()
  "Finalize visability of entry."
  (org-journal--decrypt)
  (if (and (org-journal--is-date-prefix-org-heading-p) org-journal-hide-entries-p)
      (progn
        (org-up-heading-safe)
        (org-back-to-heading)
        (outline-hide-other)
        (outline-show-subtree))
    (outline-show-all)))

Which fixes my issue, but I'm not sure if it would mess with anything else. Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Emacs Version: 29.1

Your Emacs Configuration Using DOOM-Emacs. Downloaded org-journal via the package! macro.

kizifumoli avatar Oct 20 '23 17:10 kizifumoli

Thank you for the bug report. Would you like to contribute your solution as a pull request?

bastibe avatar Oct 21 '23 07:10 bastibe

Yes. I modified the function slightly so that only outline-hide-other is affected by org-journal-hide-entries-p (just in case the other functions were necessary).

Pull request is here: https://github.com/bastibe/org-journal/pull/419

kizifumoli avatar Oct 22 '23 04:10 kizifumoli