Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: Patch: Follow convention for reading with the minibuffer.
Newsgroups: gmane.emacs.devel
Date: Friday 30th September 2005 19:52:40 UTC (over 12 years ago)
> 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
 
CD: 3ms