0

I have this configuration init.el file:

    ;; for org-journal
    (setq org-journal-dir "~/Desktop/doctorado")
    (setq org-journal-date-format "%A, %d %B %Y")
    (setq org-journal-file-type 'yearly)
    (setq org-file-format "Diary %Y")
    (require 'org-journal)
    
    ;; package manager
    (require 'package)
    (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
    
    ;; package initialization
    (package-initialize)

I want to open my journal with C-c C-j when opening emacs. However now I have to open init.el and do M-x ev-b before it works.

Why is this happening? How can I solve it?

5
  • What is the path of your init.el file? How are you starting emacs? Are you on Windows? MacOS? Linux? – NickD Dec 2 '20 at 14:55
  • @NickD I'm on Ubuntu 18.04. I start emacs from a desktop shortcut. The path of the init.el file is ~/.emacs.d/init.el – Rodrigo Dec 2 '20 at 15:07
  • After you restart emacs, what does ESC ESC : (featurep 'org-journal) say in the echo area? – NickD Dec 2 '20 at 16:52
  • 1
    Just to clarify: I'm wondering if the init.el file you show above is loaded at all. It should be in which case (featurep 'org-journal) should say t - if that's the case, the next step is to see what C-c C-j is bound to - say C-h c C-c C-j and see if it is what you expect. But if the featurep call says nil, then the file is not loaded at all: it may be that some other file is loaded first and this one is ignored - see Init for details. – NickD Dec 2 '20 at 20:17
  • Unless you're using Emacs 27+, you can't load a non-standard package (which is what org-journal seems to be) before you've initialised the package manager. You should be seeing an error if that's the issue, though, and you haven't quoted one. What does emacs --debug-init do? – phils Dec 3 '20 at 3:14
0

A combination of what NickD and phils suggested did the trick. package-initialization should be up in the configuration file.

;; package initialization
(package-initialize)

;; for org-journal
(setq org-journal-dir "~/Desktop/doctorado")
(setq org-journal-date-format "%A, %d %B %Y")
(setq org-journal-file-type 'yearly)
(setq org-file-format "Diary %Y")
(require 'org-journal)

;; package manager
(require 'package)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

I also wasn't using the init.el configuration file but the .emacs file. I erased one of them and then it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.