Vin Shelton <acs(a)xemacs.org> writes:
Here's what I've come up with. I'm not particularly
happy with the
hygiene of the patch because:
1. I had to add the new defun paths-find-potential-package-root and
couldn't add that functionality into paths-find-emacs-root (maybe
that's OK)
2. in paths-find-emacs-roots I had to add another call to
paths-uniq-append and a temporary variable, combined-roots. It seems
I should have been able to just extend paths-uniq-append, but maybe
that's not a big deal, either.
Michael, if you don't mind, please help me clean this up - I'd be
grateful for any help you'd offer.
I can't find much fault with it, except for the code and work
duplication in between `paths-find-emacs-root' and your
`paths-find-potential-package-root'. My suggestion would be to rename
`paths-find-emacs-root' to `paths-find-invocation-roots' and have it
return a list instead of a single string. Approximately like so
(untested):
(defun paths-find-emacs-root (invocation-directory invocation-name)
"Find the run-time root of XEmacs.
INVOCATION-DIRECTORY is a directory containing the XEmacs executable.
INVOCATION-NAME is the name of the executable itself."
(let* ((executable-file-name (paths-chase-symlink
(concat invocation-directory
invocation-name)))
(executable-directory (file-name-directory executable-file-name))
(maybe-root-1 (file-name-as-directory
(paths-construct-path '("..") executable-directory)))
(maybe-root-2 (file-name-as-directory
(paths-construct-path '(".." "..") executable-directory)))
(maybe-root-3 (file-name-as-directory
(paths-construct-path '(".." "..") executable-directory)))
(maybe-root-4 (file-name-as-directory
(paths-construct-path '(".." ".." "..")
executable-directory))))
(paths-filter #'paths-emacs-root-p
(list maybe-root-1 maybe-root-2 maybe-root-3 maybe-root-4))))
My intuition is that maybe-root-3 and -4 are probably a bad idea to
include under Unix, but we can sort that out once things are working
for you.
Hope this helps. Let me know if I can be of better assistance.
--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla