[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactiva

From: Markus Triska
Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark
Date: Tue, 09 Apr 2019 17:26:59 +0200
User-agent: Emacs/24.5

Noam Postavsky <address@hidden> 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 ()
      (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,

(defvar mark-test-forms
  '((new-buffer "b")
    (insert "hello")

(defun mark-test-run ()
  (let (deactivate-mark)
    (mapc 'mark-test-interpret mark-test-forms)))

(defun mark-test-interpret (expr)
  (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
             (switch-to-buffer buf)))
          ((eq e 'set-mark-command)
           (let ((inhibit-message t))
             (set-mark-command nil))))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]