相关疑难解决方法(0)

即使在更改.emacs之后,Emacs也会自动添加换行符

我目前在Mac上,并且我试图将Emacs设置为默认情况下不在文件末尾添加换行符,但我搜索的几乎所有内容都表示只需添加(setq require-final-newline nil).主目录中的emacs文件...这不起作用.我接下来要改变什么?

这就是.emacs文件现在的样子

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(gud-gdb-command-name "gdb --annotate=1")
 '(large-file-warning-threshold nil)
 '(require-final-newline nil))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file …
Run Code Online (Sandbox Code Playgroud)

emacs text-editor

12
推荐指数
1
解决办法
5783
查看次数

如何在主模式挂钩中访问目录本地变量?

我已经定义了一个.dir-locals.el文件,其中包含以下内容:

((python-mode . ((cr/virtualenv-name . "saas"))))
Run Code Online (Sandbox Code Playgroud)

在我的.emacs中,我有以下函数来检索此值并提供virtualenv路径:

(defun cr/virtualenv ()
  (cond (cr/virtualenv-name (format "%s/%s" virtualenv-base cr/virtualenv-name))
        ((getenv "EMACS_VIRTUAL_ENV") (getenv "EMACS_VIRTUAL_ENV"))
        (t "~/.emacs.d/python")))
Run Code Online (Sandbox Code Playgroud)

最后,在我的python-mode-hook列表中,我有这个钩子函数:

(add-hook 'python-mode-hook 'cr/python-mode-shell-setup)

(defun cr/python-mode-shell-setup ()
  (message "virtualenv-name is %s" cr/virtualenv-name)
  (let ((python-base (cr/virtualenv)))
    (cond ((and (fboundp 'ipython-shell-hook) (file-executable-p (concat python-base "/bin/ipython")))
           (setq python-python-command (concat python-base "/bin/ipython"))
           (setq py-python-command (concat python-base "/bin/ipython"))
           (setq py-python-command-args '( "-colors" "NoColor")))
          (t
           (setq python-python-command (concat python-base "/bin/python"))
           (setq py-python-command (concat python-base "/bin/python"))
           (setq py-python-command-args nil)))))
Run Code Online (Sandbox Code Playgroud)

当我打开一个新的python文件时,记录的消息cr/python-mode-shell-setup表明它cr/virtualenv-namenil …

python emacs dot-emacs python-mode

10
推荐指数
1
解决办法
1473
查看次数

获取emacs M-; 制作//风格评论

如何更改M-的评论样式; (comment-dwim)使用c-mode时?

我希望它使用//之前的注释而不是/**/nesting.

版:

GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-12-11 on brahms, modified by Debian
Run Code Online (Sandbox Code Playgroud)

emacs

9
推荐指数
1
解决办法
2564
查看次数

将.h设置为emacs中的c ++模式组

我不完全确定这个问题是否属于stackoverflow或超级用户(是否有emacs堆栈交换?).基于meta.stackoverflow帖子,我会假设它确实如此.

我的emacs默认头文件(.h种类)到c模式.我可以很容易地输入Mx c ++ - mode并重新突出显示,但是因为我在c ++中比c更频繁地编程.我想知道我需要改变什么才能将.h添加到c ++组.

c++ emacs

4
推荐指数
1
解决办法
1086
查看次数

标签 统计

emacs ×4

c++ ×1

dot-emacs ×1

python ×1

python-mode ×1

text-editor ×1