emacs-devel
[Top][All Lists]
Advanced

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

Re: unused local variables


From: 山本和彦
Subject: Re: unused local variables
Date: Mon, 03 Dec 2007 11:30:54 +0900 (JST)

Hello,

> What I want to say is that case-fold-search in the following example
> > is not warned with XEmacs because it is defined with 'defvar'.
> 
> So, yes: what you propose is forcing `defvar' for dynamic variables
> used across function boundaries.

Probaby you misunderstood. I did not use the word "force".

Let me explain the whole story:

----
(defvar my-global-var nil)

(defun my-func1 ()
  (setq my-local-inherit-var (1+ my-local-inherit-var)))

(defun my-func()
  (let ((my-global-var t)         ;; <1>
        (my-local-var 1)          ;; <2>
        (my-local-inherit-var 2)) ;; <3>
    ;; code which does not refer these three variabls above
    (my-func1)
    ))
----

My purpose is to detect <2>.

XEmacs warns both <2> and <3>. I said this is good enough because
I can find <2>.

To suppress warnings of <3>, there would be two options:

(1) Provide a option to suppress unused local variables (both <2> and
    <3>). It means that this option does not change Emacs's current
    behavior.

(2) Prepare a *temporary* defvar for <3> when byte-compiling only for
   detection purpose. After removing <2>, you can byte-compile without
   the temporary defvar (and ignoring a warning) and install the elc
   file.

--Kazu




reply via email to

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