emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] planner-diary code mod: Adding option to include da


From: Raymond Zeitler
Subject: [emacs-wiki-discuss] planner-diary code mod: Adding option to include date in Diary section
Date: Wed, 23 Feb 2005 16:58:26 -0500

Hi Sacha:

I like my day page's diary section to look just like a fancy diary
entry.  So rather than comment out the code that skips over the date
every time I upgrade planner, I thought I'd code in an option to allow
for it to appear.

This minor contribution involves adding a new variable and changing a
few lines in planner-diary-get-diary-entries.  It's based on version
2005.01.28-20.38-stable.  (I thought if I used "unless" ISO "if" the
code would be more elegant.  But I couldn't get "unless" to work since
it would return nil when the variable was true.)

I don't use a diff utility, so I hope the following makes sense:

+ (defcustom planner-diary-include-date-in-day-page nil
+ "Non-nil means don't omit date when copying diary entry into day
page."
+  :type 'boolean
+  :group 'planner-diary)

        (setq entries
              (if (= (point-max) 1)
                  "No entries"
                (buffer-substring
                 (if (> no-of-days 1)   ; if more than 1 day, show
everything
                     (progn
                       (while (re-search-forward "^=+$" nil t)
                         (replace-match
                          (make-string (length (match-string 0)) ?-)))
                       (point-min))
-                   ;; remove date and lots of =s if just for 1 day
-                   (progn (goto-char (point-min))
-                          (search-forward-regexp "^=+$") ; one or more
=
-                          (1+ (point))))
+                   (progn 
+                     (if planner-diary-include-date-in-day-page
+                         (goto-char (point-min))
+                       (progn (goto-char (point-min))
+                              ;; remove date and lots of =s if just for
1 day
+                              (search-forward-regexp "^=+$") ; one or
more =
+                              (1+ (point))))))                 ;;
remove final newline
                 (progn
                   (goto-char (point-max))
                   (when (bolp) (backward-char 1))
                   (point)))))
        (kill-buffer fancy-diary-buffer)
        entries))))


--
Raymond Zeitler <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]