all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Canonical way to check if an org file is an agenda file?
@ 2010-05-25 13:14 Tassilo Horn
  2010-05-25 14:35 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Tassilo Horn @ 2010-05-25 13:14 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I use org files for anything I once used plain text files, so that I can
use all org features.

Unfortunately, for my agenda files I do some additional work.  For
example, I export my agenda files to iCalendar and show them with
KOrganizer.  And I update the list of appointments.

To do that, I add some functions to `after-save-hook' in org-mode
buffers, if that file is an agenda file.  But the test that checks if
`buffer-file-name' is an agenda file is very fragile and only matches my
current setup (`org-agenda-files' is a list of exactly one directory).

So is there a canonical way to check if a file is an agenda file,
something like `org-agenda-file-p'?

Argh, after writing this, I've discovered the function
`org-agenda-files', which can be used to write such a predicate.  So how
about something like this?

--8<---------------cut here---------------start------------->8---
(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)))
--8<---------------cut here---------------end--------------->8---

If we agree that this is useful, I can wrap up a git patch this evening.
Of course, you can also add that code on your own and add a meaningful
log entry.

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-25 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25 13:14 Canonical way to check if an org file is an agenda file? Tassilo Horn
2010-05-25 14:35 ` Carsten Dominik

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.