emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .emacs-settings.el


From: Johannes Weiner
Subject: Re: .emacs-settings.el
Date: Fri, 7 Sep 2007 14:14:55 +0200
User-agent: Mutt/1.5.16 (2007-06-11)

Hi,

On Wed, Sep 05, 2007 at 07:27:21AM -0700, Davis Herring wrote:
> .emacs-settings.el can go in other directories than ~; it affects files
> found anywhere in the directory tree that contains it.  Moreover, it is
> not a file of arbitrary Lisp, but rather contains a set of buffer-local
> variables to set in the buffers visiting files it affects, subject to the
> normal risk-checking.

I would really dislike such files. Imagine every editor has a project-specific
configuration file in the project root and you have 10 hackers working on this
project with 10 different editors.

And I would dislike to have a limited set of configuration options within such
a file.

Configuration is .emacs' concern, so how about the following:

(defmacro add-project-locals (directory-action-alist)
  `(add-hook 'find-file-hook
             (lambda ()
               ,@(mapcar (lambda (dapair)
                           `(when (string-match (concat "^" ,(car dapair))
                                                (buffer-file-name))
                              ,(cdr dapair)))
                         directory-action-alist))))

Then you have

        (add-project-locals
          (("lisp/" . (message "This is a lisp project"))
           ("src/emacs-cvs/" . (progn
                                 ;; do some emacs code specific stuff here))))

expand to

        (add-hook 'find-file-hook
                  (lambda ()
                    (when (string-match (concat "^" "lisp/"))
                                        (buffer-file-name)
                      (message "This is a lisp project"))
                    (when (string-match (concat "^" "src/emacs-cvs/")
                                        (buffer-file-name))
                      (progn
                        ;; do some emacs code specific stuff here))))

Of course, this is just a kludgy hack, but I think the approach itself is not
as bad as having emacs-specific setup-files spread all over several
project-directories.
        
        Hannes

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]