1 ;;;_ elinstall.el --- Automatically and flexibly install elisp files
5 ;; Copyright (C) 2010 Tom Breton (Tehom)
7 ;; Author: Tom Breton (Tehom) <tehom@panix.com>
8 ;; Keywords: maint, tools, internal
10 ;; This file is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; This file is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
28 ;; elinstall Use this for overall loading
30 ;; elinstall-arrange-preload - Use this for non-autogenerated
31 ;; files that need to be linked in.
33 ;; elinstall-update-directory-autoloads
34 ;; elinstall-update-file-autoloads
40 (require 'cus-edit
) ;;Because we save "installedness" manually
41 (require 'byte-compile nil t
) ;;
49 "Customizations for elinstall"
51 ;;;_ . elinstall-default-priority
52 (defcustom elinstall-default-priority
54 "Default priority for site-start"
57 ;;;_ . elinstall-default-preload-target
58 (defcustom elinstall-default-preload-target
59 "~/.emacs.d/site-start.d/"
60 "Default preload-target for registering autoloads"
64 (const "~/.emacs.d/site-start.d/")
65 (const "/etc/emacs/site-start.d/")
69 ;;;_ . elinstall-already-installed
70 (defvar elinstall-already-installed
72 "(AUTOMATIC) Things that have already been installed.
73 This exists for recording what has been installed.
75 Though it's saved as customizable, user interaction is not
78 ;;;_ . elinstall-stages
79 (defstruct (elinstall-stages
80 (:constructor elinstall-make-stages
)
81 (:conc-name elinstall-stages-
>)
83 "The elinstall stages"
89 ;;;_ . Regular expressions
90 ;;;_ , elinstall-elisp-regexp
91 (defconst elinstall-elisp-regexp
94 (suf (get-load-suffixes))
95 (unless (string-match "\\.elc" suf
) (push suf tmp
)))
96 (concat "^[^=.].*" (regexp-opt tmp t
) "\\'"))
97 "Regular expression that matches elisp files" )
99 ;;;_ . elinstall-directory-true-name
100 (defun elinstall-directory-true-name ()
101 "Get the true name of the directory the calling code lives in.
102 CAUTION: This is sensitive to where it's called. That's the point of it."
105 (file-truename load-file-name
)
106 (file-truename buffer-file-name
))))
107 ;;;_ . Checking installedness
108 ;;;_ , elinstall-already-installed
109 (defun elinstall-already-installed (project-name)
110 "Return non-nil if PROJECT-NAME has been installed."
111 (member project-name elinstall-already-installed
))
113 ;;;_ , elinstall-record-installed
114 (defun elinstall-record-installed (project-name)
115 "Record that PROJECT-NAME has been installed."
117 (add-to-list 'elinstall-already-installed project-name
)
118 (customize-save-variable
119 'elinstall-already-installed
120 elinstall-already-installed
121 "Set by elinstall-record-installed"))
122 ;;;_ . Finding deffiles
123 ;;;_ , elinstall-expand-deffile-name
124 (defun elinstall-expand-deffile-name (deffile)
125 "Expand DEFFILE autoload.el's way."
127 (expand-file-name (or deffile
"loaddefs.el")
128 (expand-file-name "lisp"
134 ;;;_ , Doing autoload actions (adapted from autoload.el)
135 ;;;_ . Utilities about the action list
136 ;;;_ , elinstall-remove-autogen-action
137 (defun elinstall-remove-autogen-action (file actions
)
138 "Return ACTIONS minus any add-file-autoloads on FILE removed."
145 (if (equal file
(third act
))
150 ;;;_ , elinstall-get-autogen-action
151 (defun elinstall-get-autogen-action (file actions
)
155 (dolist (act actions
)
158 (when (equal file
(third act
))
159 (setq the-act act
)))))
161 ;;;_ . elinstall-insert-section-header
162 (defun elinstall-insert-section-header (outbuf form
)
163 "Insert the section-header line,
164 which lists the file name and which functions are in it, etc."
165 (insert generate-autoload-section-header
)
168 ;; Break that line at spaces, to avoid very long lines.
169 ;; Make each sub-line into a comment.
170 (with-current-buffer outbuf
175 (skip-chars-forward "^ \n")
177 (insert "\n" generate-autoload-section-continuation
))))))
179 ;;;_ . Making autoloads
180 ;;;_ , elinstall-insert-autoload-section
181 (defun elinstall-insert-autoload-section (text form
&optional comment-string
)
182 "Insert TEXT into current buffer as an autoload section"
184 (let* ( ;; This does something in Lucid Emacs.
187 (float-output-format nil
))
189 (elinstall-insert-section-header (current-buffer) form
)
191 (insert ";;; " comment-string
"\n"))
193 (insert generate-autoload-section-trailer
)))
195 ;;;_ , elinstall-make-autoload-action
196 (defun elinstall-make-autoload-action (buf def-file load-path-element full-path
)
197 "Return the autoloads for current buffer as a string"
199 ;;We put all the text into a temp buffer, then get that buffer's
203 (generate-new-buffer " *temp*"))
208 ;; Apparently this does something in Lucid Emacs.
211 (float-output-format nil
)
213 ;;load-name relative to a member of load-path.
215 (file-name-sans-extension
218 load-path-element
))))
220 (with-current-buffer buf
225 (goto-char (point-min))
226 (message "Finding autoloads for %s..." short-name
)
228 (skip-chars-forward " \t\n\f")
230 ((looking-at (regexp-quote generate-autoload-cookie
))
231 (search-forward generate-autoload-cookie
)
232 (skip-chars-forward " \t")
235 ;; Read the next form and make an autoload.
236 (let* ((form (prog1 (read (current-buffer))
237 (or (bolp) (forward-line 1))))
239 (make-autoload form relative-name
)))
241 (push (nth 1 form
) autoloads-done
)
242 (setq autoload form
))
243 (let ((autoload-print-form-outbuf outbuf
))
244 (autoload-print-form autoload
)))
246 ;; Copy the rest of the line to the output.
247 (princ (buffer-substring
249 ;; Back up over whitespace,
251 (skip-chars-backward " \f\t")
252 (if (= (char-after (1+ (point))) ?
)
256 (progn (forward-line 1) (point)))
259 ;; Don't read the comment.
264 (message "Finding autoloads for %s...done" short-name
))
266 ;;Return this action. The temp buffer's contents is
272 ,(with-current-buffer outbuf
(buffer-string))
275 ;;This in unwind-protected
276 (when (buffer-live-p outbuf
) (kill-buffer outbuf
))))))
279 ;;;_ , elinstall-generate-file-autoloads
281 (defun elinstall-generate-file-autoloads
282 (relative-name full-name text autoloads-done
)
283 "Insert at point a loaddefs autoload section for FILE.
284 Autoloads are generated for defuns and defmacros in FILE
285 marked by `generate-autoload-cookie' (which see).
286 If FILE is being visited in a buffer, the contents of the buffer
288 Return non-nil in the case where no autoloads were added at point.
290 FULL-NAME is the absolute name of the file.
291 RELATIVE-NAME is its name respective to some component of load-path."
292 (if (not (equal text
""))
293 ;; Insert the section-header line which lists the file name and
294 ;; which functions are in it, etc.
295 (elinstall-insert-autoload-section
300 (autoload-trim-file-name full-name
)
301 (nth 5 (file-attributes full-name
)))
303 "Generated autoloads from "
304 (autoload-trim-file-name full-name
)))
307 ;;;_ , elinstall-deffile-insert-autoloads
308 (defun elinstall-deffile-insert-autoloads (file args
)
309 "Update the autoloads for FILE in current buffer.
310 Return FILE if there was no autoload cookie in it, else nil.
312 Current buffer must be a loaddef-style file.
314 LOAD-NAME is the absolute name of the file.
315 RELATIVE-NAME is its name respective to some component of load-path."
323 (goto-char (point-min))
324 ;; Look for the section for FILE
325 (while (and (not found
)
326 (search-forward generate-autoload-section-header nil t
))
327 (let ((form (autoload-read-section-header)))
329 ((equal (nth 2 form
) file
)
330 ;; We found the section for this file.
331 (let ((begin (match-beginning 0)))
333 (search-forward generate-autoload-section-trailer
)
334 (delete-region begin
(point))
336 ((string< file
(nth 2 form
))
337 ;; We've come to a section alphabetically later than
338 ;; FILE. We assume the file is in order and so
339 ;; there must be no section for FILE. We will
340 ;; insert one before the section here.
341 (goto-char (match-beginning 0))
342 (setq found
'new
)))))
346 ;; No later sections in the file. Put before the last page.
347 (goto-char (point-max))
348 (search-backward "\f" nil t
)))
350 (apply #'elinstall-generate-file-autoloads
353 (if no-autoloads file nil
)))
354 ;;;_ . Arranging to add to info-path and load-path
355 ;;;_ , elinstall-generate-add-to-path
356 (defun elinstall-generate-add-to-path (path-element type
)
357 "Insert code at point to add PATH-ELEMENT to a path.
359 * `add-to-load-path', add to load-path
360 * `add-to-info-path', add to Info-default-directory-list
362 Current buffer must be a loaddef-style file."
365 (add-to-load-path 'load-path
)
366 (add-to-info-path 'Info-default-directory-list
)
367 (t (error "Type not recognized"))))
370 (add-to-load-path "load-path")
371 (add-to-info-path "info-path")))
374 (print-readably t
) ; This does something in Lucid Emacs.
375 (float-output-format nil
))
377 (message "Generating %s additions..." description
)
380 (elinstall-insert-section-header
382 (list type
(list path-element
) nil nil nil
))
384 (insert ";;; Generated path addition\n")
386 `(add-to-list ',path-symbol
388 ,(file-relative-name path-element
)
391 (file-truename load-file-name
)))))
394 (insert generate-autoload-section-trailer
)
395 (message "Generating %s additions...done" description
)))
398 ;;;_ , elinstall-deffile-insert-add-to-path
399 (defun elinstall-deffile-insert-add-to-path (path-element type
)
400 "Insert code in current buffer to add PATH-ELEMENT to a path.
402 * `add-to-load-path', add to load-path
403 * `add-to-info-path', add to Info-default-directory-list
405 Current buffer must be a loaddef-style file."
413 (goto-char (point-min))
414 ;; Look for the section for PATH-ELEMENT
415 (while (and (not found
)
416 (search-forward generate-autoload-section-header nil t
))
417 (let ((form (autoload-read-section-header)))
420 (equal (nth 0 form
) type
)
421 (member path-element
(nth 1 form
)))
423 ;; We found the section for this add.
424 (let ((begin (match-beginning 0)))
426 (search-forward generate-autoload-section-trailer
)
427 (delete-region begin
(point))
433 ;; No later sections in the file. Put before the last page.
434 (goto-char (point-max))
435 (search-backward "\f" nil t
)))
437 (elinstall-generate-add-to-path path-element type
)))
439 ;;This never belongs in the no-autoloads section.
441 ;;;_ . elinstall-deffile-insert
443 (defun elinstall-deffile-insert (action)
444 "Insert autoloads etc into current file according to ACTION.
445 The format of ACTION is described in the design docs.
447 Return filename if this action belongs in the no-autoload section."
452 (elinstall-deffile-insert-autoloads
457 (elinstall-deffile-insert-add-to-path
463 (elinstall-deffile-insert-add-to-path
468 ((preload-file run-tests byte-compile
)
469 (error "This case should not come here.")))))
471 ;;;_ . elinstall-prepare-deffile
472 (defun elinstall-prepare-deffile (deffile)
473 "Try to ensure that DEFFILE is available for receiving autoloads"
475 (autoload-ensure-default-file deffile
)
476 (with-current-buffer (find-file-noselect deffile
)
479 ;; We must read/write the file without any code conversion,
480 ;; but still decode EOLs.
481 (let ((coding-system-for-read 'raw-text
))
483 ;; This is to make generated-autoload-file have Unix EOLs, so
484 ;; that it is portable to all platforms.
485 (setq buffer-file-coding-system
'raw-text-unix
))
486 (or (> (buffer-size) 0)
487 (error "Autoloads file %s does not exist" buffer-file-name
))
488 (or (file-writable-p buffer-file-name
)
489 (error "Autoloads file %s is not writable"
492 ;;;_ . elinstall-update-deffile
494 ;;Adapted from autoload.el `update-directory-autoloads'.
496 (defun elinstall-update-deffile (target actions
&optional
499 Update file TARGET with current autoloads as specified by ACTIONS.
500 Also remove any old definitions pointing to libraries that can no
503 ACTIONS must be a list of actions (See the format doc). Each one's
504 filename must be relative to some element of load-path.
506 USE-LOAD-PATH is a list to use as load-path. It should include
507 any new load-path that we are arranging to create. If it's not given,
508 load-path itself is used.
510 If FORCE is `t', do it regardless of timestamps etc. (Not implemented)
511 Other non-nil cases of FORCE are reserved for future development.
513 This uses `update-file-autoloads' (which see) to do its work.
514 In an interactive call, you must give one argument, the name
515 of a single directory."
518 (use-load-path (or use-load-path load-path
))
519 (this-time (current-time))
520 ;;files with no autoload cookies.
523 (elinstall-prepare-deffile target
)
525 (find-file-noselect target
)
528 (elinstall-remove-autogen-action
529 (autoload-trim-file-name target
)
532 (goto-char (point-min))
533 (while (search-forward generate-autoload-section-header nil t
)
534 (let* ((form (autoload-read-section-header))
536 (cond ((and (consp file
) (stringp (car file
)))
537 ;; This is a list of files that have no
539 ;; There shouldn't be more than one such entry.
540 ;; Remove the obsolete section.
541 (autoload-remove-section (match-beginning 0))
542 (let ((last-time (nth 4 form
)))
544 (let ((file-time (nth 5 (file-attributes file
))))
546 (not (time-less-p last-time file-time
)))
548 (push file no-autoloads
)
550 (elinstall-remove-autogen-action
552 ((not (stringp file
)))
556 (locate-library file nil use-load-path
)))
558 ;;File doesn't exist, so remove its
561 (autoload-remove-section
562 (match-beginning 0)))
564 ;; File hasn't changed, so do nothing.
567 (nth 5 (file-attributes file-path
)))
570 (elinstall-deffile-insert
571 (elinstall-get-autogen-action
575 (elinstall-remove-autogen-action
578 ;; Remaining actions have no existing autoload sections yet.
581 (delq nil
(mapcar #'elinstall-deffile-insert actions
))))
583 ;; Sort them for better readability.
584 (setq no-autoloads
(sort no-autoloads
'string
<))
585 ;; Add the `no-autoloads' section.
586 (goto-char (point-max))
587 (search-backward "\f" nil t
)
589 (elinstall-insert-section-header
591 (list 'autoloads nil nil no-autoloads this-time
))
592 (insert generate-autoload-section-trailer
))
595 ;;;_ . elinstall-stage-update-deffiles
596 (defun elinstall-stage-update-deffiles (segment-list force use-load-path
)
597 "Update any deffiles mentioned in SEGMENT-LIST.
598 FORCE and USE-LOAD-PATH have the same meaning as in
599 `elinstall-update-deffile'.
604 ((deffile (car segment
)))
605 (if (stringp deffile
)
606 (elinstall-update-deffile deffile
(cdr segment
) force
610 ;;;_ , Doing actions to arrange preloads
611 ;;;_ . elinstall-symlink-on-emacs-start
612 (defun elinstall-symlink-on-emacs-start
613 (filename target-basename target-dir
&optional priority force
)
614 "Symlink to TARGET-BASENAME.el in TARGET-DIR
616 If PRIORITY is given, it will be used as the priority prefix,
617 otherwise elinstall-default-priority will be.
618 PRIORITY must be an integer or nil.
619 If FORCE is `t', do it regardless of timestamps etc.
620 Other non-nil cases of FORCE are reserved for future development."
623 (priority (or priority elinstall-default-priority
))
630 (expand-file-name target-name-nodir target-dir
)))
634 ;;Path should already exist.
636 (file-exists-p target-dir
))
637 (message "The target directory doesn't exist."))
638 ;;Target shouldn't already exist, but if force is given, let
640 ;;$$IMPROVE ME If it is a symlink pointing to the same place,
641 ;;do nothing even on force.
643 (file-exists-p target
)
648 (format "Really overwrite %s? " target
))))
649 (message "File %s already exists" target
)))
657 ;;;_ . elinstall-add-to-dot-emacs
658 (defun elinstall-add-to-dot-emacs (dot-emacs-name filename force
&rest r
)
659 "Add code to load FILENAME to .emacs.
660 FILENAME should not have an extension"
663 (with-current-buffer (find-file-noselect dot-emacs-name
)
666 (goto-char (point-max))
667 (insert "\n;;Added by elinstall")
668 (insert "\n;;Consider using my-site-start to manage .emacs\n")
669 (pp `(load ,filename
) (current-buffer))
673 ;;;_ . elinstall-arrange-preload
675 (defun elinstall-arrange-preload (force filename basename
&optional priority
)
676 "Arrange for FILENAME to be loaded on emacs start.
677 FORCE has its usual meaning.
678 BASENAME and PRIORITY are used as arguments to
679 `elinstall-symlink-on-emacs-start'.
683 ((preload-target elinstall-default-preload-target
))
685 ;;Dispatch the possibilities.
687 ((eq preload-target
'dot-emacs
)
688 (elinstall-add-to-dot-emacs "~/.emacs" filename force
))
689 ((stringp preload-target
)
690 (elinstall-symlink-on-emacs-start
691 filename basename preload-target priority force
))
692 ((null preload-target
)
693 (message "Not arranging for preloads"))
695 (message "I don't recognize that")))))
696 ;;;_ . elinstall-stage-arrange-preloads
697 (defun elinstall-stage-arrange-preloads (actions deffiles-used force
)
698 "Arrange any preloads mentioned in ACTIONS."
712 (member filename deffiles-used
)))))
716 #'elinstall-arrange-preload
721 "elinstall-stage-arrange-preloads: Action not
727 ;;;_ . elinstall-stage-run-tests
728 (defun elinstall-stage-run-tests (actions)
729 "Run any tests mentioned in ACTIONS."
735 ;;$$WRITE ME - not a high priority right now.
739 "elinstall-stage-run-tests: Action not
745 ;;;_ . elinstall-stage-byte-compile
746 (defun elinstall-stage-byte-compile (actions)
747 "Do any byte-compilation mentioned in ACTIONS."
752 ;;$$IMPROVE ME Understand flags to control second
753 ;;argument (whether to load file after
756 (byte-compile-file (second act
)))
759 "elinstall-stage-byte-compile: Action not
762 ;;;_ . Segregating actions
763 ;;;_ , elinstall-remove-empty-segs
764 (defun elinstall-remove-empty-segs (segment-list)
765 "Return SEGMENT-LIST minus any segments that have no actions.
766 Intended only for the deffile stage data."
775 ;;;_ , elinstall-segregate-actions
776 (defun elinstall-segregate-actions (actions)
777 "Return actions segregated by deffile.
779 Returns a list whose elements are each a cons of:
780 * deffile filename or nil
781 * A list of actions to be done for that deffile."
788 (arrange-preloads '()))
790 (dolist (act actions
)
797 ((deffile-name (second act
))
799 (assoc deffile-name build-deffiles
)))
801 ;;There are already actions on this deffile.
802 ;;Splice this action in.
804 (cons act
(cdr cell-already
)))
805 ;;There are no actions on this deffile. Add a
806 ;;place for them and include this action.
807 (push (list deffile-name act
) build-deffiles
))))
809 (push act arrange-preloads
))
811 (push act run-tests
))
813 (push act byte-compile
)))))
815 (elinstall-make-stages
817 (elinstall-remove-empty-segs build-deffiles
)
824 ;;;_ . Finding actions
826 ;;;_ . elinstall-dir-has-info
828 ;;$$IMPROVE ME - Can this test be made more precise?
829 (defun elinstall-dir-has-info (dir)
830 "Return non-nil if DIR has info files in it.
831 DIR should be an absolute path."
833 (string-match "/info/" dir
)
834 (directory-files dir nil
"\\.info\\(-[0-9]+\\)?\\(\\.gz\\)?$")))
837 ;;;_ . List of special variables used in this section
838 ;;load-path-element - The relevant element of load-path
839 ;;def-file - The file the autoload definitions etc will go into.
840 ;;add-to-load-path-p - Controls whether to add to load-path.
842 ;;;_ . elinstall-actions-for-source-file
843 (defun elinstall-actions-for-source-file (filename dir
)
844 "Return a list of actions to do for FILENAME in DIR.
845 Special variables are as noted in \"List of special variables\"."
847 load-path-element def-file
))
850 (expand-file-name filename dir
)))
853 (file-readable-p full-path
)
854 (not (auto-save-file-name-p full-path
)))
855 ;;$$IMPROVE ME create and use relevant control variables.
858 (visited (get-file-buffer full-path
))
862 ;;Visit the file cheaply.
863 ;;hack-local-variables can give errors.
864 (ignore-errors (autoload-find-file full-path
))))
868 (with-current-buffer buf
869 (if (local-variable-p 'generated-autoload-file
)
870 (elinstall-expand-deffile-name
871 generated-autoload-file
)
874 ;;Figure out whether to run some actions, by file local vars.
877 (with-current-buffer buf
878 (not no-update-autoloads
))))
881 (featurep 'byte-compile
)
882 (string-match emacs-lisp-file-regexp filename
)
884 (with-current-buffer buf
885 (not no-byte-compile
)))
887 ((dest (byte-compile-dest-file full-path
))
888 ;;$$PUNT - currently, we wouldn't have
889 ;;gotten here if we weren't intending to do
890 ;;everything so set force variables accordingly.
893 (if (file-exists-p dest
)
894 ;; File was already compiled.
895 (or recompile-p
(file-newer-than-file-p full-path dest
))
897 (y-or-n-p (concat "Compile " filename
"? "))))))))
902 `(byte-compile ,full-path
)
905 (elinstall-make-autoload-action
906 buf def-file load-path-element full-path
)
908 (unless visited
(kill-buffer-if-not-modified buf
)))))))
910 ;;;_ . elinstall-find-actions-by-spec-x
912 (defun elinstall-find-actions-by-spec-x (spec dir
)
913 "Return a list of actions to do, controlled by SPEC."
915 load-path-element def-file add-to-load-path-p
))
918 ;;$$IMPROVE ME by adding the other cases in the design.
927 (elinstall-find-actions-by-spec-x
935 (elinstall-find-actions-by-spec-x
941 (elinstall-actions-for-source-file
943 ;;$$ADD ME control, rather than trying to bind all control
944 ;;variables so we can safely bind one, will use set and
958 elinstall-elisp-regexp
))
961 elisp-source-files
;;List not empty.
969 ;;$$IMPROVE ME - remove the current deffile from
971 ;;Maybe arrange to add this directory to load-path.
978 ;;$$IMPROVE ME - be controlled by a control variable.
979 ;;If any info files are present, do add-to-info-path
982 (elinstall-dir-has-info dirname
)
990 ;;$$FIXME Don't do directories, but maybe recurse on
991 ;;them, if a flag is set.
992 ;;Maybe could follow/not symlinks similarly.
996 (elinstall-actions-for-source-file
999 elisp-source-files
)))))
1003 `((add-to-load-path ,def-file
,dir
))
1005 ((load-path-element dir
))
1006 (elinstall-find-actions-by-spec-x spec dir
))))
1015 (for-preload (third spec
)))
1016 (assert (listp for-preload
))
1020 (and for-preload
(car for-preload
))
1024 ,@(cdr for-preload
))
1027 (elinstall-find-actions-by-spec-x
1028 (fourth spec
) dir
)))))
1030 ;;$$IMPROVE ME by adding the other cases in the design.
1033 ;;;_ . elinstall-find-actions-by-spec
1034 (defun elinstall-find-actions-by-spec (spec load-path-element dir def-file
)
1038 ((load-path-element load-path-element
)
1040 (add-to-load-path-p t
))
1042 load-path-element def-file add-to-load-path-p
))
1044 (elinstall-find-actions-by-spec-x
1047 ;;;_ . high-level work
1048 ;;;_ , elinstall-get-relevant-load-path
1049 (defun elinstall-get-relevant-load-path (actions)
1059 ;;;_ , elinstall-get-deffile-list
1060 (defun elinstall-get-deffile-list (stages)
1061 "Get a list of deffile names"
1065 (elinstall-stages->build-deffiles stages
)))
1068 (defun elinstall-x (dir spec
&optional force
)
1072 ;;This is just the default deffile, spec can override it.
1074 (elinstall-expand-deffile-name nil
))
1076 (elinstall-find-actions-by-spec
1081 (stages (elinstall-segregate-actions actions
))
1083 (elinstall-get-relevant-load-path
1086 (elinstall-stage-update-deffiles
1087 (elinstall-stages->build-deffiles stages
)
1090 (elinstall-stage-arrange-preloads
1091 (elinstall-stages->arrange-preloads stages
)
1092 (elinstall-get-deffile-list stages
)
1094 (elinstall-stage-byte-compile
1095 (elinstall-stages->byte-compile stages
))
1100 (defun elinstall (project-name path spec
&optional force
)
1101 "Install elisp files.
1102 They need not be a formal package.
1106 PROJECT-NAME - the name of the project
1108 PATH - Path to the project.
1109 Suggestion: (elinstall-directory-true-name)
1111 SPEC - a spec for the autoloads etc to make. It can be as simple as
1112 \(dir \"\.\") for installing one directory.
1114 If FORCE is t, install a package even if it has already been
1115 installed. Other non-nil cases of FORCE are reserved for future
1122 (not (elinstall-already-installed project-name
)))
1123 (yes-or-no-p (format "Re-install %s? " project-name
)))
1126 `(def-file "loaddefs.el" (if-used ,project-name
) ,spec
)
1128 (elinstall-record-installed project-name
)))
1132 ;;;_ . elinstall-update-directory-autoloads
1133 ;;$$SPLIT ME - one to just classically update autoloads, one to
1137 (defun elinstall-update-directory-autoloads (dir)
1140 (interactive "DInstall all elisp files from directory: ")
1145 (elinstall-expand-deffile-name
1146 generated-autoload-file
)))
1150 `(def-file ,def-file-name
(nil) (dir ".")))))
1154 ;;;_ . elinstall-update-file-autoloads
1155 ;;$$SPLIT ME - one to just classically update autoloads, one to
1159 (defun elinstall-update-file-autoloads (file)
1162 (interactive "fInstall elisp file: ")
1165 ;;This is the default. File local vars can override it.
1166 (elinstall-expand-deffile-name
1167 generated-autoload-file
)))
1170 `(def-file ,def-file-name
(nil) (file ,file
)))))
1174 (provide 'elinstall
)
1176 ;;;_ * Local emacs vars.
1177 ;;;_ + Local variables:
1182 ;;; elinstall.el ends here