changeset 665:21ab9abf0f08

updated for version 7.0196
author vimboss
date Fri, 10 Feb 2006 23:20:28 +0000
parents ce5a759cc907
children 0137e7c3d31b
files runtime/doc/eval.txt runtime/doc/help.txt runtime/doc/if_cscop.txt runtime/doc/insert.txt runtime/doc/options.txt runtime/doc/tags src/auto/configure src/edit.c src/if_cscope.c src/option.c src/option.h src/quickfix.c src/version.h
diffstat 13 files changed, 226 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 03
+*eval.txt*      For Vim version 7.0aa.  Last change: 2006 Feb 10
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -3210,6 +3210,8 @@ line({expr})	The result is a Number, whi
 		    $	    the last line in the current buffer
 		    'x	    position of mark x (if the mark is not set, 0 is
 			    returned)
+		    w0	    first line visible in current window
+		    w$	    last line visible in current window
 		Note that only marks in the current file can be used.
 		Examples: >
 			line(".")		line number of the cursor
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -191,13 +191,6 @@ Standard plugins ~
 |pi_expl.txt|	File explorer
 
 LOCAL ADDITIONS:				*local-additions*
-|cecutil.txt|	DrChip's Utilities				Jun 11, 2004
-|engspchk.txt|	English Spelling Checker   (v61)	Mar 14, 2005
-|example.txt|	Example for a locally added help file
-|matchit.txt|   Extended "%" matching
-|test.txt|	Testing the hélp cömmånd nôw
-|typecorr.txt|	Plugin for correcting typing mistakes
-|helpp.txt|	Dummy line to avoid an error message
 
 ------------------------------------------------------------------------------
 *bars*		Bars example
--- a/runtime/doc/if_cscop.txt
+++ b/runtime/doc/if_cscop.txt
@@ -208,6 +208,11 @@ The available subcommands are:
 
 	    USAGE   :cs show
 
+							*:lcscope* *:lcs*
+This command is same as the ":cscope" command, except when the
+'cscopequickfix' option is set, the location list for the current window is
+used instead of the quickfix list to show the cscope results.
+
 							*:cstag* *E257* *E562*
 If you use cscope as well as ctags, |:cstag| allows you to search one or
 the other before making a jump.  For example, you can choose to first
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt*    For Vim version 7.0aa.  Last change: 2006 Feb 07
+*insert.txt*    For Vim version 7.0aa.  Last change: 2006 Feb 10
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1072,16 +1072,24 @@ The menu is used when:
 - There are at least two matches.
 
 While the menu is displayed these keys have a special meaning:
-<CR> and <Enter> Accept the currently selected match
-<Up>		  Select the previous match, as if CTRL-P was used
-<Down>		  Select the next match, as if CTRL-N was used
+<CR> and <Enter>  Accept the currently selected match
+
 <PageUp>	  Select a match several entries back
 <PageDown>	  Select a match several entries further
+
 <BS> and CTRL-H   Delete one character, find the matches for the shorter word
 		  before the cursor.  This may find more matches.
 CTRL-L		  Add one character from the current match, may reduce the
 		  number of matches.  Does not work after selecting one of the
 		  matches with CTRL-N, <Up>, etc.
+<Up>		  Select the previous match, as if CTRL-P was used, but don't
+		  insert it when editing the selection.
+<Down>		  Select the next match, as if CTRL-N was used, but don't
+		  insert it when editing the selection.
+
+The selection is being edited after typing <BS>, CTRL-L or when using the
+longest common match.  This stops when a match is inserted, as with CTRL-N or
+CTRL-P.
 
 The colors of the menu can be changed with these highlight groups:
 Pmenu		normal item  |hl-Pmenu|
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 02
+*options.txt*	For Vim version 7.0aa.  Last change: 2006 Feb 10
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1621,13 +1621,16 @@ A jump table for the options with a shor
 'completeopt' 'cot'	string	(default: "menu")
 			global
 			{not in Vi}
-	Options for Insert mode completion |ins-completion|.
-	Currently the only supported value is:
+	A comma separated list of options for Insert mode completion
+	|ins-completion|.  The supported values are:
 
 	   menu	    Use a popup menu to show the possible completions.  The
 		    menu is only shown when there is more than one match and
 		    sufficient colors are available.  |ins-completion-menu|
 
+	   longest  Only insert the longest common text of the matches.  Use
+	            CTRL-L to add more characters.
+
 
 				*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
 'confirm' 'cf'		boolean (default off)
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -2124,6 +2124,8 @@ 90.5	usr_90.txt	/*90.5*
 :lchdir	editing.txt	/*:lchdir*
 :lcl	quickfix.txt	/*:lcl*
 :lclose	quickfix.txt	/*:lclose*
+:lcs	if_cscop.txt	/*:lcs*
+:lcscope	if_cscop.txt	/*:lcscope*
 :le	change.txt	/*:le*
 :left	change.txt	/*:left*
 :lefta	windows.txt	/*:lefta*
@@ -3114,7 +3116,10 @@ Contents	quickref.txt	/*Contents*
 Cscope	if_cscop.txt	/*Cscope*
 CursorHold	autocmd.txt	/*CursorHold*
 CursorHold-example	windows.txt	/*CursorHold-example*
+CursorHoldI	autocmd.txt	/*CursorHoldI*
 CursorIM	mbyte.txt	/*CursorIM*
+CursorMoved	autocmd.txt	/*CursorMoved*
+CursorMovedI	autocmd.txt	/*CursorMovedI*
 D	change.txt	/*D*
 DOS	os_dos.txt	/*DOS*
 DOS-format	editing.txt	/*DOS-format*
@@ -5422,6 +5427,7 @@ hebrew	hebrew.txt	/*hebrew*
 hebrew.txt	hebrew.txt	/*hebrew.txt*
 help	various.txt	/*help*
 help-context	help.txt	/*help-context*
+help-tags	tags	1
 help-translated	various.txt	/*help-translated*
 help-xterm-window	various.txt	/*help-xterm-window*
 help.txt	help.txt	/*help.txt*
@@ -5850,6 +5856,14 @@ mapcheck()	eval.txt	/*mapcheck()*
 maple.vim	syntax.txt	/*maple.vim*
 mapleader	map.txt	/*mapleader*
 maplocalleader	map.txt	/*maplocalleader*
+mapmode-c	map.txt	/*mapmode-c*
+mapmode-i	map.txt	/*mapmode-i*
+mapmode-ic	map.txt	/*mapmode-ic*
+mapmode-l	map.txt	/*mapmode-l*
+mapmode-n	map.txt	/*mapmode-n*
+mapmode-nvo	map.txt	/*mapmode-nvo*
+mapmode-o	map.txt	/*mapmode-o*
+mapmode-v	map.txt	/*mapmode-v*
 mapping	map.txt	/*mapping*
 mark	motion.txt	/*mark*
 mark-motions	motion.txt	/*mark-motions*
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -1009,7 +1009,7 @@ gives unlimited permission to copy, dist
 _ACEOF
   exit 0
 fi
-exec 5>config.log
+exec 5>auto/config.log
 cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -15455,7 +15455,7 @@ exec 6>&1
 # Open the log real soon, to keep \$[0] and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.  Logging --version etc. is OK.
-exec 5>>config.log
+exec 5>>auto/config.log
 {
   echo
   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
@@ -16285,7 +16285,7 @@ if test "$no_create" != yes; then
     ac_config_status_args="$ac_config_status_args --quiet"
   exec 5>/dev/null
   $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-  exec 5>>config.log
+  exec 5>>auto/config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
   $ac_cs_success || { (exit 1); exit 1; }
--- a/src/edit.c
+++ b/src/edit.c
@@ -95,6 +95,9 @@ static compl_T    *compl_shown_match = N
  * are used. */
 static char_u	  *compl_leader = NULL;
 
+static int	  compl_get_longest = FALSE;	/* put longest common string
+						   in compl_leader */
+
 static int	  compl_used_match;	/* Selected one of the matches.  When
 					   FALSE the match was edited or using
 					   the longest common string. */
@@ -119,6 +122,7 @@ static expand_T	  compl_xp;
 
 static void ins_ctrl_x __ARGS((void));
 static int  has_compl_option __ARGS((int dict_opt));
+static void ins_compl_longest_match __ARGS((compl_T *match));
 static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches));
 static int  ins_compl_make_cyclic __ARGS((void));
 static void ins_compl_upd_pum __ARGS((void));
@@ -136,7 +140,7 @@ static buf_T *ins_compl_next_buf __ARGS(
 static int  ins_compl_get_exp __ARGS((pos_T *ini));
 static void ins_compl_delete __ARGS((void));
 static void ins_compl_insert __ARGS((void));
-static int  ins_compl_next __ARGS((int allow_get_expansion, int count));
+static int  ins_compl_next __ARGS((int allow_get_expansion, int count, int insert_match));
 static int  ins_compl_key2dir __ARGS((int c));
 static int  ins_compl_pum_key __ARGS((int c));
 static int  ins_compl_key2count __ARGS((int c));
@@ -683,12 +687,6 @@ edit(cmdchar, startln, count)
 #endif
 
 #ifdef FEAT_INS_EXPAND
-	/* When the popup menu is visible cursor keys change the selection. */
-	if (c == K_UP && pum_visible())
-	    c = Ctrl_P;
-	if (c == K_DOWN && pum_visible())
-	    c = Ctrl_N;
-
 	/*
 	 * Special handling of keys while the popup menu is visible or wanted
 	 * and the cursor is still in the completed word.
@@ -717,11 +715,19 @@ edit(cmdchar, startln, count)
 		    ins_compl_addleader(c);
 		    continue;
 		}
+
+		/* Pressing Enter selects the current match. */
+		if (c == CAR || c == K_KENTER || c == NL)
+		{
+		    ins_compl_delete();
+		    ins_compl_insert();
+		}
 	    }
 	}
 
 	/* Prepare for or stop CTRL-X mode.  This doesn't do completion, but
 	 * it does fix up the text when finishing completion. */
+	compl_get_longest = FALSE;
 	if (c != K_IGNORE && ins_compl_prep(c))
 	    continue;
 #endif
@@ -1103,6 +1109,10 @@ doESCkey:
 	    break;
 
 	case K_UP:	/* <Up> */
+#ifdef FEAT_INS_EXPAND
+	    if (pum_visible())
+		goto docomplete;
+#endif
 	    if (mod_mask & MOD_MASK_SHIFT)
 		ins_pageup();
 	    else
@@ -1120,6 +1130,10 @@ doESCkey:
 	    break;
 
 	case K_DOWN:	/* <Down> */
+#ifdef FEAT_INS_EXPAND
+	    if (pum_visible())
+		goto docomplete;
+#endif
 	    if (mod_mask & MOD_MASK_SHIFT)
 		ins_pagedown();
 	    else
@@ -1860,7 +1874,7 @@ ins_ctrl_x()
 	/* if the next ^X<> won't ADD nothing, then reset
 	 * compl_cont_status */
 	if (compl_cont_status & CONT_N_ADDS)
-	    compl_cont_status = (compl_cont_status | CONT_INTRPT);
+	    compl_cont_status |= CONT_INTRPT;
 	else
 	    compl_cont_status = 0;
 	/* We're not sure which CTRL-X mode it will be yet */
@@ -2138,10 +2152,70 @@ ins_compl_add(str, len, fname, extra, cd
 	compl_first_match = match;
     compl_curr_match = match;
 
+    /*
+     * Find the longest common string if still doing that.
+     */
+    if (compl_get_longest && (flags & ORIGINAL_TEXT) == 0)
+	ins_compl_longest_match(match);
+
     return OK;
 }
 
 /*
+ * Reduce the longest common string for match "match".
+ */
+    static void
+ins_compl_longest_match(match)
+    compl_T	*match;
+{
+    char_u	*p, *s;
+    int		l;
+    int		had_match;
+
+    if (compl_leader == NULL)
+	/* First match, use it as a whole. */
+	compl_leader = vim_strsave(match->cp_str);
+    else
+    {
+	/* Reduce the text if this match differs from compl_leader. */
+	for (p = compl_leader, s = match->cp_str; *p != NUL; p += l, s += l)
+	{
+#ifdef FEAT_MBYTE
+	    if (has_mbyte)
+	    {
+		l = mb_ptr2len(p);
+		if (STRNCMP(p, s, l) != 0)
+			break;
+	    }
+	    else
+#endif
+	    {
+		if (*p != *s)
+		    break;
+		l = 1;
+	    }
+	}
+
+	if (*p != NUL)
+	{
+	    /* Leader was shortened, need to change the inserted text. */
+	    *p = NUL;
+	    had_match = (curwin->w_cursor.col > compl_col);
+	    ins_compl_delete();
+	    ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
+	    ins_redraw(FALSE);
+
+	    /* When the match isn't there (to avoid matching itself) remove it
+	     * again after redrawing. */
+	    if (!had_match)
+		ins_compl_delete();
+	}
+
+	compl_used_match = FALSE;
+    }
+}
+
+/*
  * Add an array of matches to the list of matches.
  * Frees matches[].
  */
@@ -2231,7 +2305,7 @@ ins_compl_del_pum()
 pum_wanted()
 {
     /* 'completeopt' must contain "menu" */
-    if (*p_cot == NUL)
+    if (vim_strchr(p_cot, 'm') == NULL)
 	return FALSE;
 
     /* The display looks bad on a B&W display. */
@@ -2762,6 +2836,14 @@ ins_compl_prep(c)
     if (c == K_SELECT)
 	return retval;
 
+    /* Set "compl_get_longest" when finding the first matches. */
+    if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
+				      || (ctrl_x_mode == 0 && !compl_started))
+    {
+	compl_get_longest = (vim_strchr(p_cot, 'l') != NULL);
+	compl_used_match = TRUE;
+    }
+
     if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET)
     {
 	/*
@@ -3356,7 +3438,7 @@ ins_compl_get_exp(ini)
 		    last_match_pos = *pos;
 		}
 		else if (first_match_pos.lnum == last_match_pos.lnum
-			 && first_match_pos.col == last_match_pos.col)
+				 && first_match_pos.col == last_match_pos.col)
 		    found_new_match = FAIL;
 		if (found_new_match == FAIL)
 		{
@@ -3470,9 +3552,10 @@ ins_compl_get_exp(ini)
 	{
 	    if (got_int)
 		break;
+	    /* Fill the popup menu as soon as possible. */
 	    if (pum_wanted() && type != -1)
-		/* Fill the popup menu as soon as possible. */
 		ins_compl_check_keys(0);
+
 	    if ((ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE)
 							 || compl_interrupted)
 		break;
@@ -3547,10 +3630,11 @@ ins_compl_insert()
  * calls this function with "allow_get_expansion" FALSE.
  */
     static int
-ins_compl_next(allow_get_expansion, count)
+ins_compl_next(allow_get_expansion, count, insert_match)
     int	    allow_get_expansion;
     int	    count;		/* repeat completion this many times; should
 				   be at least 1 */
+    int	    insert_match;	/* Insert the newly selected match */
 {
     int	    num_matches = -1;
     int	    i;
@@ -3558,11 +3642,23 @@ ins_compl_next(allow_get_expansion, coun
     compl_T *found_compl = NULL;
     int	    found_end = FALSE;
 
-    if (allow_get_expansion)
-    {
+    if (compl_leader != NULL
+			&& (compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0)
+    {
+	/* Set "compl_shown_match" to the actually shown match, it may differ
+	 * when "compl_leader" is used to omit some of the matches. */
+	while (STRNCMP(compl_shown_match->cp_str,
+				     compl_leader, STRLEN(compl_leader)) != 0
+		&& compl_shown_match->cp_next != NULL
+		&& compl_shown_match->cp_next != compl_first_match)
+	    compl_shown_match = compl_shown_match->cp_next;
+    }
+
+    if (allow_get_expansion && insert_match
+				  && (!compl_get_longest || compl_used_match))
 	/* Delete old text to be replaced */
 	ins_compl_delete();
-    }
+
     compl_pending = FALSE;
 
     /* Repeat this for when <PageUp> or <PageDown> is typed.  But don't wrap
@@ -3615,14 +3711,25 @@ ins_compl_next(allow_get_expansion, coun
 	}
     }
 
-    /* Insert the text of the new completion */
-    ins_compl_insert();
+    /* Insert the text of the new completion, or the compl_leader. */
+    if (insert_match)
+    {
+	if (!compl_get_longest || compl_used_match)
+	    ins_compl_insert();
+	else
+	    ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
+    }
+    else
+	compl_used_match = FALSE;
 
     if (!allow_get_expansion)
     {
 	/* may undisplay the popup menu first */
 	ins_compl_upd_pum();
 
+	/* redraw to show the user what was inserted */
+	update_screen(0);
+
 	/* display the updated popup menu */
 	ins_compl_show_pum();
 
@@ -3685,13 +3792,14 @@ ins_compl_check_keys(frequency)
 	{
 	    c = safe_vgetc();	/* Eat the character */
 	    compl_shows_dir = ins_compl_key2dir(c);
-	    (void)ins_compl_next(FALSE, ins_compl_key2count(c));
+	    (void)ins_compl_next(FALSE, ins_compl_key2count(c),
+						    c != K_UP && c != K_DOWN);
 	}
 	else if (c != Ctrl_R)
 	    compl_interrupted = TRUE;
     }
     if (compl_pending && !got_int)
-	(void)ins_compl_next(FALSE, 1);
+	(void)ins_compl_next(FALSE, 1, TRUE);
 }
 
 /*
@@ -3702,8 +3810,9 @@ ins_compl_check_keys(frequency)
 ins_compl_key2dir(c)
     int		c;
 {
-    if (c == Ctrl_P || c == Ctrl_L || (pum_visible()
-			 && (c == K_PAGEUP || c == K_KPAGEUP || c == K_S_UP)))
+    if (c == Ctrl_P || c == Ctrl_L
+	    || (pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP
+						|| c == K_S_UP || c == K_UP)))
 	return BACKWARD;
     return FORWARD;
 }
@@ -3717,7 +3826,8 @@ ins_compl_pum_key(c)
     int		c;
 {
     return pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP || c == K_S_UP
-		     || c == K_PAGEDOWN || c == K_KPAGEDOWN || c == K_S_DOWN);
+		     || c == K_PAGEDOWN || c == K_KPAGEDOWN || c == K_S_DOWN
+		     || c == K_UP || c == K_DOWN);
 }
 
 /*
@@ -3730,7 +3840,7 @@ ins_compl_key2count(c)
 {
     int		h;
 
-    if (ins_compl_pum_key(c))
+    if (ins_compl_pum_key(c) && c != K_UP && c != K_DOWN)
     {
 	h = pum_get_height();
 	if (h > 3)
@@ -3783,7 +3893,8 @@ ins_complete(c)
 	 * been split because it was longer than 'tw').  if SOL is set then
 	 * skip the previous pattern, a word at the beginning of the line has
 	 * been inserted, we'll look for that  -- Acevedo. */
-	if ((compl_cont_status & CONT_INTRPT) && compl_cont_mode == ctrl_x_mode)
+	if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
+					    && compl_cont_mode == ctrl_x_mode)
 	{
 	    /*
 	     * it is a continued search
@@ -4129,9 +4240,10 @@ ins_complete(c)
     compl_shows_dir = compl_direction;
 
     /*
-     * Find next match.
+     * Find next match (and following matches).
      */
-    n = ins_compl_next(TRUE, ins_compl_key2count(c));
+    n = ins_compl_next(TRUE, ins_compl_key2count(c),
+						c != K_UP && c != K_DOWN);
 
     /* may undisplay the popup menu */
     ins_compl_upd_pum();
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -50,7 +50,7 @@ static void	    cs_file_results __ARGS((
 static void	    cs_fill_results __ARGS((char *, int , int *, char ***,
 			char ***, int *));
 static int	    cs_find __ARGS((exarg_T *eap));
-static int	    cs_find_common __ARGS((char *opt, char *pat, int, int ));
+static int	    cs_find_common __ARGS((char *opt, char *pat, int, int, int));
 static int	    cs_help __ARGS((exarg_T *eap));
 static void	    cs_init __ARGS((void));
 static void	    clear_csinfo __ARGS((int i));
@@ -183,7 +183,8 @@ do_cstag(eap)
     case 0 :
 	if (cs_check_for_connections())
 	{
-	    ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE);
+	    ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
+				 FALSE);
 	    if (ret == FALSE)
 	    {
 		cs_free_tags();
@@ -211,7 +212,7 @@ do_cstag(eap)
 		if (cs_check_for_connections())
 		{
 		    ret = cs_find_common("g", (char *)(eap->arg), eap->forceit,
-					 FALSE);
+					 FALSE, FALSE);
 		    if (ret == FALSE)
 			cs_free_tags();
 		}
@@ -219,7 +220,8 @@ do_cstag(eap)
 	}
 	else if (cs_check_for_connections())
 	{
-	    ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE);
+	    ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, FALSE,
+				 FALSE);
 	    if (ret == FALSE)
 		cs_free_tags();
 	}
@@ -967,7 +969,8 @@ cs_find(eap)
 	return FALSE;
     }
 
-    return cs_find_common(opt, pat, eap->forceit, TRUE);
+    return cs_find_common(opt, pat, eap->forceit, TRUE,
+			  eap->cmdidx == CMD_lcscope);
 } /* cs_find */
 
 
@@ -977,11 +980,12 @@ cs_find(eap)
  * common code for cscope find, shared by cs_find() and do_cstag()
  */
     static int
-cs_find_common(opt, pat, forceit, verbose)
+cs_find_common(opt, pat, forceit, verbose, use_ll)
     char *opt;
     char *pat;
     int forceit;
     int verbose;
+    int	use_ll;
 {
     int i;
     char *cmd;
@@ -1099,12 +1103,16 @@ cs_find_common(opt, pat, forceit, verbos
 	/* fill error list */
 	FILE *f;
 	char_u *tmp = vim_tempname('c');
+	qf_info_T   *qi = NULL;
+	win_T	    *wp = NULL;
 
 	f = mch_fopen((char *)tmp, "w");
 	cs_file_results(f, nummatches);
 	fclose(f);
+	if (use_ll)	    /* Use location list */
+	    wp = curwin;
 	/* '-' starts a new error list */
-	if (qf_init(NULL, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0)
+	if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0)
 	{
 # ifdef FEAT_WINDOWS
 	    if (postponed_split != 0)
@@ -1117,7 +1125,14 @@ cs_find_common(opt, pat, forceit, verbos
 		postponed_split = 0;
 	    }
 # endif
-	    qf_jump(NULL, 0, 0, forceit);
+	    if (use_ll)
+		/*
+		 * In the location list window, use the displayed location
+		 * list. Otherwise, use the location list for the window.
+		 */
+		qi = (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) ?
+				    wp->w_llist_ref : wp->w_llist;
+	    qf_jump(qi, 0, 0, forceit);
 	}
 	mch_remove(tmp);
 	vim_free(tmp);
--- a/src/option.c
+++ b/src/option.c
@@ -2628,7 +2628,7 @@ static char *(p_fdm_values[]) = {"manual
 static char *(p_fcl_values[]) = {"all", NULL};
 #endif
 #ifdef FEAT_INS_EXPAND
-static char *(p_cot_values[]) = {"menu", NULL};
+static char *(p_cot_values[]) = {"menu", "longest", NULL};
 #endif
 
 static void set_option_default __ARGS((int, int opt_flags, int compatible));
--- a/src/option.h
+++ b/src/option.h
@@ -302,7 +302,7 @@
 #define LISPWORD_VALUE	"defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object"
 
 /*
- * The following are actual variabables for the options
+ * The following are actual variables for the options
  */
 
 #ifdef FEAT_RIGHTLEFT
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -125,6 +125,7 @@ static char_u	*get_mef_name __ARGS((void
 static buf_T	*load_dummy_buffer __ARGS((char_u *fname));
 static void	wipe_dummy_buffer __ARGS((buf_T *buf));
 static void	unload_dummy_buffer __ARGS((buf_T *buf));
+static qf_info_T *ll_get_or_alloc_list __ARGS((win_T *));
 
 /* Quickfix window check helper macro */
 #define IS_QF_WINDOW(wp) (bt_quickfix(wp->w_buffer) && wp->w_llist_ref == NULL)
@@ -154,7 +155,11 @@ qf_init(wp, efile, errorformat, newlist)
 	return FAIL;
 
     if (wp != NULL)
-	qi = GET_LOC_LIST(wp);
+    {
+	qi = ll_get_or_alloc_list(wp);
+	if (qi == NULL)
+	    return FAIL;
+    }
 
     return qf_init_ext(qi, efile, curbuf, NULL, errorformat, newlist,
 						    (linenr_T)0, (linenr_T)0);
@@ -2628,12 +2633,7 @@ ex_make(eap)
 
     if (eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_lgrep
 	|| eap->cmdidx == CMD_lgrepadd)
-    {
-	qi = ll_get_or_alloc_list(curwin);
-	if (qi == NULL)
-	    return;
 	wp = curwin;
-    }
 
     autowrite_all();
     fname = get_mef_name();
@@ -2678,7 +2678,11 @@ ex_make(eap)
 					   (eap->cmdidx != CMD_grepadd
 					    && eap->cmdidx != CMD_lgrepadd)) > 0
 	    && !eap->forceit)
+    {
+	if (wp != NULL)
+	    qi = GET_LOC_LIST(wp);
 	qf_jump(qi, 0, 0, FALSE);		/* display first error */
+    }
 
     mch_remove(fname);
     vim_free(fname);
@@ -2832,12 +2836,7 @@ ex_cfile(eap)
 
     if (eap->cmdidx == CMD_lfile || eap->cmdidx == CMD_lgetfile
 	|| eap->cmdidx == CMD_laddfile)
-    {
-	qi = ll_get_or_alloc_list(curwin);
-	if (qi == NULL)
-	    return;
 	wp = curwin;
-    }
 
     if (*eap->arg != NUL)
 	set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE);
@@ -2856,7 +2855,11 @@ ex_cfile(eap)
 				  && eap->cmdidx != CMD_laddfile)) > 0
 				  && (eap->cmdidx == CMD_cfile
 					     || eap->cmdidx == CMD_lfile))
+    {
+	if (wp != NULL)
+	    qi = GET_LOC_LIST(wp);
 	qf_jump(qi, 0, 0, eap->forceit);	/* display first error */
+    }
 }
 
 /*
@@ -3517,11 +3520,11 @@ ex_cexpr(eap)
 	if ((tv->v_type == VAR_STRING && tv->vval.v_string != NULL)
 		|| (tv->v_type == VAR_LIST && tv->vval.v_list != NULL))
 	{
-	    if (qf_init_ext(qi, NULL, NULL, tv, p_efm,
-			    (eap->cmdidx == CMD_cexpr
-			     || eap->cmdidx == CMD_lexpr),
+	    int	    expr_cmd = (eap->cmdidx == CMD_cexpr
+				|| eap->cmdidx == CMD_lexpr);
+	    if (qf_init_ext(qi, NULL, NULL, tv, p_efm, expr_cmd,
 						 (linenr_T)0, (linenr_T)0) > 0
-		    && (eap->cmdidx == CMD_cexpr || eap->cmdidx == CMD_lexpr))
+		    && expr_cmd)
 		qf_jump(qi, 0, 0, eap->forceit);  /* display first error */
 	}
 	else
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 9)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 9, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 10)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 10, compiled "