From 86a95c5117c9f2bb804f4a972053f786c10eb7ea Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Thu, 25 Aug 2016 21:05:18 +0200 Subject: [PATCH 1/6] vim-patch:7.4.1952 Problem: Cscope interface does not support finding assignments. Solution: Add the "a" command. (ppettina, closes vim/vim#882) https://github.com/vim/vim/commit/b12e7ef956e0b0344778b7ef93d41f4b4ed2a670 All changes applied manually. --- src/nvim/if_cscope.c | 17 ++++++++++++----- src/nvim/version.c | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index f2432dd71d..67f096fa76 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -52,7 +52,7 @@ static cscmd_T cs_cmds[] = { "add", cs_add, N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 }, { "find", cs_find, - N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 }, + N_("Query for a pattern"), "find c|d|e|f|g|i|s|t|a name", 1 }, { "help", cs_help, N_("Show this message"), "help", 0 }, { "kill", cs_kill, @@ -105,12 +105,12 @@ char_u *get_cscope_name(expand_T *xp, int idx) { const char *query_type[] = { - "c", "d", "e", "f", "g", "i", "s", "t", NULL + "c", "d", "e", "f", "g", "i", "s", "t", "a", NULL }; /* Complete with query type of ":cscope find {query_type}". - * {query_type} can be letters (c, d, ... t) or numbers (0, 1, - * ..., 8) but only complete with letters, since numbers are + * {query_type} can be letters (c, d, ... a) or numbers (0, 1, + * ..., 9) but only complete with letters, since numbers are * redundant. */ return (char_u *)query_type[idx]; } @@ -674,6 +674,9 @@ static char *cs_create_cmd(char *csoption, char *pattern) case '8': case 'i': search = 8; break; + case '9': case 'a': + search = 9; + break; default: (void)EMSG(_("E561: unknown cscope search type")); cs_usage_msg(Find); @@ -970,6 +973,9 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, case '8': cmdletter = 'i'; break; + case '9': + cmdletter = 'a'; + break; default: cmdletter = opt[0]; } @@ -1133,7 +1139,8 @@ static int cs_help(exarg_T *eap) " g: Find this definition\n" " i: Find files #including this file\n" " s: Find this C symbol\n" - " t: Find this text string\n")); + " t: Find this text string\n" + " a: Find assignments to this symbol\n")); cmdp++; } diff --git a/src/nvim/version.c b/src/nvim/version.c index 978bc2e228..700b35a44d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -324,7 +324,7 @@ static int included_patches[] = { // 1955, // 1954, // 1953, - // 1952, + 1952, // 1951 NA // 1950, // 1949, From 1995be8451d130b88ef4f1d012921e328a8c8495 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Thu, 25 Aug 2016 21:12:24 +0200 Subject: [PATCH 2/6] vim-patch:7.4.1990 Problem: Cscope items are not sorted. Solution: Put the new "a" command first. (Ken Takata) https://github.com/vim/vim/commit/80632db65e8f5f775dadbbc10c5ba6c173ebb24f All changes applied manually. --- src/nvim/if_cscope.c | 8 ++++---- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 67f096fa76..5b5464b569 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -52,7 +52,7 @@ static cscmd_T cs_cmds[] = { "add", cs_add, N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 }, { "find", cs_find, - N_("Query for a pattern"), "find c|d|e|f|g|i|s|t|a name", 1 }, + N_("Query for a pattern"), "find a|c|d|e|f|g|i|s|t name", 1 }, { "help", cs_help, N_("Show this message"), "help", 0 }, { "kill", cs_kill, @@ -105,7 +105,7 @@ char_u *get_cscope_name(expand_T *xp, int idx) { const char *query_type[] = { - "c", "d", "e", "f", "g", "i", "s", "t", "a", NULL + "a", "c", "d", "e", "f", "g", "i", "s", "t", NULL }; /* Complete with query type of ":cscope find {query_type}". @@ -1132,6 +1132,7 @@ static int cs_help(exarg_T *eap) cmdp->usage); if (strcmp(cmdp->name, "find") == 0) MSG_PUTS(_("\n" + " a: Find assignments to this symbol\n" " c: Find functions calling this function\n" " d: Find functions called by this function\n" " e: Find this egrep pattern\n" @@ -1139,8 +1140,7 @@ static int cs_help(exarg_T *eap) " g: Find this definition\n" " i: Find files #including this file\n" " s: Find this C symbol\n" - " t: Find this text string\n" - " a: Find assignments to this symbol\n")); + " t: Find this text string\n")); cmdp++; } diff --git a/src/nvim/version.c b/src/nvim/version.c index 700b35a44d..a47e06e9e1 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -286,7 +286,7 @@ static int included_patches[] = { // 1993, // 1992, // 1991, - // 1990, + 1990, // 1989, // 1988 NA // 1987 NA From 59468e3495a253e7628f0b12a4afb748909317c6 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Thu, 25 Aug 2016 21:16:26 +0200 Subject: [PATCH 3/6] vim-patch:7.4.2033 Problem: 'cscopequickfix' option does not accept new value "a". Solution: Adjust list of command characters. (Ken Takata) https://github.com/vim/vim/commit/6d20e1754461b0f8d395f2e3464f0dc1060497f7 All changes applied manually. Definition of `CSQF_CMDS` was moved to `option_defs.h` in nvim. --- src/nvim/option_defs.h | 2 +- src/nvim/testdir/Makefile | 1 + src/nvim/testdir/test_cscope.vim | 15 +++++++++++++++ src/nvim/version.c | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/nvim/testdir/test_cscope.vim diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 8d6f42e088..7e44b0b125 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -380,7 +380,7 @@ EXTERN char_u *p_cpo; /* 'cpoptions' */ EXTERN char_u *p_csprg; /* 'cscopeprg' */ EXTERN int p_csre; /* 'cscoperelative' */ EXTERN char_u *p_csqf; /* 'cscopequickfix' */ -# define CSQF_CMDS "sgdctefi" +# define CSQF_CMDS "sgdctefia" # define CSQF_FLAGS "+-0" EXTERN int p_cst; /* 'cscopetag' */ EXTERN long p_csto; /* 'cscopetagorder' */ diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index 4979aae57a..57c99e9845 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -32,6 +32,7 @@ SCRIPTS := \ # Tests using runtest.vim.vim. # Keep test_alot*.res as the last one, sort the others. NEW_TESTS = \ + test_cscope.res \ test_hardcopy.res \ test_help_tagjump.res \ test_langmap.res \ diff --git a/src/nvim/testdir/test_cscope.vim b/src/nvim/testdir/test_cscope.vim new file mode 100644 index 0000000000..b6d70f0765 --- /dev/null +++ b/src/nvim/testdir/test_cscope.vim @@ -0,0 +1,15 @@ +" Test for cscope commands. + +if !has('cscope') + finish +endif + +func Test_cscopequickfix() + set cscopequickfix=s-,g-,d+,c-,t+,e-,f0,i-,a- + call assert_equal('s-,g-,d+,c-,t+,e-,f0,i-,a-', &cscopequickfix) + + call assert_fails('set cscopequickfix=x-', 'E474:') + call assert_fails('set cscopequickfix=s', 'E474:') + call assert_fails('set cscopequickfix=s7', 'E474:') + call assert_fails('set cscopequickfix=s-a', 'E474:') +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index a47e06e9e1..448f5908af 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -243,7 +243,7 @@ static int included_patches[] = { // 2036, // 2035 NA // 2034 NA - // 2033, + 2033, // 2032 NA // 2031, // 2030 NA From e587b490a071580708e15fe6d4f0022f1b8e7285 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Thu, 25 Aug 2016 21:29:49 +0200 Subject: [PATCH 4/6] Lint --- src/nvim/if_cscope.c | 26 +++++++++++++------------- src/nvim/option_defs.h | 20 ++++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 5b5464b569..8684957393 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -108,10 +108,10 @@ char_u *get_cscope_name(expand_T *xp, int idx) "a", "c", "d", "e", "f", "g", "i", "s", "t", NULL }; - /* Complete with query type of ":cscope find {query_type}". - * {query_type} can be letters (c, d, ... a) or numbers (0, 1, - * ..., 9) but only complete with letters, since numbers are - * redundant. */ + // Complete with query type of ":cscope find {query_type}". + // {query_type} can be letters (c, d, ... a) or numbers (0, 1, + // ..., 9) but only complete with letters, since numbers are + // redundant. return (char_u *)query_type[idx]; } case EXP_CSCOPE_KILL: @@ -1132,15 +1132,15 @@ static int cs_help(exarg_T *eap) cmdp->usage); if (strcmp(cmdp->name, "find") == 0) MSG_PUTS(_("\n" - " a: Find assignments to this symbol\n" - " c: Find functions calling this function\n" - " d: Find functions called by this function\n" - " e: Find this egrep pattern\n" - " f: Find this file\n" - " g: Find this definition\n" - " i: Find files #including this file\n" - " s: Find this C symbol\n" - " t: Find this text string\n")); + " a: Find assignments to this symbol\n" + " c: Find functions calling this function\n" + " d: Find functions called by this function\n" + " e: Find this egrep pattern\n" + " f: Find this file\n" + " g: Find this definition\n" + " i: Find files #including this file\n" + " s: Find this C symbol\n" + " t: Find this text string\n")); cmdp++; } diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h index 7e44b0b125..e36cceaaf4 100644 --- a/src/nvim/option_defs.h +++ b/src/nvim/option_defs.h @@ -370,16 +370,16 @@ static char *(p_cb_values[]) = {"unnamed", "unnamedplus", NULL}; # define CB_UNNAMED 0x001 # define CB_UNNAMEDPLUS 0x002 # define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) -EXTERN long p_cwh; /* 'cmdwinheight' */ -EXTERN long p_ch; /* 'cmdheight' */ -EXTERN int p_confirm; /* 'confirm' */ -EXTERN int p_cp; /* 'compatible' */ -EXTERN char_u *p_cot; /* 'completeopt' */ -EXTERN long p_ph; /* 'pumheight' */ -EXTERN char_u *p_cpo; /* 'cpoptions' */ -EXTERN char_u *p_csprg; /* 'cscopeprg' */ -EXTERN int p_csre; /* 'cscoperelative' */ -EXTERN char_u *p_csqf; /* 'cscopequickfix' */ +EXTERN long p_cwh; // 'cmdwinheight' +EXTERN long p_ch; // 'cmdheight' +EXTERN int p_confirm; // 'confirm' +EXTERN int p_cp; // 'compatible' +EXTERN char_u *p_cot; // 'completeopt' +EXTERN long p_ph; // 'pumheight' +EXTERN char_u *p_cpo; // 'cpoptions' +EXTERN char_u *p_csprg; // 'cscopeprg' +EXTERN int p_csre; // 'cscoperelative' +EXTERN char_u *p_csqf; // 'cscopequickfix' # define CSQF_CMDS "sgdctefia" # define CSQF_FLAGS "+-0" EXTERN int p_cst; /* 'cscopetag' */ From 0b3ec84840d9af7967b74d4204dbaaa03d003999 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Fri, 26 Aug 2016 22:13:56 +0200 Subject: [PATCH 5/6] Add if_cscope documentation for querytype 'a' From 802a0d902fca423acb15f835d7b09183883d79a0. --- runtime/doc/if_cscop.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/runtime/doc/if_cscop.txt b/runtime/doc/if_cscop.txt index 70f8d1c6f3..99d1fe42e1 100644 --- a/runtime/doc/if_cscop.txt +++ b/runtime/doc/if_cscop.txt @@ -128,6 +128,7 @@ The available subcommands are: 6 or e: Find this egrep pattern 7 or f: Find this file 8 or i: Find files #including this file + 9 or a: Find places where this symbol is assigned a value For all types, except 4 and 6, leading white space for {name} is removed. For 4 and 6 there is exactly one space between {querytype} @@ -254,13 +255,13 @@ started will have no effect! {not available when compiled without the |+quickfix| feature} 'cscopequickfix' specifies whether to use quickfix window to show cscope results. This is a list of comma-separated values. Each item consists of -|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0). +|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0). '+' indicates that results must be appended to quickfix window, '-' implies previous results clearance, '0' or command absence - don't use quickfix. Search is performed from start until first command occurrence. The default value is "" (don't use quickfix anyway). The following value seems to be useful: > - :set cscopequickfix=s-,c-,d-,i-,t-,e- + :set cscopequickfix=s-,c-,d-,i-,t-,e-,a- < *cscopetag* *cst* If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t" @@ -418,6 +419,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): > nmap f :cs find f =expand("") nmap i :cs find i ^=expand("")$ nmap d :cs find d =expand("") + nmap a :cs find a =expand("") " Using 'CTRL-spacebar' then a search type makes the vim window " split horizontally, with search result displayed in @@ -431,6 +433,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): > nmap f :scs find f =expand("") nmap i :scs find i ^=expand("")$ nmap d :scs find d =expand("") + nmap a :scs find a =expand("") " Hitting CTRL-space *twice* before the search type does a vertical " split instead of a horizontal one @@ -449,6 +452,8 @@ Cscope Home Page (http://cscope.sourceforge.net/): > \:vert scs find i ^=expand("")$ nmap d \:vert scs find d =expand("") + nmap a + \:vert scs find a =expand("") ============================================================================== 7. Cscope availability and information *cscope-info* From 89a7a4f02c35e414bc0bd33560738c9cf0abe33e Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sat, 17 Sep 2016 16:24:49 +0200 Subject: [PATCH 6/6] vim-patch:7.4.2284 Problem: Comment in scope header file is outdated. (KillTheMule) Solution: Point to the help instead. (closes vim/vim#1017) https://github.com/vim/vim/commit/f4145d8e990a72bdfea9db3110a7e42a0ff4240c --- src/nvim/if_cscope_defs.h | 13 +------------ src/nvim/version.c | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/nvim/if_cscope_defs.h b/src/nvim/if_cscope_defs.h index 8cd74c74e6..f9d06eaea3 100644 --- a/src/nvim/if_cscope_defs.h +++ b/src/nvim/if_cscope_defs.h @@ -25,18 +25,7 @@ #define CSCOPE_DBFILE "cscope.out" #define CSCOPE_PROMPT ">> " -/* - * s 0name Find this C symbol - * g 1name Find this definition - * d 2name Find functions called by this function - * c 3name Find functions calling this function - * t 4string find text string (cscope 12.9) - * t 4name Find assignments to (cscope 13.3) - * 5pattern change pattern -- NOT USED - * e 6pattern Find this egrep pattern - * f 7name Find this file - * i 8name Find files #including this file - */ +// See ":help cscope-find" for the possible queries. typedef struct { char * name; diff --git a/src/nvim/version.c b/src/nvim/version.c index 448f5908af..f28bffa91d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -75,6 +75,7 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 2284, 2219, // 2200, // 2199,