Skip to content
jrockway edited this page Sep 13, 2010 · 1 revision

Here’s a real-world example of define-project-attribute in use. When I edit xmms, it’s normally a generic-git project. However, it is slightly different from other projects, as it uses really weird indentation settings. Fortunately, eproject can automatically detect that we are working with XMMS, and then turn on the right settings:

    (define-project-attribute '("xmms2-devel" . :project-name)
      '(:is-xmms t))

    (add-hook 'c-mode-hook
              (lambda ()
                (ignore-errors
                  (eproject-maybe-turn-on)
                  (when (eproject-attribute :is-xmms)
                    (c-set-style "K&R")
                    (setq tab-width 4)
                    (setq indent-tabs-mode t)
                    (setq c-basic-offset 4)))))
Clone this wiki locally