[Top][All Lists]

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

Re: make-variable-buffer-local vs. make-local-variable

From: Noah Friedman
Subject: Re: make-variable-buffer-local vs. make-local-variable
Date: Thu, 02 Nov 2000 03:36:58 -0800 (PST)

>I'm curious if there's any concensus over which is a better way to
>define (purely) buffer-local variables for a mode --
>  (defvar foo-bar ...)
>  (make-variable-buffer-local 'foo-bar)
>  (defun foo-mode ()
>    (setq foo-bar ...))
>  (defvar foo-bar ...)
>  (defun foo-mode ()
>    (set (make-local-variable 'foo-bar) ...))

Certainly the former is always correct for user options, but since the
modern convention for those is to use defcustom I assume you were only
talking about "internal" variables.

Even in that case I prefer the former because it's more explicit that
anywhere the variable is modified it will already be buffer-local.  The
boundaries between packages are not always very clear.  For example I've
written several major modes on top of other major modes but I do not
necessarily want to invoke the parent mode's "foo-mode" function.

reply via email to

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