Org-encrypt-entries before-save-hook won't let me save my org file

What happened?

When trying to save some org files, doom emacs gets stuck in hook:before-save-hook: run org-encrypt-entries. In the log below you will see I just waited 20 secs, but I have left the computer for 6 hours or so and it just keeps frozen.

I can exit the frozen state. with C-g but file won’t get saved.

[2022-10-26 15:33:32] * 125.862223:*:hook:doom-switch-buffer-hook: run +file-templates-check-h
[2022-10-26 15:33:32] * 125.862547:*:hook:doom-switch-buffer-hook: run doom-auto-revert-buffer-h
[2022-10-26 15:33:33] Garbage collecting...done (0.104s)
[2022-10-26 15:33:33] 
[2022-10-26 15:33:34] You can run the command ‘view-echo-area-messages’ with SPC h e
[2022-10-26 15:33:34] SPC-
[2022-10-26 15:33:35] * 128.409400:*:hook:before-save-hook: run toc-org-insert-toc
[2022-10-26 15:33:35] * 128.411283:*:hook:before-save-hook: run org-update-parent-todo-statistics
[2022-10-26 15:33:35] * 128.412076:*:hook:before-save-hook: run org-encrypt-entries
Quit
[2022-10-26 15:33:55] 
Garbage collecting...

What did you expect to happen?

The file to be saved

Steps to reproduce

  1. Open my .org file
  2. Make some modifications
  3. Try to save (sometimes it will work, sometimes it doesn´t, seems to depend on the specific text/syntax within the file

Possible Solution?

The only place in config files where I found org-decrypt-entry is inside /.emacs.d directory, not /.doom.d

~/.emacs.d/modules/lang/org/config.el

;; TODO Move to +encrypt flag
(use-package! org-crypt ; built-in
  :commands org-encrypt-entries org-encrypt-entry org-decrypt-entries org-decrypt-entry
  :hook (org-reveal-start . org-decrypt-entry)
  :preface
  ;; org-crypt falls back to CRYPTKEY property then `epa-file-encrypt-to', which
  ;; is a better default than the empty string `org-crypt-key' defaults to.
  (defvar org-crypt-key nil)
  (after! org
    (add-to-list 'org-tags-exclude-from-inheritance "crypt")
    (add-hook! 'org-mode-hook
      (add-hook 'before-save-hook 'org-encrypt-entries nil t))))

Maybe I could start commenting out this lines? but I am not supposed to change anything inside /.emacs.d directory… how can I invalidate this inside /.doom.d directory instead?

System information


Loading data dump...

Here I found the same issue:

I thought this could be an org-mode bug, and maybe it is, but it doesn’t happen on vanilla emacs -q

I tried (remove-hook 'before-save-hook 'org-encrypt-entries t) on ~/.doom.d/config.el , then doom sync , and seems to have worked.

I am having the same problem. Using the remove-hook code above works for me too. This confused me because I don’t have any encryption enabled for my org files.