emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juraj Kubelka <juraj.kubelka@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Feature request: another Org file for anniversary entries
Date: Fri, 14 Jan 2011 11:44:21 +0100	[thread overview]
Message-ID: <AANLkTinomfkWwwDJ_W3475s1S1fpeCnhqegqOHA2n9A_@mail.gmail.com> (raw)


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

             reply	other threads:[~2011-01-14 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-14 10:44 Juraj Kubelka [this message]
2011-01-14 15:17 ` Feature request: another Org file for anniversary entries Giovanni Ridolfi
2011-01-14 15:45   ` Juraj Kubelka
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=AANLkTinomfkWwwDJ_W3475s1S1fpeCnhqegqOHA2n9A_@mail.gmail.com \
    --to=juraj.kubelka@gmail.com \
    --cc=emacs-orgmode@gnu.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).