Mercurial > emacs
changeset 87054:25de6f4a58d8
Merge remember-diary.el into remember.el
author | Michael Olson <mwolson@gnu.org> |
---|---|
date | Wed, 05 Dec 2007 01:16:38 +0000 |
parents | f767f1ba8301 |
children | 09f5a2d2bbcf |
files | doc/misc/ChangeLog doc/misc/remember.texi lisp/ChangeLog lisp/textmodes/remember-diary.el lisp/textmodes/remember.el |
diffstat | 5 files changed, 82 insertions(+), 95 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/misc/ChangeLog Tue Dec 04 22:41:47 2007 +0000 +++ b/doc/misc/ChangeLog Wed Dec 05 01:16:38 2007 +0000 @@ -1,3 +1,8 @@ +2007-12-05 Michael Olson <mwolson@gnu.org> + + * remember.texi (Diary): Remove "require" line for remember-diary.el. + Update documentation for `remember-diary-file'. + 2007-12-04 Michael Albinus <michael.albinus@gmx.de> * dbus.texi (Signals): Precise `dbus-register-signal'.
--- a/doc/misc/remember.texi Tue Dec 04 22:41:47 2007 +0000 +++ b/doc/misc/remember.texi Wed Dec 05 01:16:38 2007 +0000 @@ -350,7 +350,6 @@ @subheading Insinuation @lisp -(require 'remember-diary) (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) @end lisp @@ -358,6 +357,7 @@ @defopt remember-diary-file File for extracted diary entries. +If this is nil, then @code{diary-file} will be used instead." @end defopt @node Mailbox, Org, Diary, Backends
--- a/lisp/ChangeLog Tue Dec 04 22:41:47 2007 +0000 +++ b/lisp/ChangeLog Wed Dec 05 01:16:38 2007 +0000 @@ -1,3 +1,16 @@ +2007-12-05 Michael Olson <mwolson@gnu.org> + + * textmodes/remember.el: Merge contents of remember-diary.el here, + updating header. Add autoload cookie so that byte-compilation + works without warning. + (remember-diary-file): Default to nil, since diary might not yet + be loaded at this point, which would deny us access to diary-file. + (remember-diary-extract-entries): If remember-diary-file is nil, + then use diary-file instead. + + * textmodes/remember-diary.el: Remove, due to the issue of needing + the first 8 characters of a filename to be unique. + 2007-12-04 Michael Albinus <michael.albinus@gmx.de> * net/dbus.el (dbus-hash-table=): New defun.
--- a/lisp/textmodes/remember-diary.el Tue Dec 04 22:41:47 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -;;; remember-diary --- extracting diary information from buffers - -;; Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc. - -;; Author: Sacha Chua <sacha@free.net.ph> -;; Created: 24 Mar 2004 -;; Keywords: data memory todo pim diary -;; URL: http://gna.org/projects/remember-el/ - -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: - -;; This module recognizes entries of the form -;; -;; DIARY: .... -;; -;; and puts them in your ~/.diary (or remember-diary-file) together -;; with an annotation. Planner-style dates (yyyy.mm.dd) are converted -;; to yyyy-mm-dd so that diary can understand them. -;; -;; For example: -;; -;; DIARY: 2003.08.12 Sacha's birthday -;; -;; is stored as -;; -;; 2003.08.12 Sacha's birthday [[/home/sacha/notebook/emacs/emacs-wiki/remember-diary.el]] -;; -;; To use, add the following to your .emacs: -;; -;; (require 'remember-diary) -;; ;; This should be before other entries that may return t -;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) -;; - -(require 'remember) -(require 'diary-lib) - -;;; Code: -(defcustom remember-diary-file diary-file - "*File for extracted diary entries." - :type 'file - :group 'remember) - -(defun remember-diary-convert-entry (entry) - "Translate MSG to an entry readable by diary." - (save-match-data - (when remember-annotation - (setq entry (concat entry " " remember-annotation))) - (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" entry) - (replace-match - (if european-calendar-style - (concat (match-string 3 entry) "/" - (match-string 2 entry) "/" - (match-string 1 entry)) - (concat (match-string 2 entry) "/" - (match-string 3 entry) "/" - (match-string 1 entry))) - t t entry) - entry))) - -;;;###autoload -(defun remember-diary-extract-entries () - "Extract diary entries from the region." - (save-excursion - (goto-char (point-min)) - (let (list) - (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t) - (add-to-list 'list (remember-diary-convert-entry (match-string 1)))) - (when list - (make-diary-entry (mapconcat 'identity list "\n") - nil remember-diary-file)) - nil))) ;; Continue processing - -(provide 'remember-diary) - -;; arch-tag: bda8a3f8-9a9b-46aa-8493-d71d7f1e445d -;;; remember-diary.el ends here
--- a/lisp/textmodes/remember.el Tue Dec 04 22:41:47 2007 +0000 +++ b/lisp/textmodes/remember.el Wed Dec 05 01:16:38 2007 +0000 @@ -153,6 +153,29 @@ ;; Faridu'd-Din `Attar wrote: "Be occupied as little as possible with ;; things of the outer world but much with things of the inner world; ;; then right action will overcome inaction." +;; +;; * Diary integration +;; +;; To use, add the following to your .emacs: +;; +;; ;; This should be before other entries that may return t +;; (add-to-list 'remember-handler-functions 'remember-diary-extract-entries) +;; +;; This module recognizes entries of the form +;; +;; DIARY: .... +;; +;; and puts them in your ~/.diary (or remember-diary-file) together +;; with an annotation. Dates in the form YYYY.MM.DD are converted to +;; YYYY-MM-DD so that diary can understand them. +;; +;; For example: +;; +;; DIARY: 2003.08.12 Sacha's birthday +;; +;; is stored as +;; +;; 2003.08.12 Sacha's birthday ;;; History: @@ -440,6 +463,46 @@ (kill-buffer (current-buffer)) (jump-to-register remember-register))) +;;; Diary integration + +(defcustom remember-diary-file nil + "*File for extracted diary entries. +If this is nil, then `diary-file' will be used instead." + :type 'file + :group 'remember) + +(defun remember-diary-convert-entry (entry) + "Translate MSG to an entry readable by diary." + (save-match-data + (when remember-annotation + (setq entry (concat entry " " remember-annotation))) + (if (string-match "\\([0-9]+\\)\\.\\([0-9]+\\)\\.\\([0-9]+\\)" entry) + (replace-match + (if european-calendar-style + (concat (match-string 3 entry) "/" + (match-string 2 entry) "/" + (match-string 1 entry)) + (concat (match-string 2 entry) "/" + (match-string 3 entry) "/" + (match-string 1 entry))) + t t entry) + entry))) + +(autoload 'make-diary-entry "diary-lib") + +;;;###autoload +(defun remember-diary-extract-entries () + "Extract diary entries from the region." + (save-excursion + (goto-char (point-min)) + (let (list) + (while (re-search-forward "^DIARY:\\s-*\\(.+\\)" nil t) + (add-to-list 'list (remember-diary-convert-entry (match-string 1)))) + (when list + (make-diary-entry (mapconcat 'identity list "\n") + nil (or remember-diary-file diary-file))) + nil))) ;; Continue processing + ;;; Internal Functions: (defvar remember-mode-map