help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: emacs diary/calendar insert day (i-d)


From: Alan Shutko
Subject: Re: emacs diary/calendar insert day (i-d)
Date: Tue, 05 Nov 2002 18:52:58 GMT
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

Matthias Meulien <address@hidden> 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 <address@hidden> - In a variety of flavors!
Moron President Found. (A)bort (R)etry (S)hoot


reply via email to

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