From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Cleaning up code Date: Thu, 15 Aug 2013 10:40:38 +0200 Message-ID: <87mwojiby1.fsf@gmx.de> References: <87eh9x62o1.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1376556057 24612 80.91.229.3 (15 Aug 2013 08:40:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Aug 2013 08:40:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 15 10:40:59 2013 Return-path: Envelope-to: ged-emacs-devel@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 1V9t75-0000Y0-97 for ged-emacs-devel@m.gmane.org; Thu, 15 Aug 2013 10:40:59 +0200 Original-Received: from localhost ([::1]:51929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9t74-0004pN-I2 for ged-emacs-devel@m.gmane.org; Thu, 15 Aug 2013 04:40:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9t6w-0004nd-N7 for emacs-devel@gnu.org; Thu, 15 Aug 2013 04:40:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9t6q-0004G7-PD for emacs-devel@gnu.org; Thu, 15 Aug 2013 04:40:50 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:59128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9t6q-0004Fb-Bh for emacs-devel@gnu.org; Thu, 15 Aug 2013 04:40:44 -0400 Original-Received: from detlef.gmx.de ([91.41.134.176]) by mail.gmx.com (mrgmx002) with ESMTPS (Nemesis) id 0MhAAr-1VWDM00aeH-00MNuC for ; Thu, 15 Aug 2013 10:40:42 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 13 Aug 2013 12:30:47 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Provags-ID: V03:K0:nxvuE8M4Yosyosb3QG1eVa7Kf1CZY3rGCf1+KFs/eOsUpwBOHS5 RLJNhEaLianGkLHoRjvk7WEYKchIWYe2bUUsPdU4rDMp8uMoPrsRli6CJCj/x1MC20rI3kA 0w6nLJaPPRXZeZaay1TDheZMJ9wBNP7woI5C4uNZSaTVO6Zz65uh8CE2/c8IVpgonbYN0Ou tgc7fDkSynKr/m04ouznQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162753 Archived-At: Stefan Monnier writes: >> However, setting `byte-compile-force-lexical-warnings' to t is too >> coarse. For example, Tramp's macro `with-parsed-tramp-file-name' >> let-binds several variables "just in case". They are reported as unused >> then, on every invocation of that macro. > > Yup, that's one of the main problems: when a single let in the source > ends up duplicated after expansion so some expansions may use it while > others end up not using it. > > We need to add some way to tell Emacs that it should check "the sum of > all uses" or something like that. In your case, this "sum" is > open-ended, so we should instead just tell it not to check at all. Yep. There is also another case where it doesn't work as expected. Often, I let bind a variable for side effect, like this: (let ((default-directory (tramp-compat-temporary-file-directory)) (outline-regexp tramp-debug-outline-regexp)) (outline-mode)) And I get from the byte compiler tramp.el:1400:1:Warning: Unused lexical variable `outline-regexp' In Tramp, there are many such stanzas of intended side effect bindings. Therefore, there are too many false positives, that I could see the real warnings I should fix. Could we have a byte-compiler option telling that such bindings are intended? Something like this: (let ((byte-compile-force-lexical-warnings nil) (default-directory (tramp-compat-temporary-file-directory)) (outline-regexp tramp-debug-outline-regexp)) (outline-mode)) > Stefan Best regards, Michael.