emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: Follow convention for reading with the minibuffer.


From: Stefan Monnier
Subject: Re: Patch: Follow convention for reading with the minibuffer.
Date: Fri, 30 Sep 2005 15:52:40 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I much prefer using spaces instead of tabs too.  But since I noticed that
> preferable indentation in the Emacs source tree is with tabs I put into
> .emacs the following code:

> (defvar indent-tabs-mode-dirs (list (file-name-directory
>                                      (directory-file-name data-directory)))
>   "Set indent-tabs-mode in all files under specified subdirectories.")

This is wrong.  For some file types indent-tabs-mode should always be
t (e.g. for ChangeLog and Makefile) and for others it should always be nil
(e.g. for LaTeX and TeXinfo).

How 'bout:

(add-hook 'find-file-hook
  (lambda ()
    (if (and (null indent-tabs-mode)
             (local-variable-p 'indent-tabs-mode) ; Trust the major mode.
             (save-excursion
               (goto-char (point-min))
               ;; If there are at least 10 lines with a leading TAB, use TABs.
               (re-search-forward "^    " (+ (point) 100000) t 10)))
        (set (make-local-variable 'indent-tabs-mode) t))))


-- Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]