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

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

Re: Journal package for Emacs?


From: Kevin Rodgers
Subject: Re: Journal package for Emacs?
Date: Mon, 09 Sep 2002 15:25:46 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

David Forrest wrote:

On 9 Sep 2002, Stefan Monnier <address@hidden> wrote:
...
Thanks, I was certain that was true, and I appreciate your response.
I now have:

(defun my-journal-hook ()
  "Append time stamp to -*- is-journal: t -*- files."
  (when (local-variable-p 'is-journal))
    (end-of-buffer)
    (insert-current-time)))


 (if (local-variable-p 'is-journal)

What for exactly ?  `local-variable-p' should basically never be used,
except for very unusual circumstances.


I was looking for a function like 'defined' and am probably missing
something very basic.  (when 'is-journal) is always true and stamps
everything, while (when is-journal) stamps journal files, but faults with
"Symbol's value as variable is void: is-journal"


Here's the conventional way to handle that:

(defvar my-journal-var nil
 "*Non-nil if visited file is a journal.")
(make-variable-buffer-local 'my-journal-var)

(defun my-journal-hook ()
 "Append time stamp to -*- my-journal-var: t -*- files."
 (when is-journal)
 (end-of-buffer)
 (insert-current-time)))


--
Kevin Rodgers <address@hidden>



reply via email to

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