From 3da8b7af2a79ca7f4f64fe550c2c96398fe809e9 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Tue, 5 Oct 2010 10:32:56 -0400 Subject: [PATCH] Allow :write! >>nonexistent.file --HG-- extra : rebase_source : b446ad89bdbaf38f6091b2145a4b4be687eeb24d --- common/content/buffer.js | 8 ++++++-- common/content/tabs.js | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index 38e1a468..4c766f47 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1335,10 +1335,14 @@ const Buffer = Module("buffer", { if (/^>>/.test(filename)) { let file = io.File(filename.replace(/^>>\s*/, "")); - dactyl.assert(file.exists() && file.isWritable(), file.path.quote() + ": E212: Can't open file for writing"); + dactyl.assert(args.bang || file.exists() && file.isWritable(), file.path.quote() + ": E212: Can't open file for writing"); return buffer.viewSourceExternally(buffer.focusedFrame.document, function (tmpFile) { - file.write(tmpFile.read(), ">>"); + try { + file.write(tmpFile.read(), ">>"); + } catch (e) { + dactyl.echoerr(file.path.quote() + ": E212: Can't open file for writing"); + } }); } diff --git a/common/content/tabs.js b/common/content/tabs.js index 17f2cc8d..4b71f47b 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -182,9 +182,8 @@ const Tabs = Module("tabs", { TabView._initFrame(); let iframe = document.getElementById("tab-view"); this._groups = this._groups = iframe ? iframe.contentWindow : null; - if (this._groups) - while (!this._groups.TabItems) - util.threadYield(false, true); + while (this._groups && !this._groups.TabItems) + util.threadYield(false, true); return this._groups; },