2

I want to setup a Journal entry template that prompts for a date/time, so that I can process current entries, as well as older ones.

This is what I have so far:

;;; Org-capture settings
(setq org-capture-templates
      '(("j" "Journal" entry (file+olp+datetree "~/org/journal.org")
         "* %U\n%?" :time-prompt t :empty-lines 1)))

;;; Set keyboard shortcut
(global-set-key (kbd "C-c c") 'org-capture)

The trouble is, when I run the capture template, any date I select that is earlier than what is already in the datetree produces the following error:

enter image description here

Any ideas?

3
  • Which versions of Emacs and org-mode are you using? I seem to recall that this was a problem in some version combinations a while back, but it seems to work OK now with Emacs 25.3 and Org 9.16.
    – Win
    Feb 15, 2018 at 0:57
  • 1
    I found the culprit. I am using this code emacs.stackexchange.com/questions/38120/… to font-lock broken fuzzy links in org-warning face. Something is incompatible between these two snippets...
    – Adam
    Feb 15, 2018 at 23:57
  • Related: emacs.stackexchange.com/questions/36312/… I think that is what @Win referes to.
    – Tobias
    Feb 16, 2018 at 12:58

1 Answer 1

4

The error message

Match data clobbered by buffer modification hooks

is caused by functions in the hooks before-change-functions or after-change-functions modifying the match data. That may happen if these functions call search-forward and friends or looking-at and friends directly or indirectly through calling other functions.

Solve this problem by wrapping the body of these functions in (save-match-data ...).

The info manual says about that in Section 31.28 "Change Hooks":

The functions you use in these hooks should save and restore the match data if they do anything that uses regular expressions; otherwise, they will interfere in bizarre ways with the editing operations that call them.

2
  • Hi, it turns out, this was related to the markup I was applying to broken fuzzy links emacs.stackexchange.com/questions/38120/… which you just fixed. So all good!
    – Adam
    Feb 16, 2018 at 16:17
  • @Adam The edit of your question heading and my answer were my try to make the question and the answer more valuable to others with similar problems.
    – Tobias
    Feb 16, 2018 at 16:20

Your Answer

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

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