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

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