summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTassilo Horn <tassilo@member.fsf.org>2010-05-26 02:21:55 +0000
committerJohn Wiegley <johnw@newartisans.com>2010-05-26 22:46:34 -0600
commit54d513ee0c90f9864bbd39044d9dfbc4f1619513 (patch)
treede893c8f7a91bdcd7d61a7b69e9b00d979e492ba
parent6fc2ea3b9b36eeaf6f3b315cc09cbe1209468fa0 (diff)
downloadorg-mode-54d513ee0c90f9864bbd39044d9dfbc4f1619513.tar.gz
org.el (org-agenda-file-p): New predicate function.
The new function `org-agenda-file-p' checks if a given file is an org agenda file. Such a function is very useful in hooks, for example if you want to export agenda files automatically when saving: (defun th-org-mode-init () ;; Update appointments and export to iCalendar when saving. (when (org-agenda-file-p) (add-hook 'after-save-hook 'th-org-agenda-to-appt t t) (add-hook 'after-save-hook 'org-export-icalendar-this-file t t))) (add-hook 'org-agenda-mode-hook 'th-org-agenda-mode-init)
-rw-r--r--lisp/org.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 8ed2454..c1d0078 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15045,6 +15045,13 @@ used by the agenda files. If ARCHIVE is `ifmode', do this only if
(setq files (org-add-archive-files files)))
files))
+(defun org-agenda-file-p (&optional file)
+ "Return non-nil, if FILE is an agenda file.
+If FILE is omitted, use the file associated with the current
+buffer."
+ (member (or file (buffer-file-name))
+ (org-agenda-files t)))
+
(defun org-edit-agenda-file-list ()
"Edit the list of agenda files.
Depending on setup, this either uses customize to edit the variable