> the elisp (and other) code i maintain never uses tabs for indentation,
> accomplished primarily by setting `indent-tabs-mode' to nil.  when i
> edit code that uses tabs for indentation, i leave the part not relevant
> to the edit alone but take no extra steps to use tabs for the part that
> i'm editing.  i wasn't aware of any convention that contradicts this
> practice and no one has complained about it.  am i missing something?

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

(defun indent-tabs-mode ()
  "Set indent-tabs-mode in files under dirs in `indent-tabs-mode-dirs'."
  (if (and indent-tabs-mode-dirs
           buffer-file-name
           (string-match
            (concat "^\\("
                    (mapconcat 'regexp-quote indent-tabs-mode-dirs "\\|")
                    "\\)")
            buffer-file-name))
      (setq indent-tabs-mode t)))

(add-hook 'find-file-hooks 'indent-tabs-mode)

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



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

Reply via email to