|
Karsten Hopp |
3ca42e |
# KH: modified, as one line was already in the runtime update patch
|
|
Karsten Hopp |
3ca42e |
To: vim-dev@vim.org
|
|
Karsten Hopp |
3ca42e |
Subject: patch 7.0.191
|
|
Karsten Hopp |
3ca42e |
Fcc: outbox
|
|
Karsten Hopp |
3ca42e |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
3ca42e |
Mime-Version: 1.0
|
|
Karsten Hopp |
3ca42e |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
3ca42e |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
3ca42e |
------------
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
Patch 7.0.191
|
|
Karsten Hopp |
3ca42e |
Problem: The items used by getqflist() and setqflist() don't match.
|
|
Karsten Hopp |
3ca42e |
Solution: Support the "bufnum" item for setqflist(). (Yegappan Lakshmanan)
|
|
Karsten Hopp |
3ca42e |
Files: runtime/doc/eval.txt, src/quickfix.c
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
--- runtime/doc/eval.txt.191 2007-02-06 06:18:06.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
+++ runtime/doc/eval.txt 2007-02-06 06:20:52.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
@@ -2914,7 +2914,8 @@
|
|
Karsten Hopp |
3ca42e |
valid non-zero: recognized error message
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
When there is no error list or it's empty an empty list is
|
|
Karsten Hopp |
3ca42e |
- returned.
|
|
Karsten Hopp |
3ca42e |
+ returned. Quickfix list entries with non-existing buffer
|
|
Karsten Hopp |
3ca42e |
+ number are returned with "bufnr" set to zero.
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
Useful application: Find pattern matches in multiple files and
|
|
Karsten Hopp |
3ca42e |
do something with them: >
|
|
Karsten Hopp |
3ca42e |
@@ -4392,7 +4393,10 @@
|
|
Karsten Hopp |
3ca42e |
Non-dictionary items in {list} are ignored. Each dictionary
|
|
Karsten Hopp |
3ca42e |
item can contain the following entries:
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
- filename name of a file
|
|
Karsten Hopp |
3ca42e |
+ bufnr buffer number; must be the number of a valid
|
|
Karsten Hopp |
3ca42e |
+ buffer
|
|
Karsten Hopp |
3ca42e |
+ filename name of a file; only used when "bufnr" is not
|
|
Karsten Hopp |
3ca42e |
+ present or it is invalid.
|
|
Karsten Hopp |
3ca42e |
lnum line number in the file
|
|
Karsten Hopp |
3ca42e |
pattern search pattern used to locate the error
|
|
Karsten Hopp |
3ca42e |
col column number
|
|
Karsten Hopp |
3ca42e |
@@ -4405,11 +4409,13 @@
|
|
Karsten Hopp |
3ca42e |
The "col", "vcol", "nr", "type" and "text" entries are
|
|
Karsten Hopp |
3ca42e |
optional. Either "lnum" or "pattern" entry can be used to
|
|
Karsten Hopp |
3ca42e |
locate a matching error line.
|
|
Karsten Hopp |
3ca42e |
- If the "filename" entry is not present or neither the "lnum"
|
|
Karsten Hopp |
3ca42e |
- or "pattern" entries are present, then the item will not be
|
|
Karsten Hopp |
3ca42e |
- handled as an error line.
|
|
Karsten Hopp |
3ca42e |
+ If the "filename" and "bufnr" entries are not present or
|
|
Karsten Hopp |
3ca42e |
+ neither the "lnum" or "pattern" entries are present, then the
|
|
Karsten Hopp |
3ca42e |
+ item will not be handled as an error line.
|
|
Karsten Hopp |
3ca42e |
If both "pattern" and "lnum" are present then "pattern" will
|
|
Karsten Hopp |
3ca42e |
be used.
|
|
Karsten Hopp |
3ca42e |
+ Note that the list is not exactly the same as what
|
|
Karsten Hopp |
3ca42e |
+ |getqflist()| returns.
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
If {action} is set to 'a', then the items from {list} are
|
|
Karsten Hopp |
3ca42e |
added to the existing quickfix list. If there is no existing
|
|
Karsten Hopp |
3ca42e |
--- src/quickfix.c.191 2007-02-06 06:18:06.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
+++ src/quickfix.c 2007-02-06 06:18:06.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
@@ -106,7 +106,7 @@
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
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));
|
|
Karsten Hopp |
3ca42e |
static void qf_new_list __ARGS((qf_info_T *qi));
|
|
Karsten Hopp |
3ca42e |
-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));
|
|
Karsten Hopp |
3ca42e |
+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));
|
|
Karsten Hopp |
3ca42e |
static void qf_msg __ARGS((qf_info_T *qi));
|
|
Karsten Hopp |
3ca42e |
static void qf_free __ARGS((qf_info_T *qi, int idx));
|
|
Karsten Hopp |
3ca42e |
static char_u *qf_types __ARGS((int, int));
|
|
Karsten Hopp |
3ca42e |
@@ -791,6 +791,7 @@
|
|
Karsten Hopp |
3ca42e |
(*namebuf || directory)
|
|
Karsten Hopp |
3ca42e |
? namebuf
|
|
Karsten Hopp |
3ca42e |
: ((currfile && valid) ? currfile : (char_u *)NULL),
|
|
Karsten Hopp |
3ca42e |
+ 0,
|
|
Karsten Hopp |
3ca42e |
errmsg,
|
|
Karsten Hopp |
3ca42e |
lnum,
|
|
Karsten Hopp |
3ca42e |
col,
|
|
Karsten Hopp |
3ca42e |
@@ -936,12 +937,13 @@
|
|
Karsten Hopp |
3ca42e |
* Returns OK or FAIL.
|
|
Karsten Hopp |
3ca42e |
*/
|
|
Karsten Hopp |
3ca42e |
static int
|
|
Karsten Hopp |
3ca42e |
-qf_add_entry(qi, prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type,
|
|
Karsten Hopp |
3ca42e |
- valid)
|
|
Karsten Hopp |
3ca42e |
+qf_add_entry(qi, prevp, dir, fname, bufnum, mesg, lnum, col, vis_col, pattern,
|
|
Karsten Hopp |
3ca42e |
+ nr, type, valid)
|
|
Karsten Hopp |
3ca42e |
qf_info_T *qi; /* quickfix list */
|
|
Karsten Hopp |
3ca42e |
qfline_T **prevp; /* pointer to previously added entry or NULL */
|
|
Karsten Hopp |
3ca42e |
char_u *dir; /* optional directory name */
|
|
Karsten Hopp |
3ca42e |
char_u *fname; /* file name or NULL */
|
|
Karsten Hopp |
3ca42e |
+ int bufnum; /* buffer number or zero */
|
|
Karsten Hopp |
3ca42e |
char_u *mesg; /* message */
|
|
Karsten Hopp |
3ca42e |
long lnum; /* line number */
|
|
Karsten Hopp |
3ca42e |
int col; /* column */
|
|
Karsten Hopp |
3ca42e |
@@ -955,7 +957,10 @@
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL)
|
|
Karsten Hopp |
3ca42e |
return FAIL;
|
|
Karsten Hopp |
3ca42e |
- qfp->qf_fnum = qf_get_fnum(dir, fname);
|
|
Karsten Hopp |
3ca42e |
+ if (bufnum != 0)
|
|
Karsten Hopp |
3ca42e |
+ qfp->qf_fnum = bufnum;
|
|
Karsten Hopp |
3ca42e |
+ else
|
|
Karsten Hopp |
3ca42e |
+ qfp->qf_fnum = qf_get_fnum(dir, fname);
|
|
Karsten Hopp |
3ca42e |
if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
|
|
Karsten Hopp |
3ca42e |
{
|
|
Karsten Hopp |
3ca42e |
vim_free(qfp);
|
|
Karsten Hopp |
3ca42e |
@@ -1106,6 +1111,7 @@
|
|
Karsten Hopp |
3ca42e |
if (qf_add_entry(to->w_llist, &prevp,
|
|
Karsten Hopp |
3ca42e |
NULL,
|
|
Karsten Hopp |
3ca42e |
NULL,
|
|
Karsten Hopp |
3ca42e |
+ 0,
|
|
Karsten Hopp |
3ca42e |
from_qfp->qf_text,
|
|
Karsten Hopp |
3ca42e |
from_qfp->qf_lnum,
|
|
Karsten Hopp |
3ca42e |
from_qfp->qf_col,
|
|
Karsten Hopp |
3ca42e |
@@ -3134,6 +3140,7 @@
|
|
Karsten Hopp |
3ca42e |
if (qf_add_entry(qi, &prevp,
|
|
Karsten Hopp |
3ca42e |
NULL, /* dir */
|
|
Karsten Hopp |
3ca42e |
fnames[fi],
|
|
Karsten Hopp |
3ca42e |
+ 0,
|
|
Karsten Hopp |
3ca42e |
ml_get_buf(buf,
|
|
Karsten Hopp |
3ca42e |
regmatch.startpos[0].lnum + lnum, FALSE),
|
|
Karsten Hopp |
3ca42e |
regmatch.startpos[0].lnum + lnum,
|
|
Karsten Hopp |
3ca42e |
@@ -3419,6 +3426,7 @@
|
|
Karsten Hopp |
3ca42e |
char_u buf[2];
|
|
Karsten Hopp |
3ca42e |
qfline_T *qfp;
|
|
Karsten Hopp |
3ca42e |
int i;
|
|
Karsten Hopp |
3ca42e |
+ int bufnum;
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
if (wp != NULL)
|
|
Karsten Hopp |
3ca42e |
{
|
|
Karsten Hopp |
3ca42e |
@@ -3434,6 +3442,11 @@
|
|
Karsten Hopp |
3ca42e |
qfp = qi->qf_lists[qi->qf_curlist].qf_start;
|
|
Karsten Hopp |
3ca42e |
for (i = 1; !got_int && i <= qi->qf_lists[qi->qf_curlist].qf_count; ++i)
|
|
Karsten Hopp |
3ca42e |
{
|
|
Karsten Hopp |
3ca42e |
+ /* Handle entries with a non-existing buffer number. */
|
|
Karsten Hopp |
3ca42e |
+ bufnum = qfp->qf_fnum;
|
|
Karsten Hopp |
3ca42e |
+ if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
|
|
Karsten Hopp |
3ca42e |
+ bufnum = 0;
|
|
Karsten Hopp |
3ca42e |
+
|
|
Karsten Hopp |
3ca42e |
if ((dict = dict_alloc()) == NULL)
|
|
Karsten Hopp |
3ca42e |
return FAIL;
|
|
Karsten Hopp |
3ca42e |
if (list_append_dict(list, dict) == FAIL)
|
|
Karsten Hopp |
3ca42e |
@@ -3441,7 +3454,7 @@
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
buf[0] = qfp->qf_type;
|
|
Karsten Hopp |
3ca42e |
buf[1] = NUL;
|
|
Karsten Hopp |
3ca42e |
- if ( dict_add_nr_str(dict, "bufnr", (long)qfp->qf_fnum, NULL) == FAIL
|
|
Karsten Hopp |
3ca42e |
+ if ( dict_add_nr_str(dict, "bufnr", (long)bufnum, NULL) == FAIL
|
|
Karsten Hopp |
3ca42e |
|| dict_add_nr_str(dict, "lnum", (long)qfp->qf_lnum, NULL) == FAIL
|
|
Karsten Hopp |
3ca42e |
|| dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL
|
|
Karsten Hopp |
3ca42e |
|| dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL
|
|
Karsten Hopp |
3ca42e |
@@ -3472,6 +3485,7 @@
|
|
Karsten Hopp |
3ca42e |
listitem_T *li;
|
|
Karsten Hopp |
3ca42e |
dict_T *d;
|
|
Karsten Hopp |
3ca42e |
char_u *filename, *pattern, *text, *type;
|
|
Karsten Hopp |
3ca42e |
+ int bufnum;
|
|
Karsten Hopp |
3ca42e |
long lnum;
|
|
Karsten Hopp |
3ca42e |
int col, nr;
|
|
Karsten Hopp |
3ca42e |
int vcol;
|
|
Karsten Hopp |
3ca42e |
@@ -3479,6 +3493,7 @@
|
|
Karsten Hopp |
3ca42e |
int valid, status;
|
|
Karsten Hopp |
3ca42e |
int retval = OK;
|
|
Karsten Hopp |
3ca42e |
qf_info_T *qi = &ql_info;
|
|
Karsten Hopp |
3ca42e |
+ int did_bufnr_emsg = FALSE;
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
if (wp != NULL)
|
|
Karsten Hopp |
3ca42e |
{
|
|
Karsten Hopp |
3ca42e |
@@ -3508,6 +3523,7 @@
|
|
Karsten Hopp |
3ca42e |
continue;
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
filename = get_dict_string(d, (char_u *)"filename", TRUE);
|
|
Karsten Hopp |
3ca42e |
+ bufnum = get_dict_number(d, (char_u *)"bufnr");
|
|
Karsten Hopp |
3ca42e |
lnum = get_dict_number(d, (char_u *)"lnum");
|
|
Karsten Hopp |
3ca42e |
col = get_dict_number(d, (char_u *)"col");
|
|
Karsten Hopp |
3ca42e |
vcol = get_dict_number(d, (char_u *)"vcol");
|
|
Karsten Hopp |
3ca42e |
@@ -3519,12 +3535,26 @@
|
|
Karsten Hopp |
3ca42e |
text = vim_strsave((char_u *)"");
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
valid = TRUE;
|
|
Karsten Hopp |
3ca42e |
- if (filename == NULL || (lnum == 0 && pattern == NULL))
|
|
Karsten Hopp |
3ca42e |
+ if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL))
|
|
Karsten Hopp |
3ca42e |
valid = FALSE;
|
|
Karsten Hopp |
3ca42e |
|
|
Karsten Hopp |
3ca42e |
+ /* Mark entries with non-existing buffer number as not valid. Give the
|
|
Karsten Hopp |
3ca42e |
+ * error message only once. */
|
|
Karsten Hopp |
3ca42e |
+ if (bufnum != 0 && (buflist_findnr(bufnum) == NULL))
|
|
Karsten Hopp |
3ca42e |
+ {
|
|
Karsten Hopp |
3ca42e |
+ if (!did_bufnr_emsg)
|
|
Karsten Hopp |
3ca42e |
+ {
|
|
Karsten Hopp |
3ca42e |
+ did_bufnr_emsg = TRUE;
|
|
Karsten Hopp |
3ca42e |
+ EMSGN(_("E92: Buffer %ld not found"), bufnum);
|
|
Karsten Hopp |
3ca42e |
+ }
|
|
Karsten Hopp |
3ca42e |
+ valid = FALSE;
|
|
Karsten Hopp |
3ca42e |
+ bufnum = 0;
|
|
Karsten Hopp |
3ca42e |
+ }
|
|
Karsten Hopp |
3ca42e |
+
|
|
Karsten Hopp |
3ca42e |
status = qf_add_entry(qi, &prevp,
|
|
Karsten Hopp |
3ca42e |
NULL, /* dir */
|
|
Karsten Hopp |
3ca42e |
filename,
|
|
Karsten Hopp |
3ca42e |
+ bufnum,
|
|
Karsten Hopp |
3ca42e |
text,
|
|
Karsten Hopp |
3ca42e |
lnum,
|
|
Karsten Hopp |
3ca42e |
col,
|
|
Karsten Hopp |
3ca42e |
@@ -3757,6 +3787,7 @@
|
|
Karsten Hopp |
3ca42e |
if (qf_add_entry(qi, &prevp,
|
|
Karsten Hopp |
3ca42e |
NULL, /* dir */
|
|
Karsten Hopp |
3ca42e |
fnames[fi],
|
|
Karsten Hopp |
3ca42e |
+ 0,
|
|
Karsten Hopp |
3ca42e |
IObuff,
|
|
Karsten Hopp |
3ca42e |
lnum,
|
|
Karsten Hopp |
3ca42e |
(int)(regmatch.startp[0] - IObuff)
|
|
Karsten Hopp |
3ca42e |
--- src/version.c.191 2007-02-06 06:18:06.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
+++ src/version.c 2007-02-06 06:18:06.000000000 -0500
|
|
Karsten Hopp |
3ca42e |
@@ -667,6 +667,8 @@
|
|
Karsten Hopp |
3ca42e |
static int included_patches[] =
|
|
Karsten Hopp |
3ca42e |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
3ca42e |
/**/
|
|
Karsten Hopp |
3ca42e |
+ 191,
|
|
Karsten Hopp |
3ca42e |
+/**/
|
|
Karsten Hopp |
3ca42e |
190,
|
|
Karsten Hopp |
3ca42e |
/**/
|
|
Karsten Hopp |
3ca42e |
189,
|