[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: indent-tabs-mode in dir-locals
From: |
Juri Linkov |
Subject: |
Re: indent-tabs-mode in dir-locals |
Date: |
Wed, 07 Jan 2009 02:12:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
> I had believed the unwritten rule till now was "respect whatever the
> file currently uses" (which there should be a setting for; but that's
> a wishlist item).
The problem is that this rule is still unwritten ;)
So we should add a function:
(defun indent-tabs-mode-maybe ()
(if (and (null indent-tabs-mode)
;; Trust the major mode.
(not (local-variable-p 'indent-tabs-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)))
based on heuristics from Stefan
at http://thread.gmane.org/gmane.emacs.devel/42665/focus=43402
--
Juri Linkov
http://www.jurta.org/emacs/