Loading ...
Sorry, an error occurred while loading the content.

Re: patch 6.2.489

Expand Messages
  • Robert Webb
    Hi, ... been ... Patch 6.2.489 doesn t do what I expected. I thought it would exit the program entirely, but instead vim still opens but in some weird state.
    Message 1 of 4 , Apr 28, 2004
    • 0 Attachment
      Hi,

      > Patch 6.2.489
      > Problem: When accidentally opening a session in Vim which has already
      been
      > opened in another Vim there is a long row of ATTENTION prompts.
      > Need to quit each of them to get out. (Robert Webb)
      > Solution: Add the "Abort" alternative to the dialog.

      Patch 6.2.489 doesn't do what I expected. I thought it would exit the
      program entirely, but instead vim still opens but in some weird state.
      The first time I tried it I was left with lots of windows (matching
      the original session layout) onto a ZIP file, which appeared as
      garbage in vim of course. The ZIP file wasn't one of the files in the
      session being opened! But I see now it is the only item in the args
      list (don't know how I managed that), although it didn't appear in a
      window.

      With another session, choosing Abort still let vim open, but with only
      one window (instead of the original layout) and no file. I checked
      the session file, and this time the first entry in the args list was
      also in one of the windows, so maybe this made a difference.

      Conclusion:
      - I think Abort should exit the program straight away, but maybe only
      when the session is opened from the command line when running vim
      (as explained below, can that be recognised?).
      - If the first file in the args list does not otherwise appear in a
      window, then the original session window latout is created anyway
      with this file in all the windows.


      Finally, a minor point. The order of buttons is:
      Open Read-Only, Edit anyway, Recover, Quit, Abort, Delete it

      I think it would make more sense to put them in this order:
      Open Read-Only, Edit anyway, Recover, Delete it, Quit, Abort



      My environment in case it matters:

      Windows 2000, gvim 6.2.504 (all patches). I open vim sessions by
      saving them to .vse files and double clicking on them. This is set up
      by associating VSE files with the following command:

      C:\bin\vim.exe -c "so %1"

      (vim.exe is actually gvim.exe renamed, I always use the GUI version).

      Thanks,
      Rob.

      --

      Robert Webb <RobertW@...>,
      MineSweeper3D - Take Minesweeper to a whole new dimension!
      <http://www.software3d.com/Mines3D>
    • Bram Moolenaar
      ... A session file is nothing more than a generated Vim script. The abort happens somewhere halfway the script, where files are loaded into the windows that
      Message 2 of 4 , Apr 29, 2004
      • 0 Attachment
        Robert Webb wrote:

        > > Patch 6.2.489
        > > Problem: When accidentally opening a session in Vim which has already
        > been
        > > opened in another Vim there is a long row of ATTENTION prompts.
        > > Need to quit each of them to get out. (Robert Webb)
        > > Solution: Add the "Abort" alternative to the dialog.
        >
        > Patch 6.2.489 doesn't do what I expected. I thought it would exit the
        > program entirely, but instead vim still opens but in some weird state.
        > The first time I tried it I was left with lots of windows (matching
        > the original session layout) onto a ZIP file, which appeared as
        > garbage in vim of course. The ZIP file wasn't one of the files in the
        > session being opened! But I see now it is the only item in the args
        > list (don't know how I managed that), although it didn't appear in a
        > window.

        A session file is nothing more than a generated Vim script. The "abort"
        happens somewhere halfway the script, where files are loaded into the
        windows that have been created. You are left with whatever the script
        did until that point.

        You can also ":source" a session, you probably don't want Vim to exit
        then. It's also possible that most files load just fine, but you abort
        loading one of the last. You probably also don't want Vim to exit then.

        A partial solution may be to generate the session file in a slightly
        different way. I guess the main problem is when all the files are
        already open somewhere else. Trying to load the first file before
        creating all the windows and quitting when that first file can't be
        loaded, something like that.

        I had a look at the code in makeopens(), but it's not that simple...
        I made an attempt, see the patch below. I'm not sure this is without
        problems, changing the sequence of commands in a session script is
        tricky.

        > Finally, a minor point. The order of buttons is:
        > Open Read-Only, Edit anyway, Recover, Quit, Abort, Delete it
        >
        > I think it would make more sense to put them in this order:
        > Open Read-Only, Edit anyway, Recover, Delete it, Quit, Abort

        Well, the "Delete it" alternative is optional. Moving it means the
        returned number depends on the "Delete it" being present or not, makes
        the code more complicated. I don't think it's worth changing.


        *** ../vim-6.2.514/src/ex_docmd.c Fri Apr 23 12:02:42 2004
        --- src/ex_docmd.c Thu Apr 29 13:45:57 2004
        ***************
        *** 8569,8574 ****
        --- 8567,8573 ----
        int restore_size = TRUE;
        win_T *wp;
        char_u *sname;
        + win_T *edited_win = NULL;

        if (ssop_flags & SSOP_BUFFERS)
        only_save_windows = FALSE; /* Save ALL buffers */
        ***************
        *** 8657,8662 ****
        --- 8656,8684 ----
        #endif

        /*
        + * Before creating the window layout, try loading one file. If this is
        + * aborted we don't end up with a number of useless windows.
        + * This may have side effects! (e.g., compressed or network file).
        + */
        + for (wp = firstwin; wp != NULL; wp = wp->w_next)
        + {
        + if (ses_do_win(wp)
        + && wp->w_buffer->b_ffname != NULL
        + && !wp->w_buffer->b_help
        + #ifdef FEAT_QUICKFIX
        + && !bt_nofile(wp->w_buffer)
        + #endif
        + )
        + {
        + if (fputs("edit ", fd) < 0
        + || ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
        + return FAIL;
        + edited_win = wp;
        + break;
        + }
        + }
        +
        + /*
        * Save current window layout.
        */
        if (put_line(fd, "set splitbelow splitright") == FAIL)
        ***************
        *** 8702,8708 ****
        {
        if (!ses_do_win(wp))
        continue;
        ! if (put_view(fd, wp, TRUE, &ssop_flags) == FAIL)
        return FAIL;
        if (nr > 1 && put_line(fd, "wincmd w") == FAIL)
        return FAIL;
        --- 8724,8730 ----
        {
        if (!ses_do_win(wp))
        continue;
        ! if (put_view(fd, wp, wp != edited_win, &ssop_flags) == FAIL)
        return FAIL;
        if (nr > 1 && put_line(fd, "wincmd w") == FAIL)
        return FAIL;

        --
        Creating the world with Emacs: M-x let-there-be-light
        Creating the world with Vim: :make world

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
      • Robert Webb
        ... Understood. ... Thanks for the patch. It works for me. Can it become official? ... I see what you mean in the code. It s not too hard to fix though, so
        Message 3 of 4 , May 2, 2004
        • 0 Attachment
          Bram wrote:

          > > > Patch 6.2.489
          > > > Problem: When accidentally opening a session in Vim which has
          > > > already been opened in another Vim there is a long row of
          > > > ATTENTION prompts. Need to quit each of them to get out.
          > > > Solution: Add the "Abort" alternative to the dialog.
          > >
          > > Patch 6.2.489 doesn't do what I expected. I thought it would exit the
          > > program entirely...
          >
          > A session file is nothing more than a generated Vim script. The "abort"
          > happens somewhere halfway the script, where files are loaded into the
          > windows that have been created. You are left with whatever the script
          > did until that point.
          >
          > You can also ":source" a session, you probably don't want Vim to exit
          > then. It's also possible that most files load just fine, but you abort
          > loading one of the last. You probably also don't want Vim to exit then.

          Understood.

          > A partial solution may be to generate the session file in a slightly
          > different way. I guess the main problem is when all the files are
          > already open somewhere else. Trying to load the first file before
          > creating all the windows and quitting when that first file can't be
          > loaded, something like that.
          >
          > I had a look at the code in makeopens(), but it's not that simple...
          > I made an attempt, see the patch below. I'm not sure this is without
          > problems, changing the sequence of commands in a session script is
          > tricky.

          Thanks for the patch. It works for me. Can it become official?

          > > Finally, a minor point. The order of buttons is:
          > > Open Read-Only, Edit anyway, Recover, Quit, Abort, Delete it
          > >
          > > I think it would make more sense to put them in this order:
          > > Open Read-Only, Edit anyway, Recover, Delete it, Quit, Abort
          >
          > Well, the "Delete it" alternative is optional. Moving it means the
          > returned number depends on the "Delete it" being present or not, makes
          > the code more complicated. I don't think it's worth changing.

          I see what you mean in the code. It's not too hard to fix though, so
          I've attached a patch to do it. I can't test the case where the
          "Delete it" button doesn't appear, which happens inside:
          # if defined(UNIX) || defined(__EMX__) || defined(VMS)
          But it should work. I searched the docs and couldn't find reference to
          these button labels, so presumably no patch required there :-)

          Probably my first patch in more than five years! :-)

          Thanks,
          Rob.

          --

          Robert Webb <RobertW@...>,
          Want to make polyhedra?
          <http://www.software3d.com/Stella.html>
        • Bram Moolenaar
          ... Now that you tested it, yes. ... Looks OK, but it changes a translated string. I ll keep it for later, I find it more important to have the translations
          Message 4 of 4 , May 3, 2004
          • 0 Attachment
            Robert Webb wrote:

            > > A partial solution may be to generate the session file in a slightly
            > > different way. I guess the main problem is when all the files are
            > > already open somewhere else. Trying to load the first file before
            > > creating all the windows and quitting when that first file can't be
            > > loaded, something like that.
            > >
            > > I had a look at the code in makeopens(), but it's not that simple...
            > > I made an attempt, see the patch below. I'm not sure this is without
            > > problems, changing the sequence of commands in a session script is
            > > tricky.
            >
            > Thanks for the patch. It works for me. Can it become official?

            Now that you tested it, yes.

            > > > Finally, a minor point. The order of buttons is:
            > > > Open Read-Only, Edit anyway, Recover, Quit, Abort, Delete it
            > > >
            > > > I think it would make more sense to put them in this order:
            > > > Open Read-Only, Edit anyway, Recover, Delete it, Quit, Abort
            > >
            > > Well, the "Delete it" alternative is optional. Moving it means the
            > > returned number depends on the "Delete it" being present or not, makes
            > > the code more complicated. I don't think it's worth changing.
            >
            > I see what you mean in the code. It's not too hard to fix though, so
            > I've attached a patch to do it. I can't test the case where the
            > "Delete it" button doesn't appear, which happens inside:
            > # if defined(UNIX) || defined(__EMX__) || defined(VMS)
            > But it should work. I searched the docs and couldn't find reference to
            > these button labels, so presumably no patch required there :-)

            Looks OK, but it changes a translated string. I'll keep it for later, I
            find it more important to have the translations than the ordering for
            now.

            > Probably my first patch in more than five years! :-)

            Welcome back! :-)

            --
            From "know your smileys":
            :-& Eating spaghetti

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
          Your message has been successfully submitted and would be delivered to recipients shortly.