emacs identation works only in terminal (-nw)

294 views Asked by At

I have GNU Emacs 23.1.1, on Ubuntu 10.10.

I have to following .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. When I launch the GUI version with $ emacs tab indentation doesn't work. I only get space indentation.

How can I get tab indentation in the GUI as well?

The cperl conf was taken from emacswiki

The emacs packages I have:

$ 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.

1

There are 1 answers

2
ataylor On

First, check the *Messages* and *Warnings* buffers on startup. There might be a hint as to what's failing there. In particular, *Messages* should list all the startup files that emacs is loading; on Ubuntu, this will include files in /etc/emacs as well as your .emacs.

If that doesn't help, try running your .emacs interactively in the emacs debugger. Start emacs with emacs -nw -q and load .emacs into a buffer. Run M-x edebug-all-forms then run M-x 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. 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.