bastibe / org-journal

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

Creating a journal entry opens the file in Fundamental mode #396

Open rjray opened 1 year ago

rjray commented 1 year ago

Describe the Bug

I've installed the latest org-journal from ELPA, via package-install. When I create a new entry (C-c C-j), it correctly derives the name of the file from the date and opens the new file in the designated directory. However, rather than putting the buffer in org-journal-mode, it puts it in Fundamental instead.

This appears to be due to the following line in org-journal.el either not getting evaluated, or magic-mode-alist being nullified somewhere else:

(add-to-list 'magic-mode-alist '(org-journal-is-journal . org-journal-mode))

Either way, when I examine magic-mode-alist within emacs it is nil.

Desktop Configuration

This is Emacs 27.1 on Ubuntu Linux 22.04.1.

Emacs Configuration

Relevant configuration:

;;; setup-org --- Loading and configuration of org-mode

;;; Commentary:

;;; Code:

(require 'org)
(require 'org-journal)

(setq
 org-default-notes-file "~/Dropbox/org/organizer.org"
 org-journal-dir "~/Dropbox/org/journal"
 org-refile-targets '((org-agenda-files . (:maxlevel . 6))))

(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture)
(global-set-key (kbd "C-c o")
                (lambda () (interactive)
                  (find-file "~/Dropbox/org/organizer.org")))
(global-set-key (kbd "C-c O")
                (lambda () (interactive)
                  (find-file "~/Dropbox/org")))

(provide 'setup-org)
;;; setup-org.el ends here
rjray commented 1 year ago

I find that if I visit the org-journal.el file in a buffer and eval-last-sexp on that line, creating a journal entry will start using the correct buffer mode.