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: Tue, 09 Apr 2019 17:26:59 +0200 Message-ID: <87ftqrtd18.fsf@metalevel.at> 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> <87a7h0cadq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="186129"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Emacs/24.5 Cc: 35177@debbugs.gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 09 17:28:18 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 1hDsfa-000mJ1-8X for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Apr 2019 17:28:18 +0200 Original-Received: from localhost ([127.0.0.1]:43869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDsfZ-0008Cg-7Y for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Apr 2019 11:28:17 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDsfR-0008CA-Dx for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 11:28:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDsfL-000126-4w for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 11:28:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDsfK-00010U-FF for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 11:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hDsfK-0004iy-7S for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 11:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Markus Triska Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Apr 2019 15:28: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.155482362218071 (code B ref 35177); Tue, 09 Apr 2019 15:28:02 +0000 Original-Received: (at 35177) by debbugs.gnu.org; 9 Apr 2019 15:27:02 +0000 Original-Received: from localhost ([127.0.0.1]:51884 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDseM-0004hP-Ge for submit@debbugs.gnu.org; Tue, 09 Apr 2019 11:27:02 -0400 Original-Received: from metalevel.at ([78.46.218.83]:53258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDseK-0004gv-EX for 35177@debbugs.gnu.org; Tue, 09 Apr 2019 11:27:01 -0400 Original-Received: by metalevel.at (Postfix, from userid 1000) id 0D3D7A2AD1; Tue, 9 Apr 2019 17:26:59 +0200 (CEST) In-Reply-To: <87a7h0cadq.fsf@gmail.com> (Noam Postavsky's message of "Mon, 08 Apr 2019 20:04:01 -0400") 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:157422 Archived-At: Noam Postavsky writes: > 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: Thank you very much for looking into this! I have constructed an additional test case, which in a sense complements the previous one in that the mark is now active on the first run, but inactive in subsequent runs. To reproduce it, please do the following: 1. Download mark_test_run.el with: $ wget https://www.metalevel.at/ei/mark_test_run.el 2. Invoke Emacs with: $ emacs -Q mark_test_run.el 3. In that Emacs instance, please do: M-x evaluate-buffer RET M-x mark-test-run RET After this, "hello" is displayed and the mark is active. 4. Kill the current buffer (i.e., "b") with C-x k RET 5. Invoke mark-test-run again with M-x mark-test-run RET After this, "hello" is displayed and the mark is *inactive*. On subsequent invocations of mark-test-run, the mark is likewise inactive. However, I expect the mark to be active in all runs, due to the structure of mark-test-run, which binds deactivate-mark to nil: (defun mark-test-run () (interactive) (let (deactivate-mark) ...)) Can you reproduce this? This seems related to the current issue. However, if you consider this unrelated, please let me know, and I will file this as a separate issue. For completeness, I include the content of mark_test_run.el below. All the best, Markus (defvar mark-test-forms '((new-buffer "b") (insert "hello") (set-mark-command) (move-beginning-of-line))) (defun mark-test-run () (interactive) (let (deactivate-mark) (mapc 'mark-test-interpret mark-test-forms))) (defun mark-test-interpret (expr) (interactive) (let ((e (car expr))) (cond ((eq e 'insert) (insert (cadr expr))) ((eq e 'move-beginning-of-line) (move-beginning-of-line nil)) ((eq e 'new-buffer) (let ((buf (get-buffer-create (cadr expr)))) (with-current-buffer buf (erase-buffer)) (switch-to-buffer buf))) ((eq e 'set-mark-command) (let ((inhibit-message t)) (set-mark-command nil))))))