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

[Emacspeak] Re: Stage part of a hunk in magit



Tim Cross <theophilusx(a)gmail.com> writes:

> Tim Makarios <emacspeak.correspondence(a)freespoken.nz> writes:
>
>> On Thu, 2021-05-13 at 14:07 +1000, Tim Cross wrote:
>>> In what way does it not work or does it behave differently when
>>> emacspeak is running? Are there any errors? 
>>
>> If I've got multiple new consecutive lines in a file tracked by Git, and I
>> want to stage only, say, the first two, I can bring up the diff in Magit,
>> move to the first new line, press C-<SPC>, move to the second line, and
>> press s to stage only those two marked lines.  This works if Emacspeak isn't
>> loaded, but if Emacspeak is loaded, then it always stages the entire hunk
>> (as determined by Git), regardless of where the mark is set.  I see no error
>> messages, nor any difference in the output to the magit-process buffer.
>>
>> Also, without Emacspeak loaded, Magit uses different highlighting for the
>> lines between the mark and point (inclusive) when I'm doing this, but I
>> can't see any difference in Magit's highlighting when Emacspeak is loaded. 
>> I realize that many on this list may not be able to appreciate the
>> difference in highlighting, but I thought it might be useful diagnostically,
>> since the Magit manual says (in the Getting Started chapter):
>>> If the region looks like it does in other buffers, then it doesn’t select
>>> Magit sections that can be acted on as a unit.
>>
>
> OK, now I understand the issue.
>
> I just tried a simple example in my setup and it works as expected.
> However, I run emacspeak with spacemacs, which is a slightly unusual
> setup. The good news is that it obviously can work with emacspeak
> running. 
>
> I will try to see if I can reproduce your issue in my test environment.
> I'm just in the middle of upgrading that environment to Ubuntu
> 21.04, so it might be a day or so before I can test it out.
>
> My wild baseless guess is that when you are setting the region, it isn't
> actually marking the region. The fact you don't see the highlighting
> would also indicate this may be the case. I would start by verifying
> C-<space> is actually calling the same function and is setting the
> region. It might also be worth trying with transient mark mode enabled
> and disabled to see if that makes any difference. 

Just replying to my own reply!

The difference in behaviour is because by default, Emacspeak disables
transient mark mode. Without it, the behaviour you observe does not
work. Transient mark mode is enabled by default in vanilla emacs.

This leaves you with two options -

1. Enable transient mark mode. This is what I do. With transient mark
mode enabled, many commands which would normally work on the area from
point to the end of the buffer will only be applied to the region. This
is my preferred behaviour. You can enable transient mark mode in your
emacs init file (after loading Emacspeak).

2. Temporarily enable transient mark mode. If you hit C-<space>
C-<space> (i.e. ener it twice), it will temporarily enable transient
mark mode i.e. until the region is cleared. You can use this technique
to verify selecting a hunk from a diff can be staged.

HTH

Tim


-- 
Tim Cross


|May 1995 - Last Year|Current Year|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page