4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: The items used by getqflist() and setqflist() don't match.
12 Solution: Support the "bufnum" item for setqflist(). (Yegappan Lakshmanan)
13 Files: runtime/doc/eval.txt, src/quickfix.c
16 *** ../vim-7.0.190/runtime/doc/eval.txt Wed Nov 1 15:31:02 2006
17 --- runtime/doc/eval.txt Sun Feb 4 01:54:35 2007
20 vcol non-zero: "col" is visual column
21 zero: "col" is byte index
23 text description of the error
24 type type of the error, 'E', '1', etc.
25 valid non-zero: recognized error message
27 When there is no error list or it's empty an empty list is
30 Useful application: Find pattern matches in multiple files and
31 do something with them: >
33 vcol non-zero: "col" is visual column
34 zero: "col" is byte index
36 + pattern search pattern used to locate the error
37 text description of the error
38 type type of the error, 'E', '1', etc.
39 valid non-zero: recognized error message
41 When there is no error list or it's empty an empty list is
42 ! returned. Quickfix list entries with non-existing buffer
43 ! number are returned with "bufnr" set to zero.
45 Useful application: Find pattern matches in multiple files and
46 do something with them: >
49 Non-dictionary items in {list} are ignored. Each dictionary
50 item can contain the following entries:
52 ! filename name of a file
53 lnum line number in the file
54 pattern search pattern used to locate the error
57 Non-dictionary items in {list} are ignored. Each dictionary
58 item can contain the following entries:
60 ! bufnr buffer number; must be the number of a valid
62 ! filename name of a file; only used when "bufnr" is not
63 ! present or it is invalid.
64 lnum line number in the file
65 pattern search pattern used to locate the error
69 The "col", "vcol", "nr", "type" and "text" entries are
70 optional. Either "lnum" or "pattern" entry can be used to
71 locate a matching error line.
72 ! If the "filename" entry is not present or neither the "lnum"
73 ! or "pattern" entries are present, then the item will not be
74 ! handled as an error line.
75 If both "pattern" and "lnum" are present then "pattern" will
78 If {action} is set to 'a', then the items from {list} are
79 added to the existing quickfix list. If there is no existing
81 The "col", "vcol", "nr", "type" and "text" entries are
82 optional. Either "lnum" or "pattern" entry can be used to
83 locate a matching error line.
84 ! If the "filename" and "bufnr" entries are not present or
85 ! neither the "lnum" or "pattern" entries are present, then the
86 ! item will not be handled as an error line.
87 If both "pattern" and "lnum" are present then "pattern" will
89 + Note that the list is not exactly the same as what
90 + |getqflist()| returns.
92 If {action} is set to 'a', then the items from {list} are
93 added to the existing quickfix list. If there is no existing
94 *** ../vim-7.0.190/src/quickfix.c Fri Oct 20 20:15:05 2006
95 --- src/quickfix.c Sun Feb 4 01:50:17 2007
99 static int qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast));
100 static void qf_new_list __ARGS((qf_info_T *qi));
101 ! static int qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid));
102 static void qf_msg __ARGS((qf_info_T *qi));
103 static void qf_free __ARGS((qf_info_T *qi, int idx));
104 static char_u *qf_types __ARGS((int, int));
107 static int qf_init_ext __ARGS((qf_info_T *qi, char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast));
108 static void qf_new_list __ARGS((qf_info_T *qi));
109 ! static int qf_add_entry __ARGS((qf_info_T *qi, qfline_T **prevp, char_u *dir, char_u *fname, int bufnum, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid));
110 static void qf_msg __ARGS((qf_info_T *qi));
111 static void qf_free __ARGS((qf_info_T *qi, int idx));
112 static char_u *qf_types __ARGS((int, int));
116 (*namebuf || directory)
118 : ((currfile && valid) ? currfile : (char_u *)NULL),
125 * Returns OK or FAIL.
128 ! qf_add_entry(qi, prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type,
130 qf_info_T *qi; /* quickfix list */
131 qfline_T **prevp; /* pointer to previously added entry or NULL */
132 char_u *dir; /* optional directory name */
133 char_u *fname; /* file name or NULL */
134 char_u *mesg; /* message */
135 long lnum; /* line number */
136 int col; /* column */
138 * Returns OK or FAIL.
141 ! qf_add_entry(qi, prevp, dir, fname, bufnum, mesg, lnum, col, vis_col, pattern,
143 qf_info_T *qi; /* quickfix list */
144 qfline_T **prevp; /* pointer to previously added entry or NULL */
145 char_u *dir; /* optional directory name */
146 char_u *fname; /* file name or NULL */
147 + int bufnum; /* buffer number or zero */
148 char_u *mesg; /* message */
149 long lnum; /* line number */
150 int col; /* column */
154 if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
156 ! qfp->qf_fnum = qf_get_fnum(dir, fname);
157 if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
162 if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
165 ! qfp->qf_fnum = bufnum;
167 ! qfp->qf_fnum = qf_get_fnum(dir, fname);
168 if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
174 if (qf_add_entry(to->w_llist, &prevp,
184 if (qf_add_entry(qi, &prevp,
189 regmatch.startpos[0].lnum + lnum, FALSE),
190 regmatch.startpos[0].lnum + lnum,
204 qfp = qi->qf_lists[qi->qf_curlist].qf_start;
205 for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ++i)
207 + /* Handle entries with a non-existing buffer number. */
208 + bufnum = qfp->qf_fnum;
209 + if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
212 if ((dict = dict_alloc()) == NULL)
214 if (list_append_dict(list, dict) == FAIL)
218 buf[0] = qfp->qf_type;
220 ! if ( dict_add_nr_str(dict, "bufnr", (long)qfp->qf_fnum, NULL) == FAIL
221 || dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL
222 || dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL
223 || dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL
226 buf[0] = qfp->qf_type;
228 ! if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL
229 || dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL
230 || dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL
231 || dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL
237 char_u *filename, *pattern, *text, *type;
247 qf_info_T *qi = &ql_info;
248 + int did_bufnr_emsg = FALSE;
257 filename = get_dict_string(d, (char_u *)"filename", TRUE);
258 + bufnum = get_dict_number(d, (char_u *)"bufnr");
259 lnum = get_dict_number(d, (char_u *)"lnum");
260 col = get_dict_number(d, (char_u *)"col");
261 vcol = get_dict_number(d, (char_u *)"vcol");
264 text = vim_strsave((char_u *)"");
267 ! if (filename == NULL || (lnum == 0 && pattern == NULL))
270 status = qf_add_entry(qi, &prevp,
277 text = vim_strsave((char_u *)"");
280 ! if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL))
283 + /* Mark entries with non-existing buffer number as not valid. Give the
284 + * error message only once. */
285 + if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
287 + if (!did_bufnr_emsg)
289 + did_bufnr_emsg = TRUE;
290 + EMSGN(_("E92: Buffer %ld not found"), bufnum);
296 status = qf_add_entry(qi, &prevp,
306 if (qf_add_entry(qi, &prevp,
312 (int)(regmatch.startp[0] - IObuff)
313 *** ../vim-7.0.190/src/version.c Sun Feb 4 02:49:03 2007
314 --- src/version.c Sun Feb 4 02:50:49 2007
318 { /* Add new patch number below this line */
324 From "know your smileys":
325 |-P Reaction to unusually ugly C code
327 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
328 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
329 \\\ download, build and distribute -- http://www.A-A-P.org ///
330 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///