summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-08-20 08:32:01 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-08-20 08:32:31 +0200
commit6f61135c84e8ee0934db4aca66c01b4be5d250cd (patch)
tree81b3024875c0738ffb41cbe1eae61b8b9c06c49d
parent034dbac3eecdd67c83407f55cd920d3720400055 (diff)
downloadorg-mode-6f61135c84e8ee0934db4aca66c01b4be5d250cd.tar.gz
New macro
* lisp/org-agenda.el (org-agenda-with-point-at-orig-entry): New macro.
-rw-r--r--lisp/org-agenda.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 90c0fe1..117b0bb 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1488,6 +1488,18 @@ the lower-case version of all tags."
(require 'cl))
(require 'org)
+(defmacro org-agenda-with-point-at-orig-entry (string &rest body)
+ "Execute BODY with point at location given by `org-hd-marker' property.
+If STRING is non-nil, the text property will be fetched from position 0
+in that string. If STRING is nil, it will be fetched from the beginning
+of the current line."
+ `(let ((marker (get-text-property (if string 0 (point-at-bol))
+ 'org-hd-marker string)))
+ (with-current-buffer (marker-buffer marker)
+ (save-excursion
+ (goto-char marker)
+ ,@body))))
+
(defun org-add-agenda-custom-command (entry)
"Replace or add a command in `org-agenda-custom-commands'.
This is mostly for hacking and trying a new command - once the command