0

I'm using org-capture to take project-specific notes by having a notes file in each of several git repositories. Looking forward, however, I can see danger here: if I'm working on project (1) and I think to drop a note in project (2), I'll probably forget to commit it; doing this on multiple computers and syncing via github just begs for merge conflicts.

Does anyone know a way to solve at least part of this problem by having org-capture automatically pull from remote before it starts a note? I thought of trying to just use advice to do it, but there's no obvious way to do that given that the specific repository isn't selected until after org-capture is run...

3
  • 1
    The target in the capture template can be a function called with no argument. Make that function do the pull as a side-effect? Jan 16 at 10:37
  • Oooh that's a potential idea. Thank you. I didn't know you could call a function in the capture template. Jan 16 at 15:38
  • C-h v org-capture-templates is helpful here. Jan 16 at 16:43
1

You can always use defadvice. This is kind of hook that can get triggered in many situation.

(defadvice  next-line (before nextline-before activate)
  (message "Are you using next line?"))

For more https://www.emacswiki.org/emacs/AdvisingFunctions

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.