Subject: Re: bug#19513: shift-select-mode fails to be fully buffer-local

From: Kelly Dean <[email-masked]>
Date: Tue, 06 Jan 2015 06:59:39 +0000

Stefan Monnier wrote:
>> The reason I want to do that is I have a minor mode that depends on
>> shift-select-mode being disabled.
>
> Can you explain how/why?

See line-select-minor-mode in the section beginning on line 339 at
http://prtime.org/emacs/vimizer.el (currently version 0.2.2)

Comment out lines 384-385 to enable it to work with shift-select-mode, to see how the latter interferes.
Enable the mode, then press S-down. Then press down, and since you're doing a non-shifted motion command following a shifted motion command, shift-select-mode deactivates the region.

The region is supposed to stay active while line-select mode is on, and line-select is supposed to remain on until you actually do something that's supposed to deactivate the region, e.g. C-g, C-w, etc. Motion commands specifically are _not_ supposed to deactivate it, which is why I need shift-select-mode disabled while the line-select mode is on.

The reason it's a problem for motion commands to deactivate it is that I have a lot of keys bound to different motion commands depending on whether shift is pressed. E.g. I have a key bound to right-word, and the same key shifted is bound to forward-sexp. So I frequently press a combination of both shifted and non-shifted keys to move, including even when line-select is on. Normally, shift-select-mode doesn't deactivate the region, since it ignores my rebound keys, but when I happen to press a shifted key that I _don't_ have rebound (e.g. S-left, which Emacs translates to left, bound to the default of left-char), shift-select-mode notices it, and then deactivates the region upon the following non-shifted motion command.

You could say, just avoid pressing S-left, but that's not user-friendly. If I'm doing a sequence of motion commands that happen to be bound to shifted keys, and I need to do left-char in the middle of the sequence, I shouldn't have to un-press shift just to prevent shift-select-mode from biting me the next time I use a non-shifted key.

> Could you explain why you want to disable-it buffer-locally?

So that if line-select is active (which requires shift-select inactive) in one buffer, it doesn't interfere with the user's ability to use shift-select in another buffer.