Cannot open undo file for writing #14

Closed
M4T1A5 opened this Issue Jan 26, 2012 · 8 comments

Projects

None yet

3 participants

@M4T1A5
M4T1A5 commented Jan 26, 2012

Trying to write something to a directory where the user does not have write permission (say /etc) you get something like this:

  1. Insert some text
  2. Try to save as /etc/foo
  3. Error:
    E828: Cannot open undo file for writing: /etc/.foo.un~

It still writes the file, but you lose all content from the buffer and have to reopen if you want to edit more.

@chrisbra
Owner

Hi Matias!

On Do, 26 Jan 2012, Matias Kangasjärvelä wrote:

Trying to write something to a directory where the user does not have write permission (say /etc) you get something like this:

  1. Insert some text
  2. Try to save as /etc/foo
  3. Error:
    E828: Cannot open undo file for writing: /etc/.foo.un~

It still writes the file, but you lose all content from the buffer and have to reopen if you want to edit more.

Yes, Vim can't create undofiles in write-protected directories. I made
the plugin more error-robust regarding this condition and it should now
give you an error and not try to create an undofile there.

I suggest, you set the 'undodir' option to a directory, that is
writable.

Try current head, that should give at least better error messages now.

Thanks for your feedback.

regars,

Christian

@chrisyip

@chrisbra you mean the "persistence undo" feature causes this error?
If yes, I think it's a little wired, because of I didn't enable this feature, and never saw any .foo.un~ file.

@chrisbra
Owner

On Mon, January 30, 2012 12:04 pm, Chris Yip wrote:

@chrisbra you mean the "persistence undo" feature causes this error?
If yes, I think it's a little wired, because of I didn't enable this
feature, and never saw any .foo.un~ file.

Check with
:verbose set undofile
where this feature was enabled (e.g. in runtime file enables the
persistent undo files).

regards,
Christian

@chrisyip

Tried, I got nothing.

With

:verbose set fileencoding

I got:

fileencoding=utf-8
    Last set from ~/.vimrc
@chrisbra
Owner

On Mon, January 30, 2012 4:12 pm, Chris Yip wrote:

Tried, I got nothing.

With

:verbose set fileencoding

I got:

fileencoding=utf-8
    Last set from ~/.vimrc

Ah okay, then it is by default off in your case.

I think there might still be an error in the LocalSettings function
of the plugin, that does not check the undofile setting.

I'll fix it.

@chrisbra chrisbra added a commit that referenced this issue Jan 30, 2012
@chrisbra Check for undofile-setting #14 e65a11d
@chrisbra
Owner

Hi Chris!

On Mo, 30 Jan 2012, Chris Yip wrote:

Tried, I got nothing.

With

:verbose set fileencoding

I got:

fileencoding=utf-8
    Last set from ~/.vimrc

Please try current master and see if that changed.

regards,

Christian

Im Auto gibt es zwei Computer, im Fernseher steckt einer, sogar in der
Mikrowelle - nur der Microsoft PC funktioniert nicht.

@chrisyip

Perfect!
If "persistence undo" is disabled, there's no error message at all.
Just save files silently.

@M4T1A5
M4T1A5 commented Feb 1, 2012

Yes the problem seems to be fixed for me too! This is great because now i can use this plugin :)

@chrisbra chrisbra closed this Apr 21, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment