"Stephen J. Turnbull" <stephen(a)xemacs.org> writes:
>>>>> "David" == David Kastrup
<dak(a)gnu.org> writes:
David> Strictly speaking, this does not make sense since the
David> package installation process should be aware of where it
David> placed the images instead of groping all over the disk for
David> them. But that's a preview-latex internal problem and does
David> not concern XEmacs.
If you come up with a good solution, please ping us at the design
stage. I really think that the package support code (ie, XEmacs
itself) should provide a reasonably good service of this kind.
I assume you know about (and are probably already using) the
locate-data-file facility. But IIRC that takes a _directory_ to
start the search, or maybe a path, and so it doesn't provide a
standard interface.
Well, the way it looks we are going to use the following autoconf
macro (EMACS_LISP is internal to our autoconf scripts as well):
# AC_LISPIFY_DIR
# First argument is a variable name where a lisp expression is to be
# substituted with AC_SUBST.
# Second argument is the original path in shell-quoted syntax, usually
# something like [["${whatever}"]].
# If the expression is not an absolute path, it is evaluated relative
# to the current file name.
AC_DEFUN(AC_LISPIFY_DIR,[
EMACS_LISP([$1],[[(prin1-to-string
(if (file-name-absolute-p path)
(expand-file-name (file-name-as-directory path))
(backquote (expand-file-name (, (file-name-as-directory path))
(file-name-directory load-file-name)))))]],,-no-site-file,path,[$2])
AC_SUBST([$1])]
)
You place something like
AC_LISPIFY_DIR(lisppackageimagedir,[[${packageimagedir}]])
into configure.ac, and then in any *.in file a string
(defvar preview-image-dir
@lisppackageimagedir@
"The directory where preview finds its images.")
gets replaced by
"c:\\stupid\\dirname\\with\\quotes and spaces\\"
if $packageimagedir is an absolute directory path, and with
(expand-file-name "../images/" (file-name-directory load-file-name))
if $packageimagedir is a relative path (which it will be when we are
creating an XEmacs package).
The latter is the sort of thing that will get used in XEmacs packages
for AUCTeX as well as preview-latex: locating the images relative to
the package containing (among other things) the autoload definitions
for the package.
There is no reason this purely relative scheme could not well be used
in XEmacs packages.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum