]> granicus.if.org Git - vim/commitdiff
updated for version 7.0164 v7.0164
authorBram Moolenaar <Bram@vim.org>
Wed, 7 Dec 2005 21:07:59 +0000 (21:07 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 7 Dec 2005 21:07:59 +0000 (21:07 +0000)
runtime/doc/todo.txt
runtime/doc/version7.txt
src/eval.c
src/ex_cmds.c
src/main.c
src/memline.c

index c2f616e6d729c3e31dcdc035fa736229c7caa053..3bade9065ebb0645650014b09dd2be10abb92b6d 100644 (file)
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Dec 06
+*todo.txt*      For Vim version 7.0aa.  Last change: 2005 Dec 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -37,6 +37,9 @@ differences.  Use Amiga code?
 "^[.?!]\_[\])'"   ]\+"
 Using string that was freed or buffer that is overwritten?
 
+SwapExists with editexisting plugin: Is there a simple way to detect ":tag
+function" and have the remote Vim jump to the tag?
+
 When editing a file "a" that is a symbolic link to "b", while another Vim is
 editing "b", there is no warning.  Follow symlink to make swap file name?
 Patch from Stefano Zacchiroli.  Updated by James Vega, Dec 2.
@@ -157,6 +160,10 @@ Autoload:
 Add ":smap", Select mode mapping?  Otherwise: ":sunmap", so that Visual mode
 mappings for normal keys can be removed from Select mode.
 
+When expanding on the command line, recognize shell commands, such as ":!cmd".
+Complete command names by searching in $PATH.  When completing file names
+escape special characters ";&<>(){}". (Adri Verhoef)
+
 Awaiting response:
 -   Win32: tearoff menu window should have a scrollbar when it's taller than
     the screen.
@@ -902,8 +909,6 @@ MSDOS, OS/2 and Win32:
 8   When editing a file on a Samba server, case might matter.  ":e file"
     followed by ":e FILE" will edit "file" again, even though "FILE" might be
     another one.  Set last used name in buflist_new()?  Fix do_ecmd(), etc.
-8   ":mksession" generates a "cd" command where "aa\#bb" means directory "#bb"
-    in "aa", but it's used as "aa#bb". (Ronald Hoellwarth)
 8   When a buffer is editing a file like "ftp://mach/file", which is not going
     to be used like a normal file name, don't change the slashes to
     backslashes. (Ronald Hoellwarth)
@@ -1094,8 +1099,6 @@ Macintosh:
     one.
 7   When 'showbreak' is set, the amount of space a Tab occupies changes.
     Should work like 'showbreak' is inserted without changing the Tabs.
-7   When there is a "help.txt" window in a session file, restoring that
-    session will not get the "LOCAL ADDITIONS" back.
 7   When 'mousefocus' is set and switching to another window with a typed
     command, the mouse pointer may be moved to a part of the window that's
     covered by another window and we lose focus.  Only move in the y
@@ -1881,7 +1884,6 @@ Built-in script language:
 7   Add function to generate unique number (date in milliseconds).
 7   Automatically load a function from a file when it is called.  Need an
     option for the search path. (Sekera)
-7   Persistent variables: "p:var"; stored in viminfo file and sessions files.
 
 
 Robustness:
@@ -3097,20 +3099,27 @@ Modelines:
     or not.  Same for .exrc in local dir.
 
 
-Options:
-8   Make ":mksession" store buffer-specific options for the specific buffer.
+Sessions:
+8   DOS/Windows: ":mksession" generates a "cd" command where "aa\#bb" means
+    directory "#bb" in "aa", but it's used as "aa#bb". (Ronald Hoellwarth)
+7   When there is a "help.txt" window in a session file, restoring that
+    session will not get the "LOCAL ADDITIONS" back.
 8   With ":mksession" always store the 'sessionoptions' option, even when
     "options" isn't in it. (St-Amant)
-7   ":with option=value | command": temporarily set an option value and
-    restore it after the command has executed.
-7   Setting an option always sets "w_set_curswant", while this is only
-    required for a few options.  Only do it for those options to avoid the
-    side effect.
 8   When using ":mksession", also store a command to reset all options to
     their default value, before setting the options that are not at their
     default value.
 7   With ":mksession" also store the tag stack and jump history. (Michal
     Malecki)
+7   Persistent variables: "p:var"; stored in viminfo file and sessions files.
+
+Options:
+7   ":with option=value | command": temporarily set an option value and
+    restore it after the command has executed.
+7   Setting an option always sets "w_set_curswant", while this is only
+    required for a few options.  Only do it for those options to avoid the
+    side effect.
 8   Make "old" number options that really give a number of effects into string
     options that are a comma separated list.  The old number values should
     also be supported.
index 80ff683f71118e68c5247e24b5eecc3b64645aed..3c8cf6816ef62fd6cd790340bc09acc0133b0017 100644 (file)
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Dec 06
+*version7.txt*  For Vim version 7.0aa.  Last change: 2005 Dec 07
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -847,6 +847,9 @@ Unix: When open() returns EFBIG give an appropriate message.
 ":mksession" sets the SessionLoad variable to notify plugins.  A modeline is
 added to the session file to set 'filetype' to "vim".
 
+In the ATTENTION prompt put the "Delete it" choice before "Quit" to make it
+more logical.  (Robert Webb)
+
 ==============================================================================
 COMPILE TIME CHANGES                                   *compile-changes-7*
 
@@ -1408,4 +1411,6 @@ sticking to the first column.
 When using ":wq" and a BufWriteCmd autocmd uses inputsecret() the text was
 echoed anyway.  Set terminal to raw mode in getcmdline().
 
+Unix: ":w a;b~c" caused an error in expanding wildcards.
+
  vim:tw=78:ts=8:ft=help:norl:
index d1271987e70a81ee10837c2f3e6395a23f08cd44..04772225c797b1ef3c7fd3e756d79a7687140f4b 100644 (file)
@@ -338,6 +338,8 @@ static struct vimvar
     {VV_NAME("beval_col",       VAR_NUMBER), VV_RO},
     {VV_NAME("beval_text",      VAR_STRING), VV_RO},
     {VV_NAME("scrollstart",     VAR_STRING), 0},
+    {VV_NAME("swapname",        VAR_STRING), VV_RO},
+    {VV_NAME("swapchoice",      VAR_STRING), 0},
 };
 
 /* shorthand */
index b6fab2c14ff63d47299df495191b02d608e47b1f..d1d3ae1080cb0be2a3fc6a10fba53555a0d2a50a 100644 (file)
@@ -3420,7 +3420,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
        topline = curwin->w_topline;
        if (!oldbuf)                        /* need to read the file */
        {
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
            swap_exists_action = SEA_DIALOG;
 #endif
            curbuf->b_flags |= BF_CHECK_RO; /* set/reset 'ro' flag */
@@ -3435,7 +3435,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
            (void)open_buffer(FALSE, eap);
 #endif
 
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
            if (swap_exists_action == SEA_QUIT)
                retval = FAIL;
            handle_swap_exists(old_curbuf);
index 658f4e1ea5183387a11c4f79d31425258ea6b570..fd4f4e44e99ec3d84479586ba0f36425071ac084 100644 (file)
@@ -116,7 +116,7 @@ static void exe_pre_commands __ARGS((mparm_T *parmp));
 static void exe_commands __ARGS((mparm_T *parmp));
 static void source_startup_scripts __ARGS((mparm_T *parmp));
 static void main_start_gui __ARGS((void));
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
 static void check_swap_exists_action __ARGS((void));
 #endif
 #ifdef FEAT_CLIENTSERVER
@@ -2150,7 +2150,7 @@ read_stdin()
 {
     int            i;
 
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
     /* When getting the ATTENTION prompt here, use a dialog */
     swap_exists_action = SEA_DIALOG;
 #endif
@@ -2161,7 +2161,7 @@ read_stdin()
     no_wait_return = FALSE;
     msg_didany = i;
     TIME_MSG("reading stdin");
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
     check_swap_exists_action();
 #endif
 #if !(defined(AMIGA) || defined(MACOS))
@@ -2245,14 +2245,14 @@ create_windows(parmp)
                if (p_fdls >= 0)
                    curwin->w_p_fdl = p_fdls;
 #endif
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
                /* When getting the ATTENTION prompt here, use a dialog */
                swap_exists_action = SEA_DIALOG;
 #endif
                set_buflisted(TRUE);
                (void)open_buffer(FALSE, NULL); /* create memfile, read file */
 
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
                check_swap_exists_action();
 #endif
 #ifdef FEAT_AUTOCMD
@@ -2872,7 +2872,7 @@ usage()
        mch_exit(0);
 }
 
-#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
+#if defined(HAS_SWAP_EXISTS_ACTION)
 /*
  * Check the result of the ATTENTION dialog:
  * When "Quit" selected, exit Vim.
index a2ec5b224d6291e4f7d14a383ceb5c403603aa9a..a6ab42c4e2c1f361e85c09c0c590f1248bc49d75 100644 (file)
@@ -1595,7 +1595,7 @@ static int process_still_running;
 #endif
 
 /*
- * Give information about an existing swap file
+ * Give information about an existing swap file.
  * Returns timestamp (0 when unknown).
  */
     static time_t
@@ -3494,6 +3494,93 @@ get_file_in_dir(fname, dname)
     return retval;
 }
 
+static void attention_message __ARGS((buf_T *buf, char_u *fname));
+
+/*
+ * Print the ATTENTION message: info about an existing swap file.
+ */
+    static void
+attention_message(buf, fname)
+    buf_T   *buf;      /* buffer being edited */
+    char_u  *fname;    /* swap file name */
+{
+    struct stat st;
+    time_t     x, sx;
+
+    ++no_wait_return;
+    (void)EMSG(_("E325: ATTENTION"));
+    MSG_PUTS(_("\nFound a swap file by the name \""));
+    msg_home_replace(fname);
+    MSG_PUTS("\"\n");
+    sx = swapfile_info(fname);
+    MSG_PUTS(_("While opening file \""));
+    msg_outtrans(buf->b_fname);
+    MSG_PUTS("\"\n");
+    if (mch_stat((char *)buf->b_fname, &st) != -1)
+    {
+       MSG_PUTS(_("             dated: "));
+       x = st.st_mtime;    /* Manx C can't do &st.st_mtime */
+       MSG_PUTS(ctime(&x));
+       if (sx != 0 && x > sx)
+           MSG_PUTS(_("      NEWER than swap file!\n"));
+    }
+    /* Some of these messages are long to allow translation to
+     * other languages. */
+    MSG_PUTS(_("\n(1) Another program may be editing the same file.\n    If this is the case, be careful not to end up with two\n    different instances of the same file when making changes.\n"));
+    MSG_PUTS(_("    Quit, or continue with caution.\n"));
+    MSG_PUTS(_("\n(2) An edit session for this file crashed.\n"));
+    MSG_PUTS(_("    If this is the case, use \":recover\" or \"vim -r "));
+    msg_outtrans(buf->b_fname);
+    MSG_PUTS(_("\"\n    to recover the changes (see \":help recovery\").\n"));
+    MSG_PUTS(_("    If you did this already, delete the swap file \""));
+    msg_outtrans(fname);
+    MSG_PUTS(_("\"\n    to avoid this message.\n"));
+    cmdline_row = msg_row;
+    --no_wait_return;
+}
+
+#ifdef FEAT_AUTOCMD
+static int do_swapexists __ARGS((buf_T *buf, char_u *fname));
+
+/*
+ * Trigger the SwapExists autocommands.
+ * Returns a value for equivalent to do_dialog() (see below):
+ * 0: still need to ask for a choice
+ * 1: open read-only
+ * 2: edit anyway
+ * 3: recover
+ * 4: delete it
+ * 5: quit
+ * 6: abort
+ */
+    static int
+do_swapexists(buf, fname)
+    buf_T      *buf;
+    char_u     *fname;
+{
+    set_vim_var_string(VV_SWAPNAME, fname, -1);
+    set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
+
+    /* Trigger SwapExists autocommands with <afile> set to the file being
+     * edited. */
+    apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL);
+
+    set_vim_var_string(VV_SWAPNAME, NULL, -1);
+
+    switch (*get_vim_var_str(VV_SWAPCHOICE))
+    {
+       case 'o': return 1;
+       case 'e': return 2;
+       case 'r': return 3;
+       case 'd': return 4;
+       case 'q': return 5;
+       case 'a': return 6;
+    }
+
+    return 0;
+}
+#endif
+
 /*
  * Find out what name to use for the swap file for buffer 'buf'.
  *
@@ -3511,7 +3598,6 @@ findswapname(buf, dirp, old_fname)
 {
     char_u     *fname;
     int                n;
-    time_t     x, sx;
     char_u     *dir_name;
 #ifdef AMIGA
     BPTR       fh;
@@ -3797,7 +3883,9 @@ findswapname(buf, dirp, old_fname)
                if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED)
                        && vim_strchr(p_shm, SHM_ATTENTION) == NULL)
                {
-                   struct stat st;
+#if defined(HAS_SWAP_EXISTS_ACTION)
+                   int         choice = 0;
+#endif
 #ifdef CREATE_DUMMY_FILE
                    int         did_use_dummy = FALSE;
 
@@ -3813,55 +3901,41 @@ findswapname(buf, dirp, old_fname)
                        did_use_dummy = TRUE;
                    }
 #endif
-#ifdef FEAT_GUI
-                   /* If we are supposed to start the GUI but it wasn't
-                    * completely started yet, start it now.  This makes the
-                    * messages displayed in the Vim window when loading a
-                    * session from the .gvimrc file. */
-                   if (gui.starting && !gui.in_use)
-                       gui_start();
-#endif
 
 #if (defined(UNIX) || defined(__EMX__) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
                    process_still_running = FALSE;
 #endif
-                   ++no_wait_return;
-                   (void)EMSG(_("E325: ATTENTION"));
-                   MSG_PUTS(_("\nFound a swap file by the name \""));
-                   msg_home_replace(fname);
-                   MSG_PUTS("\"\n");
-                   sx = swapfile_info(fname);
-                   MSG_PUTS(_("While opening file \""));
-                   msg_outtrans(buf->b_fname);
-                   MSG_PUTS("\"\n");
-                   if (mch_stat((char *)buf->b_fname, &st) != -1)
+#ifdef FEAT_AUTOCMD
+                   /*
+                    * If there is an SwapExists autocommand and we can handle
+                    * the response, trigger it.  It may return 0 to ask the
+                    * user anyway.
+                    */
+                   if (swap_exists_action != SEA_NONE
+                           && has_autocmd(EVENT_SWAPEXISTS, buf->b_fname, buf))
+                       choice = do_swapexists(buf, fname);
+
+                   if (choice == 0)
+#endif
                    {
-                       MSG_PUTS(_("             dated: "));
-                       x = st.st_mtime;    /* Manx C can't do &st.st_mtime */
-                       MSG_PUTS(ctime(&x));
-                       if (sx != 0 && x > sx)
-                           MSG_PUTS(_("      NEWER than swap file!\n"));
+#ifdef FEAT_GUI
+                       /* If we are supposed to start the GUI but it wasn't
+                        * completely started yet, start it now.  This makes
+                        * the messages displayed in the Vim window when
+                        * loading a session from the .gvimrc file. */
+                       if (gui.starting && !gui.in_use)
+                           gui_start();
+#endif
+                       /* Show info about the existing swap file. */
+                       attention_message(buf, fname);
+
+                       /* We don't want a 'q' typed at the more-prompt
+                        * interrupt loading a file. */
+                       got_int = FALSE;
                    }
-                   /* Some of these messages are long to allow translation to
-                    * other languages. */
-                   MSG_PUTS(_("\n(1) Another program may be editing the same file.\n    If this is the case, be careful not to end up with two\n    different instances of the same file when making changes.\n"));
-                   MSG_PUTS(_("    Quit, or continue with caution.\n"));
-                   MSG_PUTS(_("\n(2) An edit session for this file crashed.\n"));
-                   MSG_PUTS(_("    If this is the case, use \":recover\" or \"vim -r "));
-                   msg_outtrans(buf->b_fname);
-                   MSG_PUTS(_("\"\n    to recover the changes (see \":help recovery\").\n"));
-                   MSG_PUTS(_("    If you did this already, delete the swap file \""));
-                   msg_outtrans(fname);
-                   MSG_PUTS(_("\"\n    to avoid this message.\n"));
-                   cmdline_row = msg_row;
-                   --no_wait_return;
-
-                   /* We don't want a 'q' typed at the more-prompt interrupt
-                    * loading a file. */
-                   got_int = FALSE;
 
 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
-                   if (swap_exists_action)
+                   if (swap_exists_action != SEA_NONE && choice == 0)
                    {
                        char_u  *name;
 
@@ -3875,7 +3949,7 @@ findswapname(buf, dirp, old_fname)
                                                                  1000, TRUE);
                            STRCAT(name, _("\" already exists!"));
                        }
-                       switch (do_dialog(VIM_WARNING,
+                       choice = do_dialog(VIM_WARNING,
                                    (char_u *)_("VIM - ATTENTION"),
                                    name == NULL
                                        ?  (char_u *)_("Swap file already exists!")
@@ -3884,7 +3958,24 @@ findswapname(buf, dirp, old_fname)
                                    process_still_running
                                        ? (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort") :
 # endif
-                                       (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Quit\n&Abort\n&Delete it"), 1, NULL))
+                                       (char_u *)_("&Open Read-Only\n&Edit anyway\n&Recover\n&Delete it\n&Quit\n&Abort"), 1, NULL);
+
+# if defined(UNIX) || defined(__EMX__) || defined(VMS)
+                       if (process_still_running && choice >= 4)
+                           choice++;   /* Skip missing "Delete it" button */
+# endif
+                       vim_free(name);
+
+                       /* pretend screen didn't scroll, need redraw anyway */
+                       msg_scrolled = 0;
+                       redraw_all_later(NOT_VALID);
+                   }
+#endif
+
+#if defined(HAS_SWAP_EXISTS_ACTION)
+                   if (choice > 0)
+                   {
+                       switch (choice)
                        {
                            case 1:
                                buf->b_p_ro = TRUE;
@@ -3895,21 +3986,16 @@ findswapname(buf, dirp, old_fname)
                                swap_exists_action = SEA_RECOVER;
                                break;
                            case 4:
-                               swap_exists_action = SEA_QUIT;
+                               mch_remove(fname);
                                break;
                            case 5:
                                swap_exists_action = SEA_QUIT;
-                               got_int = TRUE;
                                break;
                            case 6:
-                               mch_remove(fname);
+                               swap_exists_action = SEA_QUIT;
+                               got_int = TRUE;
                                break;
                        }
-                       vim_free(name);
-
-                       /* pretend screen didn't scroll, need redraw anyway */
-                       msg_scrolled = 0;
-                       redraw_all_later(NOT_VALID);
 
                        /* If the file was deleted this fname can be used. */
                        if (mch_getperm(fname) < 0)