gnu.emacs.help
[Top] [All Lists]

How to set a file major mode in elisp

Subject: How to set a file major mode in elisp
From: Mirko
Date: Fri, 02 Nov 2007 05:42:11 -0700
Newsgroups: gnu.emacs.help

Hi,

In a piece of elisp, I would like to open an existing file and set its
major mode for later editing.  This is an example of the code that I
am using

(defun diary-entry ()
  (interactive)
  (find-file "~/diary")
  (goto-char (point-max))
  (open-line 1)
  (goto-char (point-max))
... )

I will be adding an entry to the diary file, and I would like the
buffer to be in the diary mode.  Is there some way of specifying it
explicitly instead of using auto-mode-alist?

Thank you,

Mirko


<Prev in Thread] Current Thread [Next in Thread>