From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark Date: Mon, 08 Apr 2019 20:04:01 -0400 Message-ID: <87a7h0cadq.fsf@gmail.com> References: <831s2dakjz.fsf@gnu.org> <877ec5wid3.fsf@metalevel.at> <83d0lx8bsb.fsf@gnu.org> <87mul0rezk.fsf@metalevel.at> <838swk8rfr.fsf@gnu.org> <87o95gfqdp.fsf@metalevel.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="79357"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.91 (gnu/linux) Cc: 35177@debbugs.gnu.org To: Markus Triska Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 09 02:05:27 2019 Return-path: Envelope-to: geb-bug-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 1hDeGT-000KT3-4r for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Apr 2019 02:05:25 +0200 Original-Received: from localhost ([127.0.0.1]:60906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDeGS-0001yn-3u for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Apr 2019 20:05:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDeGE-0001vK-Cn for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 20:05:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDeGC-0000j7-Tv for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 20:05:10 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36801) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDeG6-0000gv-IH for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 20:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hDeG6-0008SE-8o for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 20:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Apr 2019 00:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35177 X-GNU-PR-Package: emacs Original-Received: via spool by 35177-submit@debbugs.gnu.org id=B35177.155476825332423 (code B ref 35177); Tue, 09 Apr 2019 00:05:02 +0000 Original-Received: (at 35177) by debbugs.gnu.org; 9 Apr 2019 00:04:13 +0000 Original-Received: from localhost ([127.0.0.1]:50345 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDeFI-0008Qt-R7 for submit@debbugs.gnu.org; Mon, 08 Apr 2019 20:04:13 -0400 Original-Received: from mail-qt1-f170.google.com ([209.85.160.170]:40382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDeFG-0008QX-9X for 35177@debbugs.gnu.org; Mon, 08 Apr 2019 20:04:11 -0400 Original-Received: by mail-qt1-f170.google.com with SMTP id x12so17709177qts.7 for <35177@debbugs.gnu.org>; Mon, 08 Apr 2019 17:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Pkb70KNd/Hm090DoM+d4885tCQoiPBY5EMDdlT0uz9Y=; b=beDGxgLR2VT10n/AmH7zqqPP/g1/3u2xOfMDIrWwhi83isfT8RDMWTqFT+AS7cx5ZA 3SNQwAmqPOZxkNQy5ahrdTpFsS6Bni9bfAfFUZGdhs0WZvL1wXpOCivWSCvvj7k+Kpw6 fpWmCJniGfIh0IfD2dmAd3QBOQFf5Q+pvSm8guz1rRBah2DaS5owH89Jec2lJeWNNfes 9ChP8GJAcnbbELOxRom0mCb0YFqo7xtpxt7RJzU88az1H/QKQdoswk1Rm7oT+0XzdnTK ZUzilA7byGq1Wu8PRYjqaoagwKrGztDtMpeSyp/5haCFFQ2m322rMe03ujJXRR37ZKiM qrFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Pkb70KNd/Hm090DoM+d4885tCQoiPBY5EMDdlT0uz9Y=; b=czrebhUUDqiBoonuCFZp+ratGv7I5hneMsTu6DwqQrnYKP56AjiXn7VYxoXLZJ1lVi JHjC7uqas/UOYgf7zt0V7YOMskaaHaSN005LnwS/XoLibc0TA4LdCKort2+uaQQYgrwn fv/TbFEeC1/J8KL4yU26jVj8rBxIkZ0UffvU4NTNXfLMiXWFxgacAL0l61SFgRP8S9Jd S7c5ShB5x3nuiqOVbKnxJ/1UGARTW/EssiFz6h20SKjRrzhYN6LfMp6lvWgB0MjHVotk E5/qRZ1pQHipFF5UhLC9Kv2CqZYCqvZ4Q9v7QP7KMtndU7GLYF7PU8YC0xoOEmAJ+aRl Jcpw== X-Gm-Message-State: APjAAAUhcxTgd+iOqtowV9J/fFskBFujT8hggqqkrMIXEIOBUpkpiCaA R8mN2PnyHp2+KBDz5i0dgnwd0FIC X-Google-Smtp-Source: APXvYqxHyb8ICEQghsPNjtkphQsKLTskdSgT/yX/uGhdptCNCrUBUJMCv2ItdQ6yXzN5lD781+dL3Q== X-Received: by 2002:a0c:9637:: with SMTP id 52mr26473292qvx.11.1554768243599; Mon, 08 Apr 2019 17:04:03 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id f47sm22429973qta.80.2019.04.08.17.04.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2019 17:04:02 -0700 (PDT) In-Reply-To: <87o95gfqdp.fsf@metalevel.at> (Markus Triska's message of "Mon, 08 Apr 2019 17:50:10 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:157376 Archived-At: Markus Triska writes: > (let (deactivate-mark) > (switch-to-buffer (get-buffer-create "t")) > (insert "hello") > (set-mark-command nil) > (move-beginning-of-line nil)) > > It seems to play a role whether its buffer is modified or not, hence > this receipe starting from a fresh file and an unmodified buffer. I think the key detail is whether deactivate-mark has a buffer-local value or not (modifying the buffer gives it one). If it does have a buffer-local value, then the let-binding affects just the buffer-local one, otherwise, it binds the global value. So C-x C-e on the following always gives an active mark: (progn (make-local-variable 'deactivate-mark) ;; (kill-local-variable 'deactivate-mark) (let (deactivate-mark) (switch-to-buffer (get-buffer-create "t")) (insert "hello") (set-mark-command nil) (move-beginning-of-line nil))) And if you uncomment the kill-local-variable statement, then C-x C-e will never give an active mark. C-M-x and M-x eval-region still do give an active mark for all variants. I'm not entirely sure why, but I'm guessing it's because they juggle buffers in a slightly different way, such that the command loop ends up consulting the value of deactivate-mark from somewhere else.