From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Markus Triska Newsgroups: gmane.emacs.bugs Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark Date: Mon, 08 Apr 2019 12:03:11 +0200 Message-ID: <87mul0rezk.fsf@metalevel.at> References: <831s2dakjz.fsf@gnu.org> <877ec5wid3.fsf@metalevel.at> <83d0lx8bsb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="213027"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Emacs/24.5 Cc: 35177@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 08 12:04:11 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 1hDR8M-000tJk-L6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Apr 2019 12:04:10 +0200 Original-Received: from localhost ([127.0.0.1]:50449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDR8L-0001hE-Dl for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Apr 2019 06:04:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDR8F-0001fS-3V for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 06:04:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDR8E-0000Hg-42 for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 06:04:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35472) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDR8D-0000HY-UX for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 06:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hDR8D-0001wY-OQ for bug-gnu-emacs@gnu.org; Mon, 08 Apr 2019 06:04:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Markus Triska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Apr 2019 10:04:01 +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.15547177997415 (code B ref 35177); Mon, 08 Apr 2019 10:04:01 +0000 Original-Received: (at 35177) by debbugs.gnu.org; 8 Apr 2019 10:03:19 +0000 Original-Received: from localhost ([127.0.0.1]:49016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDR7X-0001vX-AT for submit@debbugs.gnu.org; Mon, 08 Apr 2019 06:03:19 -0400 Original-Received: from metalevel.at ([78.46.218.83]:53904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDR7T-0001vN-I2 for 35177@debbugs.gnu.org; Mon, 08 Apr 2019 06:03:18 -0400 Original-Received: by metalevel.at (Postfix, from userid 1000) id DB5DEA2A8E; Mon, 8 Apr 2019 12:03:11 +0200 (CEST) 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:157342 Archived-At: Eli Zaretskii writes: > None of your additional test cases do what I said I thought you should > do, though, do they? In emacs -Q, please evaluate the following form with C-x C-e: (let (deactivate-mark) (switch-to-buffer (get-buffer-create "t")) (insert "hello") (set-mark-command nil) (move-beginning-of-line nil)) This does what you say. However, the mark is deactivated after the form is executed, which is the opposite of what I expect from this snippet. > I don't think it's something in your code that deactivates the mark, > it's what Emacs does internally when a command finishes. I noticed that the mark stays activate (as expected), when I add a "redisplay" after switch-to-buffer: (let (deactivate-mark) (switch-to-buffer (get-buffer-create "t")) (redisplay) (insert "hello") (set-mark-command nil) (move-beginning-of-line nil)) After I evaluate this, the first form also consistently retains the active mark when I evaluate it. It is expected that the mark stays active, but it is unexpected that it does so after I evaluate the second form, yet is deactivated if I only evaluate the first form. Please also note that the documentation of deactivate-mark states "around the code that does the modification". If other preconditions are necessary to consistently retain the active mark, could you please document them? Thank you.