Peter S Galbraith p...@debian.org wrote:
Dave Love f...@gnu.org wrote:
Package: emacs-goodies-el
Version: 26.4-1
Severity: normal
dirvars.el is quite unclean, at least in its use of advice and not
providing a minor mode so that it can be toggled. You might consider
URL:http://www.loveshack.ukfsn.org/emacs/dir-locals.el, which is
clean and does roughly the same thing.
Alright, here I go... four years later!
I think the file needs an autoload cookie before:
(define-minor-mode dir-locals-mode
or a :require 'dir-locals such that a user could set and save it as a
customization. I presume one might want this On generally?
But yeah, I'd like to use it in emacs-goodies-el.
Thanks!
--
Peter S. Galbraith, Debian Developer p...@debian.org
http://people.debian.org/~psg
GPG key 1024/D2A913A1 - 97CE 866F F579 96EE 6E68 8170 35FF 799E
I am using the attached version in Debian, with both the minor tweaks
mentionned above. It would be great if you accepted it; otherwise I
will create a patch.
Thanks!
Peter
;;; dir-locals.el --- Local variables for a directory tree
;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.
;; Author: Dave Love f...@gnu.org
;; Keywords: files
;; $Revision: 1.1 $
;; URL: http://www.loveshack.ukfsn.org/emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; It can be useful to specify local variables directory-wide, e.g. to
;; define CC mode styles consistently. This library implements such a
;; scheme, controlled by the global minor mode `dir-locals-mode'.
;; Place a file named `.emacs-locals' (or the value of
;; `dir-locals-file-name') in the directory root. This should specify
;; local variables in the usual way. The values it sets are inherited
;; when a file in the directory tree is found. Local variables
;; specified in the found file override the directory-wide ones.
;; However, `eval' pseudo-variables specified in the file are
;; evaluated (assuming `enable-local-eval' is true) _before_ any
;; directory-wide processing, and they are evaluated in a scratch
;; buffer, so that they are only useful for side effects on local
;; variables. `mode' pseudo-variables which specify minor modes
;; toggle those modes for files within the directory. If
;; .emacs-locals specifies a major mode, it doesn't propagate, but any
;; local variables and minor modes its hook sets will; thus it should
;; normally not specify a major mode. The `coding' pseudo-variable
;; will not propagate from .emacs-locals.
;; For example, with dir-locals mode on, placing this in .emacs-locals
;; at the top-level of the Linux source tree would set the C
;; indentation style appropriately for files within the tree:
;;
;; Local variables:
;; c-file-style: linux
;; End:
;;
;; (and ignore the stupid remarks in Documentation/CodingStyle).
;; Another possible use is, say, setting change-log parameters in
;; different trees for which the Emacs 22 development source broke use
;; of change-log-mode-hook.
;; NB: This doesn't work with some versions of the Emacs 22 codebase
;; which changed the way hack-local-variables-hook is run, but the
;; change has been reverted.
;; Another, less clean, implementation of this sort of thing was
;; posted to gnu-emacs-sources as dirvals.el by Benjamin Rutt
;; rut...@osu.edu, June 2006, based on work by Matt Armstrong
;; m...@lickey.com. It uses a different format for the equivalent
;; of .emacs-locals.
;;; Code:
(defgroup dir-locals ()
Directory-wide file-local variables
:link '(emacs-commentary-link dir-locals)
:group 'files)
(defcustom dir-locals-file-name .emacs-locals
File name used by Dir-Locals mode to specify local variables.
This should specify local variables in the normal way. When Dir-Locals
minor mode is active, these will be inherited by files found in a
directory tree containing such a file at its root.
This may also be a function of no arguments which returns the name to
use, allowing arbitrary per-directory customization of the
per-directory customization file on the basis of `default-directory'.
:group 'dir-locals
:type '(choice file function))
;; Adapted from dirvals.el.
(defcustom dir-locals-chase-remote nil
Non-nil means search upwards for `dir-locals-file-name' in remote