我在Windows 7上使用Git Bash和与设置的emacs作为默认的文本编辑器的一个问题-我试过git config --global core.editor emacs,然后git config --global core.editor "'C:/emacs-23.3/bin/runemacs.exe'",git config --global core.editor emacsclientw但无济于事.每次我在Bash中输入"emacs README.txt"之类的内容时,以下错误显示:
sh.exe":emacs:命令未找到
我已经忍受了这个最长的时间,选择单独打开emacs并打开相关文件,但这次我真的想要正确设置,以便我可以节省时间并简单地从Git Bash调用emacs .有谁知道我能做什么?在此先感谢您的帮助.
我正在研究关于本地存储的Dive Into HTML 5教程,并且遇到了这段代码:
function supports_html5_storage() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
我理解关于return 'localStorage' in window等等的部分,但我不明白为什么需要在这里尝试catch语句?简单地写下面的内容是不够的?
function supports_html5_storage(){
return 'localStorage' in window && window['localStorage']!==null;
}
Run Code Online (Sandbox Code Playgroud)
顺便说一下:我(有点)知道try/catch的目的,我只是想知道我们可能期待什么样的异常?
我正在https://developer.mozilla.org/en/AJAX/Getting_Started上从Mozilla网站学习Ajax ,我面对这段代码:
(function () {
var httpRequest;
document.getElementById("ajaxButton").onclick = function () {
makeRequest('test.html');
};
function makeRequest(url) {
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!httpRequest) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
httpRequest.onreadystatechange = alertContents;
httpRequest.open('GET', url);
httpRequest.send();
} …Run Code Online (Sandbox Code Playgroud)