From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark Date: Sun, 07 Apr 2019 18:42:40 +0300 Message-ID: <831s2dakjz.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="219765"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35177@debbugs.gnu.org To: Markus Triska Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 07 17:43:15 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 1hD9wx-000ux8-Kq for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Apr 2019 17:43:15 +0200 Original-Received: from localhost ([127.0.0.1]:40494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD9wr-0000sm-Fy for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Apr 2019 11:43:09 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD9wl-0000sd-Qs for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 11:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hD9wk-00019O-UW for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 11:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hD9wk-00019H-Ot for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 11:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hD9wk-0006Yc-Ig for bug-gnu-emacs@gnu.org; Sun, 07 Apr 2019 11:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Apr 2019 15:43: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.155465177825197 (code B ref 35177); Sun, 07 Apr 2019 15:43:02 +0000 Original-Received: (at 35177) by debbugs.gnu.org; 7 Apr 2019 15:42:58 +0000 Original-Received: from localhost ([127.0.0.1]:48607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD9wg-0006YK-5o for submit@debbugs.gnu.org; Sun, 07 Apr 2019 11:42:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hD9we-0006Y7-Ay for 35177@debbugs.gnu.org; Sun, 07 Apr 2019 11:42:56 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hD9wY-00016j-Ld; Sun, 07 Apr 2019 11:42:50 -0400 Original-Received: from [176.228.60.248] (port=4977 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hD9wX-0005FT-IE; Sun, 07 Apr 2019 11:42:50 -0400 In-reply-to: (message from Markus Triska on Sun, 07 Apr 2019 02:11:02 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:157311 Archived-At: > From: Markus Triska > Date: Sun, 07 Apr 2019 02:11:02 +0200 > > Please start Emacs with "emacs -Q" and insert the following form in the > *scratch* buffer: > > (progn > (let (deactivate-mark) > (switch-to-buffer (get-buffer-create "t")) > (erase-buffer) > (insert "hello")) > (let (deactivate-mark) > (set-mark-command nil) > (move-beginning-of-line nil))) > > then place point at the end of the form and evaluate it with C-x C-e. > > You will see a new buffer ("t"), where "hello" is inserted and nothing > is highlighted because the mark is inactive. > > However, I expect the mark to be active and the region highlighted, > because the form binds deactivate-mark to nil. This is the way that is > recommended in the Elisp manual, see for Example 31.7 "The Mark": > > To write Lisp code that modifies the buffer without causing > deactivation of the mark at the end of the command, bind > ‘deactivate-mark’ to ‘nil’ around the code that does the > modification. For example: > > (let (deactivate-mark) > (insert " ")) > I think you need to put the entire progn inside the binding of deactivate-mark. IOW, the binding should be in effect when the command terminates.