bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Eli Zaretskii
Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark
Date: Sun, 07 Apr 2019 18:42:40 +0300

> From: Markus Triska <address@hidden>
> 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.





reply via email to

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