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"))
125 ;;;_ , Doing autoload actions (adapted from autoload.el)
126 ;;;_ . Utilities about the action list
127 ;;;_ , elinstall-remove-autogen-action
128 (defun elinstall-remove-autogen-action (file actions
)
129 "Return ACTIONS minus any add-file-autoloads on FILE removed."
136 (if (equal file
(third act
))
141 ;;;_ , elinstall-get-autogen-action
142 (defun elinstall-get-autogen-action (file actions
)
146 (dolist (act actions
)
149 (when (equal file
(third act
))
150 (setq the-act act
)))))
152 ;;;_ . elinstall-insert-section-header
153 (defun elinstall-insert-section-header (outbuf form
)
154 "Insert the section-header line,
155 which lists the file name and which functions are in it, etc."
156 (insert generate-autoload-section-header
)
159 ;; Break that line at spaces, to avoid very long lines.
160 ;; Make each sub-line into a comment.
161 (with-current-buffer outbuf
166 (skip-chars-forward "^ \n")
168 (insert "\n" generate-autoload-section-continuation
))))))
170 ;;;_ . Making autoloads
171 ;;;_ , elinstall-generate-file-autoloads
172 ;;override to allow slashed load-paths
173 ;;Quick and dirty: We just adapt `generate-file-autoloads' and add
175 ;;`relative-to' can be:
176 ;; * nil: act as at present. Assume that FILE's immediate directory
178 ;; * t :: use default-directory
179 ;; * a string :: relative to it, as a filename
181 (defun elinstall-generate-file-autoloads (relative-name full-name
)
182 "Insert at point a loaddefs autoload section for FILE.
183 Autoloads are generated for defuns and defmacros in FILE
184 marked by `generate-autoload-cookie' (which see).
185 If FILE is being visited in a buffer, the contents of the buffer
187 Return non-nil in the case where no autoloads were added at point.
189 FULL-NAME is the absolute name of the file.
190 RELATIVE-NAME is its name respective to some component of load-path."
191 (let* ((outbuf (current-buffer))
194 (print-readably t
) ; This does something in Lucid Emacs.
195 (float-output-format nil
)
197 (visited (get-file-buffer full-name
))
200 ;; It is faster to avoid visiting the file.
201 (ignore-errors (autoload-find-file full-name
))))
204 (with-current-buffer source-buf
205 ;;$$MOVE ME - this should be checked in action-finding.
206 ;; Obey the no-update-autoloads file local variable.
207 (unless no-update-autoloads
208 (message "Generating autoloads for %s..." relative-name
)
209 (setq output-start
(with-current-buffer outbuf
(point)))
213 (goto-char (point-min))
215 (skip-chars-forward " \t\n\f")
217 ((looking-at (regexp-quote generate-autoload-cookie
))
218 (search-forward generate-autoload-cookie
)
219 (skip-chars-forward " \t")
222 ;; Read the next form and make an autoload.
223 (let* ((form (prog1 (read (current-buffer))
224 (or (bolp) (forward-line 1))))
226 (make-autoload form relative-name
)))
228 (push (nth 1 form
) autoloads-done
)
229 (setq autoload form
))
230 (let ((autoload-print-form-outbuf outbuf
))
231 (autoload-print-form autoload
)))
233 ;; Copy the rest of the line to the output.
234 (princ (buffer-substring
236 ;; Back up over whitespace, to preserve it.
237 (skip-chars-backward " \f\t")
238 (if (= (char-after (1+ (point))) ?
)
242 (progn (forward-line 1) (point)))
245 ;; Don't read the comment.
249 (forward-line 1))))))
252 (with-current-buffer outbuf
254 ;; Insert the section-header line which lists the file name
255 ;; and which functions are in it, etc.
256 (goto-char output-start
)
257 (elinstall-insert-section-header
262 (autoload-trim-file-name full-name
)
263 (nth 5 (file-attributes full-name
))))
265 (insert ";;; Generated autoloads from "
266 (autoload-trim-file-name full-name
) "\n"))
267 (insert generate-autoload-section-trailer
)))
268 (message "Generating autoloads for %s...done" relative-name
))
271 ;; We created this buffer, so we should kill it.
272 (kill-buffer (current-buffer))))
273 (message "Could not load %s" relative-name
))
278 ;;;_ , elinstall-deffile-insert-autoloads
279 (defun elinstall-deffile-insert-autoloads (file load-name
)
280 "Update the autoloads for FILE in current buffer.
281 Return FILE if there was no autoload cookie in it, else nil.
283 Current buffer must be a loaddef-style file.
285 LOAD-NAME is the absolute name of the file.
286 RELATIVE-NAME is its name respective to some component of load-path."
294 (goto-char (point-min))
295 ;; Look for the section for FILE
296 (while (and (not found
)
297 (search-forward generate-autoload-section-header nil t
))
298 (let ((form (autoload-read-section-header)))
300 ((equal (nth 2 form
) file
)
301 ;; We found the section for this file.
302 (let ((begin (match-beginning 0)))
304 (search-forward generate-autoload-section-trailer
)
305 (delete-region begin
(point))
307 ((string< file
(nth 2 form
))
308 ;; We've come to a section alphabetically later than
309 ;; FILE. We assume the file is in order and so
310 ;; there must be no section for FILE. We will
311 ;; insert one before the section here.
312 (goto-char (match-beginning 0))
313 (setq found
'new
)))))
317 ;; No later sections in the file. Put before the last page.
318 (goto-char (point-max))
319 (search-backward "\f" nil t
)))
321 (elinstall-generate-file-autoloads file load-name
))))
323 (if no-autoloads file nil
)))
324 ;;;_ . Arranging to add to info-path and load-path
325 ;;;_ , elinstall-generate-add-to-path
326 (defun elinstall-generate-add-to-path (path-element type
)
327 "Insert code at point to add PATH-ELEMENT to a path.
329 * `add-to-load-path', add to load-path
330 * `add-to-info-path', add to Info-default-directory-list
332 Current buffer must be a loaddef-style file."
335 (add-to-load-path 'load-path
)
336 (add-to-info-path 'Info-default-directory-list
)
337 (t (error "Type not recognized"))))
340 (add-to-load-path "load-path")
341 (add-to-info-path "info-path")))
344 (print-readably t
) ; This does something in Lucid Emacs.
345 (float-output-format nil
))
347 (message "Generating %s additions..." description
)
350 (elinstall-insert-section-header
352 (list type
(list path-element
) nil nil nil
))
354 (insert ";;; Generated path addition\n")
356 `(add-to-list ',path-symbol
358 ,(file-relative-name path-element
)
361 (file-truename load-file-name
)))))
364 (insert generate-autoload-section-trailer
)
365 (message "Generating %s additions...done" description
)))
368 ;;;_ , elinstall-deffile-insert-add-to-path
369 (defun elinstall-deffile-insert-add-to-path (path-element type
)
370 "Insert code in current buffer to add PATH-ELEMENT to a path.
372 * `add-to-load-path', add to load-path
373 * `add-to-info-path', add to Info-default-directory-list
375 Current buffer must be a loaddef-style file."
383 (goto-char (point-min))
384 ;; Look for the section for PATH-ELEMENT
385 (while (and (not found
)
386 (search-forward generate-autoload-section-header nil t
))
387 (let ((form (autoload-read-section-header)))
390 (equal (nth 0 form
) type
)
391 (member path-element
(nth 1 form
)))
393 ;; We found the section for this add.
394 (let ((begin (match-beginning 0)))
396 (search-forward generate-autoload-section-trailer
)
397 (delete-region begin
(point))
403 ;; No later sections in the file. Put before the last page.
404 (goto-char (point-max))
405 (search-backward "\f" nil t
)))
407 (elinstall-generate-add-to-path path-element type
)))
409 ;;This never belongs in the no-autoloads section.
411 ;;;_ . elinstall-deffile-insert
413 (defun elinstall-deffile-insert (action)
414 "Insert autoloads etc into current file according to ACTION.
415 The format of ACTION is described in the design docs.
417 Return filename if this action belongs in the no-autoload section."
422 (elinstall-deffile-insert-autoloads
427 (elinstall-deffile-insert-add-to-path
433 (elinstall-deffile-insert-add-to-path
438 ((preload-file run-tests byte-compile
)
439 (error "This case should not come here.")))))
441 ;;;_ . elinstall-prepare-deffile
442 (defun elinstall-prepare-deffile (deffile)
443 "Try to ensure that DEFFILE is available for receiving autoloads"
445 (autoload-ensure-default-file deffile
)
446 (with-current-buffer (find-file-noselect deffile
)
449 ;; We must read/write the file without any code conversion,
450 ;; but still decode EOLs.
451 (let ((coding-system-for-read 'raw-text
))
453 ;; This is to make generated-autoload-file have Unix EOLs, so
454 ;; that it is portable to all platforms.
455 (setq buffer-file-coding-system
'raw-text-unix
))
456 (or (> (buffer-size) 0)
457 (error "Autoloads file %s does not exist" buffer-file-name
))
458 (or (file-writable-p buffer-file-name
)
459 (error "Autoloads file %s is not writable"
462 ;;;_ . elinstall-update-deffile
464 ;;Adapted from autoload.el `update-directory-autoloads'.
466 (defun elinstall-update-deffile (target actions
&optional
469 Update file TARGET with current autoloads as specified by ACTIONS.
470 Also remove any old definitions pointing to libraries that can no
473 ACTIONS must be a list of actions (See the format doc). Each one's
474 filename must be relative to some element of load-path.
476 USE-LOAD-PATH is a list to use as load-path. It should include
477 any new load-path that we are arranging to create. If it's not given,
478 load-path itself is used.
480 If FORCE is `t', do it regardless of timestamps etc. (Not implemented)
481 Other non-nil cases of FORCE are reserved for future development.
483 This uses `update-file-autoloads' (which see) to do its work.
484 In an interactive call, you must give one argument, the name
485 of a single directory."
488 (use-load-path (or use-load-path load-path
))
489 (this-time (current-time))
490 ;;files with no autoload cookies.
493 (elinstall-prepare-deffile target
)
495 (find-file-noselect target
)
498 (elinstall-remove-autogen-action
499 (autoload-trim-file-name target
)
502 (goto-char (point-min))
503 (while (search-forward generate-autoload-section-header nil t
)
504 (let* ((form (autoload-read-section-header))
506 (cond ((and (consp file
) (stringp (car file
)))
507 ;; This is a list of files that have no
509 ;; There shouldn't be more than one such entry.
510 ;; Remove the obsolete section.
511 (autoload-remove-section (match-beginning 0))
512 (let ((last-time (nth 4 form
)))
514 (let ((file-time (nth 5 (file-attributes file
))))
516 (not (time-less-p last-time file-time
)))
518 (push file no-autoloads
)
520 (elinstall-remove-autogen-action
522 ((not (stringp file
)))
526 (locate-library file nil use-load-path
)))
528 ;;File doesn't exist, so remove its
531 (autoload-remove-section
532 (match-beginning 0)))
534 ;; File hasn't changed, so do nothing.
537 (nth 5 (file-attributes file-path
)))
540 (elinstall-deffile-insert
541 (elinstall-get-autogen-action
545 (elinstall-remove-autogen-action
548 ;; Remaining actions have no existing autoload sections yet.
551 (delq nil
(mapcar #'elinstall-deffile-insert actions
))))
553 ;; Sort them for better readability.
554 (setq no-autoloads
(sort no-autoloads
'string
<))
555 ;; Add the `no-autoloads' section.
556 (goto-char (point-max))
557 (search-backward "\f" nil t
)
559 (elinstall-insert-section-header
561 (list 'autoloads nil nil no-autoloads this-time
))
562 (insert generate-autoload-section-trailer
))
565 ;;;_ . elinstall-stage-update-deffiles
566 (defun elinstall-stage-update-deffiles (segment-list force use-load-path
)
567 "Update any deffiles mentioned in SEGMENT-LIST.
568 FORCE and USE-LOAD-PATH have the same meaning as in
569 `elinstall-update-deffile'.
574 ((deffile (car segment
)))
575 (if (stringp deffile
)
576 (elinstall-update-deffile deffile
(cdr segment
) force
580 ;;;_ , Doing actions to arrange preloads
581 ;;;_ . elinstall-symlink-on-emacs-start
582 (defun elinstall-symlink-on-emacs-start
583 (filename target-basename target-dir
&optional priority force
)
584 "Symlink to TARGET-BASENAME.el in TARGET-DIR
586 If PRIORITY is given, it will be used as the priority prefix,
587 otherwise elinstall-default-priority will be.
588 PRIORITY must be an integer or nil.
589 If FORCE is `t', do it regardless of timestamps etc.
590 Other non-nil cases of FORCE are reserved for future development."
593 (priority (or priority elinstall-default-priority
))
600 (expand-file-name target-name-nodir target-dir
)))
604 ;;Path should already exist.
606 (file-exists-p target-dir
))
607 (message "The target directory doesn't exist."))
608 ;;Target shouldn't already exist, but if force is given, let
610 ;;$$IMPROVE ME If it is a symlink pointing to the same place,
611 ;;do nothing even on force.
613 (file-exists-p target
)
618 (format "Really overwrite %s? " target
))))
619 (message "File %s already exists" target
)))
627 ;;;_ . elinstall-add-to-dot-emacs
628 (defun elinstall-add-to-dot-emacs (dot-emacs-name filename force
&rest r
)
629 "Add code to load FILENAME to .emacs.
630 FILENAME should not have an extension"
633 (with-current-buffer (find-file-noselect dot-emacs-name
)
636 (goto-char (point-max))
637 (insert "\n;;Added by elinstall")
638 (insert "\n;;Consider using my-site-start to manage .emacs\n")
639 (pp `(load ,filename
) (current-buffer))
643 ;;;_ . elinstall-arrange-preload
645 (defun elinstall-arrange-preload (force filename basename
&optional priority
)
646 "Arrange for FILENAME to be loaded on emacs start.
647 FORCE has its usual meaning.
648 BASENAME and PRIORITY are used as arguments to
649 `elinstall-symlink-on-emacs-start'.
653 ((preload-target elinstall-default-preload-target
))
655 ;;Dispatch the possibilities.
657 ((eq preload-target
'dot-emacs
)
658 (elinstall-add-to-dot-emacs "~/.emacs" filename force
))
659 ((stringp preload-target
)
660 (elinstall-symlink-on-emacs-start
661 filename basename preload-target priority force
))
662 ((null preload-target
)
663 (message "Not arranging for preloads"))
665 (message "I don't recognize that")))))
666 ;;;_ . elinstall-stage-arrange-preloads
667 (defun elinstall-stage-arrange-preloads (actions deffiles-used force
)
668 "Arrange any preloads mentioned in ACTIONS."
682 (member filename deffiles-used
)))))
686 #'elinstall-arrange-preload
691 "elinstall-stage-arrange-preloads: Action not
697 ;;;_ . elinstall-stage-run-tests
698 (defun elinstall-stage-run-tests (actions)
699 "Run any tests mentioned in ACTIONS."
705 ;;$$WRITE ME - not a high priority right now.
709 "elinstall-stage-run-tests: Action not
715 ;;;_ . elinstall-stage-byte-compile
716 (defun elinstall-stage-byte-compile (actions)
717 "Do any byte-compilation mentioned in ACTIONS."
722 ;;$$IMPROVE ME Understand flags to control second
723 ;;argument (whether to load file after
726 (byte-compile-file (second act
)))
729 "elinstall-stage-byte-compile: Action not
732 ;;;_ . Segregating actions
733 ;;;_ , elinstall-remove-empty-segs
734 (defun elinstall-remove-empty-segs (segment-list)
735 "Return SEGMENT-LIST minus any segments that have no actions.
736 Intended only for the deffile stage data."
745 ;;;_ , elinstall-segregate-actions
746 (defun elinstall-segregate-actions (actions)
747 "Return actions segregated by deffile.
749 Returns a list whose elements are each a cons of:
750 * deffile filename or nil
751 * A list of actions to be done for that deffile."
758 (arrange-preloads '()))
760 (dolist (act actions
)
767 ((deffile-name (second act
))
769 (assoc deffile-name build-deffiles
)))
771 ;;There are already actions on this deffile.
772 ;;Splice this action in.
774 (cons act
(cdr cell-already
)))
775 ;;There are no actions on this deffile. Add a
776 ;;place for them and include this action.
777 (push (list deffile-name act
) build-deffiles
))))
779 (push act arrange-preloads
))
781 (push act run-tests
))
783 (push act byte-compile
)))))
785 (elinstall-make-stages
787 (elinstall-remove-empty-segs build-deffiles
)
794 ;;;_ . Finding actions
795 ;;;_ , Treating the parameter list
796 ;;;_ . elinstall-add-parameter
797 (defun elinstall-add-parameter (alist key new-value
)
798 "Add a new value for KEY to ALIST"
802 (assq-delete-all key
(copy-list alist
))))
804 ;;;_ . elinstall-get-parameter
805 (defun elinstall-get-parameter (alist key
)
806 "Get the value of KEY from ALIST"
808 (cdr (assq key alist
)))
809 ;;;_ . elinstall-expand-file-name
812 (defun elinstall-expand-file-name (filename alist
)
813 "Expand FILENAME by the value of `path' in ALIST"
816 (elinstall-get-parameter alist
'path
)))
817 ;;;_ , Finding deffiles
818 ;;;_ . elinstall-expand-deffile-name
819 (defun elinstall-expand-deffile-name (deffile)
820 "Expand DEFFILE autoload.el's way."
822 (expand-file-name (or deffile
"loaddefs.el")
823 (expand-file-name "lisp"
827 ;;;_ . elinstall-dir-has-info
829 ;;$$IMPROVE ME - Can this test be made more precise?
830 (defun elinstall-dir-has-info (dir)
831 "Return non-nil if DIR has info files in it.
832 DIR should be an absolute path."
834 (string-match "/info/" dir
)
835 (directory-files dir nil
"\\.info\\(-[0-9]+\\)?\\(\\.gz\\)?$")))
838 ;;;_ . List of special variables used here
839 ;;load-path-element - The relevant element of load-path
840 ;;def-file - The file the autoload definitions etc will go into.
841 ;;add-to-load-path-p - Controls whether to add to load-path.
843 ;;;_ . elinstall-actions-for-source-file
844 (defun elinstall-actions-for-source-file (filename dir
)
845 "Return a list of actions to do for FILENAME in DIR.
846 Special variables are as noted in \"List of special variables\"."
848 load-path-element def-file
))
851 (file-readable-p full-path
)
852 (not (auto-save-file-name-p full-path
)))
853 ;;$$IMPROVE ME add and use relevant control variables.
856 (expand-file-name filename dir
))
857 (visited (get-file-buffer full-path
))
861 ;;Visit the file cheaply.
862 ;;hack-local-variables can give errors.
863 (ignore-errors (autoload-find-file full-path
))))
864 ;;Figure out whether to run some actions, by file local vars.
867 (with-current-buffer buf
868 (not no-update-autoloads
))))
872 (with-current-buffer buf
873 (if (local-variable-p 'generated-autoload-file
)
874 (elinstall-expand-deffile-name
875 generated-autoload-file
)
880 (featurep 'byte-compile
)
881 (string-match emacs-lisp-file-regexp filename
)
883 (with-current-buffer buf
884 (not no-byte-compile
)))
886 ((dest (byte-compile-dest-file full-path
))
887 ;;$$PUNT - currently, we wouldn't have gotten
888 ;;here if we weren't intending to do everything.
891 (if (file-exists-p dest
)
892 ;; File was already compiled.
893 (or recompile-p
(file-newer-than-file-p full-path dest
))
895 (y-or-n-p (concat "Compile " filename
"? "))))))))
900 `(byte-compile ,full-path
)
905 ;;load-name relative to a member of load-path
906 ,(file-name-sans-extension
913 (unless visited
(kill-buffer-if-not-modified buf
))))))
915 ;;;_ . elinstall-find-actions-by-spec-x
917 (defun elinstall-find-actions-by-spec-x (spec dir
)
918 "Return a list of actions to do, controlled by SPEC."
920 load-path-element def-file add-to-load-path-p
))
923 ;;$$IMPROVE ME by adding the other cases in the design.
932 (elinstall-find-actions-by-spec-x
940 (elinstall-find-actions-by-spec-x
946 (elinstall-actions-for-source-file
948 ;;$$ADD ME control, rather than trying to bind all control
949 ;;variables so we can safely bind one, will use set and
963 elinstall-elisp-regexp
))
966 elisp-source-files
;;List not empty.
974 ;;$$IMPROVE ME - remove the current deffile from
976 ;;Maybe arrange to add this directory to load-path.
983 ;;$$IMPROVE ME - be controlled by a control variable.
984 ;;If any info files are present, do add-to-info-path
987 (elinstall-dir-has-info dirname
)
995 ;;$$FIXME Don't do directories, but maybe recurse on
996 ;;them, if a flag is set.
997 ;;Maybe could follow/not symlinks similarly.
1000 #'(lambda (filename)
1001 (elinstall-actions-for-source-file
1004 elisp-source-files
)))))
1008 `((add-to-load-path ,def-file
,dir
))
1010 ((load-path-element dir
))
1011 (elinstall-find-actions-by-spec-x spec dir
))))
1020 (for-preload (third spec
)))
1021 (assert (listp for-preload
))
1025 (and for-preload
(car for-preload
))
1029 ,@(cdr for-preload
))
1032 (elinstall-find-actions-by-spec-x
1033 (fourth spec
) dir
)))))
1035 ;;$$IMPROVE ME by adding the other cases in the design.
1038 ;;;_ . elinstall-find-actions-by-spec
1039 (defun elinstall-find-actions-by-spec (spec load-path-element dir def-file
)
1043 ((load-path-element load-path-element
)
1045 (add-to-load-path-p t
))
1047 load-path-element def-file add-to-load-path-p
))
1049 (elinstall-find-actions-by-spec-x
1052 ;;;_ . high-level work
1053 ;;;_ , elinstall-get-relevant-load-path
1054 (defun elinstall-get-relevant-load-path (actions)
1064 ;;;_ , elinstall-get-deffile-list
1065 (defun elinstall-get-deffile-list (stages)
1066 "Get a list of deffile names"
1070 (elinstall-stages->build-deffiles stages
)))
1073 (defun elinstall-x (dir spec
&optional force
)
1077 ;;This is just the default deffile, spec can override it.
1079 (elinstall-expand-deffile-name nil
))
1081 (elinstall-find-actions-by-spec
1086 (stages (elinstall-segregate-actions actions
))
1088 (elinstall-get-relevant-load-path
1091 (elinstall-stage-update-deffiles
1092 (elinstall-stages->build-deffiles stages
)
1095 (elinstall-stage-arrange-preloads
1096 (elinstall-stages->arrange-preloads stages
)
1097 (elinstall-get-deffile-list stages
)
1099 (elinstall-stage-byte-compile
1100 (elinstall-stages->byte-compile stages
))
1105 (defun elinstall (project-name path spec
&optional force
)
1106 "Install elisp files.
1107 They need not be a formal package.
1111 PROJECT-NAME - the name of the project
1113 PATH - Path to the project.
1114 Suggestion: (elinstall-directory-true-name)
1116 SPEC - a spec for the autoloads etc to make. It can be as simple as
1117 \(dir \"\.\") for installing one directory.
1119 If FORCE is t, install a package even if it has already been
1120 installed. Other non-nil cases of FORCE are reserved for future
1127 (not (elinstall-already-installed project-name
)))
1128 (yes-or-no-p (format "Re-install %s? " project-name
)))
1131 `(def-file "loaddefs.el" (if-used ,project-name
) ,spec
)
1133 (elinstall-record-installed project-name
)))
1137 ;;;_ . elinstall-update-directory-autoloads
1138 ;;$$SPLIT ME - one to just classically update autoloads, one to
1142 (defun elinstall-update-directory-autoloads (dir)
1145 (interactive "DInstall all elisp files from directory: ")
1150 (elinstall-expand-deffile-name
1151 generated-autoload-file
)))
1155 `(def-file ,def-file-name
(nil) (dir ".")))))
1159 ;;;_ . elinstall-update-file-autoloads
1160 ;;$$SPLIT ME - one to just classically update autoloads, one to
1164 (defun elinstall-update-file-autoloads (file)
1167 (interactive "fInstall elisp file: ")
1170 ;;This is the default. File local vars can override it.
1171 (elinstall-expand-deffile-name
1172 generated-autoload-file
)))
1175 `(def-file ,def-file-name
(nil) (file ,file
)))))
1179 (provide 'elinstall
)
1181 ;;;_ * Local emacs vars.
1182 ;;;_ + Local variables:
1187 ;;; elinstall.el ends here