Skip to content

Project Attributes

jrockway edited this page · 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 ()
                  (when (eproject-attribute :is-xmms)
                    (c-set-style "K&R")
                    (setq tab-width 4)
                    (setq indent-tabs-mode t)
                    (setq c-basic-offset 4)))))
Something went wrong with that request. Please try again.