unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* update date in diary
@ 2002-09-12 22:53 Randy Zelick
  0 siblings, 0 replies; 11+ messages in thread
From: Randy Zelick @ 2002-09-12 22:53 UTC (permalink / raw)



Hello there,

I was wondering if there is a way to replace a typed-in date in my diary
file with a variable that is the current date.

I have a small to-do list that I like to keep in my diary file. Every 
morning I change the date so that these few lines from the diary file 
appear in my fancy diary window, which shows various appointments for that 
day.

Of course, it would be handy if the to-do list would follow automatically 
the current date.

Thanks!

=Randy=

P.S. Sorry, but this may be a duplicate message!

-- 
R. Zelick				email: zelickr@pdx.edu
Department of Biology			voice: 503-725-3086
Portland State University		fax:   503-725-3888

mailing:
P.O. Box 751
Portland, OR 97207

shipping:
1719 SW 10th Ave, Room 246
Portland, OR 97201

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
       [not found] <mailman.1031871312.16859.help-gnu-emacs@gnu.org>
@ 2002-09-13  1:23 ` Edward M. Reingold
  2002-09-13 14:51   ` Kai Großjohann
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Edward M. Reingold @ 2002-09-13  1:23 UTC (permalink / raw)
  Cc: zelickr

>>>>> "RZ" == Randy Zelick <zelickr@biohazard.pdx.edu> writes:

    RZ> I was wondering if there is a way to replace a typed-in date in my
    RZ> diary file with a variable that is the current date.

There is no such function, but you can do it with a diary sexp:

    %%(equal date (calendar-current-date)) Blah blah blah

-- 

Professor Edward M. Reingold                Email: reingold@iit.edu
Chairman, Department of Computer Science    Voice: (312) 567-3309
Illinois Institute of Technology            Assistant: (312) 567-5152
Stuart Building                             Fax:   (312) 567-5067
10 West 31st Street, Suite 236
Chicago, IL  60616-3729  U.S.A.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-13  1:23 ` update date in diary Edward M. Reingold
@ 2002-09-13 14:51   ` Kai Großjohann
  2002-09-16  1:02     ` Kenneth Jacker
  2002-09-13 14:52   ` Stefan Monnier <foo@acm.com>
  2002-09-13 17:49   ` Randy Zelick
  2 siblings, 1 reply; 11+ messages in thread
From: Kai Großjohann @ 2002-09-13 14:51 UTC (permalink / raw)


reingold@emr.cs.iit.edu (Edward M. Reingold) writes:

>>>>>> "RZ" == Randy Zelick <zelickr@biohazard.pdx.edu> writes:
>
>     RZ> I was wondering if there is a way to replace a typed-in date in my
>     RZ> diary file with a variable that is the current date.
>
> There is no such function, but you can do it with a diary sexp:
>
>     %%(equal date (calendar-current-date)) Blah blah blah

In fact recent Emacsen come with a package todo-mode.el which does
just this.  It allows you to manage your todo items and then arranges
for them to be displayed in the Calendar.  (But you need to use the
fancy display, not the simple display.)

kai
-- 
~/.signature is: umop 3p!sdn    (Frank Nobis)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-13  1:23 ` update date in diary Edward M. Reingold
  2002-09-13 14:51   ` Kai Großjohann
@ 2002-09-13 14:52   ` Stefan Monnier <foo@acm.com>
  2002-09-13 17:49   ` Randy Zelick
  2 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-09-13 14:52 UTC (permalink / raw)


RZ> I was wondering if there is a way to replace a typed-in date in my
RZ> diary file with a variable that is the current date.
> There is no such function, but you can do it with a diary sexp:
>     %%(equal date (calendar-current-date)) Blah blah blah

I also like to have todo lists and merge them with my diary in that way.
Maybe calendar should support it "natively" ?
It could also do things like "add a todo entry `pay the rent' every month".


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-13  1:23 ` update date in diary Edward M. Reingold
  2002-09-13 14:51   ` Kai Großjohann
  2002-09-13 14:52   ` Stefan Monnier <foo@acm.com>
@ 2002-09-13 17:49   ` Randy Zelick
  2 siblings, 0 replies; 11+ messages in thread
From: Randy Zelick @ 2002-09-13 17:49 UTC (permalink / raw)


Thanks for the several suggestions. I tried the simple solution by Edward 
Reingold, and it works just fine like this:

     %%(equal date (calendar-current-date))
      .
      to-do list:
      .
      here is my first thing
      and now for my second
      .

These show up in my fancy diary automatically. The dots are just my device 
for separating this list from other day-specific appointments set in my 
diary.

Cheers,

=Randy=

-- 
R. Zelick				email: zelickr@pdx.edu
Department of Biology			voice: 503-725-3086
Portland State University		fax:   503-725-3888

mailing:
P.O. Box 751
Portland, OR 97207

shipping:
1719 SW 10th Ave, Room 246
Portland, OR 97201

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
       [not found] <mailman.1031939415.20318.help-gnu-emacs@gnu.org>
@ 2002-09-14 16:18 ` bruce ingalls
  2002-09-15  2:54   ` Edward M. Reingold
  0 siblings, 1 reply; 11+ messages in thread
From: bruce ingalls @ 2002-09-14 16:18 UTC (permalink / raw)


I liked this thread on calendars so much, that I am
making it the welcome screen on future versions of my
EMacro project <url: http://emacro.sf.net/ >

Here is the code I have combined, so far:
(more discussion, below)

;;__________________________________________________________________________
;;;;;; 
	Calendar

(defgroup e-common nil "Settings from e-common.el file." :group 'emacs)

(defcustom mark-diary-entries-in-calendar t
   "This takes effect when you invoke 'M-x calendar'."
   :group 'e-common
   :type 'boolean)
(defcustom mark-holidays-in-calendar t "Display holidays."
  :group 'e-common
  :type 'boolean)

(defcustom calendar-startup t "Display diary when starting Emacs."
   :group 'e-common
   :type 'boolean)

(defconst diary-display-hook 'fancy-diary-display)
(setq today-visible-calendar-hook 'calendar-mark-today)
;;(setq calendar-setup 'one-frame)	;ToDo: errors on Emacs v21.2.1
(autoload 'calendar "calendar" "Display 3-month calendar." t)

;;Is this actually useful?
;;(setq calendar-latitude 40.7)		;New York City
;;(setq calendar-longitude -73.9)	;New York City, EDT

;;Doesn't seem to do anything
(require 'appt)
(appt-check)

;;(add-hook 'diary-hook 'appt-make-list)
(when calendar-startup
   (let ((inhibit-redisplay t))
;;    (save-window-excursion
       (calendar)
       (if (file-exists-p diary-file)
	  (progn
	    (mark-diary-entries)
	    (diary)))
;; 
(holidays)
	))
;;__________________________________________________________________________

I am still wrestling with the defcustom() statements; you may wish to 
replace them with setq()s.
I want to provide users with easy M-x customizability. While I should 
put most of the defcustom() statements as custom-set-value()s at the end 
of my .emacs (system), I need their values for this to execute. It seems 
  that shadowing a copy of them is the best compromise.

I also liked it, when the calendar (when run in X or other Window) 
popped up in a separate frame. I'm happy for someone to save me time, 
puzzling how to get that back.

Ideally, I'd like the calendar & holidays to appear in one frame. If 
diary-file exists, I'd like diary, too. I tried
	(setq calendar-setup 'one-frame)
but this caused errors in Emacs v21.2.1, running on Linux. The default 
of nil works fine, except when I add holidays to the mix.

Finally, since this is the opening screen, I'd like a message to new 
users, explaining that they can use C-x 1 to unsplit the buffers.
This could appear in the scratch buffer.

This would only be necessary for console mode, if I get Calendar to pop 
up in a new frame in window mode.

Finally, I'd also like appt-check to pop up any outstanding 
appointments. I could not get that to work.

Thanks ahead to everyone for your help!
-Bruce

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-14 16:18 ` bruce ingalls
@ 2002-09-15  2:54   ` Edward M. Reingold
  2002-09-15 14:29     ` bruce ingalls
  0 siblings, 1 reply; 11+ messages in thread
From: Edward M. Reingold @ 2002-09-15  2:54 UTC (permalink / raw)
  Cc: bingalls

>>>>> "bi" == bruce ingalls <bingalls@fit-zones.NO-SPAM.com> writes:

    bi> ;;Is this actually useful?  ;;(setq calendar-latitude 40.7) ;New York
    bi> City ;;(setq calendar-longitude -73.9) ;New York City, EDT

They are needed to get times of sunrise/sunset for your locale (but you also
need calendar-time-zone, calendar-standard-time-zone-name, and
calendar-daylight-time-zone-name).  These variables particpate in other things
as weel (lunar phase times, for example).

    bi> ;;Doesn't seem to do anything (require 'appt) (appt-check)

    bi> Ideally, I'd like the calendar & holidays to appear in one frame. If
    bi> diary-file exists, I'd like diary, too. I tried (setq calendar-setup
    bi> 'one-frame) but this caused errors in Emacs v21.2.1, running on
    bi> Linux. The default of nil works fine, except when I add holidays to
    bi> the mix.

I will track down the problem if you can be more specific--I don't use Linux,
nor have I switched to v. 21 yet.

-- 

Professor Edward M. Reingold                Email: reingold@iit.edu
Chairman, Department of Computer Science    Voice: (312) 567-3309
Illinois Institute of Technology            Assistant: (312) 567-5152
Stuart Building                             Fax:   (312) 567-5067
10 West 31st Street, Suite 236
Chicago, IL  60616-3729  U.S.A.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-15  2:54   ` Edward M. Reingold
@ 2002-09-15 14:29     ` bruce ingalls
  2002-09-16 13:38       ` Stefan Monnier <foo@acm.com>
  0 siblings, 1 reply; 11+ messages in thread
From: bruce ingalls @ 2002-09-15 14:29 UTC (permalink / raw)


Prof. Reingold-
Thanks for the help.

Here is the problem:
It looks like (setq calendar-setup one-frame) is the nice popup I was 
looking for.
Here is the minimal (temporary) .emacs that causes the problem:
[-debug-init errors follow]

(defconst diary-display-hook 'fancy-diary-display)
(setq calendar-setup 'one-frame)
(calendar)

I'll likely solve this, by just removing
(defconst diary-display-hook 'fancy-diary-display)

The remaining issue, is that I'd like to display the calendar, diary and 
(future only) holidays all in one frame. Currently, holidays display in 
a separate frame.

I'm not sure how to get appt.el working. I read the C-h f help for 
appt-check, but nothing happened. Perhaps I don't know what I should 
expect to happen.

Here is the results of emacs -debug-init:

Debugger entered--Lisp error: (wrong-type-argument listp 
fancy-diary-display)
   byte-code("S(Æ\b!\x11ÇÈ!^É	!^ÊËÌ	!\"AÍ=f\x1c

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-13 14:51   ` Kai Großjohann
@ 2002-09-16  1:02     ` Kenneth Jacker
  0 siblings, 0 replies; 11+ messages in thread
From: Kenneth Jacker @ 2002-09-16  1:02 UTC (permalink / raw)


  kai> In fact recent Emacsen come with a package todo-mode.el which
  kai> does just this.  It allows you to manage your todo items and
  kai> then arranges for them to be displayed in the Calendar.  (But
  kai> you need to use the fancy display, not the simple display.)

I thought I'd give "todo-mode" a try.  But, I still can't make the
"todo" entries  show up in the calendar ...  note that I've been using
the calendar/diary package itself for many years ... nice!

Here's what I'm doing with emacs-21.2.1.  Among other things, my
.emacs contains:

    (setq diary-file "~/.diary")
    (add-hook 'diary-display-hook  'fancy-diary-display)

The first line of my ".diary" file is:

    #include "~/.todo-do"     { also tried "/home/khj/.todo-do" }

And the above file contains:

    -*- mode: todo; todo-categories: ("Todo" "Todo" "Todo"); -*-
    */* --- Todo
    */* 2002-09-15 20:32 khj: get todo-mode to work!
    --- End
    */*
    ---------------------------------------------------------------------------

Typing "M-x calendar", however, shows my ".diary" entries just as before.

Shouldn't I see the "get todo-mode to work!" as well?


Most likely I'm just forgetting something (though I have read 'info'
pages and the "todo-mode.el" source).

Thanks for any help,

  -Kenneth

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-15 14:29     ` bruce ingalls
@ 2002-09-16 13:38       ` Stefan Monnier <foo@acm.com>
  2002-09-16 20:36         ` bruce ingalls
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-09-16 13:38 UTC (permalink / raw)


> (defconst diary-display-hook 'fancy-diary-display)

- the value of `diary-display-hook' is clearly not meant to be cast in
  stone, so why do you declare it as a constant ?

- `defconst' and `defvar' should only be used to define the variable
  in its home package.  So `defconst' is wrong here.

- hooks should only be manipulated via add-hook/remove-hook.


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: update date in diary
  2002-09-16 13:38       ` Stefan Monnier <foo@acm.com>
@ 2002-09-16 20:36         ` bruce ingalls
  0 siblings, 0 replies; 11+ messages in thread
From: bruce ingalls @ 2002-09-16 20:36 UTC (permalink / raw)




Stefan Monnier wrote:
>>(defconst diary-display-hook 'fancy-diary-display)
> 
> 
> - the value of `diary-display-hook' is clearly not meant to be cast in
>   stone, so why do you declare it as a constant ?

Hm. This was some old code I had.
FWIW, replacing defconst() with add-hook() did not solve the problem.
Thanks for the knowledge.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-09-16 20:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1031871312.16859.help-gnu-emacs@gnu.org>
2002-09-13  1:23 ` update date in diary Edward M. Reingold
2002-09-13 14:51   ` Kai Großjohann
2002-09-16  1:02     ` Kenneth Jacker
2002-09-13 14:52   ` Stefan Monnier <foo@acm.com>
2002-09-13 17:49   ` Randy Zelick
     [not found] <mailman.1031939415.20318.help-gnu-emacs@gnu.org>
2002-09-14 16:18 ` bruce ingalls
2002-09-15  2:54   ` Edward M. Reingold
2002-09-15 14:29     ` bruce ingalls
2002-09-16 13:38       ` Stefan Monnier <foo@acm.com>
2002-09-16 20:36         ` bruce ingalls
2002-09-12 22:53 Randy Zelick

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