#13 When closing tab, return to the document at the top of MRU

interface (8)

This is a pretty frequent work pattern of mine:

1. Editing file A
2. Searching for function and opening file B
3. Closing file B because I just wanted to look at the function definition
4. Without this patch I get to the file following the B's tab (which
is just a random file) but my brain expects that I get to A

I know it's possible to kind of simulate the behaviour I want with
the "next to current" placement option but I really don't see a single
advantage of having tabs closed in sequential order. This is also
why I didn't make this behaviour optional. But maybe I miss some
use case of tabs being closed sequentially - just tell me.


  • Nick Treleaven

    Nick Treleaven - 2011-10-05

    I think we need an optional various/hidden pref for this, perhaps off by default. The use case is reviewing documents to close - it's useful to keep hitting ctrl-w and Geany goes through the tabs in order.

    P.S. Sorry for not posting this earlier.

  • Anonymous - 2011-10-09

    I see, I don't use Geany this way so it doesn't affect me. I'll make it configurable as you suggest.

  • Colomban Wendling

    Sorry for the looooong delay :/

    I joined a patch that adds a setting to control whether to switch to MRU or to use the old behavior.

    I'd commit all this (including MRU rewrite), but I'm wondering if switching tab in a document-close callback is really OK, since it might change the document_get_current() behavior in other callback, and this somewhat randomly depending on which callback gets emitted first.
    OTOH, mru_docs isn't available outside callbacks.c, so…

    Any opinion/thoughts?

  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2011-12-24

    No need to apologize - the ball was on my side with adding the config option. Thanks for doing it for me!

    Good point with the document-close behavior - even though I haven't experienced any problems using this patch (for one and half year), I can imagine there could be some plugins depending on a predictable behavior.

    Which lead me to something I didn't like all the time about the MRU queue - it clearly doesn't belong to keybindings.c but to notebook.c. So I have moved all the MRU functionality to notebook.c and moved the closing logic back to notebook_remove_page() since the MRU queue is accessible from the notebook now.

    I've created mru_patches branch under my repository here


    The first four patches are my three patches plus your patch, the fourth patch moves MRU to notebook.c without any further modifications and finally the last patch moves the tab removal logic from the document-close callback to noteboor_remove_page().


  • Colomban Wendling

    Looks good to me, apart the missing notebook.h inclusion (fixed) and an error in my patch that led to wrong switch when closing first tab when in RTL non-MRU mode (also fixed).

    I've merged it now, thanks! :)

  • Colomban Wendling

    • assigned_to: nobody --> colombanw
    • status: open --> closed-fixed

Log in to post a comment.