From: Carsten Dominik <carsten.dominik@gmail.com>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Canonical way to check if an org file is an agenda file?
Date: Tue, 25 May 2010 16:35:41 +0200 [thread overview]
Message-ID: <F1B0A9E3-6B50-4096-AE5B-02A053EFA9A3@gmail.com> (raw)
In-Reply-To: <87vdacp1hi.fsf@thinkpad.tsdh.de>
On May 25, 2010, at 3:14 PM, Tassilo Horn wrote:
> 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.
Sure, this would be useful.
- Carsten
>
> Bye,
> Tassilo
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
- Carsten
prev parent reply other threads:[~2010-05-25 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F1B0A9E3-6B50-4096-AE5B-02A053EFA9A3@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=tassilo@member.fsf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).