yt-summer 发表于 2018-6-11 07:23:03

windows中emacs构建IDE

windows中emacs构建IDE
  要在windows中构建emacs的IDE非常复杂,需要在MinGw中进行编译,我搞了一个星期,终于搞定了,可是启动速度暴慢,不得已只好去网上找一个已经优化编译好了的。想要进行C/C++编译,就只需要搞定GCC/G++就可以了,我去MinGw中编译了一个,可是却不能和emacs连起来使用。所以需要在Windows上装DevC++,大家可以sourceforg网站下载devcpp-alpha_setup.exe这个文件然后安装在D盘。然后在配置文件_emacs中加入下面这段话,就可以了。


[*];;如果当前目录有makefile则用make -k编译,否则,如果是
[*];;处于c-mode,就用gcc -Wall编译,如果是c++-mode就用 g++ -Wall编译"
[*](global-set-key (kbd &quot;<f7>&quot;) 'smart-compile)
[*](defun smart-compile()
[*](interactive)
[*];; 查找 Makefile
[*](let ((candidate-make-file-name '(&quot;makefile&quot; &quot;Makefile&quot; &quot;GNUmakefile&quot;))
[*]      (command nil))
[*]    (if (not (null
[*]            (find t candidate-make-file-name :key
[*]                  '(lambda (f) (file-readable-p f)))))
[*]      (setq command &quot;make -k &quot;)
[*]      ;; 没有找到 Makefile ,查看当前 mode 是否是已知的可编译的模式
[*]      (if (null (buffer-file-name (current-buffer)))
[*]          (message &quot;Buffer not attached to a file, won't compile!&quot;)
[*]      (if (eq major-mode 'c-mode)
[*]            (setq command
[*]                  (concat &quot;D:/Dev-Cpp/bin/gcc.exe -Wall -o &quot;      ;;你要明确知道自己的编译器在哪里,
[*]                        (file-name-sans-extension                        ;;这样,用你的gcc.exe的地址代替这里的D:/Dev-Cpp/bin/gcc.exe   
[*]                           (file-name-nondirectory buffer-file-name)) ;;注意,这里的路径的斜杠和vista的习惯相反,你要注意修改
[*]                        &quot; &quot;
[*]                        (file-name-nondirectory buffer-file-name)
[*]                        &quot; -g -lm &quot;))
[*]          (if (eq major-mode 'c++-mode)
[*]            (setq command
[*]                  (concat &quot;D:/Dev-Cpp/bin/g++.exe -Wall -o &quot; ;;还有这里的g++,也同gcc一样...
[*]                            (file-name-sans-extension
[*]                           (file-name-nondirectory buffer-file-name))
[*]                            &quot; &quot;
[*]                            (file-name-nondirectory buffer-file-name)
[*]                            &quot; -g -lm &quot;))
[*]            (message &quot;Unknow mode, won't compile!&quot;)))))
[*]    (if (not (null command))
[*]      (let ((command (read-from-minibuffer &quot;Compile command: &quot; command)))
[*]          (compile command)))))
页: [1]
查看完整版本: windows中emacs构建IDE