From 5ca6e3d7034f7d45ac7302210b4157a3f6e64cf1 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 15 Aug 2012 21:08:45 +0200 Subject: [PATCH] org.el: Fix bug when adjusting another clock * org.el (org-fill-context-prefix): Require org-element. (org-timestamp-change): Fix bug by saving excursion when adjusting another clock. Thanks to Steinar Bang for reporting this. --- lisp/org.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index f824f8983..86ec7472d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16530,15 +16530,16 @@ in the timestamp determines what will be changed." (clfixpos (if (> 0 clfixnth) nil (nth clfixnth org-clock-history)))) (if (not clfixpos) (message "No clock to adjust") - (org-goto-marker-or-bmk clfixpos) - (org-show-subtree) - (when (re-search-forward clrgx nil t) - (goto-char (match-beginning 1)) - (let (org-clock-adjust-closest) - (org-timestamp-change n org-ts-what updown)) - (message "Clock adjusted in %s for heading: %s" - (file-name-nondirectory (buffer-file-name)) - (org-get-heading t t)))))))) + (save-excursion + (org-goto-marker-or-bmk clfixpos) + (org-show-subtree) + (when (re-search-forward clrgx nil t) + (goto-char (match-beginning 1)) + (let (org-clock-adjust-closest) + (org-timestamp-change n org-ts-what updown)) + (message "Clock adjusted in %s for heading: %s" + (file-name-nondirectory (buffer-file-name)) + (org-get-heading t t))))))))) ;; Try to recenter the calendar window, if any. (if (and org-calendar-follow-timestamp-change (get-buffer-window "*Calendar*" t) @@ -20960,6 +20961,9 @@ hierarchy of headlines by UP levels before marking the subtree." Return fill prefix, as a string, or nil if current line isn't meant to be filled." (unless (and (derived-mode-p 'message-mode) (not (message-in-body-p))) + ;; FIXME: Prevent an error for users who forgot to make autoloads? + ;; See also `org-fill-paragraph', which has the same. + (require 'org-element) ;; FIXME: This is really the job of orgstruct++-mode (save-excursion (goto-char p) -- 2.11.4.GIT