bastibe / org-journal

A simple org-mode based journaling mode
BSD 3-Clause "New" or "Revised" License
1.23k stars 122 forks source link

[BUG] Possible "hide entries" behavior bug. #418

Open kizifumoli opened 9 months ago

kizifumoli commented 9 months ago

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):

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

bastibe commented 9 months ago

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

kizifumoli commented 9 months ago

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