unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Markus Triska <triska@metalevel.at>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 35177@debbugs.gnu.org
Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark
Date: Tue, 09 Apr 2019 17:26:59 +0200	[thread overview]
Message-ID: <87ftqrtd18.fsf@metalevel.at> (raw)
In-Reply-To: <87a7h0cadq.fsf@gmail.com> (Noam Postavsky's message of "Mon, 08 Apr 2019 20:04:01 -0400")

Noam Postavsky <npostavs@gmail.com> 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))))))





  reply	other threads:[~2019-04-09 15:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07  0:11 bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark Markus Triska
2019-04-07 15:42 ` Eli Zaretskii
2019-04-07 22:39   ` Markus Triska
2019-04-08  2:35     ` Eli Zaretskii
2019-04-08 10:03       ` Markus Triska
2019-04-08 15:09         ` Eli Zaretskii
2019-04-08 15:50           ` Markus Triska
2019-04-08 16:00             ` Eli Zaretskii
2019-04-09  0:04             ` Noam Postavsky
2019-04-09 15:26               ` Markus Triska [this message]
2019-04-09 23:46                 ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftqrtd18.fsf@metalevel.at \
    --to=triska@metalevel.at \
    --cc=35177@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).