unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* indent-tabs-mode in dir-locals
@ 2009-01-04  0:44 Glenn Morris
  2009-01-04  4:19 ` Eli Zaretskii
  2009-01-07  0:12 ` Juri Linkov
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Morris @ 2009-01-04  0:44 UTC (permalink / raw)
  To: emacs-devel


(A super-urgent subject for the new year...)

I would like to ask for indent-tabs-mode to be removed from
.dir.locals.el. The most recent discussion on this subject I am aware
of said:

http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg00820.html

  space-vs-tabs-vs-aliens doesn't matter, as long as it's indented to
  the right position. That's my opinion on this matter.

(based on which I untabified the files I maintain)

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).




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-04  0:44 indent-tabs-mode in dir-locals Glenn Morris
@ 2009-01-04  4:19 ` Eli Zaretskii
  2009-01-07  0:12 ` Juri Linkov
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2009-01-04  4:19 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> From: Glenn Morris <rgm@gnu.org>
> Date: Sat, 03 Jan 2009 19:44:56 -0500
> 
> 
> I would like to ask for indent-tabs-mode to be removed from
> .dir.locals.el. The most recent discussion on this subject I am aware
> of said:
> 
> http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg00820.html
> 
>   space-vs-tabs-vs-aliens doesn't matter, as long as it's indented to
>   the right position. That's my opinion on this matter.
> 
> (based on which I untabified the files I maintain)
> 
> 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).

I believe the convention in the Emacs sources is to use the default
value of indent-tabs-mode.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-04  0:44 indent-tabs-mode in dir-locals Glenn Morris
  2009-01-04  4:19 ` Eli Zaretskii
@ 2009-01-07  0:12 ` Juri Linkov
  2009-01-07  4:13   ` Stefan Monnier
  2009-01-08  4:35   ` Glenn Morris
  1 sibling, 2 replies; 7+ messages in thread
From: Juri Linkov @ 2009-01-07  0:12 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> 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/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-07  0:12 ` Juri Linkov
@ 2009-01-07  4:13   ` Stefan Monnier
  2009-01-08  4:35   ` Glenn Morris
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-01-07  4:13 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Glenn Morris, emacs-devel

> (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)))

I don't think such complexity is warranted for such a minor problem.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-07  0:12 ` Juri Linkov
  2009-01-07  4:13   ` Stefan Monnier
@ 2009-01-08  4:35   ` Glenn Morris
  2009-01-08 22:51     ` Juri Linkov
  1 sibling, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2009-01-08  4:35 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

Juri Linkov wrote:

>> 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 ;)

I already had a local hack based on a mode-hook. Now it is broken
thanks to dir-locals over-riding it. Anyway, I've just edited my local
copy of dir-locals (making it kind of pointless).




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-08  4:35   ` Glenn Morris
@ 2009-01-08 22:51     ` Juri Linkov
  2009-01-09  3:18       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2009-01-08 22:51 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

>>> 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 ;)
>
> I already had a local hack based on a mode-hook. Now it is broken
> thanks to dir-locals over-riding it. Anyway, I've just edited my local
> copy of dir-locals (making it kind of pointless).

Some modes set it explicitly to nil (e.g. texinfo-mode).  So the global
unconditional indent-tabs-mode in .dir-locals.el currently breaks these
modes, because mode settings are applied before file-local settings.
Maybe we should set (indent-tabs-mode . t) only for c-mode and
emacs-lisp-mode?

-- 
Juri Linkov
http://www.jurta.org/emacs/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: indent-tabs-mode in dir-locals
  2009-01-08 22:51     ` Juri Linkov
@ 2009-01-09  3:18       ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2009-01-09  3:18 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Glenn Morris, emacs-devel

> Maybe we should set (indent-tabs-mode . t) only for c-mode and
> emacs-lisp-mode?

No, we just shouldn't set it in .dir-local.el.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-01-09  3:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-04  0:44 indent-tabs-mode in dir-locals Glenn Morris
2009-01-04  4:19 ` Eli Zaretskii
2009-01-07  0:12 ` Juri Linkov
2009-01-07  4:13   ` Stefan Monnier
2009-01-08  4:35   ` Glenn Morris
2009-01-08 22:51     ` Juri Linkov
2009-01-09  3:18       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).