bastibe / org-journal

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

Question: How to fold previous days in a weekly journal? #439

Open anthonyclarka2 opened 4 months ago

anthonyclarka2 commented 4 months ago

Describe the bug When I call org-journal-new-entry all the previous days in a weekly journal are expanded.

Question: Is there a way to fold previous days?

This almost certainly isn't a bug in org-journal I hope I am not causing upset by asking this here :/

Screenshots This is what my current week journal looks like before I start: org-journal-before-new-entry

After running org-journal-new-entry: org-journal-after-new-entry

How I want it to look: org-journal-desired-behaviour

Desktop (please complete the following information):

Your Emacs Configuration

;; https://github.com/bastibe/org-journal
(use-package org-journal
  :bind
  ("C-c n j" . org-journal-new-entry)
  ("C-c j" . org-journal-open-current-journal-file)
  :custom
  ;; (org-journal-date-prefix "#+TITLE: ")
  ;; (org-journal-time-prefix "* ")
  (org-journal-file-format "%Y-%m-%d.org")
  (org-journal-file-type 'weekly)
  (org-journal-dir "~/Org/Journal/")
  (org-journal-date-format "%Y-%m-%d")
  (org-journal-carryover-items "TODO=\"TODO\"|TODO=\"NEXT\"|TODO=\"PROG\"")
  (org-journal-enable-agenda-integration t)
  (org-journal-find-file 'find-file))
bastibe commented 4 months ago

Does the org variable org-set-startup-visibility change this behavior?

aclarknexient commented 4 months ago

(work account)

Unfortunately not, it didn't change the behaviour.

bastibe commented 4 months ago

There's also org-journal-hide-entries-p that you could customize

aclarknexient commented 4 months ago

I will look into that, thank you very much. I won't be able to get to it until the weekend, is it OK if this issue remains open until then?

bastibe commented 4 months ago

No problem whatsoever. And no rush, either.

aclarknexient commented 4 months ago

Here's what I've discovered:

Using a barebones init.el in a fresh ~/.emacs.d/ directory:

(setq package-enable-at-startup nil)

;; Now we need MELPA
(require 'package)
(setq package-archives
  '(("MELPA"        . "https://melpa.org/packages/")
     ("GNU ELPA"     . "https://elpa.gnu.org/packages/")))
(package-initialize)

(defvar bootstrap-version)
(let ((bootstrap-file
        (expand-file-name
          "straight/repos/straight.el/bootstrap.el"
          (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
       (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
      (url-retrieve-synchronously
        "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
        'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))
(setq straight-use-package-by-default t)

;; use-package
(eval-when-compile
  (require 'use-package))

;; https://github.com/bastibe/org-journal
(use-package org-journal
  :bind
  ("C-c n j" . org-journal-new-entry)
  ("C-c j" . org-journal-open-current-journal-file)
  :custom
  ;; (org-journal-date-prefix "#+TITLE: ")
  ;; (org-journal-time-prefix "* ")
  (org-journal-file-format "%Y-%m-%d.org")
  (org-journal-file-type 'weekly)
  (org-journal-dir "~/Org/Journal/")
  (org-journal-date-format "%Y-%m-%d")
  (org-journal-carryover-items "TODO=\"TODO\"|TODO=\"NEXT\"|TODO=\"PROG\"")
  (org-journal-enable-agenda-integration t)
  (org-journal-find-file 'find-file))

(setq org-directory "~/Org/")
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(org-agenda-files '("/REDACTED/Org/Journal/2024-07-22.org"))
 '(org-journal-find-file-fn 'find-file nil nil "Customized with use-package org-journal"))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

With that configuration, org-journal-new-entry shows this:

image

If org-startup-folded is set to 'fold the same layout as above is shown.

Similarly if #+STARTUP: overview is added to the top of the org file, the same layout is shown.

I think org-set-startup-visibility is deprecated. It is listed as define-obsolete-function-alias 'org-set-startup-visibility in org-compat.el.

I'll try customizing org-journal-hide-entries-p next.

aclarknexient commented 4 months ago

With org-journal-hide-entries-p to to nil:

image

With that variable set to t, the same layout as the previous comment is shown, i.e. the properties drawer is hidden.

I don't want to take up much of your time. Please don't spend ages on this, it's not particularly important, just a visual issue and it doesn't prevent me from using your wonderful work :)