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

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

bug#52896: 29.0.50; transient-mark-mode is set to a lot of 'only syms


From: Eli Zaretskii
Subject: bug#52896: 29.0.50; transient-mark-mode is set to a lot of 'only syms
Date: Thu, 30 Dec 2021 20:49:45 +0200

> From: Andrey Listopadov <andreyorst@gmail.com>
> Date: Thu, 30 Dec 2021 12:53:08 +0300
> 
> I've installed the expand-region.el package and noticed that transient
> mark mode started misbehaving.  I'm using Emacs with
> `transient-mark-mode' disabled, and enable it occasionally via `C-SPC
> C-SPC' when needed.  After using `er/expand-region' function I've
> noticed that `C-SPC C-SPC' doesn't highlight the region.  Upon further
> inspection I've noticed that the `transient-mark-mode' variable is set
> to `(only only only only only ... only) with a total of 26 `only'
> symbols.  Symbols disappear one by one when I move the point or invoke
> other commands, so eventually `C-SPC C-SPC' starts working again.
> 
> I've added a watcher to the `transient-mark-mode' variable and upon
> first activation of expand region I see this:
> 
>     transient-mark-mode (only) set #<buffer *scratch*>
>     transient-mark-mode (only only) set #<buffer *scratch*>
>     transient-mark-mode (only only only) set #<buffer *scratch*>
>     transient-mark-mode (only only only only) set #<buffer *scratch*>
>     Type = to expand again, - to contract, 0 to reset
> 
> Upon further investigation I've found that this happens inside the
> `exchange-point-and-mark' function.  I've added a message right before
> `cons' call to confirm that:
> 
>     transient-mark-mode (only) set #<buffer *scratch*>
>     exchange-point-and-mark
>     transient-mark-mode (only only) set #<buffer *scratch*>
>     exchange-point-and-mark
>     transient-mark-mode (only only only) set #<buffer *scratch*>
>     exchange-point-and-mark
>     transient-mark-mode (only only only only) set #<buffer *scratch*>
>     Type = to expand again, - to contract, 0 to reset
> 
> The function explicitly checks if ``(eq (car-safe transient-mark-mode)
> 'only)'' is true and then conses `only' to the `transient-mark-mode',
> causing it to grow.  I'm not sure what is the intention here, but this
> makes it harder using `C-SPC C-SPC` to temporarily activate the
> transient mark mode.

How come transient-mark-mode became set to 'only' in the first place?
That is supposed to happen only when shift-translated commands are
used, and should be reset to the old value whenever the first
non-shift-translated command is used.  See the doc string of
transient-mark-mode (the variable).

You can see how it works if, in "emacs -Q", you press and hold Shift
and use arrow keys to move point, then evaluate

  M-: transient-mark-mode RET

You should then see the value '(only . t)' of the variable.  Once you
type some unshifted command, like C-f, the value becomes t again.

So I suspect that the expand-region.el package you installed does
something to cause this, and in particular doesn't take care to reset
the value when it should.

Bottom line: you should look in expand-region.el for the reasons of
this misbehavior, and perhaps report a bug to its developers.





reply via email to

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