1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 ;; Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Katsumi Yamaoka <yamaoka@jpl.org>
9 ;; Keywords: news, path
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
32 ;; Set coding priority of Shift-JIS to the bottom.
33 (if (featurep 'xemacs)
34 (defalias 'set-coding-priority 'ignore)
35 (defalias 'coding-priority-list 'ignore)
36 (defalias 'set-coding-priority-list 'ignore))
37 (cond ((and (featurep 'xemacs) (featurep 'mule))
38 (if (memq 'shift-jis (coding-priority-list))
39 (set-coding-priority-list
40 (append (delq 'shift-jis (coding-priority-list)) '(shift-jis)))))
42 (if (memq 'coding-category-sjis coding-category-list)
44 (append (delq 'coding-category-sjis
45 (copy-sequence coding-category-list))
46 '(coding-category-sjis))))))
48 (defvar dgnushack-default-load-path (copy-sequence load-path))
50 (defalias 'facep 'ignore)
55 ;; `dolist' might not be available because of ``-no-autoloads''.
57 ;; It may have been defined in egg.el.
59 (load "cl-macs" nil t))
61 (defvar srcdir (or (getenv "srcdir") "."))
62 (defvar loaddir (and load-file-name (file-name-directory load-file-name)))
64 (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR")))
65 (unless (zerop (length w3dir))
66 (file-name-as-directory w3dir))))
68 (let ((urldir (getenv "URLDIR")))
69 (unless (zerop (length urldir))
70 (setq urldir (file-name-as-directory urldir))
71 (push (file-name-as-directory urldir) load-path))
72 (when (and dgnushack-w3-directory
73 (not (string-equal urldir dgnushack-w3-directory)))
74 (push dgnushack-w3-directory load-path)))
76 ;; If we are building w3 in a different directory than the source
77 ;; directory, we must read *.el from source directory and write *.elc
78 ;; into the building directory. For that, we define this function
79 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
80 (defun byte-compile-dest-file (filename)
81 "Convert an Emacs Lisp source file name to a compiled file name.
82 In addition, remove directory name part from FILENAME."
83 (setq filename (byte-compiler-base-file-name filename))
84 (setq filename (file-name-sans-versions filename))
85 (setq filename (file-name-nondirectory filename))
86 (if (memq system-type '(win32 w32 mswindows windows-nt))
87 (setq filename (downcase filename)))
88 (cond ((eq system-type 'vax-vms)
89 (concat (substring filename 0 (string-match ";" filename)) "c"))
90 ((string-match emacs-lisp-file-regexp filename)
91 (concat (substring filename 0 (match-beginning 0)) ".elc"))
92 (t (concat filename ".elc"))))
95 ;; To avoid having defsubsts and inlines happen.
96 ;(if (featurep 'xemacs)
97 ; (require 'byte-optimize)
98 ; (require 'byte-opt))
99 ;(defun byte-optimize-inline-handler (form)
100 ; "byte-optimize-handler for the `inline' special-form."
101 ; (cons 'progn (cdr form)))
102 ;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun)
104 (when (and (not (featurep 'xemacs))
105 (= emacs-major-version 21)
106 (>= emacs-minor-version 3)
108 (let ((byte-compile-error-on-warn t))
109 (byte-optimize-form (quote (pop x)) t)
111 (error (string-match "called for effect"
112 (error-message-string code)))))
113 (defadvice byte-optimize-form-code-walker (around silence-warn-for-pop
116 "Silence the warning \"...called for effect\" for the `pop' form.
117 It is effective only when the `pop' macro is defined by cl.el rather
120 (if (and (eq (car-safe form) 'car)
122 (setq tmp (get 'car 'side-effect-free))
123 (not byte-compile-delete-errors)
124 (not (eq tmp 'error-free))
125 (eq (car-safe (cadr form)) 'prog1)
126 (let ((var (cadr (cadr form)))
127 (last (nth 2 (cadr form))))
129 (null (nthcdr 3 (cadr form)))
130 (eq (car-safe last) 'setq)
132 (eq (car-safe (nth 2 last)) 'cdr)
133 (eq (cadr (nth 2 last)) var))))
135 (put 'car 'side-effect-free 'error-free)
138 (put 'car 'side-effect-free tmp)))
141 (when (and (not (featurep 'xemacs))
142 (byte-optimize-form '(and (> 0 1) foo) t))
143 (defadvice byte-optimize-form-code-walker
144 (around fix-bug-in-and/or-forms (form for-effect) activate)
145 "Optimize the rest of the and/or forms.
146 It has been fixed in XEmacs before releasing 21.4 and also has been
147 fixed in Emacs after 21.3."
148 (if (and for-effect (memq (car-safe form) '(and or)))
149 (let ((fn (car form))
150 (backwards (reverse (cdr form))))
151 (while (and backwards
152 (null (setcar backwards
153 (byte-optimize-form (car backwards) t))))
154 (setq backwards (cdr backwards)))
155 (if (and (cdr form) (null backwards))
157 " all subforms of %s called for effect; deleted" form))
160 (mapcar 'byte-optimize-form (cdr backwards))))
161 (setq ad-return-value (cons fn (nreverse backwards))))
164 ;; Add `configure-package-path' to `load-path' for XEmacs. Those paths
165 ;; won't appear in `load-path' when XEmacs starts with the `-no-autoloads'
166 ;; option or the `-vanilla' option because of a bug. :<
167 (when (and (featurep 'xemacs)
168 (boundp 'configure-package-path)
169 (listp configure-package-path))
174 (when (and (stringp path)
175 (not (string-equal path ""))
177 (setq path (expand-file-name "lisp" path))))
178 (directory-files path t)))
179 configure-package-path)))
182 (setq path (car paths)
185 (not (or (string-match "/\\.\\.?\\'" path)
186 (member (file-name-as-directory path) load-path)
187 (member path load-path)))
188 (file-directory-p path))
189 (push (file-name-as-directory path) adds)))
190 (setq load-path (nconc (nreverse adds) load-path))))
192 (if (file-exists-p (expand-file-name "dgnuspath.el" srcdir))
193 (load (expand-file-name "dgnuspath.el" srcdir) nil nil t))
196 (load "~/.lpath.el" t nil t)
197 (error (message "Error in \"~/.lpath.el\" file: %s" err)))
199 (when (featurep 'xemacs)
201 (require 'timer-funcs)
203 You should upgrade your XEmacs packages, especially xemacs-base.\n"))
205 ;; The reason that to load `advice' is necessary is:
206 ;; 1. `path-util' loads poe.elc.
207 ;; 2. poe.elc requires the `ad-add-advice' function which is expanded
209 ;; 3. XEmacs is running with the -no-autoloads option.
212 ;; Don't load path-util until `char-after' and `char-before' have been
213 ;; optimized because it requires `poe' and then modify the functions.
217 APEL was not found or an error occurred. You will need to run the
218 configure script again adding the --with-addpath=APEL_PATH option.\n"
221 (unless (locate-library "mel")
223 (unless (module-installed-p 'mel)
224 ;; FLIM 1.14 may have installed in two "flim" subdirectories.
225 (push (expand-file-name "flim"
226 (file-name-directory (get-latest-path "^apel$" t)))
228 (unless (module-installed-p 'mel)
230 FLIM was not found. You will need to run the configure script again
231 adding the --with-addpath=FLIM_PATH option.\n"
235 (when (and (featurep 'xemacs)
236 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
237 (modify-syntax-entry ?= " " table)
239 (with-syntax-table table
241 (goto-char (point-min))
244 ;; The original `with-syntax-table' uses `copy-syntax-table' which
245 ;; doesn't seem to copy modified syntax entries in XEmacs 21.5.
246 (defmacro with-syntax-table (syntab &rest body)
247 "Evaluate BODY with the SYNTAB as the current syntax table."
248 `(let ((stab (syntax-table)))
251 ;;(set-syntax-table (copy-syntax-table ,syntab))
252 (set-syntax-table ,syntab)
254 (set-syntax-table stab)))))
256 (push srcdir load-path)
257 (push loaddir load-path)
258 (load (expand-file-name "lpath.el" loaddir) nil t)
262 ;; Bind functions defined by `defun-maybe'.
263 (put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
264 (defun byte-compile-file-form-defun-maybe (form)
265 (if (and (not (fboundp (nth 1 form)))
266 (memq 'unresolved byte-compile-warnings))
267 (setq byte-compile-function-environment
268 (cons (cons (nth 1 form)
269 (cons 'lambda (cdr (cdr form))))
270 byte-compile-function-environment)))
273 ;; Unknown variables and functions.
274 (unless (featurep 'xemacs)
275 (defalias 'Custom-make-dependencies 'ignore)
276 (defalias 'update-autoloads-from-directory 'ignore))
278 (defalias 'device-sound-enabled-p 'ignore)
279 (defalias 'play-sound-file 'ignore)
280 (defalias 'nndb-request-article 'ignore)
281 (defalias 'efs-re-read-dir 'ignore)
282 (defalias 'ange-ftp-re-read-dir 'ignore)
283 (defalias 'define-mail-user-agent 'ignore)
286 (when (featurep 'xemacs)
287 (unless (fboundp 'defadvice)
288 (autoload 'defadvice "advice" nil nil 'macro))
289 (autoload 'Info-directory "info" nil t)
290 (autoload 'Info-menu "info" nil t)
291 (autoload 'annotations-at "annotations")
292 (autoload 'apropos "apropos" nil t)
293 (autoload 'apropos-command "apropos" nil t)
294 (autoload 'bbdb-complete-name "bbdb-com" nil t)
295 (autoload 'browse-url "browse-url" nil t)
296 (autoload 'c-mode "cc-mode" nil t)
297 (autoload 'customize-apropos "cus-edit" nil t)
298 (autoload 'customize-save-variable "cus-edit" nil t)
299 (autoload 'customize-set-variable "cus-edit" nil t)
300 (autoload 'customize-variable "cus-edit" nil t)
301 (autoload 'delete-annotation "annotations")
302 (autoload 'dolist "cl-macs" nil nil 'macro)
303 (autoload 'enriched-decode "enriched")
304 (autoload 'executable-find "executable")
305 (autoload 'font-lock-fontify-buffer "font-lock" nil t)
306 (autoload 'info "info" nil t)
307 (autoload 'mail-extract-address-components "mail-extr")
308 (autoload 'mail-fetch-field "mail-utils")
309 (autoload 'make-annotation "annotations")
310 (autoload 'make-display-table "disp-table")
312 (autoload 'ps-despool "ps-print" nil t)
313 (autoload 'ps-spool-buffer "ps-print" nil t)
314 (autoload 'ps-spool-buffer-with-faces "ps-print" nil t)
315 (autoload 'read-passwd "passwd")
316 (autoload 'regexp-opt "regexp-opt")
317 (autoload 'reporter-submit-bug-report "reporter")
318 (if (and (emacs-version>= 21 5)
319 (not (featurep 'sxemacs)))
320 (autoload 'setenv "process" nil t)
321 (autoload 'setenv "env" nil t))
322 (autoload 'sgml-mode "psgml" nil t)
323 (autoload 'sha1 "sha1")
324 (autoload 'sha1-binary "sha1")
325 (autoload 'smtpmail-send-it "smtpmail")
326 (autoload 'sort-numeric-fields "sort" nil t)
327 (autoload 'sort-subr "sort")
328 (autoload 'trace-function-background "trace" nil t)
329 (autoload 'w3-do-setup "w3")
330 (autoload 'w3-prepare-buffer "w3-display")
331 (autoload 'w3-region "w3-display" nil t)
332 (defalias 'frame-char-height 'frame-height)
333 (defalias 'frame-char-width 'frame-width)
334 (defalias 'frame-parameter 'frame-property)
335 (defalias 'make-overlay 'ignore)
336 (defalias 'overlay-end 'ignore)
337 (defalias 'overlay-get 'ignore)
338 (defalias 'overlay-put 'ignore)
339 (defalias 'overlay-start 'ignore)
340 (defalias 'overlays-in 'ignore)
341 (defalias 'replace-dehighlight 'ignore)
342 (defalias 'replace-highlight 'ignore)
343 (defalias 'w3-coding-system-for-mime-charset 'ignore)))
347 (when (featurep 'xemacs)
348 (autoload 'c-mode "cc-mode" nil t)
349 (autoload 'font-lock-mode "font-lock" nil t)
350 (autoload 'read-kbd-macro "edmacro" nil t)
351 (autoload 'turn-on-font-lock "font-lock" nil t))
352 (autoload 'nnheader-detect-coding-region "nnheader")
353 (autoload 'std11-extract-addresses-components "nnheader")
354 (autoload 'std11-fold-region "nnheader")
355 (autoload 'std11-narrow-to-field "nnheader")
356 (autoload 'std11-unfold-region "nnheader"))
358 (defconst dgnushack-unexporting-files
359 (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el"
360 "legacy-gnus-agent.el")
361 (unless (or (condition-case code
364 (message "No w3: %s%s, retrying..."
365 (error-message-string code)
366 (if (setq code (locate-library "w3-parse"))
367 (concat " (" code ")")
370 ;; Maybe mis-configured Makefile is used (e.g.
371 ;; configured for FSFmacs but XEmacs is running).
372 (let ((lp (delete dgnushack-w3-directory
373 (copy-sequence load-path))))
374 (if (let ((load-path lp))
378 ;; If success, fix `load-path' for compiling.
381 (message " => fixed; W3DIR=%s"
383 (locate-library "w3-parse")))
385 (message " => ignored")
387 '("nnultimate.el" "webmail.el" "nnwfm.el"))
389 (progn (require 'mh-e) nil)
391 (message "No mh-e: %s%s (ignored)"
392 (error-message-string code)
393 (if (setq code (locate-library "mh-e"))
394 (concat " (" code ")")
398 (progn (require 'xml) nil)
400 (message "No xml: %s%s (ignored)"
401 (error-message-string code)
402 (if (setq code (locate-library "xml"))
403 (concat " (" code ")")
407 (progn (require 'bbdb) nil)
409 (message "No bbdb: %s%s (ignored)"
410 (error-message-string code)
411 (if (setq code (locate-library "bbdb"))
412 (concat " (" code ")")
415 (unless (featurep 'xemacs)
416 '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el"))
417 (when (and (fboundp 'base64-decode-string)
418 (subrp (symbol-function 'base64-decode-string)))
420 (when (and (fboundp 'md5) (subrp (symbol-function 'md5)))
422 (when (featurep 'xemacs)
424 "Files which will not be installed.")
426 (defconst dgnushack-exporting-files
427 (let ((files (directory-files srcdir nil "^[^=].*\\.el$" t)))
428 (dolist (file dgnushack-unexporting-files)
429 (setq files (delete file files)))
430 (sort files 'string-lessp))
431 "Files which will be compiled and installed.")
433 (defun dgnushack-exporting-files ()
434 "Print name of files which will be installed."
435 (princ (mapconcat 'identity dgnushack-exporting-files " ")))
437 (defconst dgnushack-dont-compile-files
439 "mm-bodies.el" "mm-decode.el" "mm-encode.el" "mm-extern.el"
440 "mm-partial.el" "mm-uu.el" "mm-view.el" "mml-sec.el" "mml-smime.el"
441 "mml.el" "mml1991.el" "mml2015.el")
442 "Files which should not be byte-compiled.")
444 (defun dgnushack-compile-verbosely ()
445 "Call dgnushack-compile with warnings ENABLED. If you are compiling
446 patches to gnus, you should consider modifying make.bat to call
447 dgnushack-compile-verbosely. All other users should continue to use
449 (dgnushack-compile t))
451 (defun dgnushack-compile (&optional warn)
452 ;;(setq byte-compile-dynamic t)
454 (setq byte-compile-warnings
455 '(free-vars unresolved callargs redefine)))
458 (message "load-path=(\"%s\")"
459 (mapconcat 'identity load-path "\"\n \""))
461 (dolist (file dgnushack-exporting-files)
462 (setq file (expand-file-name file srcdir))
463 (when (and (file-exists-p
464 (setq elc (concat (file-name-nondirectory file) "c")))
465 (file-newer-than-file-p file elc))
468 ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
470 (when (featurep 'xemacs)
471 (setq gnus-xmas-glyph-directory "dummy"))
473 (let ((files dgnushack-exporting-files)
474 ;;(byte-compile-generate-call-tree t)
476 (while (setq file (pop files))
477 (unless (member file dgnushack-dont-compile-files)
478 (setq file (expand-file-name file srcdir))
479 (when (or (not (file-exists-p
480 (setq elc (concat (file-name-nondirectory file) "c"))))
481 (file-newer-than-file-p file elc))
483 (byte-compile-file file)))))))
485 (defun dgnushack-recompile ()
487 (byte-recompile-directory "." 0))
489 (defvar dgnushack-gnus-load-file
490 (if (featurep 'xemacs)
491 (expand-file-name "auto-autoloads.el" srcdir)
492 (expand-file-name "gnus-load.el" srcdir)))
494 (defvar dgnushack-cus-load-file
495 (if (featurep 'xemacs)
496 (expand-file-name "custom-load.el" srcdir)
497 (expand-file-name "cus-load.el" srcdir)))
499 (defun dgnushack-make-cus-load ()
501 (let ((cusload-base-file dgnushack-cus-load-file))
502 (if (fboundp 'custom-make-dependencies)
503 (custom-make-dependencies)
504 (Custom-make-dependencies))
505 (when (featurep 'xemacs)
506 (message "Compiling %s..." dgnushack-cus-load-file)
507 (byte-compile-file dgnushack-cus-load-file))))
509 (defun dgnushack-make-auto-load ()
511 (unless (make-autoload '(define-derived-mode child parent name
514 (defadvice make-autoload (around handle-define-derived-mode activate)
515 "Handle `define-derived-mode'."
516 (if (eq (car-safe (ad-get-arg 0)) 'define-derived-mode)
517 (setq ad-return-value
519 (list 'quote (nth 1 (ad-get-arg 0)))
521 (nth 4 (ad-get-arg 0))
524 (put 'define-derived-mode 'doc-string-elt 3))
525 (let ((generated-autoload-file dgnushack-gnus-load-file)
526 (make-backup-files nil)
527 (autoload-package-name "gnus"))
528 (if (featurep 'xemacs)
529 (if (file-exists-p generated-autoload-file)
530 (delete-file generated-autoload-file))
531 (with-temp-file generated-autoload-file
533 (if (featurep 'xemacs)
534 (let ((si:message (symbol-function 'message)))
535 (defun message (fmt &rest args)
536 (cond ((and (string-equal "Generating autoloads for %s..." fmt)
537 (file-exists-p (file-name-nondirectory (car args))))
539 fmt (file-name-nondirectory (car args))))
540 ((string-equal "No autoloads found in %s" fmt))
541 ((string-equal "Generating autoloads for %s...done" fmt))
542 (t (apply si:message fmt args))))
544 (batch-update-autoloads)
545 (fset 'message si:message)))
546 (batch-update-autoloads))))
548 (defun dgnushack-make-load ()
549 (unless (featurep 'xemacs)
550 (message "Generating %s..." dgnushack-gnus-load-file)
551 (with-temp-file dgnushack-gnus-load-file
552 (insert-file-contents dgnushack-cus-load-file)
553 (delete-file dgnushack-cus-load-file)
554 (goto-char (point-min))
555 (search-forward ";;; Code:")
557 (delete-region (point-min) (point))
559 ;;; gnus-load.el --- automatically extracted custom dependencies and autoload
563 (goto-char (point-max))
564 (if (search-backward "custom-versions-load-alist" nil t)
567 (while (eq (char-after) ?\;)
570 (delete-region (point) (point-max))
572 ;; smiley-* are duplicated. Remove them all.
573 (let ((point (point)))
574 (insert-file-contents dgnushack-gnus-load-file)
576 (while (search-forward "smiley-" nil t)
578 (if (looking-at "(autoload ")
579 (delete-region (point) (progn (forward-sexp) (point)))
582 (goto-char (point-max))
583 (when (search-backward "\n(provide " nil t)
585 (delete-region (point) (point-max)))
588 \(provide 'gnus-load)
591 ;;; version-control: never
592 ;;; no-byte-compile: t
593 ;;; no-update-autoloads: t
595 ;;; gnus-load.el ends here
598 (message "Compiling %s..." dgnushack-gnus-load-file)
599 (byte-compile-file dgnushack-gnus-load-file)
600 (when (featurep 'xemacs)
601 (message "Creating dummy gnus-load.el...")
602 (with-temp-file (expand-file-name "gnus-load.el")
605 \(provide 'gnus-load)
608 ;;; version-control: never
609 ;;; no-byte-compile: t
610 ;;; no-update-autoloads: t
612 ;;; gnus-load.el ends here"))))
615 (defconst dgnushack-info-file-regexp-en
616 (let ((names '("gnus" "message" "emacs-mime"))
618 (while (setq name (pop names))
619 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
620 (when names "\\|"))))
622 "Regexp matching English info files.")
624 (defconst dgnushack-info-file-regexp-ja
625 (let ((names '("gnus-ja" "message-ja"))
627 (while (setq name (pop names))
628 (setq regexp (concat regexp "^" name "\\.info\\(-[0-9]+\\)?$"
629 (when names "\\|"))))
631 "Regexp matching Japanese info files.")
633 (defun dgnushack-remove-extra-files-in-package ()
634 "Remove extra files in the lisp directory of the XEmacs package."
635 (let ((lisp-dir (expand-file-name (concat "lisp/"
637 (cadr command-line-args-left)
640 (car command-line-args-left))))
641 (setq command-line-args-left nil)
642 (when (file-directory-p lisp-dir)
644 (dolist (file dgnushack-exporting-files)
645 (setq files (nconc files (list file (concat file "c")))))
646 (dolist (file (directory-files lisp-dir nil nil t t))
647 (unless (member file files)
648 (setq file (expand-file-name file lisp-dir))
649 (message "Removing %s..." file)
654 (defun dgnushack-install-package-manifest ()
655 "Install MANIFEST file as an XEmacs package."
656 (let* ((package-dir (pop command-line-args-left))
657 (product-name (pop command-line-args-left))
658 (pkginfo-dir (expand-file-name "pkginfo" package-dir))
659 (name (expand-file-name (concat "MANIFEST." product-name)
662 (unless (file-directory-p pkginfo-dir)
663 (message "Creating directory %s/..." pkginfo-dir)
664 (make-directory pkginfo-dir))
665 (message "Generating %s..." name)
667 (insert "pkginfo/MANIFEST." product-name "\n")
668 (let ((lisp-dir (concat "lisp/" product-name "/"))
669 (files (sort (directory-files "." nil "\\.elc?$" t) 'string-lessp))
671 (while (setq file (pop files))
672 (unless (member file dgnushack-unexporting-files)
673 (insert lisp-dir file "\n")))
675 (sort (directory-files "../texi/" nil
676 (concat dgnushack-info-file-regexp-en
678 dgnushack-info-file-regexp-ja)
681 (while (setq file (pop files))
682 (insert "info/" file "\n"))
683 (insert "etc/gnus-tut.txt\n")
685 (sort (directory-files "../etc/images/gnus/" nil
686 "\\.\\(pbm\\|xbm\\|xpm\\)\\'"
689 (while (setq file (pop files))
690 (insert "etc/images/gnus/" file "\n"))
691 (insert "etc/images/gnus/x-splash\n")
693 (sort (directory-files "../etc/images/smilies/" nil
694 "\\.\\(pbm\\|xpm\\)\\'"
697 (while (setq file (pop files))
698 (insert "etc/images/smilies/" file "\n"))))))
700 (defun dgnushack-find-lisp-shadows (&optional lispdir)
701 "Return a list of directories in which other Gnus installations exist.
702 This function looks for the other Gnus installations which will shadow
703 the new Gnus Lisp modules which have been installed in LISPDIR, using
704 the default `load-path'. The return value will make sense only when
705 LISPDIR is existent and is listed in the default `load-path'. Assume
706 LISPDIR will be prepended to `load-path' by a user if the default
707 `load-path' does not contain it."
709 (setq lispdir (getenv "lispdir")))
710 (when (and lispdir (file-directory-p lispdir))
711 (setq lispdir (file-truename (directory-file-name lispdir)))
712 (let ((indices '("gnus.elc" "gnus.el" "gnus.el.bz2" "gnus.el.gz"
713 "message.elc" "message.el" "message.el.bz2"
715 (path (delq nil (mapcar
718 (when (and p (file-directory-p p))
719 (file-truename (directory-file-name p)))
721 dgnushack-default-load-path)))
724 (setq rest (cons (car path) rest)
725 path (delete (car rest) (cdr path))))
726 (setq path (nreverse (cdr (member lispdir rest)))
731 (when (file-exists-p (expand-file-name (pop elcs) (car path)))
732 (setq rest (cons (car path) rest)
734 (setq path (cdr path)))
736 (setq path (nreverse rest))
738 (let (print-level print-length)
740 WARNING: The other gnus installation" (if (cdr path) "s have" " has") "\
741 been detected in:\n\n " (mapconcat 'identity path "\n ") "\n\n\
742 You will need to modify the run-time `load-path', remove them manually,
743 or remove them using `make remove-installed-shadows'.\n\n"))))))))
745 (defun dgnushack-remove-lisp-shadows (&optional lispdir)
746 "Remove the other Gnus installations which shadow the recent one."
747 (let ((path (with-temp-buffer
748 (let ((standard-output (current-buffer)))
749 (dgnushack-find-lisp-shadows lispdir))))
750 elcs files shadows file)
752 (unless (setq elcs (directory-files srcdir nil "\\.elc\\'"))
753 (error "You should build .elc files first."))
759 (list (concat el "c") el (concat el ".bz2") (concat el ".gz")))
761 (list (file-name-nondirectory dgnushack-gnus-load-file)
762 (file-name-nondirectory dgnushack-cus-load-file))
763 (mapcar (lambda (elc) (substring elc 0 -1)) elcs)))))
767 (setq file (expand-file-name (pop shadows) (car path)))
768 (when (file-exists-p file)
769 (princ (concat " Removing " file "..."))
774 (error (princ "failed\n")))))
775 (setq path (cdr path))))))
777 ;;; dgnushack.el ends here