emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Feature request: another Org file for anniversary entries
@ 2011-01-14 10:44 Juraj Kubelka
  2011-01-14 15:17 ` Giovanni Ridolfi
  0 siblings, 1 reply; 5+ messages in thread
From: Juraj Kubelka @ 2011-01-14 10:44 UTC (permalink / raw)
  To: emacs-orgmode


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

I would like to add anniversary entries to another Org file then other
diaries. Would it be possible? There is a suggested patch in the attachment.

Thank you a lot,
Jura

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

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

diff --git a/.emacs.d/add-ons/org-agenda.el b/.emacs.d/add-ons/org-agenda.el
index 6bcbf62..b81562d 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,16 @@ 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 (org-agenda-anniversary-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 +7552,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

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

* Re: Feature request: another Org file for anniversary entries
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Ridolfi @ 2011-01-14 15:17 UTC (permalink / raw)
  To: Juraj Kubelka; +Cc: emacs-orgmode

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 ;-)

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

* Re: Feature request: another Org file for anniversary entries
  2011-01-14 15:17 ` Giovanni Ridolfi
@ 2011-01-14 15:45   ` Juraj Kubelka
  2011-02-11 12:25     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Juraj Kubelka @ 2011-01-14 15:45 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode


[-- 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

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

* Re: Feature request: another Org file for anniversary entries
  2011-01-14 15:45   ` Juraj Kubelka
@ 2011-02-11 12:25     ` Bastien
  2011-02-15  9:25       ` Juraj Kubelka
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2011-02-11 12:25 UTC (permalink / raw)
  To: Juraj Kubelka; +Cc: emacs-orgmode

Hi Juraj,

thanks for the patch and the explanations.

Juraj Kubelka <juraj.kubelka@gmail.com> writes:

> So, my regular diary events are stored in main.org file and
> anniversaries in anniversary.org file.

Which lets you have two separate .ics files, one containing
anniversaries, the other one not containing them.

I still fail to understand what is needed that cannot be taken
care of by your settings.  

Thanks,

-- 
 Bastien

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

* Re: Feature request: another Org file for anniversary entries
  2011-02-11 12:25     ` Bastien
@ 2011-02-15  9:25       ` Juraj Kubelka
  0 siblings, 0 replies; 5+ messages in thread
From: Juraj Kubelka @ 2011-02-15  9:25 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


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

Hi Bastien,

I may mixed two thinks I supposed to achieve.

1. to be able to export anniversaries in a separate .ics file. As you posted
recently, in a new org-mode release, it will be possible to use
`org-icalendar-honor-noexport-tag' customization. I have not tried yet, but
it should work. So, this is likely not the case right now.

2. I have a lot of anniversaries and I want to store new items (by pressing
"i a" in Org Agenda buffer) to a different .org file. I do not want to have
them in the same file as the other diary entries (by pressing "i d" o "i
b"). Are there any settings I can use for the purpose? Maybe I missed
something.

Thank you in advance,
Juraj

On Fri, Feb 11, 2011 at 1:25 PM, Bastien <bastien.guerry@wikimedia.fr>wrote:

> Hi Juraj,
>
> thanks for the patch and the explanations.
>
> Juraj Kubelka <juraj.kubelka@gmail.com> writes:
>
> > So, my regular diary events are stored in main.org file and
> > anniversaries in anniversary.org file.
>
> Which lets you have two separate .ics files, one containing
> anniversaries, the other one not containing them.
>
> I still fail to understand what is needed that cannot be taken
> care of by your settings.
>
> Thanks,
>
> --
>  Bastien
>

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

[-- Attachment #2: 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

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

end of thread, other threads:[~2011-02-15  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2011-02-11 12:25     ` Bastien
2011-02-15  9:25       ` Juraj Kubelka

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).