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

Re: Using % in makefiles... << Patch included

Expand Messages
  • Tim
    Hi (Bram) This is my first time editing Vim code and putting up a patch, so please bear with me :) Ok, I ve made the changes I think are required. I ve tested
    Message 1 of 1 , Feb 20 9:00 PM
    • 0 Attachment
      Hi (Bram)

      This is my first time editing Vim code and putting up a patch, so please
      bear with me :)

      Ok, I've made the changes I think are required. I've tested them out myself
      (dunno if there are test scripts?).

      What I did was get the latest Vim code via CVS, then edited the search.c
      file (I had to manually change it to writable then compile it - i'm assuming
      we don't have access to edit/submit files...)

      Bram, I did it based on the fact you said that an option is not required
      since C/C++ code doen'st have !if etc in them.

      PS: Please let me know if i'm doing something wrong/stupid, so that I can
      get it right the next time :) Thanks!

      Here's the patch:

      diff -r1.6 search.c
      1198c1198
      < else if (initc != '#' && initc != NUL)
      ---
      > else if (initc != '#' && initc != '!' && initc != NUL)
      1223,1224c1223,1224
      < * Either initc is '#', or no initc was given and we need to look
      under the
      < * cursor.
      ---
      > * Either initc is '#' or '!', or no initc was given and we need to
      > * look under the cursor.
      1228c1228
      < if (initc == '#')
      ---
      > if (initc == '#' || initc == '!' )
      1241c1241
      < /* Are we before or at #if, #else etc.? */
      ---
      > /* Are we before or at #if, #else, !if (makefiles) etc? */
      1243c1243,1244
      < if (*ptr == '#' && pos.col <= (colnr_t)(ptr - linep))
      ---
      > if ( ( *ptr == '#' || *ptr == '!' )
      > && pos.col <= (colnr_t)(ptr - linep))
      1284,1285c1285,1286
      < * If we are not on a comment or the # at the start of a line, then
      < * look for brace anywhere on this line after the cursor.
      ---
      > * If we are not on a comment or the # or the ! at the start of a
      > * line, then look for brace anywhere on this line after the cursor.
      1326,1327c1327,1329
      < /* no brace in the line, maybe use " #if" then */
      < if (!cpo_match && *skipwhite(linep) == '#')
      ---
      > /* no brace in the line, maybe use " #if" then or !if */
      > if (!cpo_match && (*skipwhite(linep) == '#' ||
      > *skipwhite(linep) == '!' ) )
      1337a1340
      > * Or the makefile variants, !if, !else, !endif
      1341c1344
      < if (initc != '#')
      ---
      > if (initc != '#' && initc != '!' )
      1365c1368
      < if (*ptr != '#')
      ---
      > if (*ptr != '#' && *ptr != '!' )
      1393c1396,1397
      < else if (initc == '#' && STRNCMP(ptr, "el", 2) == 0)
      ---
      > else if ( ( initc == '#' || initc == '!' ) &&
      > STRNCMP(ptr, "el", 2) == 0)

      - Tim
      ----- Original Message -----
      From: "Bram Moolenaar" <Bram@...>
      To: "Tim" <rocket96@...>
      Cc: "Vim" <vim-dev@...>
      Sent: Sunday, February 20, 2000 6:35 AM
      Subject: Re: Using % in makefiles...


      >
      > Tim wrote:
      >
      > > I'm able to use the % key when on top of a C/C++ preprocessor command to
      > > jump to corresponding commands (ie, when on top of a #if, it'll jump to
      > > #else, if any, and #endif).
      > >
      > > Is it possible to extend that to makefiles? Some make utilities use !
      > > instead of # as the first character. I find that I often replace
      makefile
      > > commands (!if) with preprocessor ones (#if) just to find mismatched
      > > commands.
      >
      > The use of '#' is hard-coded. To change this would require an option to
      > define the character in front of the if/else/endif. You would set it to
      '!'
      > for makefiles then.
      >
      > Hmm, perhaps it's possible to allow "!if", "!endif" and "!else" in C code
      too,
      > without breaking anything. I don't think these can appear in a valid C
      file.
      > We would not need an option then.
      >
      > --
      > Q: What is a patch 22?
      > A: A patch you need to include to make it possible to include patches.
      >
      > /-/-- Bram Moolenaar --- Bram@... ---
      http://www.moolenaar.net --\-\
      > \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf
      / /
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.