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

Re: why is 'keywordprog' global ?

Expand Messages
  • Christian J. Robinson
    ... Meaning the :set code would have to recognize that keywordprg was being set to an empty value and set it to :help ? This would work, but it would be a
    Message 1 of 6 , Dec 28, 2002
    • 0 Attachment
      Bram Moolenaar wrote:

      > Christian J. Robinson wrote:
      >
      >> Bram Moolenaar wrote:
      >>>
      >>> Since 'keywordprog' has so far been global, it should be made
      >>> global-local to remain backwards compatible. See ":help
      >>> global-local" to find out how this works. This was already an item
      >>> in the todo list, thus if you can make a patch for global-local I
      >>> might include it.
      >>
      >> The implementation of global-local options is such that the local
      >> value is a zero-length string/nul unless you've set the option
      >> locally. Normally that means vim just accesses the global option
      >> instead, but in this case it meant that :help was always being used
      >> when only the global value was set.
      >
      > It's not obvious how to solve this. It's a conflict of the old
      > meaning of 'keywordprg' being empty and a local value for a
      > global-local option being empty.
      >
      > How about this solution: To get the effect of the empty value, set the
      > local value to ":help". The empty value of a local option than has
      > the consistent meaning of using the global value. Does that sound
      > reasonable?

      Meaning the :set code would have to recognize that 'keywordprg' was
      being set to an empty value and set it to ":help"?

      This would work, but it would be a little unexpected. Also, this can't
      be done for :setlocal due to the following lines in ":help global-local":

      You can switch back to using the global value by making the local value empty:
      :setlocal makeprg=

      Which may be acceptable for just maintaining backward compatibility with
      :set.

      Perhaps additionally an update to the documentation saying that
      'keywordprg' should be set to ":help" and a note that the empty value is
      supported for backward compatibility, but deprecated?

      I've attempted to implement a patch (against 6.1.266) that does this,
      included below.


      While working on this, I have discovered a bug which I think isn't my
      fault. To reproduce it, compile vim with efence (and without my patch),
      then run the following commands within "vim -u NONE -U NONE -N":

      :setlocal define=something
      :setglobal define=somethingelse
      :set define<
      :set define?

      Vim should SEGV at this point. (Without efence I don't get a SEGV but
      the last command displays garbage.)


      diff -cr vim61~/runtime/doc/options.txt vim61/runtime/doc/options.txt
      *** vim61~/runtime/doc/options.txt Sat Dec 28 04:26:39 2002
      --- vim61/runtime/doc/options.txt Sat Dec 28 09:09:27 2002
      ***************
      *** 3315,3326 ****
      The 'keymodel' option is set by the |:behave| command.

      *'keywordprg'* *'kp'*
      ! 'keywordprg' 'kp' string (default "man" or "man -s", DOS: "",
      OS/2: "view /", VMS: "help")
      ! global
      {not in Vi}
      Program to use for the |K| command. Environment variables are
      ! expanded |:set_env|. When empty ":help" is used.
      When "man" is used, Vim will automatically translate a count for the
      "K" command to a section number. Also for "man -s", in which case the
      "-s" is removed when there is no count.
      --- 3315,3328 ----
      The 'keymodel' option is set by the |:behave| command.

      *'keywordprg'* *'kp'*
      ! 'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help",
      OS/2: "view /", VMS: "help")
      ! global or local to buffer |global-local|
      {not in Vi}
      Program to use for the |K| command. Environment variables are
      ! expanded |:set_env|. ":help" may be used to access the Vim internal
      ! help. (Note that previously the empty value did this, which is
      ! now deprecated.)
      When "man" is used, Vim will automatically translate a count for the
      "K" command to a section number. Also for "man -s", in which case the
      "-s" is removed when there is no count.
      diff -cr vim61~/src/buffer.c vim61/src/buffer.c
      *** vim61~/src/buffer.c Sat Dec 28 04:26:40 2002
      --- vim61/src/buffer.c Sat Dec 28 05:15:14 2002
      ***************
      *** 1433,1438 ****
      --- 1433,1439 ----
      #ifdef FEAT_CRYPT
      clear_string_option(&buf->b_p_key);
      #endif
      + clear_string_option(&buf->b_p_kp);
      clear_string_option(&buf->b_p_mps);
      clear_string_option(&buf->b_p_fo);
      clear_string_option(&buf->b_p_isk);
      diff -cr vim61~/src/normal.c vim61/src/normal.c
      *** vim61~/src/normal.c Sat Dec 28 04:26:41 2002
      --- vim61/src/normal.c Sat Dec 28 08:59:24 2002
      ***************
      *** 4678,4685 ****
      }

      /* Allocate buffer to put the command in. Inserting backslashes can
      ! * double the length of the word. p_kp could be added and some numbers. */
      ! buf = alloc((unsigned)(n * 2 + 30 + STRLEN(p_kp)));
      if (buf == NULL)
      return;
      buf[0] = NUL;
      --- 4678,4687 ----
      }

      /* Allocate buffer to put the command in. Inserting backslashes can
      ! * double the length of the word. p_kp / curbuf->b_p_kp could be added
      ! * and some numbers. */
      ! p = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp;
      ! buf = alloc((unsigned)(n * 2 + 30 + STRLEN(p)));
      if (buf == NULL)
      return;
      buf[0] = NUL;
      ***************
      *** 4703,4716 ****
      break;

      case 'K':
      ! if (*p_kp == NUL)
      STRCPY(buf, ":he ");
      else
      {
      /* When a count is given, turn it into a range. Is this
      * really what we want? */
      ! isman = (STRCMP(p_kp, "man") == 0);
      ! isman_s = (STRCMP(p_kp, "man -s") == 0);
      if (cap->count0 != 0 && !(isman || isman_s))
      sprintf((char *)buf, ".,.+%ld", cap->count0 - 1);

      --- 4705,4718 ----
      break;

      case 'K':
      ! if (*p == NUL || STRCMP(p, ":he") == 0 || STRCMP(p, ":help") == 0)
      STRCPY(buf, ":he ");
      else
      {
      /* When a count is given, turn it into a range. Is this
      * really what we want? */
      ! isman = (STRCMP(p, "man") == 0);
      ! isman_s = (STRCMP(p, "man -s") == 0);
      if (cap->count0 != 0 && !(isman || isman_s))
      sprintf((char *)buf, ".,.+%ld", cap->count0 - 1);

      ***************
      *** 4718,4724 ****
      if (cap->count0 == 0 && isman_s)
      STRCAT(buf, "man");
      else
      ! STRCAT(buf, p_kp);
      STRCAT(buf, " ");
      if (cap->count0 != 0 && (isman || isman_s))
      {
      --- 4720,4726 ----
      if (cap->count0 == 0 && isman_s)
      STRCAT(buf, "man");
      else
      ! STRCAT(buf, p);
      STRCAT(buf, " ");
      if (cap->count0 != 0 && (isman || isman_s))
      {
      ***************
      *** 4751,4757 ****
      */
      if (cmdchar == '*' || cmdchar == '#')
      aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
      ! else if (cmdchar == 'K' && *p_kp != NUL)
      aux_ptr = (char_u *)" \t\\\"|!";
      else
      /* Don't escape spaces and Tabs in a tag with a backslash */
      --- 4753,4760 ----
      */
      if (cmdchar == '*' || cmdchar == '#')
      aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
      ! else if (cmdchar == 'K' && ! (*p == NULL || STRCMP(p, ":he") == 0
      ! || STRCMP(p, ":help") == 0))
      aux_ptr = (char_u *)" \t\\\"|!";
      else
      /* Don't escape spaces and Tabs in a tag with a backslash */
      diff -cr vim61~/src/option.c vim61/src/option.c
      *** vim61~/src/option.c Sat Dec 28 04:26:44 2002
      --- vim61/src/option.c Sat Dec 28 08:55:48 2002
      ***************
      *** 92,97 ****
      --- 92,98 ----
      , PV_ISK
      , PV_KEY
      , PV_KMAP
      + , PV_KP
      , PV_LBR
      , PV_LISP
      , PV_LIST
      ***************
      *** 1231,1240 ****
      #endif
      {(char_u *)"", (char_u *)0L}},
      {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
      ! (char_u *)&p_kp, PV_NONE,
      {
      #if defined(MSDOS) || defined(MSWIN)
      ! (char_u *)"",
      #else
      #ifdef VMS
      (char_u *)"help",
      --- 1232,1241 ----
      #endif
      {(char_u *)"", (char_u *)0L}},
      {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
      ! (char_u *)&p_kp, OPT_BOTH(PV_KP),
      {
      #if defined(MSDOS) || defined(MSWIN)
      ! (char_u *)":help",
      #else
      #ifdef VMS
      (char_u *)"help",
      ***************
      *** 3505,3515 ****
      ++arg; /* jump to after the '=' or ':' */

      /*
      * Convert 'whichwrap' number to string, for
      * backwards compatibility with Vim 3.0.
      * Misuse errbuf[] for the resulting string.
      */
      ! if (varp == (char_u *)&p_ww && isdigit(*arg))
      {
      *errbuf = NUL;
      i = getdigits(&arg);
      --- 3506,3529 ----
      ++arg; /* jump to after the '=' or ':' */

      /*
      + * Set 'keywordprg' to ":help" if an empty
      + * value was passed to :set by the user.
      + * Misuse errbuf[] for the resulting string.
      + */
      + if (varp == (char_u *)&p_kp
      + && (*arg == NUL || *arg == ' '))
      + {
      + *errbuf = NUL;
      + STRCAT(errbuf, ":help");
      + save_arg = arg;
      + arg = errbuf;
      + }
      + /*
      * Convert 'whichwrap' number to string, for
      * backwards compatibility with Vim 3.0.
      * Misuse errbuf[] for the resulting string.
      */
      ! else if (varp == (char_u *)&p_ww && isdigit(*arg))
      {
      *errbuf = NUL;
      i = getdigits(&arg);
      ***************
      *** 4098,4103 ****
      --- 4112,4118 ----
      #ifdef FEAT_CRYPT
      check_string_option(&buf->b_p_key);
      #endif
      + check_string_option(&buf->b_p_kp);
      check_string_option(&buf->b_p_mps);
      check_string_option(&buf->b_p_fo);
      check_string_option(&buf->b_p_isk);
      ***************
      *** 7140,7145 ****
      --- 7155,7161 ----
      case OPT_BOTH(PV_EFM): return (char_u *)&(curbuf->b_p_efm);
      #endif
      case OPT_BOTH(PV_EP): return (char_u *)&(curbuf->b_p_ep);
      + case OPT_BOTH(PV_KP): return (char_u *)&(curbuf->b_p_kp);
      case OPT_BOTH(PV_PATH): return (char_u *)&(curbuf->b_p_path);
      case OPT_BOTH(PV_AR): return (char_u *)&(curbuf->b_p_ar);
      case OPT_BOTH(PV_TAGS): return (char_u *)&(curbuf->b_p_tags);
      ***************
      *** 7175,7180 ****
      --- 7191,7198 ----
      /* global option with local value: use local value if it's been set */
      case OPT_BOTH(PV_EP): return *curbuf->b_p_ep != NUL
      ? (char_u *)&curbuf->b_p_ep : p->var;
      + case OPT_BOTH(PV_KP): return *curbuf->b_p_kp != NUL
      + ? (char_u *)&curbuf->b_p_kp : p->var;
      case OPT_BOTH(PV_PATH): return *curbuf->b_p_path != NUL
      ? (char_u *)&(curbuf->b_p_path) : p->var;
      case OPT_BOTH(PV_AR): return curbuf->b_p_ar >= 0
      ***************
      *** 7603,7608 ****
      --- 7621,7627 ----
      #ifdef FEAT_CRYPT
      buf->b_p_key = vim_strsave(p_key);
      #endif
      + buf->b_p_kp = vim_strsave(p_kp);
      #ifdef FEAT_SEARCHPATH
      buf->b_p_sua = vim_strsave(p_sua);
      #endif
      ***************
      *** 7624,7629 ****
      --- 7643,7649 ----
      buf->b_p_efm = empty_option;
      #endif
      buf->b_p_ep = empty_option;
      + buf->b_p_kp = empty_option;
      buf->b_p_path = empty_option;
      buf->b_p_tags = empty_option;
      #ifdef FEAT_FIND_ID
      diff -cr vim61~/src/structs.h vim61/src/structs.h
      *** vim61~/src/structs.h Sat Dec 28 04:26:35 2002
      --- vim61/src/structs.h Sat Dec 28 05:15:14 2002
      ***************
      *** 952,957 ****
      --- 952,958 ----
      #ifdef FEAT_CRYPT
      char_u *b_p_key; /* 'key' */
      #endif
      + char_u *b_p_kp; /* 'keywordprg' */
      #ifdef FEAT_LISP
      int b_p_lisp; /* 'lisp' */
      #endif

      --
      Where are those flashbacks they promised me?
      Christian J. Robinson <infynity@...> http://infynity.spodzone.com/
      PGP key: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
    • Bram Moolenaar
      ... No, the user has to set the local value to :help . Doing this automatically would defeat the idea that an empty value means that the global value is to
      Message 2 of 6 , Dec 28, 2002
      • 0 Attachment
        > Bram Moolenaar wrote:
        >
        > > Christian J. Robinson wrote:
        > >
        > >> Bram Moolenaar wrote:
        > >>>
        > >>> Since 'keywordprog' has so far been global, it should be made
        > >>> global-local to remain backwards compatible. See ":help
        > >>> global-local" to find out how this works. This was already an item
        > >>> in the todo list, thus if you can make a patch for global-local I
        > >>> might include it.
        > >>
        > >> The implementation of global-local options is such that the local
        > >> value is a zero-length string/nul unless you've set the option
        > >> locally. Normally that means vim just accesses the global option
        > >> instead, but in this case it meant that :help was always being used
        > >> when only the global value was set.
        > >
        > > It's not obvious how to solve this. It's a conflict of the old
        > > meaning of 'keywordprg' being empty and a local value for a
        > > global-local option being empty.
        > >
        > > How about this solution: To get the effect of the empty value, set the
        > > local value to ":help". The empty value of a local option than has
        > > the consistent meaning of using the global value. Does that sound
        > > reasonable?
        >
        > Meaning the :set code would have to recognize that 'keywordprg' was
        > being set to an empty value and set it to ":help"?

        No, the user has to set the local value to ":help". Doing this
        automatically would defeat the idea that an empty value means that the
        global value is to be used.

        Thus ":help" would always use the internal help function, but the empty
        value only does this for the global value. That way it's backwards
        compatible. This would be just a small change in your patch.

        > While working on this, I have discovered a bug which I think isn't my
        > fault. To reproduce it, compile vim with efence (and without my patch),
        > then run the following commands within "vim -u NONE -U NONE -N":
        >
        > :setlocal define=something
        > :setglobal define=somethingelse
        > :set define<
        > :set define?
        >
        > Vim should SEGV at this point. (Without efence I don't get a SEGV but
        > the last command displays garbage.)

        I can reproduce it. The following patch appears to fix this.

        *** option.c~ Sun Nov 10 13:30:55 2002
        --- option.c Sat Dec 28 22:36:49 2002
        ***************
        *** 3498,3506 ****
        }
        else if (nextchar == '<') /* set to global val */
        {
        ! newval = *(char_u **)get_varp_scope(
        ! &(options[opt_idx]), OPT_GLOBAL);
        ! new_value_alloced = FALSE;
        }
        else
        {
        --- 3498,3506 ----
        }
        else if (nextchar == '<') /* set to global val */
        {
        ! newval = vim_strsave(*(char_u **)get_varp_scope(
        ! &(options[opt_idx]), OPT_GLOBAL));
        ! new_value_alloced = TRUE;
        }
        else
        {

        --
        hundred-and-one symptoms of being an internet addict:
        180. You maintain more than six e-mail addresses.

        /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
        \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
        \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
      • Christian J. Robinson
        ... That s basically how the patch included in my previous message works. Setting the local value to the empty string makes vim use the global value. Setting
        Message 3 of 6 , Dec 28, 2002
        • 0 Attachment
          Today (Sat, 28 Dec 2002), Bram Moolenaar wrote:

          >> Bram Moolenaar wrote:
          >>
          >>> Christian J. Robinson wrote:
          >>>
          >>>> Normally that means vim just accesses the global option instead,
          >>>> but in this case it meant that :help was always being used when
          >>>> only the global value was set.
          >>>
          >>> It's not obvious how to solve this. It's a conflict of the old
          >>> meaning of 'keywordprg' being empty and a local value for a
          >>> global-local option being empty.
          >>>
          >>> How about this solution: To get the effect of the empty value, set
          >>> the local value to ":help". The empty value of a local option than
          >>> has the consistent meaning of using the global value. Does that
          >>> sound reasonable?
          >>
          >> Meaning the :set code would have to recognize that 'keywordprg' was
          >> being set to an empty value and set it to ":help"?
          >
          > No, the user has to set the local value to ":help". Doing this
          > automatically would defeat the idea that an empty value means that the
          > global value is to be used.
          >
          > Thus ":help" would always use the internal help function, but the
          > empty value only does this for the global value. That way it's
          > backwards compatible. This would be just a small change in your
          > patch.

          That's basically how the patch included in my previous message works.
          Setting the local value to the empty string makes vim use the global
          value. Setting the global value to an empty string will cause vim to
          set it to ":help" for backward compatibility. It's easy enough to
          change this so that the user always has to use ":help", if that's
          preferred.

          I don't think my documentation update was written clearly, though.

          Below is another patch that replaces my previous patch, created against
          6.1.267. It slightly changes the documentation, and fixes a small
          problem I missed.

          >> :setlocal define=something
          >> :setglobal define=somethingelse
          >> :set define<
          >> :set define?
          >>
          >> Vim should SEGV at this point. (Without efence I don't get a SEGV but
          >> the last command displays garbage.)
          >
          > I can reproduce it. The following patch appears to fix this.

          It fixes it for me.



          diff -cr vim61~/runtime/doc/options.txt vim61/runtime/doc/options.txt
          *** vim61~/runtime/doc/options.txt Sat Dec 28 18:00:20 2002
          --- vim61/runtime/doc/options.txt Sat Dec 28 18:02:58 2002
          ***************
          *** 3315,3326 ****
          The 'keymodel' option is set by the |:behave| command.

          *'keywordprg'* *'kp'*
          ! 'keywordprg' 'kp' string (default "man" or "man -s", DOS: "",
          OS/2: "view /", VMS: "help")
          ! global
          {not in Vi}
          Program to use for the |K| command. Environment variables are
          ! expanded |:set_env|. When empty ":help" is used.
          When "man" is used, Vim will automatically translate a count for the
          "K" command to a section number. Also for "man -s", in which case the
          "-s" is removed when there is no count.
          --- 3315,3328 ----
          The 'keymodel' option is set by the |:behave| command.

          *'keywordprg'* *'kp'*
          ! 'keywordprg' 'kp' string (default "man" or "man -s", DOS: ":help",
          OS/2: "view /", VMS: "help")
          ! global or local to buffer |global-local|
          {not in Vi}
          Program to use for the |K| command. Environment variables are
          ! expanded |:set_env|. ":help" may be used to access the Vim internal
          ! help. (Note that previously setting the global option to the empty
          ! value did this, which is now deprecated.)
          When "man" is used, Vim will automatically translate a count for the
          "K" command to a section number. Also for "man -s", in which case the
          "-s" is removed when there is no count.
          diff -cr vim61~/src/buffer.c vim61/src/buffer.c
          *** vim61~/src/buffer.c Sat Dec 28 18:00:22 2002
          --- vim61/src/buffer.c Sat Dec 28 18:00:35 2002
          ***************
          *** 1433,1438 ****
          --- 1433,1439 ----
          #ifdef FEAT_CRYPT
          clear_string_option(&buf->b_p_key);
          #endif
          + clear_string_option(&buf->b_p_kp);
          clear_string_option(&buf->b_p_mps);
          clear_string_option(&buf->b_p_fo);
          clear_string_option(&buf->b_p_isk);
          diff -cr vim61~/src/normal.c vim61/src/normal.c
          *** vim61~/src/normal.c Sat Dec 28 18:00:23 2002
          --- vim61/src/normal.c Sat Dec 28 18:01:26 2002
          ***************
          *** 4678,4685 ****
          }

          /* Allocate buffer to put the command in. Inserting backslashes can
          ! * double the length of the word. p_kp could be added and some numbers. */
          ! buf = alloc((unsigned)(n * 2 + 30 + STRLEN(p_kp)));
          if (buf == NULL)
          return;
          buf[0] = NUL;
          --- 4678,4687 ----
          }

          /* Allocate buffer to put the command in. Inserting backslashes can
          ! * double the length of the word. p_kp / curbuf->b_p_kp could be added
          ! * and some numbers. */
          ! p = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp;
          ! buf = alloc((unsigned)(n * 2 + 30 + STRLEN(p)));
          if (buf == NULL)
          return;
          buf[0] = NUL;
          ***************
          *** 4703,4716 ****
          break;

          case 'K':
          ! if (*p_kp == NUL)
          STRCPY(buf, ":he ");
          else
          {
          /* When a count is given, turn it into a range. Is this
          * really what we want? */
          ! isman = (STRCMP(p_kp, "man") == 0);
          ! isman_s = (STRCMP(p_kp, "man -s") == 0);
          if (cap->count0 != 0 && !(isman || isman_s))
          sprintf((char *)buf, ".,.+%ld", cap->count0 - 1);

          --- 4705,4718 ----
          break;

          case 'K':
          ! if (*p == NUL || STRCMP(p, ":he") == 0 || STRCMP(p, ":help") == 0)
          STRCPY(buf, ":he ");
          else
          {
          /* When a count is given, turn it into a range. Is this
          * really what we want? */
          ! isman = (STRCMP(p, "man") == 0);
          ! isman_s = (STRCMP(p, "man -s") == 0);
          if (cap->count0 != 0 && !(isman || isman_s))
          sprintf((char *)buf, ".,.+%ld", cap->count0 - 1);

          ***************
          *** 4718,4724 ****
          if (cap->count0 == 0 && isman_s)
          STRCAT(buf, "man");
          else
          ! STRCAT(buf, p_kp);
          STRCAT(buf, " ");
          if (cap->count0 != 0 && (isman || isman_s))
          {
          --- 4720,4726 ----
          if (cap->count0 == 0 && isman_s)
          STRCAT(buf, "man");
          else
          ! STRCAT(buf, p);
          STRCAT(buf, " ");
          if (cap->count0 != 0 && (isman || isman_s))
          {
          ***************
          *** 4751,4757 ****
          */
          if (cmdchar == '*' || cmdchar == '#')
          aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
          ! else if (cmdchar == 'K' && *p_kp != NUL)
          aux_ptr = (char_u *)" \t\\\"|!";
          else
          /* Don't escape spaces and Tabs in a tag with a backslash */
          --- 4753,4760 ----
          */
          if (cmdchar == '*' || cmdchar == '#')
          aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
          ! else if (cmdchar == 'K' && ! (*p == NUL || STRCMP(p, ":he") == 0
          ! || STRCMP(p, ":help") == 0))
          aux_ptr = (char_u *)" \t\\\"|!";
          else
          /* Don't escape spaces and Tabs in a tag with a backslash */
          diff -cr vim61~/src/option.c vim61/src/option.c
          *** vim61~/src/option.c Sat Dec 28 18:00:24 2002
          --- vim61/src/option.c Sat Dec 28 18:00:35 2002
          ***************
          *** 92,97 ****
          --- 92,98 ----
          , PV_ISK
          , PV_KEY
          , PV_KMAP
          + , PV_KP
          , PV_LBR
          , PV_LISP
          , PV_LIST
          ***************
          *** 1231,1240 ****
          #endif
          {(char_u *)"", (char_u *)0L}},
          {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
          ! (char_u *)&p_kp, PV_NONE,
          {
          #if defined(MSDOS) || defined(MSWIN)
          ! (char_u *)"",
          #else
          #ifdef VMS
          (char_u *)"help",
          --- 1232,1241 ----
          #endif
          {(char_u *)"", (char_u *)0L}},
          {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
          ! (char_u *)&p_kp, OPT_BOTH(PV_KP),
          {
          #if defined(MSDOS) || defined(MSWIN)
          ! (char_u *)":help",
          #else
          #ifdef VMS
          (char_u *)"help",
          ***************
          *** 3505,3515 ****
          ++arg; /* jump to after the '=' or ':' */

          /*
          * Convert 'whichwrap' number to string, for
          * backwards compatibility with Vim 3.0.
          * Misuse errbuf[] for the resulting string.
          */
          ! if (varp == (char_u *)&p_ww && isdigit(*arg))
          {
          *errbuf = NUL;
          i = getdigits(&arg);
          --- 3506,3529 ----
          ++arg; /* jump to after the '=' or ':' */

          /*
          + * Set 'keywordprg' to ":help" if an empty
          + * value was passed to :set by the user.
          + * Misuse errbuf[] for the resulting string.
          + */
          + if (varp == (char_u *)&p_kp
          + && (*arg == NUL || *arg == ' '))
          + {
          + *errbuf = NUL;
          + STRCAT(errbuf, ":help");
          + save_arg = arg;
          + arg = errbuf;
          + }
          + /*
          * Convert 'whichwrap' number to string, for
          * backwards compatibility with Vim 3.0.
          * Misuse errbuf[] for the resulting string.
          */
          ! else if (varp == (char_u *)&p_ww && isdigit(*arg))
          {
          *errbuf = NUL;
          i = getdigits(&arg);
          ***************
          *** 4098,4103 ****
          --- 4112,4118 ----
          #ifdef FEAT_CRYPT
          check_string_option(&buf->b_p_key);
          #endif
          + check_string_option(&buf->b_p_kp);
          check_string_option(&buf->b_p_mps);
          check_string_option(&buf->b_p_fo);
          check_string_option(&buf->b_p_isk);
          ***************
          *** 7140,7145 ****
          --- 7155,7161 ----
          case OPT_BOTH(PV_EFM): return (char_u *)&(curbuf->b_p_efm);
          #endif
          case OPT_BOTH(PV_EP): return (char_u *)&(curbuf->b_p_ep);
          + case OPT_BOTH(PV_KP): return (char_u *)&(curbuf->b_p_kp);
          case OPT_BOTH(PV_PATH): return (char_u *)&(curbuf->b_p_path);
          case OPT_BOTH(PV_AR): return (char_u *)&(curbuf->b_p_ar);
          case OPT_BOTH(PV_TAGS): return (char_u *)&(curbuf->b_p_tags);
          ***************
          *** 7175,7180 ****
          --- 7191,7198 ----
          /* global option with local value: use local value if it's been set */
          case OPT_BOTH(PV_EP): return *curbuf->b_p_ep != NUL
          ? (char_u *)&curbuf->b_p_ep : p->var;
          + case OPT_BOTH(PV_KP): return *curbuf->b_p_kp != NUL
          + ? (char_u *)&curbuf->b_p_kp : p->var;
          case OPT_BOTH(PV_PATH): return *curbuf->b_p_path != NUL
          ? (char_u *)&(curbuf->b_p_path) : p->var;
          case OPT_BOTH(PV_AR): return curbuf->b_p_ar >= 0
          ***************
          *** 7603,7608 ****
          --- 7621,7627 ----
          #ifdef FEAT_CRYPT
          buf->b_p_key = vim_strsave(p_key);
          #endif
          + buf->b_p_kp = vim_strsave(p_kp);
          #ifdef FEAT_SEARCHPATH
          buf->b_p_sua = vim_strsave(p_sua);
          #endif
          ***************
          *** 7624,7629 ****
          --- 7643,7649 ----
          buf->b_p_efm = empty_option;
          #endif
          buf->b_p_ep = empty_option;
          + buf->b_p_kp = empty_option;
          buf->b_p_path = empty_option;
          buf->b_p_tags = empty_option;
          #ifdef FEAT_FIND_ID
          diff -cr vim61~/src/structs.h vim61/src/structs.h
          *** vim61~/src/structs.h Sat Dec 28 18:00:18 2002
          --- vim61/src/structs.h Sat Dec 28 18:00:35 2002
          ***************
          *** 952,957 ****
          --- 952,958 ----
          #ifdef FEAT_CRYPT
          char_u *b_p_key; /* 'key' */
          #endif
          + char_u *b_p_kp; /* 'keywordprg' */
          #ifdef FEAT_LISP
          int b_p_lisp; /* 'lisp' */
          #endif

          --
          A big enough hammer can usually fix anything.
          Christian J. Robinson <infynity@...> http://infynity.spodzone.com/
          PGP key: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
        • Bram Moolenaar
          ... I would prefer to avoid automatically changing an option value. It s too much magic for the user. ... Thanks, I ll keep it for including later (bug fixes
          Message 4 of 6 , Dec 29, 2002
          • 0 Attachment
            Christian J. Robinson wrote:

            > That's basically how the patch included in my previous message works.
            > Setting the local value to the empty string makes vim use the global
            > value. Setting the global value to an empty string will cause vim to
            > set it to ":help" for backward compatibility. It's easy enough to
            > change this so that the user always has to use ":help", if that's
            > preferred.

            I would prefer to avoid automatically changing an option value. It's
            too much magic for the user.

            > I don't think my documentation update was written clearly, though.
            >
            > Below is another patch that replaces my previous patch, created against
            > 6.1.267. It slightly changes the documentation, and fixes a small
            > problem I missed.

            Thanks, I'll keep it for including later (bug fixes go first!).

            --
            hundred-and-one symptoms of being an internet addict:
            184. You no longer ask prospective dates what their sign is, instead
            your line is "Hi, what's your URL?"

            /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
            /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\
            \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
            \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
          Your message has been successfully submitted and would be delivered to recipients shortly.