unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* emacs diary/calendar insert day (i-d)
@ 2002-11-05  0:57 mr.sparkle
  2002-11-05 18:36 ` Matthias Meulien
  2002-11-07 18:25 ` Edward M. Reingold
  0 siblings, 2 replies; 12+ messages in thread
From: mr.sparkle @ 2002-11-05  0:57 UTC (permalink / raw)


hello!

1. The command insert entry (i-d) for diary/calendar always places the
   new entry at the bottom of the .diary file. Is there a way to make
   it insert entries in cronological order?

2. If you make two separate entries for the same day, you get two
   separate entries in .diary. What I would like, is when you execute
   i-d a second time on the same day, point would be placed in .diary
   on that day, rather than at the bottom of the file.

thanks!

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

* Re: emacs diary/calendar insert day (i-d)
  2002-11-05  0:57 emacs diary/calendar insert day (i-d) mr.sparkle
@ 2002-11-05 18:36 ` Matthias Meulien
  2002-11-05 18:52   ` Alan Shutko
  2002-11-07 18:25 ` Edward M. Reingold
  1 sibling, 1 reply; 12+ messages in thread
From: Matthias Meulien @ 2002-11-05 18:36 UTC (permalink / raw)


happy@vole.com (mr.sparkle) wrote:

> 1. The command insert entry (i-d) for diary/calendar always places
> the new entry at the bottom of the .diary file. (...)

Note that it sometime places an empty line at the top of the file, so
it is impossible to specify local variables in the diary file...
-- 
Matthias

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

* Re: emacs diary/calendar insert day (i-d)
  2002-11-05 18:36 ` Matthias Meulien
@ 2002-11-05 18:52   ` Alan Shutko
  2002-11-09 19:46     ` Janusz S. Bień
       [not found]     ` <mailman.1036861638.12745.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 12+ messages in thread
From: Alan Shutko @ 2002-11-05 18:52 UTC (permalink / raw)


Matthias Meulien <meulien@club.lemonde.fr> writes:

> Note that it sometime places an empty line at the top of the file, so
> it is impossible to specify local variables in the diary file...

Until that gets fixed (on my list), you can use this:

(defvar ats-diary-file-list 
  `(,(expand-file-name diary-file)
    ,(expand-file-name "~/Library/diary-historical")
    ,(expand-file-name "~/Library/diary-anniversaries"))
  "List of diary files.")

(defun ats-fix-diary-top ()
  "Remove newlines at the top of the diary file when saving."
  (save-excursion
    (if (member buffer-file-name ats-diary-file-list)	       
	(progn
	  (goto-char (point-min))
	  (if (re-search-forward "\\`\n+" nil t)
	      (replace-match ""))))
    nil))

(add-hook 'write-file-hooks 'ats-fix-diary-top)


-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Moron President Found. (A)bort (R)etry (S)hoot

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

* Re: emacs diary/calendar insert day (i-d)
  2002-11-05  0:57 emacs diary/calendar insert day (i-d) mr.sparkle
  2002-11-05 18:36 ` Matthias Meulien
@ 2002-11-07 18:25 ` Edward M. Reingold
  2002-11-07 23:38   ` mr.sparkle
  1 sibling, 1 reply; 12+ messages in thread
From: Edward M. Reingold @ 2002-11-07 18:25 UTC (permalink / raw)


>>>>> "ms" == mr sparkle <happy@vole.com> writes:

    ms> hello!  1. The command insert entry (i-d) for diary/calendar always
    ms> places the new entry at the bottom of the .diary file. Is there a way
    ms> to make it insert entries in cronological order?

    ms> 2. If you make two separate entries for the same day, you get two
    ms> separate entries in .diary. What I would like, is when you execute i-d
    ms> a second time on the same day, point would be placed in .diary on that
    ms> day, rather than at the bottom of the file.

You would need to write your own version of `insert-diary-entry'.

-- 

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] 12+ messages in thread

* Re: emacs diary/calendar insert day (i-d)
  2002-11-07 18:25 ` Edward M. Reingold
@ 2002-11-07 23:38   ` mr.sparkle
  0 siblings, 0 replies; 12+ messages in thread
From: mr.sparkle @ 2002-11-07 23:38 UTC (permalink / raw)


On 07 Nov 2002, reingold@emr.cs.iit.edu wrote:
>>>>>> "ms" == mr sparkle <happy@vole.com> writes:
> 
>     ms> hello!  1. The command insert entry (i-d) for diary/calendar
>     ms> always places the new entry at the bottom of the .diary
>     ms> file. Is there a way to make it insert entries in
>     ms> cronological order?
> 
>     ms> 2. If you make two separate entries for the same day, you
>     ms> get two separate entries in .diary. What I would like, is
>     ms> when you execute i-d a second time on the same day, point
>     ms> would be placed in .diary on that day, rather than at the
>     ms> bottom of the file.
> 
> You would need to write your own version of `insert-diary-entry'.

That will be near the top of the list, when I master elisp!

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

* Re: emacs diary/calendar insert day (i-d)
  2002-11-05 18:52   ` Alan Shutko
@ 2002-11-09 19:46     ` Janusz S. Bień
       [not found]     ` <mailman.1036861638.12745.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Janusz S. Bień @ 2002-11-09 19:46 UTC (permalink / raw)
  Cc: help-gnu-emacs, Matthias Meulien

On Tue, 05 Nov 2002  Alan Shutko <ats@acm.org> wrote:

> Matthias Meulien <meulien@club.lemonde.fr> writes:
> 
> > Note that it sometime places an empty line at the top of the file, so
> > it is impossible to specify local variables in the diary file...

Not true, see below.

> 
> Until that gets fixed (on my list), you can use this:

[...]

Isn't it really needed?

What about using a local variables block at the end of the file?

Regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
http://www.orient.uw.edu.pl/~jsbien/
---------------------------------------------------------------------
Na tym koncie czytam i wysylam poczte i wiadomosci offline.
On this account I read/post mail/news offline.

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

* Re: emacs diary/calendar insert day (i-d)
       [not found]     ` <mailman.1036861638.12745.help-gnu-emacs@gnu.org>
@ 2002-11-10  1:53       ` Alan Shutko
  2002-11-10 10:26       ` Matthias Meulien
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Shutko @ 2002-11-10  1:53 UTC (permalink / raw)


jsbien@mimuw.edu.pl (Janusz S. Bień) writes:

> What about using a local variables block at the end of the file?

You know, I didn't think about that....

-- 
Alan Shutko <ats@acm.org> - In a variety of flavors!
Everything dries out, nothing unburns.....

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

* Re: emacs diary/calendar insert day (i-d)
       [not found]     ` <mailman.1036861638.12745.help-gnu-emacs@gnu.org>
  2002-11-10  1:53       ` Alan Shutko
@ 2002-11-10 10:26       ` Matthias Meulien
  2002-11-11 10:11         ` Janusz S. Bień
       [not found]         ` <mailman.1036999692.28763.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 12+ messages in thread
From: Matthias Meulien @ 2002-11-10 10:26 UTC (permalink / raw)


jsbien@mimuw.edu.pl (Janusz S. Bień) wrote:

> (...) What about using a local variables block at the end of the
> file?

The command  `insert-diary-entry' and similar functions insert their
entries at the end of the file. 
-- 
Matthias

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

* Re: emacs diary/calendar insert day (i-d)
  2002-11-10 10:26       ` Matthias Meulien
@ 2002-11-11 10:11         ` Janusz S. Bień
       [not found]         ` <mailman.1036999692.28763.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 12+ messages in thread
From: Janusz S. Bień @ 2002-11-11 10:11 UTC (permalink / raw)
  Cc: Alan Shutko, Matthias Meulien

On 10 Nov 2002  Matthias Meulien <meulien@club.lemonde.fr> wrote:

> jsbien@mimuw.edu.pl (Janusz S. Bień) wrote:
> 
> > (...) What about using a local variables block at the end of the
> > file?
> 
> The command  `insert-diary-entry' and similar functions insert their
> entries at the end of the file. 

Fortunately the local variable block doesn't need to be at the very
end of the file:

           The start of the local variables list must be no more than
        3000 characters from the end of the file, and must be in the
        last page if the file is divided into pages.

I hope the future versions of diary functions will take care of local
variables blocks.

Best regards

Janusz

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
http://www.orient.uw.edu.pl/~jsbien/
---------------------------------------------------------------------
Na tym koncie czytam i wysylam poczte i wiadomosci offline.
On this account I read/post mail/news offline.

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

* Re: emacs diary/calendar insert day (i-d)
       [not found]         ` <mailman.1036999692.28763.help-gnu-emacs@gnu.org>
@ 2002-11-11 15:08           ` Edward M. Reingold
  2002-11-11 17:23             ` Edward M. Reingold
  0 siblings, 1 reply; 12+ messages in thread
From: Edward M. Reingold @ 2002-11-11 15:08 UTC (permalink / raw)


>>>>> "JS=" == Janusz S =?iso-8859-2?q?Bie=F1?= <jsbien@mimuw.edu.pl> writes:

    JS=> I hope the future versions of diary functions will take care of local
    JS=> variables blocks.

Yes, that really is a bug.  I will try to see that it gets fixed soon.
-- 

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] 12+ messages in thread

* Re: emacs diary/calendar insert day (i-d)
  2002-11-11 15:08           ` Edward M. Reingold
@ 2002-11-11 17:23             ` Edward M. Reingold
  2002-11-13  5:11               ` mr.sparkle
  0 siblings, 1 reply; 12+ messages in thread
From: Edward M. Reingold @ 2002-11-11 17:23 UTC (permalink / raw)


>>>>> "EMR" == Edward M Reingold <reingold@emr.cs.iit.edu> writes:

     JS=> I hope the future versions of diary functions will take care of local
    JS=> variables blocks.

    EMR> Yes, that really is a bug.  I will try to see that it gets fixed
    EMR> soon.  --

Can somebody test this in Emacs 21 (which I don't use yet):

(defun make-diary-entry (string &optional nonmarking file)
  "Insert a diary entry STRING which may be NONMARKING in FILE.
If omitted, NONMARKING defaults to nil and FILE defaults to diary-file."
  (find-file-other-window
   (substitute-in-file-name (if file file diary-file)))
  (widen)
  (goto-char (point-max))
  (if (let ((case-fold-search t))
        (search-backward "Local Variables:"
                         (max (- (point-max) 3000) (point-min))
                         t))
      (progn
        (beginning-of-line)
        (insert "\n")
        (previous-line 1)))
  (insert
   (if (bolp) "" "\n")
   (if nonmarking diary-nonmarking-symbol "")
   string " "))

-- 

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] 12+ messages in thread

* Re: emacs diary/calendar insert day (i-d)
  2002-11-11 17:23             ` Edward M. Reingold
@ 2002-11-13  5:11               ` mr.sparkle
  0 siblings, 0 replies; 12+ messages in thread
From: mr.sparkle @ 2002-11-13  5:11 UTC (permalink / raw)


On 11 Nov 2002, reingold@emr.cs.iit.edu wrote:
>>>>>> "EMR" == Edward M Reingold <reingold@emr.cs.iit.edu> writes:
> 
>      JS=> I hope the future versions of diary functions will take
>      care of local
>     JS=> variables blocks.
> 
>     EMR> Yes, that really is a bug.  I will try to see that it gets
>     EMR> fixed soon.  --
> 
> Can somebody test this in Emacs 21 (which I don't use yet):
> 
> (defun make-diary-entry (string &optional nonmarking file) "Insert a
>   diary entry STRING which may be NONMARKING in FILE.  If omitted,
>   NONMARKING defaults to nil and FILE defaults to diary-file."
>   (find-file-other-window (substitute-in-file-name (if file file
>   diary-file))) (widen) (goto-char (point-max)) (if (let
>   ((case-fold-search t)) (search-backward "Local Variables:" (max (-
>   (point-max) 3000) (point-min)) t)) (progn (beginning-of-line)
>   (insert "\n") (previous-line 1))) (insert (if (bolp) "" "\n") (if
>   nonmarking diary-nonmarking-symbol "") string " "))

This wouldn't evaluate for me

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

end of thread, other threads:[~2002-11-13  5:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-05  0:57 emacs diary/calendar insert day (i-d) mr.sparkle
2002-11-05 18:36 ` Matthias Meulien
2002-11-05 18:52   ` Alan Shutko
2002-11-09 19:46     ` Janusz S. Bień
     [not found]     ` <mailman.1036861638.12745.help-gnu-emacs@gnu.org>
2002-11-10  1:53       ` Alan Shutko
2002-11-10 10:26       ` Matthias Meulien
2002-11-11 10:11         ` Janusz S. Bień
     [not found]         ` <mailman.1036999692.28763.help-gnu-emacs@gnu.org>
2002-11-11 15:08           ` Edward M. Reingold
2002-11-11 17:23             ` Edward M. Reingold
2002-11-13  5:11               ` mr.sparkle
2002-11-07 18:25 ` Edward M. Reingold
2002-11-07 23:38   ` mr.sparkle

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