- (setq elisp-prefix install-elisp-prefix)
- )
- (or
- (catch 'tag
- (let ((rest default-load-path)
- dir)
- (while (setq dir (car rest))
- (if (string-match
- (concat "^"
- (expand-file-name (concat ".*/" elisp-prefix) prefix)
- "$")
- dir)
- (or (string-match (format "%d\\.%d"
- emacs-major-version
- emacs-minor-version) dir)
- (throw 'tag dir)
- ))
- (setq rest (cdr rest))
- )))
- (expand-file-name (concat
- (if running-emacs-19_29-or-later
- "share/"
- "lib/")
- (cond ((boundp 'NEMACS) "nemacs/")
- ((boundp 'MULE) "mule/")
- (running-xemacs
- (if (featurep 'mule)
- "xmule/"
- "xemacs/"))
- (t "emacs/"))
- elisp-prefix) prefix)
- ))
+ (setq elisp-prefix install-elisp-prefix))
+ (or (catch 'tag
+ (let ((rest default-load-path)
+ (regexp (concat "^"
+ (expand-file-name (concat ".*/" elisp-prefix)
+ prefix)
+ "/?$")))
+ (while rest
+ (if (string-match regexp (car rest))
+ (if (or allow-version-specific
+ (not (string-match (format "/%d\\.%d"
+ emacs-major-version
+ emacs-minor-version)
+ (car rest))))
+ (throw 'tag (car rest))))
+ (setq rest (cdr rest)))))
+ (expand-file-name (concat (if (and (not (featurep 'xemacs))
+ (or (>= emacs-major-version 20)
+ (and (= emacs-major-version 19)
+ (> emacs-minor-version 28))))
+ "share/"
+ "lib/")
+ (cond
+ ((featurep 'xemacs)
+ (if (featurep 'mule)
+ "xmule/"
+ "xemacs/"))
+ ;; unfortunately, unofficial mule based on
+ ;; 19.29 and later use "emacs/" by default.
+ ((boundp 'MULE) "mule/")
+ ((boundp 'NEMACS) "nemacs/")
+ (t "emacs/"))
+ elisp-prefix)
+ prefix)))