From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Changing buffer-local variables to cycle emacs options Date: Tue, 29 Dec 2020 21:17:52 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26427"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: steve-humphreys@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 29 15:18:28 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kuFpT-0006nu-KJ for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 29 Dec 2020 15:18:27 +0100 Original-Received: from localhost ([::1]:41894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuFpS-0004Mh-HV for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 29 Dec 2020 09:18:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuFp8-0004MY-3G for help-gnu-emacs@gnu.org; Tue, 29 Dec 2020 09:18:06 -0500 Original-Received: from mail-vs1-xe32.google.com ([2607:f8b0:4864:20::e32]:39572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kuFp6-00039n-Lb for help-gnu-emacs@gnu.org; Tue, 29 Dec 2020 09:18:05 -0500 Original-Received: by mail-vs1-xe32.google.com with SMTP id h6so7102871vsr.6 for ; Tue, 29 Dec 2020 06:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=24dPUxAodQp8Hd8Hy1MwNcZ/p8NpR1ToUm3X8REmIY8=; b=Q+2bl7IGHTyv6Rh4urGkSO1bdQC5gG81UVu0wD4/AKN7ohJ9NBtUvjxI4VQzxIwXck l3isS24g+Ni0kh7UrpPmi7d51gKq+tHW0yb56EnBfMLbAic+FG46a2cS4k+zB317qbpa YZtlvkJFWNGNXJFX+VxWS9WlWSQBtryZwcmy4plOgbcQneATp0HldpbprMiZxa9+WiNJ cm2Tj6aSqj82mkdL067PV1wEvdwdSWwmvQkWzhxLhnB4hbdhjFAblDC6jbNN0pIoRArt icz/oFbmxb+Uzp02SYTjDOSWoZDf1U98qnKmT3nXyS9NFWqqu8c+xgn4SP8IcR7XXu4i kOiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=24dPUxAodQp8Hd8Hy1MwNcZ/p8NpR1ToUm3X8REmIY8=; b=NxELQmymTOhtlDgLTjNWb5mbUe5sb0BZQTBOU0mXojF948f4VJcJrr2VWKooXHSgWf oBuGcEjC+NxZZnkwY9Q2y3UW97/ML7ZLAhQwqGFTglDOcegCGlJt1yMzCZLP/mhoi7V6 oIleULFyURefSBn96HNdWMoZW58xQsT/qsKQvvQIkXDmUaDNFBBlX96n43rhvNiuD8qn dNyzQ8Ivqdq/TKQp8LWfdv9UZT56aZxJTAYA+QqU/sDFlCgKJPJQuRnhkjn/Dge5gaCh JDvtUdKFddrEzmM6tiownTmyxk13rcloZpXDDoubxBFbZGGOgonoECubs5LK6ryak9tu lX0A== X-Gm-Message-State: AOAM533ZGNmZjOAPPF3rIpNYseHuO+x19EMCkIvMhPT/nn+iau3PCdWQ 4esT6f48uuycCcqMpefDxFtffZhOc2vYXnLWoCo= X-Google-Smtp-Source: ABdhPJylMRav8MY3Ozl8Vis1JiLM0F6+2ZdbqSfUfLHUqX844NlPX92kPYeNf1H0k2E40S9vuvTpri21GP/wn5ocqr8= X-Received: by 2002:a05:6102:255:: with SMTP id a21mr30554633vsq.31.1609251483242; Tue, 29 Dec 2020 06:18:03 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e32; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126896 Archived-At: On Tue, 29 Dec 2020 at 12:14, 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).