小编ant*_*twp的帖子

sh.exe":找不到emacs:命令(Git bash Windows)

我在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 .有谁知道我能做什么?在此先感谢您的帮助.

windows git emacs bash

5
推荐指数
1
解决办法
1万
查看次数

Javascript尝试捕获Localstorage Detection

我正在研究关于本地存储的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的目的,我只是想知道我们可能期待什么样的异常?

javascript try-catch

3
推荐指数
1
解决办法
1875
查看次数

(function()在这个特定的代码段中意味着什么?

我正在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)

javascript ajax mozilla

2
推荐指数
1
解决办法
207
查看次数

标签 统计

javascript ×2

ajax ×1

bash ×1

emacs ×1

git ×1

mozilla ×1

try-catch ×1

windows ×1