Subject: [sup-talk] [PATCH] mode.focus not called when buffer killed

From: [email-masked] (Grant Hollingworth)
Date: Tue, 27 Nov 2007 17:18:42 -0500

r708 changed buffer.rb to set @focus_buf in kill_buffer. The problem with that is that focus_on (called through raise_to_front) sees that @focus_buf is set and returns without doing anything... so mode.focus is never called. Since focus_on will set @focus_buf, I changed kill_buffer back and moved the focus_on call in raise_to_front out of the conditional. I think that should still work as expected.

If I added some tests, would you use them? Some assertions would really help with cases like this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup-kill-buffer-focus.diff
Type: application/octet-stream
Size: 678 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071127/f9132051/attachment.obj

---

From: [email-masked] (William Morgan)
Date: Wed, 28 Nov 2007 09:21:59 -0800

Excerpts from Grant Hollingworth's message of Tue Nov 27 14:18:42 -0800 2007:
> r708 changed buffer.rb to set @focus_buf in kill_buffer. The problem
> with that is that focus_on (called through raise_to_front) sees that
> @focus_buf is set and returns without doing anything... so mode.focus
> is never called. Since focus_on will set @focus_buf, I changed
> kill_buffer back and moved the focus_on call in raise_to_front out of
> the conditional. I think that should still work as expected.

Applied, thanks.

> really help with cases like this.

Sure!

-- 
William <wmorgan-sup at masanjin.net>

---

From: [email-masked] (Grant Hollingworth)
Date: Thu, 29 Nov 2007 10:50:36 -0500

> Applied, thanks.

I noticed that you used 'focus_on buf' instead of 'focus_on @buffers.last'. I assumed that if @buffers.last.force_to_top? was true, that you'd want to focus on the last buffer instead of the one just moved to @buffers[-2]. Or do you just want to make sure that the force_to_top buffer stays at the end of @buffers?

---

From: [email-masked] (William Morgan)
Date: Thu, 29 Nov 2007 10:18:09 -0800

Excerpts from Grant Hollingworth's message of Thu Nov 29 07:50:36 -0800 2007:
> I noticed that you used 'focus_on buf' instead of 'focus_on
> @buffers.last'. I assumed that if @buffers.last.force_to_top? was
> true, that you'd want to focus on the last buffer instead of the one
> just moved to @buffers[-2]. Or do you just want to make sure that the
> force_to_top buffer stays at the end of @buffers?

Nope, you're correct. Focus should stay on the force_to_top? buffer,
regardless of whether something was deleted underneath it. I had tried a
couple different variations and didn't clean up properly. Thanks again!