小编Dan*_*iel的帖子

Emacs:将Ch转换为DEL,将Mh转换为M-DEL

我希望我的C/Mh键是删除绑定.

通常的global-set-key解决方案对我来说不起作用,因为我希望这些键在任何地方表现为删除,包括迷你缓冲区和各种模式,并且能够在我的各种Linux/OS X/Windows emacs安装之间工作.

我有以下几乎解决方案:

(when (>= emacs-major-version 23)
  (setq help-char (string-to-char "<f1>"))                      ;; Bind ONLY F1 to help, not C-h
  (define-key input-decode-map (kbd "C-h") (kbd "DEL"))         ;; Translate C-h to DEL ;; FIXME:  Should be in emacs 22, doens't work.
  (define-key input-decode-map (kbd "M-h") (kbd "M-<DEL>"))     ;; Translate M-h to M-DEL
  ;; (define-key input-decode-map (kbd "<backspace>") 'version) ;; Stop me using backspace for a while
)
Run Code Online (Sandbox Code Playgroud)

但这显然只适用于Emacs> 22,因为input-decode-map.

有人能帮我找到一个在22,甚至21?(但不是优先考虑的事).干杯!

编辑:我的解决方案:

它还没有完全存在,但这解决了我的大多数问题:

(setq help-char [f1]) ;; I don't …
Run Code Online (Sandbox Code Playgroud)

emacs dot-emacs key-bindings emacs23 emacs24

6
推荐指数
2
解决办法
1858
查看次数

对 Singleton::Singleton() 的未定义引用

我正在尝试从Design Patterns 工作中获得第一个基本的单例示例,但这让我很难过。

这段代码可以干净地编译g++ -c Singleton.cpp

class Singleton {
public:
    static Singleton* Instance();
protected:
    Singleton();
private:
    static Singleton* _instance;
};

Singleton* Singleton::_instance = 0;

Singleton* Singleton::Instance() {
    if (_instance == 0) {
        _instance = new Singleton;
    }
    return _instance;
}
Run Code Online (Sandbox Code Playgroud)

但是当我添加一个骨架 main() 并编译时g++ Singleton.cpp我得到undefined reference to 'Singleton::Singleton()'.

我错过了什么?

c++ singleton design-patterns

0
推荐指数
1
解决办法
1655
查看次数