From: Yuri Khan <yuri.v.khan@gmail.com>
To: steve-humphreys@gmx.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Changing buffer-local variables to cycle emacs options
Date: Tue, 29 Dec 2020 21:17:52 +0700 [thread overview]
Message-ID: <CAP_d_8VnfNmu8L=CG5mcp59_FLErAdVjL0pDc5cMU0gvSROYKg@mail.gmail.com> (raw)
In-Reply-To: <trinity-8284d63c-135a-4770-894e-a4db06e86e07-1609218831254@3c-app-mailcom-bs13>
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).
prev parent reply other threads:[~2020-12-29 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 5:13 Changing buffer-local variables to cycle emacs options steve-humphreys
2020-12-29 6:28 ` steve-humphreys
2020-12-29 14:17 ` Yuri Khan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAP_d_8VnfNmu8L=CG5mcp59_FLErAdVjL0pDc5cMU0gvSROYKg@mail.gmail.com' \
--to=yuri.v.khan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=steve-humphreys@gmx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).