On 2007-04-27, Gary Johnson <[EMAIL PROTECTED]> wrote: > On 2007-04-26, Navdeep Parhar <[EMAIL PROTECTED]> wrote: > > Hello, > > > > Currently :cscope has a variant :lcscope that allows the use of > > the location list instead of the quickfix list. However, :scscope > > has no equivalent that uses the location list. Please note that > > :scs splits only if cscope returns some results, so :scs is not > > the same as ":split cs". Due to this reason ":split lcscope" can > > not be used to get the same behaviour as the proposed :lscscope. > > > > I was looking for a way to open the results of a cscope query in a > > new tab, and use the location list at the same time. That's when > > I realized the need for :lscsope. ":tab lsc ..." does what I > > need. > > > > Here is a patch to add :lscscope to vim. I have tested it on > > Solaris and Linux and it works for me. Feedback is welcome. > > Wonderful! Thank you. I have applied it to vim on SunOS 5.8 and am > testing it now. The lack of this feature has kept me from using > location lists until now, so I'm not sure yet how this _should_ > work. I'll also have to remember to use the location-list form of > several commands. > > I use a combination of tags, :grep and ":scscope find" to search the > code I'm working on. I often find myself in the process of > traversing one quickfix list when I'd like to follow some other > quickfix list in another window, but be able to easily come back to > the original quickfix list just by changing to the original window. > > I'll let you know how this works out.
I'm confused. I tried exercising this patch and I'm not getting the results I expect, but I don't know if it's the patch, the behavior of location lists, or me. Here's an example. I cd'd to the src directory of my vim installation which is currently at patch level 208. Then I built a cscope database. $ cscope -b Then I opened one of the source files, $ view +3725 buffer.c added the cscope database, :cs add cscope.out moved the cursor to the get_fileformat symbol and opened a new window containing a location list of the places where that function is called. :lscscope find c ^R^W (1 of 10): <<build_stl_str_hl>> else if (num == CAR && get_fileformat(wp->w_buffer) == EOL_MAC) That happens to be the same line in buffer.c that the cursor had been on. Then I went to the third location in the list, :3ll (3 of 10): <<readfile>> fileformat = get_fileformat(curbuf); which is line 925 of fileio.c. I moved the cursor to the top of this function, readfile (line 209), and opened a new window containing a location list of the places where this function is called. :lscscope find c ^R^W (1 of 12): <<open_buffer>> retval = readfile(curbuf->b_ffname, curbuf->b_fname, This window contains buffer.c, which is also being viewed in the bottom window. The location list is new. We can check the location list stack state as follows: :lold error list 1 of 2; 10 errors :lnew error list 2 of 2; 12 errors Then I went to the 5th location in this list. :5ll (5 of 12): <<do_filter>> if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, This is line 1209 of ex_cmds.c. At this point, I wanted to stop following this location list, close this window and return to the place where I executed the :lscscope command, then pick up where I was in the first location list. :q This closed the top window and made the second window "active" with the cursor on the first line of the readline() function. So far so good. When I left this window, I had been at location 3 of 10 in the first location list. Therefore, I expected that executing :ll would put the cursor back on line 925 of this file, fileio.c. :ll (1 of 12): <<open_buffer>> retval = readfile(curbuf->b_ffname, curbuf->b_fname, Not only did the :ll command use the "wrong" (i.e., unexpected) location list, but it jumped to the first location in that list instead of the last location used, which was number 5. Checking the location list stack state, :lold error list 1 of 2; 10 errors :lnew error list 2 of 2; 12 errors shows that there are still two location lists. I would have expected that closing that top window would have deleted the newest list. So is this a bug, or am I just not getting it? $ vim --version VIM - Vi IMproved 7.0 (2006 May 7, compiled Apr 27 2007 14:19:23) Included patches: 1-208 Compiled by [EMAIL PROTECTED] Normal version with GTK GUI. Features included (+) or not (-): -arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +folding -footer +fork() -gettext -hangul_input -iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm +mouse_xterm -multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile -python +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/home/garyjohn/src/SunOS/vim-7.0-patched/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/opt/TWWfsw/gtk+12/include/gtk-1.2 -I/opt/TWWfsw/glib12/include/glib-1.2 -I/opt/TWWfsw/glib12/lib/glib/include -I/usr/openwin/include -I/home/garyjohn/src/SunOS/ncurses-5.4/include/ncurses -g -O2 -I/usr/openwin/include Linking: gcc -L/usr/openwin/lib -R/usr/openwin/lib -L/home/garyjohn/src/SunOS/ncurses-5.4/lib -o vim -L/opt/TWWfsw/gtk+12/lib -R/opt/TWWfsw/gtk+12/lib -L/usr/openwin/lib -R/usr/openwin/lib -lgtk -lgdk -L/opt/TWWfsw/glib12/lib -R/opt/TWWfsw/glib12/lib -lgmodule -lglib -lXext -lm -lXt -lX11 -lSM -lICE -lnsl -lsocket -lncurses -ldl Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA