From b6ef6671a8e3110cea656e66043d83a75d80d50a Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Thu, 3 May 2018 11:01:43 -0400 Subject: [PATCH] Force reverting buffers on dropbox upon agenda reload The auto-revert thing does not work because of sshfs, so I need to force reloading every time the agenda is redone. Not a big deal --- global.org | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/global.org b/global.org index f5321c2..2b70257 100644 --- a/global.org +++ b/global.org @@ -371,6 +371,10 @@ (add-hook 'org-mode-hook (lambda () (turn-on-auto-fill))) #+END_SRC + Revert orgzly buffers on agenda refresh + #+BEGIN_SRC emacs-lisp + (advice-add 'org-agenda-redo :before 'org-revert-all-orgzly-buffers) + #+END_SRC *** Agenda Set the canonical binding for the agenda #+BEGIN_SRC emacs-lisp @@ -411,6 +415,27 @@ (tags-todo "5m") (tags-todo "20m"))))) #+END_SRC +*** Reverting stuff from orgzly + #+BEGIN_SRC emacs-lisp + (defun org-revert-all-orgzly-buffers () + "Revert all Org buffers that are sitting in orgzly + Prompt for confirmation when there are unsaved changes. Be sure + you know what you are doing before letting this function + overwrite your changes." + (interactive) + (message "Reverting Orgzly buffers…") + (save-excursion + (save-window-excursion + (dolist (b (buffer-list)) + (when (and (with-current-buffer b (derived-mode-p 'org-mode)) + (with-current-buffer b buffer-file-name) + (with-current-buffer b (string-match-p "orgzly" default-directory))) + (with-current-buffer b (print buffer-file-name)) + (pop-to-buffer-same-window b) + (revert-buffer t 'no-confirm))) + (when (and (featurep 'org-id) org-id-track-globally) + (org-id-locations-load))))) + #+END_SRC *** Capture Set default keybinding #+BEGIN_SRC emacs-lisp