[erlang-questions] Emacs 'erlang-mode-hook

Daniel Pezely dpezely@REDACTED
Mon Sep 22 20:39:48 CEST 2014


> have Emacs erlang-shell play nice with multiple components
> built by rebar (invoked from Makefiles).

In case anyone was using the earlier 'erlang-mode-hook for Emacs, here is a corrected version:

;; Add paths to ../../*/deps/ebin for running & compiling:
(add-hook 'erlang-mode-hook
          (lambda () 
            (setq inferior-erlang-machine-options
                  (append (remove nil
                                  (mapcan (lambda (app-path)
                                            (let ((ebin (concat app-path "/ebin")))
                                              (when (file-readable-p ebin)
                                                (list "-pa" ebin))))
                                          (directory-files "../.." t "[^.]$")))
                          (remove nil
                                  (mapcan (lambda (dep)
                                            (let ((dep-path (concat dep "/deps")))
                                              (when (file-readable-p dep-path)
                                                (mapcan (lambda (dir)
                                                          (list "-pz" (concat dir "/ebin")))
                                                        (directory-files dep-path t "[^.]$")))))
                                          (directory-files "../.." t "[^.]$"))))
                  erlang-compile-extra-opts
                  (append (remove nil
                                  (mapcan (lambda (app-path)
                                            (let ((ebin (concat app-path "/ebin")))
                                              (when (file-readable-p ebin)
                                                (list 'i ebin))))
                                          (directory-files "../.." t "[^.]$")))
                          (remove nil
                                  (mapcan (lambda (dep)
                                            (let ((dep-path (concat dep "/deps")))
                                              (when (file-readable-p dep-path)
                                                (mapcar (lambda (dir)
                                                          (cons 'i (concat dir "/ebin")))
                                                        (directory-files dep-path t "[^.]$")))))
                                          (directory-files "../.." t "[^.]$")))))))

Further context is within original message.
See http://erlang.org/pipermail/erlang-questions/2014-July/080149.html

-Daniel
--
dpezely@REDACTED











More information about the erlang-questions mailing list