emacs识别仅在终端(-nw)中工作



我在Ubuntu 10.10上有GNU Emacs 23.1.1。

我必须遵循。emacs:

(custom-set-variables
  '(cua-mode t nil (cua-base))
  '(inhibit-startup-screen t)
)
(show-paren-mode 1)
(setq show-paren-delay 0)
;; perl mode stuff
(fset 'perl-mode 'cperl-mode)
(setq cperl-indent-level 4
      cperl-close-paren-offset -4
      cperl-continued-statement-offset 0
      cperl-indent-parens-as-block t
      cperl-tab-always-indent t
      cperl-invalid-face nil
)

当我执行$ emacs -nw时,选项卡缩进工作正常。当我启动带有$ emacs选项卡的GUI版本时,缩进不起作用。我只得到空格缩进。

如何在GUI中获得选项卡缩进?

cperl conf取自emacswiki

我的emacs包:

$ dpkg -l | grep emacs
ii  emacs                                23.1+1-4ubuntu7.2+maverick1                       The GNU Emacs editor (metapackage)
ii  emacs-goodies-el                     33.6ubuntu1                                       Miscellaneous add-ons for Emacs
ii  emacs-snapshot                       1:20090909-1                                      The GNU Emacs editor (development snapshot)
ii  emacs-snapshot-bin-common            1:20090909-1                                      The GNU Emacs editor's shared, architecture dependent files
ii  emacs-snapshot-common                1:20090909-1                                      The GNU Emacs editor's common infrastructure
ii  emacs23                              23.1+1-4ubuntu7.2+maverick1                       The GNU Emacs editor (with GTK+ user interface)
ii  emacs23-bin-common                   23.1+1-4ubuntu7.2+maverick1                       The GNU Emacs editor's shared, architecture dependent files
ii  emacs23-common                       23.1+1-4ubuntu7.2+maverick1                       The GNU Emacs editor's shared, architecture independent infrastructure
ii  emacsen-common                       1.4.19ubuntu1                                     Common facilities for all emacsen

编辑:对不起,我只是注意到我没有正确研究这种行为。在gui和-nw中,当我编辑一个已经缩进制表符的文件时,它会使用制表符,而当我编辑新文件时,会用空格缩进。

首先,在启动时检查*Messages**Warnings*缓冲区。可能会有一个迹象表明那里出了什么问题。特别地,*Messages*应该列出emacs正在加载的所有启动文件;在Ubuntu上,这将包括/etc/emacs.emacs中的文件。

如果没有帮助,请尝试在emacs调试器中以交互方式运行.emacs。使用emacs -nw -q启动emacs,并将.emacs加载到缓冲区中。运行M-x edebug所有表单,然后运行M-x eval buffer

编辑:在两个环境中的perl缓冲区中检查indent-tabs-mode的值。这用于控制是使用制表符还是空格进行缩进。添加(setq-default indent-tabs-mode t)应强制emacs使用制表符缩进。

最新更新