[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to set a file major mode in elisp
From: |
Mirko |
Subject: |
Re: How to set a file major mode in elisp |
Date: |
Mon, 05 Nov 2007 05:40:23 -0800 |
User-agent: |
G2/1.0 |
On Nov 2, 4:10 pm, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 02.11.2007 um 17:54 schrieb Mirko:
>
> > I don't want to mess with the diary file format if I can avoid it.
>
> You don't mess with the file format if you add local variables - you
> just make it clear to GNU Emacs what is obvious for you!
>
> I, for example, make clear that the diary file is in UTF-8:
>
> ;; Local variables:
> ;; coding: utf-8
> ;; End:
>
> and you can add
>
> ;; mode: diary
>
> --
> Greetings
>
> Pete
>
> ...And always remember the last words of my grandfather, who said:
> "A truck!" - Emo Phillips
Well, I decided to "cheat" by using the "built-in" make-diary-entry.
This function will set-up the file mode correctly.
(defun hj-entry ()
"Insert the jounral template into the diary file"
(interactive)
(let ((calendar-date-display-form '((substring monthname 0 3) " "
day ", " year)))
(make-diary-entry (concat (calendar-date-string (calendar-current-
date))
" Journal: "))))
Thanks,
Mirko