简体   繁体   English

emacs 标识仅适用于终端(-nw)

[英]emacs identation works only in terminal (-nw)

I have GNU Emacs 23.1.1, on Ubuntu 10.10.我在 Ubuntu 10.10 上有 GNU Emacs 23.1.1。

I have to following.emacs:我必须关注.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
)

When I do $ emacs -nw the tab indentation works fine.当我做$ emacs -nw时,标签缩进工作正常。 When I launch the GUI version with $ emacs tab indentation doesn't work.当我使用$ emacs启动 GUI 版本时,选项卡缩进不起作用。 I only get space indentation.我只得到空格缩进。

How can I get tab indentation in the GUI as well?如何在 GUI 中获得制表符缩进?

The cperl conf was taken from emacswiki cperl conf 取自emacswiki

The emacs packages I have:我拥有的 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

EDIT: Sorry, but I just noticed that I hadn't studied the behaviour correctly.编辑:对不起,但我只是注意到我没有正确研究这种行为。 In both gui and -nw, when I edit a file already indented in tabs, it uses tabs, whereas when I edit a new file, it indents it with spaces.在 gui 和 -nw 中,当我编辑一个已经在制表符中缩进的文件时,它使用制表符,而当我编辑一个新文件时,它用空格缩进它。

First, check the *Messages* and *Warnings* buffers on startup.首先,在启动时检查*Messages**Warnings*缓冲区。 There might be a hint as to what's failing there.可能会有关于那里失败的提示。 In particular, *Messages* should list all the startup files that emacs is loading;特别是, *Messages*应该列出 emacs 正在加载的所有启动文件; on Ubuntu, this will include files in /etc/emacs as well as your .emacs .在 Ubuntu 上,这将包括/etc/emacs以及您的.emacs中的文件。

If that doesn't help, try running your.emacs interactively in the emacs debugger.如果这没有帮助,请尝试在 emacs 调试器中以交互方式运行 your.emacs。 Start emacs with emacs -nw -q and load.emacs into a buffer.使用emacs -nw -q启动 emacs 并将.emacs 加载到缓冲区中。 Run Mx edebug-all-forms then run Mx eval-buffer .运行Mx edebug-all-forms然后运行Mx eval-buffer Press space repeatedly to step through the file.反复按空格键以单步执行文件。

Edit: Check the value of indent-tabs-mode in a perl buffer in both of your environment.编辑:检查两个环境中 perl 缓冲区中indent-tabs-mode的值。 This is used to control whether to indent with tab characters or spaces.这用于控制是否使用制表符或空格缩进。 Adding (setq-default indent-tabs-mode t) should force emacs to indent with tab characters.添加(setq-default indent-tabs-mode t)应该强制 emacs 使用制表符缩进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM