Automatic caveats for emacs lisp files

- The name of the subdirectory under site-lisp may not be exactly the
  same as the name of the package

- `(normal-top-level-add-subdirs-to-load-path)` adds every subdirectory
  of `default-directory` to the load-path, so users don't have to update
  their load-path for every package they install.

Closes Homebrew/homebrew#42309.
This commit is contained in:
Alex Dunn 2015-07-05 14:45:26 -07:00
parent 607be5e711
commit 81eedecc5a
2 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class Caveats
caveats << plist_caveats
caveats << python_caveats
caveats << app_caveats
caveats << elisp_caveats
caveats.compact.join("\n")
end
@ -132,6 +133,19 @@ class Caveats
end
end
def elisp_caveats
if keg && keg.elisp_installed?
<<-EOS.undent
Emacs Lisp files have been installed to:
#{HOMEBREW_PREFIX}/share/emacs/site-lisp/
Add the following to your init file to have packages installed by Homebrew added to your load-path:
(let ((default-directory "#{HOMEBREW_PREFIX}/share/emacs/site-lisp/"))
(normal-top-level-add-subdirs-to-load-path))
EOS
end
end
def plist_caveats
s = []
if f.plist or (keg and keg.plist_installed?)

View File

@ -243,6 +243,10 @@ class Keg
Dir["#{path}/{,libexec/}*.app"].any?
end
def elisp_installed?
Dir["#{path}/share/emacs/site-lisp/**/*.el"].any?
end
def version
require 'pkg_version'
PkgVersion.parse(path.basename.to_s)