From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steven Degutis Newsgroups: gmane.emacs.help Subject: Re: Get rid of free variable warning from other packages? Date: Tue, 9 Apr 2013 17:22:30 -0500 Message-ID: References: <26186B0D948E49618DD69E37D686A3CE@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd6b1563c0c8404d9f4fdcf X-Trace: ger.gmane.org 1365546168 22179 80.91.229.3 (9 Apr 2013 22:22:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 9 Apr 2013 22:22:48 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 10 00:22:48 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UPgwB-00047N-Qe for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Apr 2013 00:22:48 +0200 Original-Received: from localhost ([::1]:36435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPgwB-0007Qq-Dj for geh-help-gnu-emacs@m.gmane.org; Tue, 09 Apr 2013 18:22:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPgvx-0007Qi-QQ for help-gnu-emacs@gnu.org; Tue, 09 Apr 2013 18:22:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPgvv-0003QC-84 for help-gnu-emacs@gnu.org; Tue, 09 Apr 2013 18:22:33 -0400 Original-Received: from mail-ve0-f172.google.com ([209.85.128.172]:51826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPgvv-0003Q8-2b for help-gnu-emacs@gnu.org; Tue, 09 Apr 2013 18:22:31 -0400 Original-Received: by mail-ve0-f172.google.com with SMTP id oz10so7099797veb.3 for ; Tue, 09 Apr 2013 15:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Js5sktQvQVX3dI4pw8XuFzsefDKYPGwXyujBjW9fH20=; b=HyggjQgsaStob91AZ5Ldo76DKnT3pZ5b1Jq4TCXmp2G6bFZEIMOIy1z2/iSiGLkU7U Iz47sLqmtOSd1NR9b0/jHon7xkZGC1MBqSxFTn9zNdi4joCCAf02O4hIWtlLw6U0YXmi T6gjfCakmR3g8CVabcTjHpvmh/+LRiwQs1cU4m/zdENKKynbnGi6XEH9CH0ghCXGzSTF Yxm8VTCH5a0iQv66VOrfxXk3n9xuykekMKJ+Az3Ws7FLPCVf/S8TmImulfpKakO0/q7k JaEJOfVEi/1VTFuzVE03mMIRnqNNilXUmZJMoNn2wZLwfso19ysRyMzdB9PryMehosEt +DoA== X-Received: by 10.59.11.199 with SMTP id ek7mr21022081ved.19.1365546150659; Tue, 09 Apr 2013 15:22:30 -0700 (PDT) Original-Received: by 10.58.161.144 with HTTP; Tue, 9 Apr 2013 15:22:30 -0700 (PDT) In-Reply-To: <26186B0D948E49618DD69E37D686A3CE@us.oracle.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.128.172 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90053 Archived-At: --047d7bd6b1563c0c8404d9f4fdcf Content-Type: text/plain; charset=ISO-8859-1 Thanks. That's actually what I currently do: https://github.com/sdegutis/ido-vertical-mode.el/blob/master/ido-vertical-mode.el#L138-L165 The plugin in question: https://github.com/sdegutis/ido-vertical-mode.el -Steven On Tue, Apr 9, 2013 at 5:13 PM, Drew Adams wrote: > > In my package, I setq some variables that are defined in other > > packages. (Specifically, in ido-vertical-mode, I setq > > ido-decorations.) Is there a way to disable the warning that > > says I'm setqing a free variable? > > (defvar ido-decorations) > > IOW, a vacuous defvar: no value initialization. > > > Or better yet, is there a better way to set a variable that > > belongs to another package, only when my minor-mode is > > enabled, and have it reverted back when my minor-mode is > > disabled? > > A different topic (not "or better yet"). > > When your minor mode is turned on, save the current value of the > other-package > variable in your own separate, internal variable. When your mode is > turned off, > restore the saved value. > > This is not perfect, of course, since presumably other interactions while > your > mode is active might change that package variable's value, so restoring > (when > you exit your mode) the value it had when your mode was turned on might > not be > the right thing to do. It's a judgment call based on your particular > context. > > (OT - For key bindings, things are typically simpler: you can just define > bindings in your minor-mode map that shadow bindings in major modes (and in > other minor modes, if you can finagle things so yours come out on top).) > > --047d7bd6b1563c0c8404d9f4fdcf Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Tue, Apr 9, 2013 at 5:13 PM, Drew Ada= ms <drew.adams@oracle.com> wrote:
> In my package, I setq some variables that are define= d in other
> packages. (Specifically, in ido-vertical-mode, I setq
> ido-decorations.) Is there a way to disable the warning that
> says I'm setqing a free variable?

(defvar ido-decorations)

IOW, a vacuous defvar: no value initialization.

> Or better yet, is there a better way to set a variable that
> belongs to another package, only when my minor-mode is
> enabled, and have it reverted back when my minor-mode is
> disabled?

A different topic (not "or better yet").

When your minor mode is turned on, save the current value of the other-pack= age
variable in your own separate, internal variable. =A0When your mode is turn= ed off,
restore the saved value.

This is not perfect, of course, since presumably other interactions while y= our
mode is active might change that package variable's value, so restoring= (when
you exit your mode) the value it had when your mode was turned on might not= be
the right thing to do. =A0It's a judgment call based on your particular= context.

(OT - For key bindings, things are typically simpler: you can just define bindings in your minor-mode map that shadow bindings in major modes (and in=
other minor modes, if you can finagle things so yours come out on top).)

--047d7bd6b1563c0c8404d9f4fdcf--