all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Declaring a local dynamic variable?
@ 2013-09-20  9:52 Joost Kremers
  2013-09-20 12:30 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 46+ messages in thread
From: Joost Kremers @ 2013-09-20  9:52 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

If I purposefully use a local dynamic variable as in:

(defun foo ()
  (let* ((my-counter 0)
         (var (or (bar 'one)
                  (bar 'two)
                  (bar 'three))))
    (do-something-with var)
    (issue-a-message-depending-on-the-value-of my-counter)))

(defun bar (arg)
  (setq my-counter (1+ my-counter))
  (do-something-with arg)
  (and-return-result))

the byte compiler will issue a warning about referring to a free
variable in `bar'. What is the proper way of letting the byte compiler
know that it shouldn't worry about this particular variable, without
silencing it completely? I don't want to disable all warnings, or even
just the warnings about free variables.

Right now, I'm using a `(defvar my-counter)' inside the function
definition of `bar', but that looks a bit strange. Is there a better or
"more proper" way of doing this?

TIA

Joost


-- 
Joost Kremers                                   joostkremers@fastmail.fm
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2013-11-03  1:42 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20  9:52 Declaring a local dynamic variable? Joost Kremers
2013-09-20 12:30 ` Stefan Monnier
2013-09-20 14:54   ` Andreas Röhler
     [not found]   ` <mailman.2569.1379688787.10748.help-gnu-emacs@gnu.org>
2013-09-20 15:10     ` Barry Margolin
2013-09-20 16:34       ` Andreas Röhler
     [not found]       ` <mailman.2578.1379694764.10748.help-gnu-emacs@gnu.org>
2013-09-20 20:59         ` Barry Margolin
2013-09-21  5:49           ` Andreas Röhler
2013-09-23 16:19           ` Joost Kremers
     [not found]           ` <mailman.2622.1379742443.10748.help-gnu-emacs@gnu.org>
2013-09-21 11:31             ` Barry Margolin
2013-09-21 13:32               ` Andreas Röhler
     [not found]               ` <mailman.2638.1379770251.10748.help-gnu-emacs@gnu.org>
2013-09-22  3:49                 ` Barry Margolin
2013-09-23 16:26             ` Joost Kremers
2013-09-23 21:17               ` Barry Margolin
2013-09-23 22:14                 ` Joost Kremers
2013-09-24  0:03                   ` Barry Margolin
2013-09-25  8:58                     ` Joost Kremers
2013-09-22 17:11 ` Pascal J. Bourguignon
2013-09-23 16:17   ` Joost Kremers
2013-09-24 21:40   ` Stefan Monnier
2013-11-02 23:56   ` WJ
2013-11-03  1:42   ` WJ
     [not found] ` <mailman.2566.1379680283.10748.help-gnu-emacs@gnu.org>
2013-09-23 16:11   ` Joost Kremers
2013-09-24 21:34     ` Stefan Monnier
2013-09-25  5:52       ` Andreas Röhler
2013-09-25  7:24         ` Stefan Monnier
2013-09-25  8:43       ` Joost Kremers
2013-09-25 12:26         ` Stefan Monnier
2013-10-12 16:54           ` Andreas Röhler
     [not found]           ` <mailman.3886.1381596756.10748.help-gnu-emacs@gnu.org>
2013-10-12 21:25             ` Kai Grossjohann
2013-10-13  8:12               ` Andreas Röhler
2013-10-13 13:37                 ` Stefan Monnier
2013-10-13 17:41                   ` Andreas Röhler
2013-10-13 19:56                     ` Kai Großjohann
     [not found]         ` <mailman.2843.1380112007.10748.help-gnu-emacs@gnu.org>
2013-09-25 15:46           ` Barry Margolin
2013-09-25 18:53             ` Stefan Monnier
2013-09-27  9:53               ` Andreas Röhler
2013-09-27 13:15                 ` Stefan Monnier
     [not found]               ` <mailman.2982.1380275511.10748.help-gnu-emacs@gnu.org>
2013-09-27 14:31                 ` Barry Margolin
2013-09-27 18:48                   ` Andreas Röhler
     [not found]                   ` <mailman.3016.1380307597.10748.help-gnu-emacs@gnu.org>
2013-09-27 20:18                     ` Pascal J. Bourguignon
2013-09-27 23:57                       ` Stefan Monnier
2013-09-28  6:20                       ` Andreas Röhler
2013-09-28  6:24                         ` W. Greenhouse
2013-09-28  6:50                           ` Andreas Röhler
2013-09-28  7:21                             ` W. Greenhouse
     [not found]             ` <mailman.2873.1380135245.10748.help-gnu-emacs@gnu.org>
2013-09-26  0:06               ` Barry Margolin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.