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

RE: nowrap lost in session.

Expand Messages
  • Bram Moolenaar
    ... It appears this has nothing to do with session files. I think you can ... CTRL-W CTRL-W ... In the second window the modelines are not read, because the
    Message 1 of 6 , Sep 3, 2004
      Robert Webb wrote:

      > > The session file has a very particular order for restoring the windows,
      > > because it has to take care of size and several other things. It's not
      > > strange that when you don't restore option values, they will not be
      > > restored properly. Nevertheless, the "edit file" commands should use
      > > the modeline in the file.
      >
      > Right. I didn't expect it to restore options from before, I expected
      > it to set them from the modelines.
      >
      > I expect the first time the file is loaded, the modelines would be
      > used. The other windows on that file should inherit that setting.
      >
      > Not sure if I pointed it out, but the first window does have the right
      > setting, it's only the second window on the same file that doesn't.

      It appears this has nothing to do with session files. I think you can
      reproduce it with:

      :set wrap
      :split
      :edit file-with-nowrap-in-modeline
      CTRL-W CTRL-W
      :edit file-with-nowrap-in-modeline

      In the second window the modelines are not read, because the buffer is
      already loaded. That's OK for buffer-local options, but window-local
      options are not set then.

      I'll see if the modeline can be read when displaying an already loaded
      buffer in a window, without causing unwanted side effects.

      --
      DINGO: And after the spanking ... the oral sex.
      GALAHAD: Oh, dear! Well, I...
      GIRLS: The oral sex ... The oral sex.
      GALAHAD: Well, I suppose I could stay a BIT longer.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// 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
      ... Maybe another solution would be to inherit window and buffer options from another existing window/buffer if one exists for the same file, as if it had been
      Message 2 of 6 , Sep 12, 2004
        Bram wrote:

        > Robert Webb wrote:
        >
        > > > The session file has a very particular order for restoring the
        > > > windows, because it has to take care of size and several other
        > > > things. It's not strange that when you don't restore option
        > > > values, they will not be restored properly. Nevertheless, the
        > > > "edit file" commands should use the modeline in the file.
        > >
        > > Right. I didn't expect it to restore options from before, I
        > > expected it to set them from the modelines.
        > >
        > > I expect the first time the file is loaded, the modelines would be
        > > used. The other windows on that file should inherit that setting.
        > >
        > > Not sure if I pointed it out, but the first window does have the
        > > right setting, it's only the second window on the same file that
        > > doesn't.
        >
        > It appears this has nothing to do with session files. I think you
        > can reproduce it with:
        >
        > :set wrap
        > :split
        > :edit file-with-nowrap-in-modeline
        > CTRL-W CTRL-W
        > :edit file-with-nowrap-in-modeline
        >
        > In the second window the modelines are not read, because the buffer
        > is already loaded. That's OK for buffer-local options, but
        > window-local options are not set then.
        >
        > I'll see if the modeline can be read when displaying an already
        > loaded buffer in a window, without causing unwanted side effects.

        Maybe another solution would be to inherit window and buffer options
        from another existing window/buffer if one exists for the same file,
        as if it had been split from that window.

        If you are already viewing a particular file with nowrap in one
        window, chances are you also want to view it with nowrap in any other
        windows. You can then change the setting of course if you really did
        want a different setting.

        Might be a bit strange to read modelines for a file that has already
        been read. With my suggestion, the modelines are only read once, but
        inherited for new windows.

        What do you think? Obviously if there are two windows already open
        then it's ambiguous as to which one to inherit from, but I don't think
        that would matter much, just use the first one.

        Rob.

        --

        Robert Webb <RobertW@...>,
        Want to make polyhedra?
        <http://www.software3d.com/Stella.html>
      • Bram Moolenaar
        ... It s possible, but it conflicts with options you may have already set in the window. For example, if number is set you might want to keep it, instead of
        Message 3 of 6 , Sep 13, 2004
          Robert Webb wrote:

          > > It appears this has nothing to do with session files. I think you
          > > can reproduce it with:
          > >
          > > :set wrap
          > > :split
          > > :edit file-with-nowrap-in-modeline
          > > CTRL-W CTRL-W
          > > :edit file-with-nowrap-in-modeline
          > >
          > > In the second window the modelines are not read, because the buffer
          > > is already loaded. That's OK for buffer-local options, but
          > > window-local options are not set then.
          > >
          > > I'll see if the modeline can be read when displaying an already
          > > loaded buffer in a window, without causing unwanted side effects.
          >
          > Maybe another solution would be to inherit window and buffer options
          > from another existing window/buffer if one exists for the same file,
          > as if it had been split from that window.

          It's possible, but it conflicts with options you may have already set in
          the window. For example, if 'number' is set you might want to keep it,
          instead of using the value from another window that is displaying the
          buffer.

          The modelines overrule option values, thus using the modelines to set
          window-local options should be OK. But options from another window
          should not overrule options of the current window. Perhaps if they were
          not explicitly set, but that becomes rather unpredictable.

          > Might be a bit strange to read modelines for a file that has already
          > been read. With my suggestion, the modelines are only read once, but
          > inherited for new windows.

          I already implemented the idea to only use window-local options from the
          modeline, and it appears to work well. It looks logical to me that when
          you show a file in a window it's modelines are used.

          > What do you think? Obviously if there are two windows already open
          > then it's ambiguous as to which one to inherit from, but I don't think
          > that would matter much, just use the first one.

          That would be another reason not to use the options from another window,
          it would be arbitrary what option values you get.

          --
          BRIDGEKEEPER: What is your favorite editor?
          GAWAIN: Emacs ... No, Viiiiiiiiiiimmmmmmm!
          "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD

          /// 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.