[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64730: 30.0.50; Mark activation doesn't work after insert
From: |
Bruno Boal |
Subject: |
bug#64730: 30.0.50; Mark activation doesn't work after insert |
Date: |
Thu, 20 Jul 2023 09:28:48 +0100 |
Thank you for such a quick and helpful reply.
Best regards,
BB
Eli Zaretskii <eliz@gnu.org> writes:
> tags 64730 notabug
> thanks
>
>> Cc: public@protesilaos.com
>> From: Bruno Boal <egomet@bboal.com>
>> Date: Wed, 19 Jul 2023 12:17:21 +0100
>>
>> I'm trying to evaluate the following snippet in emacs -Q, however as
>> soon as I try to insert a character, the region is not highlighted
>> anymore. `activate- mark' doesn't make it work either. Whereas
>> interactively with `exchange-point-and-mark' the region gets proper
>> highlight.
>>
>> (progn
>> (insert "")
>> (push-mark (line-beginning-position) :no-message :activate))
>>
>> (progn
>> (insert "a")
>> (push-mark (line-beginning-position) :no-message :activate))
>
> This is the intended behavior. The ELisp manual says in the node "The
> Mark":
>
> -- Variable: deactivate-mark
> If an editor command sets this variable non-‘nil’, then the editor
> command loop deactivates the mark after the command returns (if
> Transient Mark mode is enabled). All the primitives that change
> the buffer set ‘deactivate-mark’, to deactivate the mark when the
> command is finished. Setting this variable makes it buffer-local.
>
> 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 " "))