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

Re: Suggestion [was: Re: Easter exercise for the reader]

Expand Messages
  • Zdenek Sekera
    Message 1 of 21 , May 1, 2000
    • 0 Attachment
      Ron Aaron wrote:
      >
      > Bram Moolenaar <Bram@...> writes:
      > >My main reason to not want to include a way to disable messages in a general
      > >way, is that people will switch it on, forget about it, and complain that
      > >something doesn't work. It's even worse when some system-wide vimrc file sets
      > >the option for you.
      > >
      > >Rule #1: Don't give somebody a tool that he's going to hurt himself with.
      >
      > But you're giving them vi !?! :-0

      ...but improved...:-)

      ---Zdenek
    • Flemming Madsen
      ... Ok, that explains why :redirect is not actually a redirect :-) If it was (or had an option for it) we would already have the feature that most (?) people
      Message 2 of 21 , May 1, 2000
      • 0 Attachment
        Bram Moolenaar wrote:
        >
        > Mark Waggoner wrote:
        >
        > > Regarding the :silent discussion...
        > >
        > > Would an option like:
        > >
        > > notifylevel (or some more meaningful name) be more useful?
        >
        > My main reason to not want to include a way to disable messages in a general
        > way, is that people will switch it on, forget about it, and complain that
        > something doesn't work. It's even worse when some system-wide vimrc file sets
        > the option for you.
        >
        > Rule #1: Don't give somebody a tool that he's going to hurt himself with.
        >

        Ok, that explains why :redirect is not actually a redirect :-)
        If it was (or had an option for it) we would already have the feature
        that most (?) people seem to expect from the silent command.

        I would like to propose a combination of both worlds:

        - The :silent 'command' form is (potentially) more convenient than the
        :redir BEGIN <stuff> :redir END form. Also it will not allow somebody
        to shoot off their whole leg.

        - For scripting, it is a much required feature to be able to disable (all)
        output to the screen. At the same time it is often equally mandatory to
        have a record of what would othwerwise have been written for subsequent
        parsing.

        How about a :divert command that has the syntax of :silent and the funtionality
        of :redirect @reg, with the added default of not writing to the screen:

        :divert[!] reg command Redirect message output of 'command' to register
        'reg'. Append to the contents of the registers {a-z}
        if its name is given uppercase {A-Z}. If [!] if given,
        messages will also appear on the screen.
        Use the "black hole" register '_' for discarding
        output altogether.


        Regards

        /Flemming
      • Bram Moolenaar
        ... Ah, now I understand. :silent unmap should not bother you with a message. I ll add a remark in the todo list. -- hundred-and-one symptoms of being
        Message 3 of 21 , May 1, 2000
        • 0 Attachment
          Ron Aaron wrote:

          > I mean that if I do:
          > unmap <cr>
          > when <cr> wasn't mapped to something, I get the error message "No such
          > mapping". If I e.g. want to make sure that certain keys are unmapped:
          >
          > au BufEnter * unmap <cr>
          >
          > I get that annoying message every time I go into a buffer unless that key was
          > mapped. So instead, I do something like:
          >
          > au BufEnter * if mapcheck('<cr>')!='' | unmap <cr> | endif
          >
          > which is a lot more work than I should have to do, IMHO.
          >
          > Does this make sense?

          Ah, now I understand. ":silent unmap <cr>" should not bother you with a
          message. I'll add a remark in the todo list.

          --
          hundred-and-one symptoms of being an internet addict:
          181. You make up words that go with the "happy tune" your modem makes
          while dialing your ISP.

          /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
          \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
        • Bram Moolenaar
          Flemming Madsen wrote: [about switching of messages for a sequence of commands] ... Yes, :redirect doesn t work very nice. I m still looking for a solution.
          Message 4 of 21 , May 1, 2000
          • 0 Attachment
            Flemming Madsen wrote:

            [about switching of messages for a sequence of commands]
            > Bram Moolenaar wrote:
            > > My main reason to not want to include a way to disable messages in a
            > > general way, is that people will switch it on, forget about it, and
            > > complain that something doesn't work. It's even worse when some
            > > system-wide vimrc file sets the option for you.
            > >
            > > Rule #1: Don't give somebody a tool that he's going to hurt himself with.
            >
            > Ok, that explains why :redirect is not actually a redirect :-)
            > If it was (or had an option for it) we would already have the feature
            > that most (?) people seem to expect from the silent command.

            Yes, :redirect doesn't work very nice. I'm still looking for a solution.
            Perhaps by not echoing until the user is asked to hit a key. Still, any
            prompt would be missing then. How do you know you have to hit return if the
            hit-return prompt isn't there? Probably have to remember the last message and
            output that before waiting for the key.

            > I would like to propose a combination of both worlds:
            >
            > - The :silent 'command' form is (potentially) more convenient than the
            > :redir BEGIN <stuff> :redir END form. Also it will not allow somebody
            > to shoot off their whole leg.

            ":silent cmd" should be a relatively safe thing. And it will work for things
            you want no messages for.

            > - For scripting, it is a much required feature to be able to disable (all)
            > output to the screen. At the same time it is often equally mandatory to
            > have a record of what would othwerwise have been written for subsequent
            > parsing.
            >
            > How about a :divert command that has the syntax of :silent and the
            > funtionality of :redirect @reg, with the added default of not writing to the
            > screen:
            >
            > :divert[!] reg command Redirect message output of 'command' to register
            > 'reg'. Append to the contents of the registers {a-z}
            > if its name is given uppercase {A-Z}. If [!] if
            > given, messages will also appear on the screen.
            > Use the "black hole" register '_' for discarding
            > output altogether.

            I think ":silent redir" can be used for this. Then it can work exactly like
            ":redir", but without echoing the messages. The problem mentioned above will
            probably have to be solved anyway, and it avoids the need for another command.

            Hopefully the script writer remembers that any output from the script will be
            redirected too, an ":echo "hello"" won't work!

            --
            hundred-and-one symptoms of being an internet addict:
            182. You may not know what is happening in the world, but you know
            every bit of net-gossip there is.

            /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
            \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
          • Flemming Madsen
            ... Yes, if :silent would cause :redir to stop messages from going to the screen, this would fill the void nicely. Of course it _does_ enable your .vimrc file
            Message 5 of 21 , May 1, 2000
            • 0 Attachment
              Bram Moolenaar wrote:
              >
              > Flemming Madsen wrote:
              >
              > [about switching of messages for a sequence of commands]
              > > Bram Moolenaar wrote:
              > > > My main reason to not want to include a way to disable messages in a
              > > > general way, is that people will switch it on, forget about it, and
              > > > complain that something doesn't work. It's even worse when some
              > > > system-wide vimrc file sets the option for you.
              > > >
              > > > Rule #1: Don't give somebody a tool that he's going to hurt himself with.
              > >
              > > Ok, that explains why :redirect is not actually a redirect :-)
              > > If it was (or had an option for it) we would already have the feature
              > > that most (?) people seem to expect from the silent command.
              >
              > Yes, :redirect doesn't work very nice. I'm still looking for a solution.
              > Perhaps by not echoing until the user is asked to hit a key. Still, any
              > prompt would be missing then. How do you know you have to hit return if the
              > hit-return prompt isn't there? Probably have to remember the last message and
              > output that before waiting for the key.
              >
              > > I would like to propose a combination of both worlds:
              > >
              > > :divert[!] reg command Redirect message output of 'command' to register
              > > 'reg'. Append to the contents of the registers {a-z}
              > > if its name is given uppercase {A-Z}. If [!] if
              > > given, messages will also appear on the screen.
              > > Use the "black hole" register '_' for discarding
              > > output altogether.
              >
              > I think ":silent redir" can be used for this. Then it can work exactly like
              > ":redir", but without echoing the messages. The problem mentioned above will
              > probably have to be solved anyway, and it avoids the need for another command.
              >
              > Hopefully the script writer remembers that any output from the script will be
              > redirected too, an ":echo "hello"" won't work!
              >
              Yes, if :silent would cause :redir to stop messages from going to the screen,
              this would fill the void nicely. Of course it _does_ enable your .vimrc file
              or a faulty/rogue function to disable/hide messages on a global basis.
              That's fine with me though. :redir END is the programmers responsibility anyway.

              Regards
              /Flemming
            Your message has been successfully submitted and would be delivered to recipients shortly.