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

Patch: Make 'keywordprg' buffer local.

Expand Messages
  • Christian J. Robinson
    The following patch against 6.1.263 makes keywordprg a buffer local setting. The reason for this is because I like to set it to the empty value in vim
    Message 1 of 1 , Dec 2, 2002
    • 0 Attachment
      The following patch against 6.1.263 makes 'keywordprg' a buffer local
      setting. The reason for this is because I like to set it to the empty
      value in vim files, to "perldoc -f" in perl files, and so on.

      I hope I didn't miss anything.

      diff -cr vim61~/runtime/doc/options.txt vim61/runtime/doc/options.txt
      *** vim61~/runtime/doc/options.txt Sun Dec 1 12:49:57 2002
      --- vim61/runtime/doc/options.txt Sun Dec 1 12:50:41 2002
      ***************
      *** 3317,3323 ****
      *'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.
      --- 3317,3323 ----
      *'keywordprg'* *'kp'*
      'keywordprg' 'kp' string (default "man" or "man -s", DOS: "",
      OS/2: "view /", VMS: "help")
      ! local to buffer
      {not in Vi}
      Program to use for the |K| command. Environment variables are
      expanded |:set_env|. When empty ":help" is used.
      diff -cr vim61~/src/buffer.c vim61/src/buffer.c
      *** vim61~/src/buffer.c Sun Dec 1 12:27:43 2002
      --- vim61/src/buffer.c Sun Dec 1 12:34:56 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 Sun Dec 1 10:40:22 2002
      --- vim61/src/normal.c Sun Dec 1 12:22:37 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,4686 ----
      }

      /* Allocate buffer to put the command in. Inserting backslashes can
      ! * double the length of the word. curbuf->b_p_kp could be added and some
      ! * numbers. */
      ! buf = alloc((unsigned)(n * 2 + 30 + STRLEN(curbuf->b_p_kp)));
      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);

      --- 4704,4717 ----
      break;

      case 'K':
      ! if (*curbuf->b_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(curbuf->b_p_kp, "man") == 0);
      ! isman_s = (STRCMP(curbuf->b_p_kp, "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))
      {
      --- 4719,4725 ----
      if (cap->count0 == 0 && isman_s)
      STRCAT(buf, "man");
      else
      ! STRCAT(buf, curbuf->b_p_kp);
      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 */
      --- 4752,4758 ----
      */
      if (cmdchar == '*' || cmdchar == '#')
      aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
      ! else if (cmdchar == 'K' && *curbuf->b_p_kp != NUL)
      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 Sun Dec 1 10:55:47 2002
      --- vim61/src/option.c Sun Dec 1 12:38:17 2002
      ***************
      *** 92,97 ****
      --- 92,98 ----
      , PV_ISK
      , PV_KEY
      , PV_KMAP
      + , PV_KP
      , PV_LBR
      , PV_LISP
      , PV_LIST
      ***************
      *** 187,192 ****
      --- 188,194 ----
      #ifdef FEAT_CRYPT
      static char_u *p_key;
      #endif
      + static char_u *p_kp;
      #ifdef FEAT_LISP
      static int p_lisp;
      #endif
      ***************
      *** 1231,1237 ****
      #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 *)"",
      --- 1233,1239 ----
      #endif
      {(char_u *)"", (char_u *)0L}},
      {"keywordprg", "kp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE,
      ! (char_u *)&p_kp, PV_KP,
      {
      #if defined(MSDOS) || defined(MSWIN)
      (char_u *)"",
      ***************
      *** 4098,4103 ****
      --- 4100,4106 ----
      #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);
      ***************
      *** 7292,7297 ****
      --- 7295,7301 ----
      #ifdef FEAT_CRYPT
      case PV_KEY: return (char_u *)&(curbuf->b_p_key);
      #endif
      + case PV_KP: return (char_u *)&(curbuf->b_p_kp);
      #ifdef FEAT_LISP
      case PV_LISP: return (char_u *)&(curbuf->b_p_lisp);
      #endif
      ***************
      *** 7603,7608 ****
      --- 7607,7613 ----
      #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
      diff -cr vim61~/src/option.h vim61/src/option.h
      *** vim61~/src/option.h Sun Dec 1 11:02:10 2002
      --- vim61/src/option.h Sun Dec 1 11:02:12 2002
      ***************
      *** 490,496 ****
      EXTERN char_u *p_isi; /* 'isident' */
      EXTERN char_u *p_isp; /* 'isprint' */
      EXTERN int p_js; /* 'joinspaces' */
      - EXTERN char_u *p_kp; /* 'keywordprg' */
      #ifdef FEAT_VISUAL
      EXTERN char_u *p_km; /* 'keymodel' */
      #endif
      --- 490,495 ----
      diff -cr vim61~/src/structs.h vim61/src/structs.h
      *** vim61~/src/structs.h Sun Dec 1 10:39:56 2002
      --- vim61/src/structs.h Sun Dec 1 10:39:59 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

      --
      Why can't you be a non-conformist like everyone else?
      Christian J. Robinson <infynity@...> http://infynity.spodzone.com/
      PGP key: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
    Your message has been successfully submitted and would be delivered to recipients shortly.