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

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

Re: Changing buffer-local variables to cycle emacs options


From: Yuri Khan
Subject: Re: Changing buffer-local variables to cycle emacs options
Date: Tue, 29 Dec 2020 21:17:52 +0700

On Tue, 29 Dec 2020 at 12:14, <steve-humphreys@gmx.com> wrote:
>
> I am getting the following Lisp error
>
> Debugger entered--Lisp error: (void-variable gstate)

> I am using the function below.  The problem occurs when I comment out
> "(defvar gstate 0)".  When I introduce the variable, the Lisp Error is
> not reported.
>
> One confusion that exists is that I want gstate buffer-local.  But I think
> that using defvar is a mistake.  Another think is to avoid defining gstate
> before calling the function.  My plan was to have "pcase" do to the "(_"
> part if the buffer-local variable "gstate" is not defined, and then define
> it using "(setq-local gstate 1)".

Defining your variables before use is the right way.

If you know you always want a variable to be buffer-local, you can use
(defvar-local gstate 0).



reply via email to

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