wsdjeg / vim-fetch

Make Vim handle line and column numbers in file names with a minimum of fuss
http://www.vim.org/scripts/script.php?script_id=5089
MIT License
312 stars 17 forks source link

Presence of swap files results in "Error detected while processing function fetch#buffer" #11

Closed Lekensteyn closed 6 years ago

Lekensteyn commented 8 years ago

When a swap file is present and vim-fetch is activated, an error is reported:

"foo:1" [New File]
Found a swap file by the name ".foo.swp"
          owned by: peter   dated: Mon Dec 21 18:10:12 2015
         file name: /tmp/test/foo
          modified: no
         user name: peter   host name: al
        process ID: 1968
While opening file "foo"
             dated: Mon Dec 21 18:10:02 2015

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r foo"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".foo.swp"
    to avoid this message.

Swap file ".foo.swp" already exists!
"foo" [readonly] 0L, 0C
Error detected while processing function fetch#buffer:
line   40:
E325: ATTENTION
Press ENTER or type command to continue

Steps to reproduce:

  1. touch foo && vim foo
  2. mv .foo.swp .foo.tmp
  3. Quit vim (:q)
  4. mv .foo.tmp .foo.swp
  5. vim foo:1
  6. Chose option [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it or (Q)uit. These trigger an error. Option (A)bort is unaffected.
kopischke commented 8 years ago

Thanks for bringing this to my attention: I wasn't even aware Vim wraps the swap recovery process in an exception until now. That exception being triggered in mid function call when you use fetch, things go awry; I’ll have to see what the most elegant way of bowing out is in that case, but this definitely should be fixable.

kopischke commented 8 years ago

@Lekensteyn as I won’t have the opportunity to reproduce this for a few days at least, could you tell me what error exactly is triggered by choosing any recovery option but (A)bort? Thanks!

bazz1tv commented 6 years ago

For anyone who wants to use the fix before Release 2.1 comes out, do from a new branch git pull origin fix/swap-exception