Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anthonyclarka2 opened this issue Jul 20, 2024 · 7 comments
Open

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

anthonyclarka2 opened this issue Jul 20, 2024 · 7 comments

Comments

@anthonyclarka2
Copy link

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

  • OS: Fedora 40, x86_64, Wayland, Nvidia 4070
  • Emacs Version 31.0.50

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
Copy link
Owner

bastibe commented Jul 22, 2024

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

@aclarknexient
Copy link

(work account)

Unfortunately not, it didn't change the behaviour.

@bastibe
Copy link
Owner

bastibe commented Jul 24, 2024

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

@aclarknexient
Copy link

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
Copy link
Owner

bastibe commented Jul 27, 2024

No problem whatsoever. And no rush, either.

@aclarknexient
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants