aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/cal-xtra.texi14
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/calendar/diary-lib.el40
5 files changed, 65 insertions, 2 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index efe031d465b..dbb274360fd 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12011-05-06 Glenn Morris <rgm@gnu.org>
2
3 * cal-xtra.texi (Fancy Diary Display): Mention diary comments.
4
12011-05-02 Lars Magne Ingebrigtsen <larsi@gnus.org> 52011-05-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 6
3 * misc.texi (Emacs Server): Document `server-eval-at'. 7 * misc.texi (Emacs Server): Document `server-eval-at'.
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index b936636403a..4a51e9004fc 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -616,6 +616,20 @@ first within each day. Note how the sort command is placed at the end
616of the hook list, in case earlier members of the list change the order 616of the hook list, in case earlier members of the list change the order
617of the diary entries, or add items. 617of the diary entries, or add items.
618 618
619@vindex diary-comment-start
620 You can write @samp{comments} in diary entries, by setting the
621variables @code{diary-comment-start} and @code{diary-comment-end} to
622strings that delimit comments. The fancy display does not print
623comments. You might want to put meta-data for the use of other packages
624(e.g. the appointment package,
625@iftex
626@pxref{Appointments,,,emacs, the Emacs Manual})
627@end iftex
628@ifnottex
629@pxref{Appointments})
630@end ifnottex
631inside comments.
632
619@vindex diary-include-string 633@vindex diary-include-string
620 Your main diary file can include other files. This permits a group of 634 Your main diary file can include other files. This permits a group of
621people to share a diary file for events that apply to all of them. 635people to share a diary file for events that apply to all of them.
diff --git a/etc/NEWS b/etc/NEWS
index 5094ecfc4fc..61713c71fc8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -447,6 +447,10 @@ You can get a comparable behavior with:
447 447
448** Calendar, Diary, and Appt 448** Calendar, Diary, and Appt
449 449
450+++
451*** Diary entries can contain non-printing `comments'.
452See the variable `diary-comment-start'.
453
450*** New function `diary-hebrew-birthday'. 454*** New function `diary-hebrew-birthday'.
451 455
452--- 456---
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2b7830f8726..ef5e5422222 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12011-05-06 Glenn Morris <rgm@gnu.org> 12011-05-06 Glenn Morris <rgm@gnu.org>
2 2
3 * calendar/diary-lib.el (diary-comment-start, diary-comment-end):
4 New options.
5 (diary-add-to-list): Strip comments from the displayed string.
6 (diary-mode): Set comment-start and comment-end.
7
3 * vc/diff-mode.el (smerge-refine-subst): Declare. 8 * vc/diff-mode.el (smerge-refine-subst): Declare.
4 (diff-refine-hunk): Don't require smerge-mode when compiling. 9 (diff-refine-hunk): Don't require smerge-mode when compiling.
5 10
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 43c0682277c..951b271b935 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -142,6 +142,25 @@ See the documentation for the function `diary-list-sexp-entries'."
142 :type 'string 142 :type 'string
143 :group 'diary) 143 :group 'diary)
144 144
145(defcustom diary-comment-start nil
146 "String marking the start of a comment in the diary, or nil.
147Nil means there are no comments. The diary does not display
148parts of entries that are inside comments. You can use comments
149for whatever you like, e.g. for meta-data that packages such as
150`appt.el' can use.
151See also `diary-comment-end'."
152 :version "24.1"
153 :type '(choice (const :tag "No comment" nil) string)
154 :group 'diary)
155
156(defcustom diary-comment-end ""
157 "String marking the end of a comment in the diary.
158The empty string means comments finish at the end of a line.
159See also `diary-comment-start'."
160 :version "24.1"
161 :type 'string
162 :group 'diary)
163
145(defcustom diary-hook nil 164(defcustom diary-hook nil
146 "List of functions called after the display of the diary. 165 "List of functions called after the display of the diary.
147Used for example by the appointment package - see `appt-activate'." 166Used for example by the appointment package - see `appt-activate'."
@@ -610,10 +629,15 @@ If LITERAL is nil, it is taken to be the same as STRING.
610 629
611The entry is added to the list as (DATE STRING SPECIFIER LOCATOR 630The entry is added to the list as (DATE STRING SPECIFIER LOCATOR
612GLOBCOLOR), where LOCATOR has the form (MARKER FILENAME LITERAL), 631GLOBCOLOR), where LOCATOR has the form (MARKER FILENAME LITERAL),
613FILENAME being the file containing the diary entry." 632FILENAME being the file containing the diary entry.
633
634Modifies STRING using `diary-modify-entry-list-string-function', if non-nil.
635Also removes the region between `diary-comment-start' and
636`diary-comment-end', if the former is non-nil."
614 (when (and date string) 637 (when (and date string)
615 ;; b-f-n is nil if we are visiting an include file in a temp-buffer. 638 ;; b-f-n is nil if we are visiting an include file in a temp-buffer.
616 (let ((dfile (or (buffer-file-name) diary-file))) 639 (let ((dfile (or (buffer-file-name) diary-file))
640 cstart)
617 (if diary-file-name-prefix 641 (if diary-file-name-prefix
618 (let ((prefix (funcall diary-file-name-prefix-function dfile))) 642 (let ((prefix (funcall diary-file-name-prefix-function dfile)))
619 (or (string-equal prefix "") 643 (or (string-equal prefix "")
@@ -621,6 +645,16 @@ FILENAME being the file containing the diary entry."
621 (and diary-modify-entry-list-string-function 645 (and diary-modify-entry-list-string-function
622 (setq string (funcall diary-modify-entry-list-string-function 646 (setq string (funcall diary-modify-entry-list-string-function
623 string))) 647 string)))
648 (when (and diary-comment-start
649 (string-match (setq cstart (regexp-quote diary-comment-start))
650 string))
651 ;; Preserve the value with the comments.
652 (or literal (setq literal string))
653 (setq string (replace-regexp-in-string
654 (format "%s.*%s" cstart
655 (if (zerop (length diary-comment-end)) "$"
656 (regexp-quote diary-comment-end)))
657 "" string)))
624 (setq diary-entries-list 658 (setq diary-entries-list
625 (append diary-entries-list 659 (append diary-entries-list
626 (list (list date string specifier 660 (list (list date string specifier
@@ -2353,6 +2387,8 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2353 "Major mode for editing the diary file." 2387 "Major mode for editing the diary file."
2354 (set (make-local-variable 'font-lock-defaults) 2388 (set (make-local-variable 'font-lock-defaults)
2355 '(diary-font-lock-keywords t)) 2389 '(diary-font-lock-keywords t))
2390 (set (make-local-variable 'comment-start) diary-comment-start)
2391 (set (make-local-variable 'comment-end) diary-comment-end)
2356 (add-to-invisibility-spec '(diary . nil)) 2392 (add-to-invisibility-spec '(diary . nil))
2357 (add-hook 'after-save-hook 'diary-redraw-calendar nil t) 2393 (add-hook 'after-save-hook 'diary-redraw-calendar nil t)
2358 ;; In case the file was modified externally, refresh the calendar 2394 ;; In case the file was modified externally, refresh the calendar