From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#16728: 24.3.50; bug? (with-temp-buffer (insert "foo")) deactivates mark in current buffer Date: Fri, 14 Feb 2014 19:12:35 +0100 Message-ID: References: <87fvnok8zr.fsf@tue.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392401598 14226 80.91.229.3 (14 Feb 2014 18:13:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Feb 2014 18:13:18 +0000 (UTC) Cc: 16728@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 14 19:13:24 2014 Return-path: Envelope-to: geb-bug-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 1WENGO-0008KR-2Y for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Feb 2014 19:13:24 +0100 Original-Received: from localhost ([::1]:53228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WENGN-0005Co-97 for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Feb 2014 13:13:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WENGD-0005A5-K8 for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 13:13:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WENG2-0001Je-MC for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 13:13:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WENG2-0001JS-J0 for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 13:13:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WENG1-0005T3-Nd for bug-gnu-emacs@gnu.org; Fri, 14 Feb 2014 13:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Helmut Eller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Feb 2014 18:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16728 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16728-submit@debbugs.gnu.org id=B16728.139240156520994 (code B ref 16728); Fri, 14 Feb 2014 18:13:01 +0000 Original-Received: (at 16728) by debbugs.gnu.org; 14 Feb 2014 18:12:45 +0000 Original-Received: from localhost ([127.0.0.1]:52597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WENFl-0005SX-2P for submit@debbugs.gnu.org; Fri, 14 Feb 2014 13:12:45 -0500 Original-Received: from mail-ea0-f176.google.com ([209.85.215.176]:40709) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WENFj-0005SD-4Q for 16728@debbugs.gnu.org; Fri, 14 Feb 2014 13:12:43 -0500 Original-Received: by mail-ea0-f176.google.com with SMTP id b10so1874788eae.21 for <16728@debbugs.gnu.org>; Fri, 14 Feb 2014 10:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=uq6AK2XqMCZkq0I1jacdePWRS/RnVecfA37NgFhL3tI=; b=fSIVt6gb9A4saBOmmB42AGPeal91i3mI+lmXrxvXP6oq3fgLVmnpL2xzNFwhcCL8sP T9scnb3nPhOm3V3o5L+1bFdP9p64Xc84ZS9f+MuDgHLyJ7SND6S5BIKnRI3i6+GxNbhC ViZTqr5j/7WnH8FDWBiqEpEtqAoO3N9wfIKx+cBtcQ9pD75dIB1iTcHxi6xVueYmj2FI y+gIXHmlgxEMx5GyxDAl2tgbLfDWgg6RN8eLPtw938Si0d7qEXeFmnmJWSWhx0Ox5b/A ebaONyVlbhPVymOWfMgfDt3Gj3QEgX2uFeKBah5erdFCXVX4f2cT1dB+g6YNT8adPUSX q3CQ== X-Received: by 10.14.2.193 with SMTP id 41mr4143836eef.55.1392401557340; Fri, 14 Feb 2014 10:12:37 -0800 (PST) Original-Received: from ix ([212.46.176.45]) by mx.google.com with ESMTPSA id o45sm22532474eeb.18.2014.02.14.10.12.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Feb 2014 10:12:36 -0800 (PST) Original-Received: from helmut by ix with local (Exim 4.80) (envelope-from ) id 1WENFb-0003Ln-Dc; Fri, 14 Feb 2014 19:12:35 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 14 Feb 2014 12:21:27 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:85586 Archived-At: On Fri, Feb 14 2014, Stefan Monnier wrote: >> (list (with-temp-buffer >> (set (make-local-variable 'deactivate-mark) nil) >> (insert "foo") >> (let (deactivate-mark) >> (with-temp-buffer >> (insert "bar")))) >> deactivate-mark) > > The `let' above dynamically binds the `deactivate-mark' of the first > temp-buffer. The (insert "bar") then set the deactivate-mark in the > second temp-buffer, which did not make it buffer-local, so it really > sets the global deactivate-mark. Try: > > (with-temp-buffer > (let ((a 3) > (buf (current-buffer))) > (make-local-variable 'a) > (let ((a 4)) > (with-temp-buffer > (message "a=%S but a=%S" (list a (local-variable-p 'a)) > (with-current-buffer buf > (list a (local-variable-p 'a)))))))) > > Interaction between let-bindings and buffer-local bindings is tricky. This prints "a=(3 nil) but a=(4 t)". "a=(4 nil) but a=(3 t)" would be less surprising. Why is it this way? This behavior of let seems non-intuitive and rather useless to me. I don't suppose that there is a variant of let that does what I want? Helmut