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

Re: Patch: make "emenu" accept the unlocalized menu names

Expand Messages
  • Tony Mechelynck
    ... [...] The :emenu command is also useful to access the Vim menus in console mode, for instance as follows: if has( wildmenu ) set wildmenu
    Message 1 of 7 , May 2, 2010
    • 0 Attachment
      On 03/05/10 05:55, Edward L. Fox wrote:
      > Hi Bram,
      >
      > Here's a small patch provided by Liang Peng, alias Bezetek James. He
      > has fixed the problem in menu/unmenu/emenu series commands.
      >
      > As my understanding, "emenu" is designed for scripts to access some
      > menu items. However, "emenu" only accepts the localized menu names.
      > For example, you can use your script to add a new menu item by calling
      > "amenu File.Test :echo 'hello'<CR>", but you can't execute the same
      > menu item by calling "emenu File.Test" if you are not running Vim in
      > English mode. Instead, you have to use localized menu name for
      > "File". However, we don't have any interface to access the menu
      > translation table via script. So "emenu" command is nearly useless
      > for script writers.
      [...]

      The :emenu command is also useful to access the Vim menus in console
      mode, for instance as follows:

      if has("wildmenu")
      set wildmenu wildmode=longest:full,full
      else
      set wildmode=longest,list:longest,full
      endif

      if has('menu')
      if !has('gui_running')
      runtime menu.vim
      endif
      set wildcharm=<C-T> " or anything not needed in cmdline mode
      map <C-Z> :emenu<C-T>
      imap <C-Z> <C-O>:emenu<C-T>
      " we can still suspend Vim with :sus[pend] or :st[op]
      endif


      Best regards,
      Tony.
      --
      "And what will you do when you grow up to be as big as me?"
      asked the father of his little son.
      "Diet."

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Edward L. Fox
      On Mon, May 3, 2010 at 13:43, Tony Mechelynck ... This patch makes both localized and unlocalized menu items appear in the wild menu. I think it s reasonable
      Message 2 of 7 , May 2, 2010
      • 0 Attachment
        On Mon, May 3, 2010 at 13:43, Tony Mechelynck
        <antoine.mechelynck@...> wrote:
        > On 03/05/10 05:55, Edward L. Fox wrote:
        >>
        >> Hi Bram,
        >>
        >> Here's a small patch provided by Liang Peng, alias Bezetek James.  He
        >> has fixed the problem in menu/unmenu/emenu series commands.
        >>
        >> As my understanding, "emenu" is designed for scripts to access some
        >> menu items.  However, "emenu" only accepts the localized menu names.
        >> For example, you can use your script to add a new menu item by calling
        >> "amenu File.Test :echo 'hello'<CR>", but you can't execute the same
        >> menu item by calling "emenu File.Test" if you are not running Vim in
        >> English mode.  Instead, you have to use localized menu name for
        >> "File".  However, we don't have any interface to access the menu
        >> translation table via script.  So "emenu" command is nearly useless
        >> for script writers.
        >
        > [...]
        >
        > The :emenu command is also useful to access the Vim menus in console mode,
        > for instance as follows:
        >
        > if has("wildmenu")
        >        set wildmenu wildmode=longest:full,full
        > else
        >        set wildmode=longest,list:longest,full
        > endif
        >
        > if has('menu')
        >        if !has('gui_running')
        >                runtime menu.vim
        >        endif
        >        set wildcharm=<C-T>     " or anything not needed in cmdline mode
        >        map <C-Z> :emenu<C-T>
        >        imap <C-Z> <C-O>:emenu<C-T>
        >        " we can still suspend Vim with :sus[pend] or :st[op]
        > endif

        This patch makes both localized and unlocalized menu items appear in
        the wild menu. I think it's reasonable because both of them works.
        What do you think?

        >
        >
        > Best regards,
        > Tony.
        > --
        >        "And what will you do when you grow up to be as big as me?"
        > asked the father of his little son.
        >        "Diet."
        >

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Tony Mechelynck
        On 03/05/10 07:50, Edward L. Fox wrote: [...] ... If they are selectable separately, I think it s comparable to what happens when localized help is
        Message 3 of 7 , May 3, 2010
        • 0 Attachment
          On 03/05/10 07:50, Edward L. Fox wrote:
          [...]
          > This patch makes both localized and unlocalized menu items appear in
          > the wild menu. I think it's reasonable because both of them works.
          > What do you think?

          If they are selectable separately, I think it's comparable to what
          happens when "localized help" is installed, where helptag completion
          brings up tags for both @en help and help in every installed help
          language. For the menus, I suppose that if v:lang is "C", "POSIX", "en",
          or, let's say, "en_US.UTF-8" or "English_United-States.1252", only
          English menus will come up (and that only once for each menu or menuitem)?


          Best regards,
          Tony.
          --
          MORTICIAN: Bring out your dead!
          [clang]
          Bring out your dead!
          [clang]
          Bring out your dead!
          CUSTOMER: Here's one -- nine pence.
          DEAD PERSON: I'm not dead!
          The Quest for the Holy Grail (Monty
          Python)

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Bram Moolenaar
          ... This is very useful. There was an old patch that I never got around looking into, from Bjorn Winckler. It dates 2008 March 30.
          Message 4 of 7 , May 7, 2010
          • 0 Attachment
            Edward L. Fox wrote:

            > Here's a small patch provided by Liang Peng, alias Bezetek James. He
            > has fixed the problem in menu/unmenu/emenu series commands.
            >
            > As my understanding, "emenu" is designed for scripts to access some
            > menu items. However, "emenu" only accepts the localized menu names.
            > For example, you can use your script to add a new menu item by calling
            > "amenu File.Test :echo 'hello'<CR>", but you can't execute the same
            > menu item by calling "emenu File.Test" if you are not running Vim in
            > English mode. Instead, you have to use localized menu name for
            > "File". However, we don't have any interface to access the menu
            > translation table via script. So "emenu" command is nearly useless
            > for script writers.
            >
            > Bezetek's patch makes menu/unmenu/emenu useful again. He modified the
            > menu structure to store the original strings before the localization,
            > and accepts the unlocalized strings for all the menu series commands
            > when calling all menu related command. To keep the compatibility,
            > localized menu names are also accepted, just like the behavior before.
            >
            > This is his first patch to Vim, and he's quite eager to participate in
            > open source projects. Please help review his patch and include it in
            > the next release of Vim. Many thanks!

            This is very useful.

            There was an old patch that I never got around looking into, from Bjorn
            Winckler. It dates 2008 March 30.

            http://www.mail-archive.com/vim_dev@.../msg02561.html

            Perhaps you can compare the patches and find out what works best?

            --
            How To Keep A Healthy Level Of Insanity:
            3. Every time someone asks you to do something, ask if they want fries
            with that.

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Edward L. Fox
            ... The language of the menu could be specified by set langmenu=... statement in .vimrc. If your menu language is not English, this patch will make both
            Message 5 of 7 , May 9, 2010
            • 0 Attachment
              On Mon, May 03, 2010 at 04:51:27PM +0200, Tony Mechelynck wrote:
              > On 03/05/10 07:50, Edward L. Fox wrote:
              > [...]
              > >This patch makes both localized and unlocalized menu items appear in
              > >the wild menu. I think it's reasonable because both of them works.
              > >What do you think?
              >
              > If they are selectable separately, I think it's comparable to what
              > happens when "localized help" is installed, where helptag completion
              > brings up tags for both @en help and help in every installed help
              > language. For the menus, I suppose that if v:lang is "C", "POSIX",
              > "en", or, let's say, "en_US.UTF-8" or "English_United-States.1252",
              > only English menus will come up (and that only once for each menu or
              > menuitem)?

              The language of the menu could be specified by "set langmenu=..."
              statement in .vimrc. If your menu language is not English, this patch
              will make both localized menu items and original ones appear in the
              wild menu. If your menu language is already English, it will *not*
              display each menu item twice.

              >
              > Best regards,
              > Tony.
              > --
              > MORTICIAN: Bring out your dead!
              > [clang]
              > Bring out your dead!
              > [clang]
              > Bring out your dead!
              > CUSTOMER: Here's one -- nine pence.
              > DEAD PERSON: I'm not dead!
              > The Quest for the Holy Grail
              > (Monty Python)

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Edward L. Fox
              ... I reviewed both of them. The patch from Bjorn only fixed the emenu problem. Liang s patch actually did much more, for example, it also adjust the wild
              Message 6 of 7 , May 9, 2010
              • 0 Attachment
                On Fri, May 07, 2010 at 04:17:36PM +0200, Bram Moolenaar wrote:
                >
                > Edward L. Fox wrote:
                >
                > > Here's a small patch provided by Liang Peng, alias Bezetek James. He
                > > has fixed the problem in menu/unmenu/emenu series commands.
                > >
                > > As my understanding, "emenu" is designed for scripts to access some
                > > menu items. However, "emenu" only accepts the localized menu names.
                > > For example, you can use your script to add a new menu item by calling
                > > "amenu File.Test :echo 'hello'<CR>", but you can't execute the same
                > > menu item by calling "emenu File.Test" if you are not running Vim in
                > > English mode. Instead, you have to use localized menu name for
                > > "File". However, we don't have any interface to access the menu
                > > translation table via script. So "emenu" command is nearly useless
                > > for script writers.
                > >
                > > Bezetek's patch makes menu/unmenu/emenu useful again. He modified the
                > > menu structure to store the original strings before the localization,
                > > and accepts the unlocalized strings for all the menu series commands
                > > when calling all menu related command. To keep the compatibility,
                > > localized menu names are also accepted, just like the behavior before.
                > >
                > > This is his first patch to Vim, and he's quite eager to participate in
                > > open source projects. Please help review his patch and include it in
                > > the next release of Vim. Many thanks!
                >
                > This is very useful.
                >
                > There was an old patch that I never got around looking into, from Bjorn
                > Winckler. It dates 2008 March 30.
                >
                > http://www.mail-archive.com/vim_dev@.../msg02561.html
                >
                > Perhaps you can compare the patches and find out what works best?

                I reviewed both of them. The patch from Bjorn only fixed the emenu
                problem. Liang's patch actually did much more, for example, it also
                adjust the wild menu for all menu related commands as well. Moreover,
                he slightly modified the structure of menu.c to make the code a little
                bit more readable, which was also suggested by Bjorn in his post.

                I think his patch is already in very good quality, and is almost ready
                to be included. Can anyone else also help with a more strict review?

                > --
                > How To Keep A Healthy Level Of Insanity:
                > 3. Every time someone asks you to do something, ask if they want fries
                > with that.
                >
                > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                > \\\ download, build and distribute -- http://www.A-A-P.org ///
                > \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              Your message has been successfully submitted and would be delivered to recipients shortly.