1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 09:48:00 +01:00

argdo liberator.jss/"foo \"" + str + "\""/"foo " + str.quote()/g

This commit is contained in:
Kris Maglione
2008-12-06 18:33:54 -05:00
parent 532d520e0e
commit ae25ea4309
4 changed files with 18 additions and 27 deletions

View File

@@ -1500,7 +1500,7 @@ function Marks() //{{{
// ignore invalid mark characters unless there are no valid mark chars // ignore invalid mark characters unless there are no valid mark chars
if (args && !/[a-zA-Z]/.test(args)) if (args && !/[a-zA-Z]/.test(args))
{ {
liberator.echoerr("E283: No marks matching \"" + args + "\""); liberator.echoerr("E283: No marks matching " + args.quote());
return; return;
} }
@@ -1640,7 +1640,7 @@ function Marks() //{{{
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0); marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
if (marks.length == 0) if (marks.length == 0)
{ {
liberator.echoerr("E283: No marks matching \"" + filter + "\""); liberator.echoerr("E283: No marks matching " + filter.quote());
return; return;
} }
} }

View File

@@ -611,7 +611,7 @@ function Events() //{{{
{ {
for (let [,dir] in Iterator(dirs)) for (let [,dir] in Iterator(dirs))
{ {
liberator.echomsg("Searching for \"macros/*\" in \"" + dir.path + "\"", 2); liberator.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
liberator.log("Sourcing macros directory: " + dir.path + "...", 3); liberator.log("Sourcing macros directory: " + dir.path + "...", 3);

View File

@@ -241,8 +241,7 @@ function IO() //{{{
if (!found) if (!found)
{ {
liberator.echoerr("E344: Can't find directory \"" + args + "\" in cdpath" liberator.echoerr("E344: Can't find directory " + args.quote() + " in cdpath\n"
+ "\n"
+ "E472: Command failed"); + "E472: Command failed");
} }
} }
@@ -275,22 +274,14 @@ function IO() //{{{
if (file.exists() && !args.bang) if (file.exists() && !args.bang)
{ {
liberator.echoerr("E189: \"" + filename + "\" exists (add ! to override)"); liberator.echoerr("E189: " + filename.quote() + " exists (add ! to override)");
return; return;
} }
// FIXME: Use a set/specifiable list here: // TODO: Use a set/specifiable list here:
let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)]; let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
lines = util.Array.flatten(lines); lines = util.Array.flatten(lines);
// :mkvimrc doesn't save autocommands, so we don't either - remove this code at some point
// line += "\n\" Auto-Commands\n";
// for (let item in autocommands)
// line += "autocmd " + item.event + " " + item.pattern.source + " " + item.command + "\n";
// if (mappings.getMapLeader() != "\\")
// line += "\nlet mapleader = \"" + mappings.getMapLeader() + "\"\n";
// source a user .vimperatorrc file // source a user .vimperatorrc file
lines.unshift('"' + liberator.version); lines.unshift('"' + liberator.version);
lines.push("\nsource! " + filename + ".local"); lines.push("\nsource! " + filename + ".local");
@@ -302,7 +293,7 @@ function IO() //{{{
} }
catch (e) catch (e)
{ {
liberator.echoerr("E190: Cannot open \"" + filename + "\" for writing"); liberator.echoerr("E190: Cannot open " + filename.quote() + " for writing");
liberator.log("Could not write to " + file.path + ": " + e.message); // XXX liberator.log("Could not write to " + file.path + ": " + e.message); // XXX
} }
}, },
@@ -474,7 +465,7 @@ function IO() //{{{
if (!dir.exists() || !dir.isDirectory()) if (!dir.exists() || !dir.isDirectory())
{ {
liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path"); liberator.echoerr("E344: Can't find directory " + dir.path.quote() + " in path");
return null; return null;
} }
@@ -777,7 +768,7 @@ lookup:
let found = false; let found = false;
// FIXME: should use original arg string // FIXME: should use original arg string
liberator.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + options["runtimepath"] + "\"", 2); liberator.echomsg("Searching for " + paths.join(" ").quote() + " in " + options["runtimepath"].quote(), 2);
outer: outer:
for (let [,dir] in Iterator(dirs)) for (let [,dir] in Iterator(dirs))
@@ -786,7 +777,7 @@ lookup:
{ {
let file = joinPaths(dir, path); let file = joinPaths(dir, path);
liberator.echomsg("Searching for \"" + file.path, 3); liberator.echomsg("Searching for " + file.path.quote(), 3);
if (file.exists() && file.isFile() && file.isReadable()) if (file.exists() && file.isFile() && file.isReadable())
{ {
@@ -800,7 +791,7 @@ lookup:
} }
if (!found) if (!found)
liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1); // FIXME: should use original arg string liberator.echomsg("not found in 'runtimepath': " + paths.join(" ").quote(), 1); // FIXME: should use original arg string
return found; return found;
}, },
@@ -823,9 +814,9 @@ lookup:
if (!silent) if (!silent)
{ {
if (file.exists() && file.isDirectory()) if (file.exists() && file.isDirectory())
liberator.echomsg("Cannot source a directory: \"" + filename + "\"", 0); liberator.echomsg("Cannot source a directory: " + filename.quote(), 0);
else else
liberator.echomsg("could not source: \"" + filename + "\"", 1); liberator.echomsg("could not source: " + filename.quote(), 1);
liberator.echoerr("E484: Can't open file " + filename); liberator.echoerr("E484: Can't open file " + filename);
} }
@@ -833,7 +824,7 @@ lookup:
return; return;
} }
liberator.echomsg("sourcing \"" + filename + "\"", 2); liberator.echomsg("sourcing " + filename.quote(), 2);
let str = ioManager.readFile(file); let str = ioManager.readFile(file);
let uri = ioService.newFileURI(file); let uri = ioService.newFileURI(file);
@@ -943,7 +934,7 @@ lookup:
if (scriptNames.indexOf(file.path) == -1) if (scriptNames.indexOf(file.path) == -1)
scriptNames.push(file.path); scriptNames.push(file.path);
liberator.echomsg("finished sourcing \"" + filename + "\"", 2); liberator.echomsg("finished sourcing " + filename.quote(), 2);
liberator.log("Sourced: " + file.path, 3); liberator.log("Sourced: " + file.path, 3);
} }

View File

@@ -235,7 +235,7 @@ const liberator = (function () //{{{
if (dialogs[i][0] == args) if (dialogs[i][0] == args)
return dialogs[i][2](); return dialogs[i][2]();
} }
liberator.echoerr(args ? "Dialog \"" + args + "\" not available" : "E474: Invalid argument"); liberator.echoerr(args ? "Dialog " + args.quote() + " not available" : "E474: Invalid argument");
} }
catch (e) catch (e)
{ {
@@ -918,7 +918,7 @@ const liberator = (function () //{{{
if (config.helpFiles.indexOf(helpFile) != -1) if (config.helpFiles.indexOf(helpFile) != -1)
liberator.open("chrome://liberator/locale/" + helpFile, where); liberator.open("chrome://liberator/locale/" + helpFile, where);
else else
liberator.echo("Sorry, help file \"" + helpFile + "\" not found"); liberator.echo("Sorry, help file " + helpFile.quote() + " not found");
return; return;
} }
@@ -977,7 +977,7 @@ const liberator = (function () //{{{
for (let [,dir] in Iterator(dirs)) for (let [,dir] in Iterator(dirs))
{ {
// TODO: search plugins/**/* for plugins // TODO: search plugins/**/* for plugins
liberator.echomsg("Searching for \"plugin/*.{js,vimp}\" in \"" + dir.path + "\"", 2); liberator.echomsg('Searching for "plugin/*.{js,vimp}" in ' + dir.path.quote(), 2);
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3); liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);