0

My init.el is symlinked by NixOS, so that means it's write protected.

For some reason, after org-capture, Emacs tries to write to this file.

I'm not sure I understand what it's trying to write?;)

Emacs also truncates this backtrace and shows three elipsis. How can I prevent that and show the entire backtrace?;)

Debugger entered--Lisp error: (error "Attempt to save to a file that you aren’t allowed ...")
  error("Attempt to save to a file that you aren't allowed ...")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer(nil)
  save-buffer()
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_126>(#<buffer 4kwdwkndp0pjq45018phykzmgl2vd1cc-hm_home.dot.emacs.dot.d.emacsen.el>)
  map-y-or-n-p(#f(compiled-function (buffer) #<bytecode -0x166b668bec870ccf>) #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_126> (#<buffer capture.org> #<buffer 4kwdwkndp0pjq45018phykzmgl2vd1cc-hm_home.dot.emacs.dot.d.emacsen.el>) ("buffer" "buffers" "save") ((18 #f(compiled-function (buf) #<bytecode 0x19b5453ef578904>) "view this buffer") (6 #f(compiled-function (buf) #<bytecode -0x14d254c4619ebb64>) "view this buffer and quit") (100 #f(compiled-function (buf) #<bytecode -0x109e95b8987dc548>) "view changes in this buffer")))
  save-some-buffers(:no-prompt #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_28>)
  apply(save-some-buffers (:no-prompt #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_28>))
  timer-event-handler([t 0 5 0 :repeat save-some-buffers (:no-prompt #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_28>) idle 0 nil])
  read-from-minibuffer(#("File 4kwdwkndp0pjq45018phykzmgl2vd1cc-hm_home.dot...." 114 115 (face help-key-binding font-lock-face help-key-binding) 119 120 (face help-key-binding font-lock-face help-key-binding)) nil (keymap (keymap (escape . abort-recursive-edit) (remap keymap (quit . abort-recursive-edit) (exit-prefix . abort-recursive-edit) (exit . y-or-n-p-insert-other) (scroll-other-window-down . minibuffer-scroll-other-window-down) (scroll-other-window . minibuffer-scroll-other-window) (scroll-down . minibuffer-scroll-down-command) (scroll-up . minibuffer-scroll-up-command) (recenter . minibuffer-recenter-top-bottom) (self-insert-command . y-or-n-p-insert-other) (ignore . y-or-n-p-insert-other) (delete-and-edit . y-or-n-p-insert-other) (edit-replacement . y-or-n-p-insert-other) (edit . y-or-n-p-insert-other) (undo-all . y-or-n-p-insert-other) (undo . y-or-n-p-insert-other) (backup . y-or-n-p-insert-other) (skip . y-or-n-p-insert-n) (automatic . y-or-n-p-insert-y) (act-and-exit . y-or-n-p-insert-y) (act-and-show . y-or-n-p-insert-y) (act . y-or-n-p-insert-y)) keymap (18 . helm-minibuffer-history) (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the min...") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuf...") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\15" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (24 keymap (down . minibuffer-complete-defaults) (up . minibuffer-complete-history)) (13 . exit-minibuffer) (10 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (60 . minibuffer-beginning-of-buffer) (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) keymap (escape . exit-prefix) (M-prior . scroll-other-window-down) (M-next . scroll-other-window) (prior . scroll-down) (next . scroll-up) (27 keymap (33554454 . scroll-other-window-down) (22 . scroll-other-window) (118 . scroll-down)) (22 . scroll-up) (29 . quit) (7 . quit) (63 . help) (help . help) (f1 . help) (8 . help) (85 . undo-all) (117 . undo) (94 . backup) (33 . automatic) (12 . recenter) (23 . delete-and-edit) (18 . edit) (46 . act-and-exit) (return . exit) (13 . exit) (113 . exit) (44 . act-and-show) (69 . edit-replacement-exact-case) (101 . edit-replacement) (78 . skip) (89 . act) (110 . skip) (121 . act) (backspace . skip) (delete . skip) (127 . skip) (32 . act)) nil t)
  yes-or-no-p("File 4kwdwkndp0pjq45018phykzmgl2vd1cc-hm_home.dot....")
  basic-save-buffer-2()
  basic-save-buffer-1()
  basic-save-buffer(nil)
  save-buffer()
  custom-save-all()
  customize-save-variable(bmkp-last-as-first-bookmark-file "~/agenda/bookmark.txt")
  bookmark-save()
  bmkp-maybe-save-bookmarks()
  bookmark-store("org-capture-last-stored" ((annotation) (tags) (filename . "/home/b0ef/agenda/capture.org") (handler . org-bookmark-heading-jump) (id . "c878d848-d811-46c0-9ce4-d8638a23d8ca") (outline-path "WT")) nil nil t)
  bookmark-set("org-capture-last-stored")
  org-capture-store-last-position()
  org-capture-finalize(nil)
  funcall-interactively(org-capture-finalize nil)
  command-execute(org-capture-finalize)

3
  • See e.g. emacs.stackexchange.com/questions/55774/… for getting rid of the ellipses.
    – NickD
    Commented Oct 2, 2023 at 19:09
  • Just as an FYI: org-capture sets a bookmark: org-capture-last-stored (org-refile also sets a bookmark: org-refile-last-stored). You can use them to jump to the last note you captured (or the last heading you refiled). After a capture or a refile, you can list the bookmarks with C-x r l and jump to the last capture by pressing RET on the appropriate bookmark.
    – NickD
    Commented Oct 2, 2023 at 19:54
  • thanks, org-capture-goto-last-stored was a missing part of my puzzle;) Commented Oct 3, 2023 at 7:08

1 Answer 1

4

All you have to do is read the stack trace.

  …
  customize-save-variable(bmkp-last-as-first-bookmark-file "~/agenda/bookmark.txt")
  bookmark-save()
  bmkp-maybe-save-bookmarks()
  bookmark-store("org-capture-last-stored" ((annotation) (tags) (filename . "/home/b0ef/agenda/capture.org") (handler . org-bookmark-heading-jump) (id . "c878d848-d811-46c0-9ce4-d8638a23d8ca") (outline-path "WT")) nil nil t)
  bookmark-set("org-capture-last-stored")
  …

As you can see, it set a bookmark and then saved your bookmarks. Bookmarks are saved in a customizable variable, and your customizable variables are stored in your init file.

You can change what file is used to store customizable variables by setting the variable custom-file. For example:

(setq custom-file (concat dotfiles-dir "custom.el"))
2
  • It is probably a good idea to have a separate customization file instead of saving customizations in your init file. Add ` (setq custom-file "/path/to/customize.el") (load-file custom-file)` to your init file and make sure that customize.el is somewhere where Emacs can save to.
    – NickD
    Commented Oct 2, 2023 at 17:32
  • I already had this code, but it was somehow being blocked in init.el for other reasons;) thanks Commented Oct 3, 2023 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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