From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Hi-Angel Newsgroups: gmane.emacs.help Subject: Re: Dynamic let for lexical scope? Date: Wed, 13 Feb 2019 09:39:30 +0300 Message-ID: References: <87wom4o0ka.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="9127"; mail-complaints-to="usenet@blaine.gmane.org" Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 13 07:46:42 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtoJd-0002JU-Po for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Feb 2019 07:46:41 +0100 Original-Received: from localhost ([127.0.0.1]:51889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtoJc-0000ZQ-Ox for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Feb 2019 01:46:40 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtoJI-0000Xq-K8 for help-gnu-emacs@gnu.org; Wed, 13 Feb 2019 01:46:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtoD5-00013J-Kq for help-gnu-emacs@gnu.org; Wed, 13 Feb 2019 01:39:56 -0500 Original-Received: from mail-it1-x134.google.com ([2607:f8b0:4864:20::134]:37206) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtoD4-0000IN-TB for help-gnu-emacs@gnu.org; Wed, 13 Feb 2019 01:39:55 -0500 Original-Received: by mail-it1-x134.google.com with SMTP id l131so3069384ita.2 for ; Tue, 12 Feb 2019 22:39:42 -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:content-transfer-encoding; bh=I6ixksgvT3AZx/aYNpH54kXGIA1rcfc07ESbTp26lnQ=; b=oe9Ft8OfzqZ3VLLvmofmC1YXD6DiIvocHMJFsq19zU+z6WU+xUGdcykR2afEHscqOF oxEAFILjLfxN6MIy1nGa1+TNv1rCdJcR3UAk9/4+CNZMcrMWQorc8spV6FyR4/TPkTMT 9P+U4lznk+6KHPA5XiGNSe+6BdMSVrV4My6dJPg2HqeU1MA6kD6WAXMD2p1v3fFV/C8d yDHuf81auhPxAhA816ToUgKlqHHzRJK5W3ijMuOkFUL5O5uuqr7KJHuapcTbHLxeKMfi z7UvB5798V1XamIJjAYdvsidR/Xd5NchOFcUNW17RVnw4gLO1nGHV4sydPUGVN99W1qf ym5A== 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:content-transfer-encoding; bh=I6ixksgvT3AZx/aYNpH54kXGIA1rcfc07ESbTp26lnQ=; b=JgbozFJDeS2rd8/NraR2dgWtImBoToa7UKQbQkdR8mGQDm8lrc4kzl57m3jaz2/M54 novW5uEyWfTI50FsdVXx9sC8m9jg49XauvAGBbTXrvBqdU/LColqlgWs0Ml0FrEJiwL9 3FjZb83k6uxPKdrIoXiD1FHrgaBm1Z68aKM8fjmrVwLuq5UnhFT4w+f3rBUqhOHDsTcn Mdgt4V8cjeANYLncpEpUwJToDDSLW98nSb1DNaGFUd+AhJGp8QOSXfof4875nILEc2AC 5IvkemquJBd4rPCZp1haIewZqsOZ9ErMaXUcETX7ypcUaNokIGqlrMk6bKJUoY9NfyK8 QMLw== X-Gm-Message-State: AHQUAuaU238qNYANv1LfD0zwG98eL4eoVxa402XoZdaYgXlf+nD/FPAQ EYiazhoMeM+uQuRwpImHuVZJCZase5YM0MgwPgE= X-Google-Smtp-Source: AHgI3Ia0IMNCXHww62Ha+x924DO4+G+6sycZBiuB+pFKXRLg4o8Ar5pSc4zexINz0slZS780IT4SOzs8qMMsKLVcQ0U= X-Received: by 2002:a5e:9243:: with SMTP id z3mr4736310iop.107.1550039981311; Tue, 12 Feb 2019 22:39:41 -0800 (PST) In-Reply-To: <87wom4o0ka.fsf@web.de> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::134 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:119389 Archived-At: Thank you! On Wed, 13 Feb 2019 at 05:59, Michael Heerdegen wrote: > > Hi-Angel writes: > > > I have the following function: > > > > (defun sort-lines-nocase (beg end) > > (let ((sort-fold-case t)) > > (sort-lines nil beg end))) > > > > It temporarily changes sort-fold-case. Now, when compiled with > > > > ;;; -*- lexical-binding: t -*- > > > > at the top, it causes a warning "Unused lexical variable > > =E2=80=98sort-fold-case=E2=80=99". > > The canonical answer is: add (defvar sort-fold-case) to get local > dynamical binding: > > (defun sort-lines-nocase (beg end) > (defvar sort-fold-case) > (let ((sort-fold-case t)) > (sort-lines nil beg end))) > > In your case, I guess the problem is that `sort-lines' is autoloaded and > the variable is not yet declared when you compile (or evaluate for the > first time). So you could also add > > (eval-when-compile (require 'sort)) > > It's a matter of taste which alternative is better or cleaner. If you > use more stuff from sort.el, it's probably better to `require' it. > > > Michael.