emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juraj Kubelka <juraj.kubelka@gmail.com>
To: Giovanni Ridolfi <giovanni.ridolfi@yahoo.it>
Cc: emacs-orgmode@gnu.org
Subject: Re: Feature request: another Org file for anniversary entries
Date: Fri, 14 Jan 2011 16:45:08 +0100	[thread overview]
Message-ID: <AANLkTi=tgFa4AHONFCBTLDdtpDFgHGuWzUtt8ZNdzoNt@mail.gmail.com> (raw)
In-Reply-To: <83y66nfrbn.fsf@yahoo.it>


[-- Attachment #1.1: Type: text/plain, Size: 1643 bytes --]

Hi Gionanni,

As I understand code in org-agenda-add-entry-to-org-agenda-diary-file
function, it search for "* Anniversaries" string in org-agenda-diary-file
file. It is the same file, where other events ("i d" (day), "i b" (block))
are inserted. But I would like to paste anniversaries to another org mode
file. The reason is, org-agenda-diary-file org file is exported to iCalendar
format and published to my mobile device. Here, I do not want to have these
anniversaries. I want to export anniversaries to another iCalendar file,
which is not published to my mobile device, but is imported by another
tools.

So, my patch introduces a new custom variable org-agenda-anniversary-entry,
which enables this feature. So, my regular diary events are stored in
main.org file and anniversaries in anniversary.org file.

Is it clear right now? Because it does not seem to me, your suggestion
solves me problem.

Regards,
Juraj

PS: Sorry, the first patch is missing a peace of code, the second one should
be right and complete.

On Fri, Jan 14, 2011 at 4:17 PM, Giovanni Ridolfi <giovanni.ridolfi@yahoo.it
> wrote:

> Juraj Kubelka <juraj.kubelka@gmail.com> writes:
>
> Hi, Juraj,
>
> > I would like to add anniversary entries to another Org file then other
> > diaries. Would it be possible?
>
> Isn't the following "code" in an org-file (in the agenda-list) enough?
>
> ** Birthdays & anniversaries
> :PROPERTIES:
> :CATEGORY: Ann
> :END:
>                    month day [1]
> %%(diary-anniversary  01 11 1956) John's Birthday  (%d yo)
>
> If not, would you, please, elaborate?
>
> cheers,
> Giovanni
> [1] you can also use day month syntax ;-)
>

[-- Attachment #1.2: Type: text/html, Size: 2307 bytes --]

[-- Attachment #2: patch.diff --]
[-- Type: application/octet-stream, Size: 3308 bytes --]

diff --git a/.emacs.d/add-ons/org-agenda.el b/.emacs.d/add-ons/org-agenda.el
index 6bcbf62..c692ca0 100644
--- a/.emacs.d/add-ons/org-agenda.el
+++ b/.emacs.d/add-ons/org-agenda.el
@@ -7410,7 +7410,8 @@ buffer, display it in another window."
 	  (t (message "No running clock, use `C-c C-x C-j' to jump to the most recent one")))))
 
 (defun org-agenda-diary-entry-in-org-file ()
-  "Make a diary entry in the file `org-agenda-diary-file'."
+  "Make a diary entry in the file `org-agenda-diary-file' or
+anniversary entry in `org-agenda-anniversary-file'."
   (let (d1 d2 char (text "") dp1 dp2)
     (if (equal (buffer-name) "*Calendar*")
 	(setq d1 (calendar-cursor-to-date t)
@@ -7469,12 +7470,18 @@ top-level    as top-level entries at the end of the file."
 
 (defun org-agenda-add-entry-to-org-agenda-diary-file (type text &optional d1 d2)
   "Add a diary entry with TYPE to `org-agenda-diary-file'.
+For TYPE equal to `anniversary', a diary entry is added to
+`org-agenda-anniversary-file'.
 If TEXT is not empty, it will become the headline of the new entry, and
 the resulting entry will not be shown.  When TEXT is empty, switch to
-`org-agenda-diary-file' and let the user finish the entry there."
-  (let ((cw (current-window-configuration)))
+`org-agenda-diary-file'/`org-agenda-anniversary-file' and let the user
+finish the entry there."
+  (let ((cw (current-window-configuration))
+        (of (if (eq type 'anniversary) 
+                (org-agenda-anniversary-file)
+              org-agenda-diary-file)))
     (org-switch-to-buffer-other-window
-     (find-file-noselect org-agenda-diary-file))
+     (find-file-noselect of))
     (widen)
     (goto-char (point-min))
     (cond
@@ -7547,7 +7554,7 @@ the resulting entry will not be shown.  When TEXT is empty, switch to
 	  (set-window-configuration cw)
 	  (message "%s entry added to %s"
 		   (capitalize (symbol-name type))
-		   (abbreviate-file-name org-agenda-diary-file)))
+		   (abbreviate-file-name of)))
       (org-reveal t)
       (message "Please finish entry here"))))
 
diff --git a/.emacs.d/add-ons/org.el b/.emacs.d/add-ons/org.el
index eb91968..7eab905 100644
--- a/.emacs.d/add-ons/org.el
+++ b/.emacs.d/add-ons/org.el
@@ -3112,6 +3112,24 @@ points to a file, `org-agenda-diary-entry' will be used instead."
 	  (const :tag "The standard Emacs diary file" diary-file)
 	  (file :tag "Special Org file diary entries")))
 
+(defcustom org-agenda-anniversary-file 'org-agenda-diary-file
+  "File to which to add new anniversary entries with the `i' key
+followed by `a' key in agenda and calendar.  When this is the
+symbol `org-agenda-diary-entry', the functionality in the Emacs
+calendar will be used to add entries to the
+`org-agenda-diary-entry'.  But when this points to a file,
+`org-agenda-anniversary-entry' will be used instead."
+  :group 'org-agenda
+  :type '(choice
+	  (const :tag "Same Org file as for other new entries" org-agenda-diary-file)
+	  (file :tag "Another Org file anniversary entries")))
+
+(defun org-agenda-anniversary-file ()
+  "Return real file name."
+  (if (eq org-agenda-anniversary-file 'org-agenda-diary-file)
+      org-agenda-diary-file
+    org-agenda-anniversary-file))
+
 (eval-after-load "calendar"
   '(progn
      (org-defkey calendar-mode-map org-calendar-to-agenda-key

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

  reply	other threads:[~2011-01-14 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 10:44 Feature request: another Org file for anniversary entries Juraj Kubelka
2011-01-14 15:17 ` Giovanni Ridolfi
2011-01-14 15:45   ` Juraj Kubelka [this message]
2011-02-11 12:25     ` Bastien
2011-02-15  9:25       ` Juraj Kubelka

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='AANLkTi=tgFa4AHONFCBTLDdtpDFgHGuWzUtt8ZNdzoNt@mail.gmail.com' \
    --to=juraj.kubelka@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=giovanni.ridolfi@yahoo.it \
    /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).