0

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.

vkats
  • 117
  • 1
  • 8
  • what is the result of `C-h w `? – kindahero May 26 '11 at 16:49
  • @kindahero: in the GUI right? the result is a the prompt of the "where is command" and a list of possible commands (I guess due to the ) – vkats May 30 '11 at 08:46
  • sorry, that should be `C-h k ` (C-h k tells you "the command" runs by the key stroke) – kindahero May 30 '11 at 13:06
  • @kindahero Hm, there seems to be something. In the GUI `indent-for-tab-command` In the -nw `forward-button`. Although see my edit for a mistake I had made. – vkats May 31 '11 at 15:25

1 Answers1

0

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.

ataylor
  • 64,891
  • 24
  • 161
  • 189
  • `*Messages*`: has nothing suspicious (all `done`). I don't have a `*Warnings*` buffer and I couldn't find how to open it. I also tried the other thing, but the debugger reported what was returned from each command and finished happily. – vkats May 30 '11 at 08:52
  • I added `(setq-default indent-tabs-mode t)` before the `;; perl mode stuff`, but it didn't change anything. However, see my edit for a mistake I had made. – vkats May 31 '11 at 15:29