> 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


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to