home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.1.072
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- MIME-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.1.072
- Problem: When a file name in a tags file starts with http:// or something
- else for which there is a BufReadCmd autocommand, the file isn't
- opened anyway.
- Solution: Check if there is a matching BufReadCmd autocommand and try to
- open the file.
- Files: src/fileio.c, src/proto/fileio.pro, src/tag.c
-
-
- *** ../vim61.071/src/fileio.c Thu May 16 21:32:05 2002
- --- src/fileio.c Thu May 16 21:59:24 2002
- ***************
- *** 5767,5772 ****
- --- 5767,5794 ----
- static EVENT_T last_event;
- static int last_group;
-
- + #ifdef BACKSLASH_IN_FILENAME
- + static void forward_slash __ARGS((char_u *));
- +
- + /*
- + * Convert all backslashes in fname to forward slashes in-place.
- + */
- + static void
- + forward_slash(fname)
- + char_u *fname;
- + {
- + for (p = fname; *p != NUL; ++p)
- + # ifdef FEAT_MBYTE
- + /* The Big5 encoding can have '\' in the trail byte. */
- + if (enc_dbcs != 0 && (*mb_ptr2len_check)(p) > 1)
- + ++p;
- + else
- + # endif
- + if (*p == '\\')
- + *p = '/';
- + }
- + #endif
- +
- /*
- * Show the autocommands for one AutoPat.
- */
- ***************
- *** 6900,6930 ****
- /*
- * Replace all backslashes with forward slashes. This makes the
- * autocommand patterns portable between Unix and MS-DOS.
- - * Watch out for the Big5 encoding, it has '\' in the trail byte.
- */
- ! {
- ! char_u *p;
- !
- ! if (sfname != NULL)
- ! {
- ! for (p = sfname; *p; ++p)
- ! # ifdef FEAT_MBYTE
- ! if (enc_dbcs != 0 && (*mb_ptr2len_check)(p) > 1)
- ! ++p;
- ! else
- ! # endif
- ! if (*p == '\\')
- ! *p = '/';
- ! }
- ! for (p = fname; *p; ++p)
- ! # ifdef FEAT_MBYTE
- ! if (enc_dbcs != 0 && (*mb_ptr2len_check)(p) > 1)
- ! ++p;
- ! else
- ! # endif
- ! if (*p == '\\')
- ! *p = '/';
- ! }
- #endif
-
- #ifdef VMS
- --- 6922,6931 ----
- /*
- * Replace all backslashes with forward slashes. This makes the
- * autocommand patterns portable between Unix and MS-DOS.
- */
- ! if (sfname != NULL)
- ! forward_slash(sfname);
- ! forward_slash(fname);
- #endif
-
- #ifdef VMS
- ***************
- *** 7179,7184 ****
- --- 7180,7230 ----
- acp->nextcmd = NULL;
- else
- acp->nextcmd = ac->next;
- + return retval;
- + }
- +
- + /*
- + * Return TRUE if there is a matching autocommand for "fname".
- + */
- + int
- + has_autocmd(event, sfname)
- + EVENT_T event;
- + char_u *sfname;
- + {
- + AutoPat *ap;
- + char_u *fname;
- + char_u *tail = gettail(sfname);
- + int retval = FALSE;
- +
- + fname = FullName_save(sfname, FALSE);
- + if (fname == NULL)
- + return FALSE;
- +
- + #ifdef BACKSLASH_IN_FILENAME
- + /*
- + * Replace all backslashes with forward slashes. This makes the
- + * autocommand patterns portable between Unix and MS-DOS.
- + */
- + sfname = vim_strsave(sfname);
- + if (sfname != NULL)
- + forward_slash(sfname);
- + forward_slash(fname);
- + #endif
- +
- + for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
- + if (ap->pat != NULL && ap->cmds != NULL
- + && match_file_pat(ap->reg_pat, fname, sfname, tail,
- + ap->allow_dirs))
- + {
- + retval = TRUE;
- + break;
- + }
- +
- + vim_free(fname);
- + #ifdef BACKSLASH_IN_FILENAME
- + vim_free(sfname);
- + #endif
- +
- return retval;
- }
-
- *** ../vim61.071/src/proto/fileio.pro Fri Mar 22 21:41:09 2002
- --- src/proto/fileio.pro Mon May 6 19:55:39 2002
- ***************
- *** 25,30 ****
- --- 25,31 ----
- void aucmd_restbuf __ARGS((aco_save_T *aco));
- int apply_autocmds __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
- int has_cursorhold __ARGS((void));
- + int has_autocmd __ARGS((EVENT_T event, char_u *sfname));
- char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
- char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
- char_u *get_event_name __ARGS((expand_T *xp, int idx));
- *** ../vim61.071/src/tag.c Mon Apr 8 22:11:31 2002
- --- src/tag.c Mon May 6 19:57:34 2002
- ***************
- *** 2430,2438 ****
- tofree_fname = fname; /* free() it later */
-
- /*
- ! * check if file for tag exists before abandoning current file
- */
- ! if (mch_getperm(fname) < 0)
- {
- retval = NOTAGFILE;
- vim_free(nofile_fname);
- --- 2430,2444 ----
- tofree_fname = fname; /* free() it later */
-
- /*
- ! * Check if the file with the tag exists before abandoning the current
- ! * file. Also accept a file name for which there is a matching BufReadCmd
- ! * autocommand event (e.g., http://sys/file).
- */
- ! if (mch_getperm(fname) < 0
- ! #ifdef FEAT_AUTOCMD
- ! && !has_autocmd(EVENT_BUFREADCMD, fname)
- ! #endif
- ! )
- {
- retval = NOTAGFILE;
- vim_free(nofile_fname);
- *** ../vim61.071/src/version.c Thu May 16 21:50:46 2002
- --- src/version.c Thu May 16 21:54:47 2002
- ***************
- *** 608,609 ****
- --- 608,611 ----
- { /* Add new patch number below this line */
- + /**/
- + 72,
- /**/
-
- --
- How To Keep A Healthy Level Of Insanity:
- 4. Put your garbage can on your desk and label it "in".
-
- /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\
- /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
- \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
- \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
-