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
47 "Customizations for elinstall"
50 (defcustom elinstall-default-priority
52 "Default priority for site-start"
56 (defcustom elinstall-default-preload-target
57 "~/.emacs.d/site-start.d/"
58 "Default preload-target for registering autoloads"
62 (const "~/.emacs.d/site-start.d/")
63 (const "/etc/emacs/site-start.d/")
69 (defcustom elinstall-already-installed
71 "Things that have already been installed.
72 This exists for recording what has been installed. User interaction is not
73 contemplated at this time." )
75 ;;;_ . elinstall-stages
76 (defstruct (elinstall-stages
77 (:constructor elinstall-make-stages
)
78 (:conc-name elinstall-stages-
>)
80 "The elinstall stages"
87 ;;;_ . Regular expressions
88 ;;;_ , elinstall-elisp-regexp
89 (defconst elinstall-elisp-regexp
92 (suf (get-load-suffixes))
93 (unless (string-match "\\.elc" suf
) (push suf tmp
)))
94 (concat "^[^=.].*" (regexp-opt tmp t
) "\\'"))
95 "Regular expression that matches elisp files" )
98 ;;;_ . elinstall-directory-true-name
99 (defun elinstall-directory-true-name ()
100 "Get the true name of the directory the calling code lives in.
101 CAUTION: This is sensitive to where it's called. That's the point of it."
104 (file-truename load-file-name
)
105 (file-truename buffer-file-name
))))
106 ;;;_ . Checking installedness
107 ;;;_ , elinstall-already-installed
108 (defun elinstall-already-installed (project-name)
109 "Return non-nil if PROJECT-NAME has been installed."
110 (member project-name elinstall-already-installed
))
112 ;;;_ , elinstall-record-installed
113 (defun elinstall-record-installed (project-name)
114 "Record that PROJECT-NAME has been installed."
116 (add-to-list 'elinstall-already-installed project-name
)
117 (customize-save-variable
118 'elinstall-already-installed
119 elinstall-already-installed
120 "Set by elinstall-record-installed"))
124 ;;;_ , Doing autoload actions (All adapted from autoload.el)
125 ;;;_ . Utilities about the action list
126 ;;;_ , elinstall-remove-autogen-action
127 (defun elinstall-remove-autogen-action (file actions
)
128 "Return ACTIONS minus any add-file-autoloads on FILE removed."
135 (if (equal file
(third act
))
140 ;;;_ , elinstall-get-autogen-action
141 (defun elinstall-get-autogen-action (file actions
)
145 (dolist (act actions
)
148 (when (equal file
(third act
))
149 (setq the-act act
)))))
152 ;;;_ . Making autoloads
153 ;;;_ , elinstall-generate-file-autoloads
154 ;;override to allow slashed load-paths
155 ;;Quick and dirty: We just adapt `generate-file-autoloads' and add
157 ;;`relative-to' can be:
158 ;; * nil: act as at present. Assume that FILE's immediate directory
160 ;; * t :: use default-directory
161 ;; * a string :: relative to it, as a filename
163 (defun elinstall-generate-file-autoloads (relative-name full-name
)
164 "Insert at point a loaddefs autoload section for FILE.
165 Autoloads are generated for defuns and defmacros in FILE
166 marked by `generate-autoload-cookie' (which see).
167 If FILE is being visited in a buffer, the contents of the buffer
169 Return non-nil in the case where no autoloads were added at point.
171 FULL-NAME is the absolute name of the file.
172 RELATIVE-NAME is its name respective to some component of load-path."
173 (let* ((outbuf (current-buffer))
176 (print-readably t
) ; This does something in Lucid Emacs.
177 (float-output-format nil
)
179 (visited (get-file-buffer full-name
))
182 ;; It is faster to avoid visiting the file.
183 (ignore-errors (autoload-find-file full-name
))))
186 (with-current-buffer source-buf
187 ;;$$MOVE ME - this should be checked in action-finding.
188 ;; Obey the no-update-autoloads file local variable.
189 (unless no-update-autoloads
190 (message "Generating autoloads for %s..." relative-name
)
191 (setq output-start
(with-current-buffer outbuf
(point)))
195 (goto-char (point-min))
197 (skip-chars-forward " \t\n\f")
199 ((looking-at (regexp-quote generate-autoload-cookie
))
200 (search-forward generate-autoload-cookie
)
201 (skip-chars-forward " \t")
204 ;; Read the next form and make an autoload.
205 (let* ((form (prog1 (read (current-buffer))
206 (or (bolp) (forward-line 1))))
208 (make-autoload form relative-name
)))
210 (push (nth 1 form
) autoloads-done
)
211 (setq autoload form
))
212 (let ((autoload-print-form-outbuf outbuf
))
213 (autoload-print-form autoload
)))
215 ;; Copy the rest of the line to the output.
216 (princ (buffer-substring
218 ;; Back up over whitespace, to preserve it.
219 (skip-chars-backward " \f\t")
220 (if (= (char-after (1+ (point))) ?
)
224 (progn (forward-line 1) (point)))
227 ;; Don't read the comment.
231 (forward-line 1))))))
234 (with-current-buffer outbuf
236 ;; Insert the section-header line which lists the file name
237 ;; and which functions are in it, etc.
238 (goto-char output-start
)
239 (autoload-insert-section-header
240 outbuf autoloads-done relative-name full-name
241 (nth 5 (file-attributes full-name
)))
242 (insert ";;; Generated autoloads from "
243 (autoload-trim-file-name full-name
) "\n"))
244 (insert generate-autoload-section-trailer
)))
245 (message "Generating autoloads for %s...done" relative-name
))
248 ;; We created this buffer, so we should kill it.
249 (kill-buffer (current-buffer))))
250 (message "Could not load %s" relative-name
))
255 ;;;_ , elinstall-deffile-insert-autoloads
256 (defun elinstall-deffile-insert-autoloads (file load-name
)
257 "Update the autoloads for FILE in current buffer.
258 Return FILE if there was no autoload cookie in it, else nil.
260 Current buffer must be a loaddef-style file.
262 LOAD-NAME is the absolute name of the file.
263 RELATIVE-NAME is its name respective to some component of load-path."
271 (goto-char (point-min))
272 ;; Look for the section for FILE
273 (while (and (not found
)
274 (search-forward generate-autoload-section-header nil t
))
275 (let ((form (autoload-read-section-header)))
277 ((equal (nth 2 form
) file
)
278 ;; We found the section for this file.
279 (let ((begin (match-beginning 0)))
281 (search-forward generate-autoload-section-trailer
)
282 (delete-region begin
(point))
284 ((string< file
(nth 2 form
))
285 ;; We've come to a section alphabetically later than
286 ;; FILE. We assume the file is in order and so
287 ;; there must be no section for FILE. We will
288 ;; insert one before the section here.
289 (goto-char (match-beginning 0))
290 (setq found
'new
)))))
294 ;; No later sections in the file. Put before the last page.
295 (goto-char (point-max))
296 (search-backward "\f" nil t
)))
298 (elinstall-generate-file-autoloads file load-name
))))
300 (if no-autoloads file nil
)))
301 ;;;_ . Arranging to add to info-path and load-path
302 ;;;_ , elinstall-generate-add-to-path
303 (defun elinstall-generate-add-to-path (path-element type
)
304 "Insert code at point to add PATH-ELEMENT to a path.
306 * `add-to-load-path', add to load-path
307 * `add-to-info-path', add to Info-default-directory-list
309 Current buffer must be a loaddef-style file."
312 (add-to-load-path 'load-path
)
313 (add-to-info-path 'Info-default-directory-list
)))
316 (add-to-load-path "load-path")
317 (add-to-info-path "info-path")))
320 (print-readably t
) ; This does something in Lucid Emacs.
321 (float-output-format nil
))
323 (message "Generating %s additions..." description
)
325 (autoload-insert-section-header
326 (current-buffer) (list path-element
) nil nil
328 (insert ";;; Generated path addition\n")
330 `(add-to-list ',path-symbol
332 ,(file-relative-name path-element
)
335 (file-truename load-file-name
)))))
338 (insert generate-autoload-section-trailer
)
339 (message "Generating %s additions...done" description
)))
342 ;;;_ , elinstall-deffile-insert-add-to-path
343 (defun elinstall-deffile-insert-add-to-path (path-element type
)
344 "Insert code in current buffer to add PATH-ELEMENT to a path.
346 * `add-to-load-path', add to load-path
347 * `add-to-info-path', add to Info-default-directory-list
349 Current buffer must be a loaddef-style file."
357 (goto-char (point-min))
358 ;; Look for the section for PATH-ELEMENT
359 (while (and (not found
)
360 (search-forward generate-autoload-section-header nil t
))
361 (let ((form (autoload-read-section-header)))
364 (equal (nth 0 form
) type
)
365 (member (nth 1 form
) path-element
))
367 ;; We found the section for this add.
368 (let ((begin (match-beginning 0)))
370 (search-forward generate-autoload-section-trailer
)
371 (delete-region begin
(point))
377 ;; No later sections in the file. Put before the last page.
378 (goto-char (point-max))
379 (search-backward "\f" nil t
)))
381 (elinstall-generate-add-to-path path-element type
)))
383 ;;This never belongs in the no-autoloads section.
386 ;;;_ . elinstall-deffile-insert
388 (defun elinstall-deffile-insert (action)
389 "Insert autoloads etc into current file according to ACTION.
390 The format of ACTION is described in the design docs.
392 Return filename if this action belongs in the no-autoload section."
397 (elinstall-deffile-insert-autoloads
402 (elinstall-deffile-insert-add-to-path
408 (elinstall-deffile-insert-add-to-path
413 ((preload-file run-tests byte-compile
)
414 (error "This case should not come here.")))))
416 ;;;_ . elinstall-prepare-deffile
417 (defun elinstall-prepare-deffile (deffile)
418 "Try to ensure that DEFFILE is available for receiving autoloads"
420 (autoload-ensure-default-file deffile
)
421 (with-current-buffer (find-file-noselect deffile
)
424 ;; We must read/write the file without any code conversion,
425 ;; but still decode EOLs.
426 (let ((coding-system-for-read 'raw-text
))
428 ;; This is to make generated-autoload-file have Unix EOLs, so
429 ;; that it is portable to all platforms.
430 (setq buffer-file-coding-system
'raw-text-unix
))
431 (or (> (buffer-size) 0)
432 (error "Autoloads file %s does not exist" buffer-file-name
))
433 (or (file-writable-p buffer-file-name
)
434 (error "Autoloads file %s is not writable"
437 ;;;_ . elinstall-update-deffile
439 ;;Adapted from autoload.el `update-directory-autoloads'.
441 (defun elinstall-update-deffile (target actions
&optional
444 Update file TARGET with current autoloads as specified by ACTIONS.
445 Also remove any old definitions pointing to libraries that can no
448 ACTIONS must be a list of actions (See the format doc). Each one's
449 filename must be relative to some element of load-path.
451 USE-LOAD-PATH is a list to use as load-path. It should include
452 any new load-path that we are arranging to create. If it's not given,
453 load-path itself is used.
455 If FORCE is `t', do it regardless of timestamps etc. (Not implemented)
456 Other non-nil cases of FORCE are reserved for future development.
458 This uses `update-file-autoloads' (which see) to do its work.
459 In an interactive call, you must give one argument, the name
460 of a single directory."
463 (use-load-path (or use-load-path load-path
))
464 (this-time (current-time))
465 ;;files with no autoload cookies.
468 (elinstall-prepare-deffile target
)
470 (find-file-noselect target
)
473 (elinstall-remove-autogen-action
474 (autoload-trim-file-name target
)
477 (goto-char (point-min))
478 (while (search-forward generate-autoload-section-header nil t
)
479 (let* ((form (autoload-read-section-header))
481 (cond ((and (consp file
) (stringp (car file
)))
482 ;; This is a list of files that have no
484 ;; There shouldn't be more than one such entry.
485 ;; Remove the obsolete section.
486 (autoload-remove-section (match-beginning 0))
487 (let ((last-time (nth 4 form
)))
489 (let ((file-time (nth 5 (file-attributes file
))))
491 (not (time-less-p last-time file-time
)))
493 (push file no-autoloads
)
495 (elinstall-remove-autogen-action
497 ((not (stringp file
)))
501 (locate-library file nil use-load-path
)))
503 ;;File doesn't exist, so remove its
506 (autoload-remove-section
507 (match-beginning 0)))
509 ;; File hasn't changed, so do nothing.
512 (nth 5 (file-attributes file-path
)))
515 (elinstall-deffile-insert
516 (elinstall-get-autogen-action
520 (elinstall-remove-autogen-action
523 ;; Remaining actions have no existing autoload sections yet.
526 (delq nil
(mapcar #'elinstall-deffile-insert actions
))))
528 ;; Sort them for better readability.
529 (setq no-autoloads
(sort no-autoloads
'string
<))
530 ;; Add the `no-autoloads' section.
531 (goto-char (point-max))
532 (search-backward "\f" nil t
)
533 (autoload-insert-section-header
534 (current-buffer) nil nil no-autoloads this-time
)
535 (insert generate-autoload-section-trailer
))
539 ;;;_ , Doing actions to arrange preloads
540 ;;;_ . elinstall-insert-add-to-path
541 (defun elinstall-insert-add-to-path (new path-sym
)
542 "Insert code to add NEW to PATH-SYM.
543 Insert this at point in current buffer."
546 `(add-to-list ',path-sym
547 (expand-file-name ,new
550 (file-truename load-file-name
)))))
553 ;;;_ . elinstall-insert-add-to-load-path
554 (defun elinstall-insert-add-to-load-path (new)
555 "Insert code to add NEW to load-path.
556 Insert this at point in current buffer."
557 (elinstall-insert-add-to-path new
'load-path
))
559 ;;;_ . elinstall-insert-add-to-info-path
560 (defun elinstall-insert-add-to-info-path (new)
561 "Insert code to add NEW to info-path.
562 Insert this at point in current buffer."
563 (elinstall-insert-add-to-path new
'Info-default-directory-list
))
565 ;;;_ . elinstall-symlink-on-emacs-start
566 (defun elinstall-symlink-on-emacs-start
567 (filename target-basename target-dir
&optional priority force
)
568 "Symlink to TARGET-BASENAME.el in TARGET-DIR
570 If PRIORITY is given, it will be used as the priority prefix,
571 otherwise elinstall-default-priority will be.
572 PRIORITY must be an integer or nil.
573 If FORCE is `t', do it regardless of timestamps etc.
574 Other non-nil cases of FORCE are reserved for future development."
577 (priority (or priority elinstall-default-priority
))
584 (expand-file-name target-name-nodir target-dir
)))
588 ;;Path should already exist.
590 (file-exists-p target-dir
))
591 (message "The target directory doesn't exist."))
592 ;;Target shouldn't already exist, but if force is given, let
594 ;;$$IMPROVE ME If it is a symlink pointing to the same place,
595 ;;do nothing even on force.
597 (file-exists-p target
)
602 (format "Really overwrite %s? " project-name
))))
603 (message "File %s already exists" target
)))
611 ;;;_ . elinstall-add-to-dot-emacs
612 (defun elinstall-add-to-dot-emacs (dot-emacs-name filename force
&rest r
)
613 "Add code to load FILENAME to .emacs.
614 FILENAME should not have an extension"
617 (with-current-buffer (find-file-noselect dot-emacs-name
)
620 (goto-char (point-max))
621 (insert "\n;;Added by elinstall")
622 (insert "\n;;Consider using my-site-start to manage .emacs\n")
623 (pp `(load ,filename
) (current-buffer))
627 ;;;_ . elinstall-arrange-preload
629 (defun elinstall-arrange-preload (force filename basename
&optional priority
)
630 "Arrange for FILENAME to be loaded on emacs start.
631 FORCE has its usual meaning.
632 BASENAME and PRIORITY are used as arguments to
633 `elinstall-symlink-on-emacs-start'.
637 ((preload-target elinstall-default-preload-target
))
639 ;;Dispatch the possibilities.
641 ((eq preload-target
'dot-emacs
)
642 (elinstall-add-to-dot-emacs "~/.emacs" filename
))
643 ((stringp preload-target
)
644 (elinstall-symlink-on-emacs-start
645 filename basename preload-target priority force
))
647 (message "Not arranging for preloads"))
649 (message "I don't recognize that")))))
651 ;;;_ , Cleanup actions
652 ;;Nothing yet. This will be another type of action.
654 ;;;_ . Segregating actions
655 ;;;_ , elinstall-remove-empty-segs
656 (defun elinstall-remove-empty-segs (segment-list)
657 "Return SEGMENT-LIST minus any segments that have no actions.
658 Intended only for the deffile stage data."
667 ;;;_ , elinstall-segregate-actions
668 (defun elinstall-segregate-actions (actions)
669 "Return actions segregated by deffile.
671 Returns a list whose elements are each a cons of:
672 * deffile filename or nil
673 * A list of actions to be done for that deffile."
680 (arrange-preloads '()))
682 (dolist (act actions
)
689 ((deffile-name (second act
))
691 (assoc deffile-name build-deffiles
)))
693 ;;There are already actions on this deffile.
694 ;;Splice this action in.
696 (cons act
(cdr cell-already
)))
697 ;;There are no actions on this deffile. Add a
698 ;;place for them and include this action.
699 (push (list deffile-name act
) build-deffiles
))))
701 (push act arrange-preloads
))
703 (push act run-tests
))
705 (push act byte-compile
)))))
707 (elinstall-make-stages
709 (elinstall-remove-empty-segs build-deffiles
)
721 ;;;_ . Finding actions
722 ;;;_ , Treating the parameter list
723 ;;;_ . elinstall-add-parameter
724 (defun elinstall-add-parameter (alist key new-value
)
725 "Add a new value for KEY to ALIST"
729 (assq-delete-all key
(copy-list alist
))))
731 ;;;_ . elinstall-get-parameter
732 (defun elinstall-get-parameter (alist key
)
733 "Get the value of KEY from ALIST"
735 (cdr (assq key alist
)))
736 ;;;_ . elinstall-expand-file-name
739 (defun elinstall-expand-file-name (filename alist
)
740 "Expand FILENAME by the value of `path' in ALIST"
743 (elinstall-get-parameter alist
'path
)))
744 ;;;_ , Finding deffiles
745 ;;;_ . elinstall-expand-deffile-name
746 (defun elinstall-expand-deffile-name (deffile)
747 "Expand DEFFILE autoload.el's way."
749 (expand-file-name (or deffile
"loaddefs.el")
750 (expand-file-name "lisp"
753 ;;;_ . elinstall-maybe-get-deffile
754 (defun elinstall-maybe-get-deffile (file)
755 "If FILE defined `generated-autoload-file', return it.
756 Otherwise return nil.
757 Return it as an absolute filename."
760 ;;$$FIXME load buffer if it's not already loaded
762 ((existing-buffer (get-file-buffer file
)))
764 ;; We want to get a value for generated-autoload-file from
765 ;; the local variables section if it's there.
766 ;;But if it's not loaded, we don't? Maybe should use
767 ;; `autoload-find-file' and load it.
769 (set-buffer existing-buffer
))
770 (if (local-variable-p 'generated-autoload-file
)
771 (elinstall-expand-deffile-name
772 generated-autoload-file
)
777 ;;;_ . elinstall-find-actions-for-file
778 (defun elinstall-find-actions-for-file
779 (filename load-path-element dir parameters
)
780 "Return a list of actions to do for FILENAME.
781 LOAD-PATH-ELEMENT, DIR, and PARAMETERS are interpreted as in
782 `elinstall-find-actions-by-spec' "
786 (expand-file-name filename dir
)))
789 ,(elinstall-get-parameter
790 parameters
'def-file
)
791 ;;load-name relative to a member of load-path
792 ,(file-name-sans-extension
796 ,load-path-element
;;Is this still used?
799 ;;;_ . elinstall-find-actions-by-spec
801 (defun elinstall-find-actions-by-spec (spec load-path-element path parameters
)
802 "Return a list of actions to do, controlled by SPEC and PARAMETERS.
804 LOAD-PATH-ELEMENT is the conceptual element of load-path that
805 surrounds DIR. It may not yet have been added to load-path."
807 ;;$$IMPROVE ME by adding the other cases in the design.
816 (elinstall-find-actions-by-spec
826 (elinstall-find-actions-by-spec
834 (elinstall-find-actions-for-file
835 filename load-path-element dir parameters
))
845 (elinstall-get-parameter
846 parameters
'block-add-to-load-path
)))
854 ;;Do this only if there are loadable files.
857 ,(elinstall-get-parameter
858 parameters
'def-file
)
862 ;;Do add-to-info-path too. But test if there are
863 ;;any info files present.
866 ;; We want to get a value for generated-autoload-file
867 ;; from the local variables section if it's there.
868 ;;Use `elinstall-maybe-get-deffile'
869 ;; Otherwise we'll use `def-file' in parameters.
871 ;;$$FIXME This isn't quite right. If directory
872 ;;itself is not in load-path, this will be wrong.
873 ;;Gotta know where our encompassing part of
876 ;;$$ENCAP ME This should be shared with the
877 ;;treatment of (file FN)
879 ;;$$FIXME Don't do directories, but maybe recurse on
880 ;;them, if a flag is set. And since we definitely
881 ;;have a load-path element here,
882 ;;'block-add-to-load-path according to a parameter.
883 ;;Maybe could follow/not symlinks similarly.
887 (elinstall-find-actions-for-file
895 nil
;;Relative filenames
896 elinstall-elisp-regexp
))))))
904 (for-preload (third spec
)))
905 (assert (listp for-preload
))
909 (and for-preload
(car for-preload
))
916 (elinstall-find-actions-by-spec
920 (elinstall-add-parameter parameters
921 'def-file new-def-file
))))))
923 ;;$$IMPROVE ME by adding the other cases in the design.
926 ;;;_ . high-level work
927 ;;;_ , elinstall-get-relevant-load-path
928 (defun elinstall-get-relevant-load-path (actions)
938 ;;;_ , elinstall-stage-update-deffiles
939 (defun elinstall-stage-update-deffiles (segment-list force use-load-path
)
940 "Update any deffiles mentioned in SEGMENT-LIST.
941 FORCE and USE-LOAD-PATH have the same meaning as in
942 `elinstall-update-deffile'.
947 ((deffile (car segment
)))
948 (if (stringp deffile
)
949 (elinstall-update-deffile deffile
(cdr segment
) force
952 ;;;_ , elinstall-stage-arrange-preloads
953 (defun elinstall-stage-arrange-preloads (actions deffiles-used
)
954 "Arrange any preloads mentioned in ACTIONS."
961 ((proceed (car act
)))
962 ;;$$TEST whether to proceed
964 #'elinstall-arrange-preload
969 "elinstall-stage-arrange-preloads: Action not
973 ;;;_ , elinstall-stage-run-tests
974 (defun elinstall-stage-run-tests (actions)
975 "Run any tests mentioned in ACTIONS."
981 ;;$$WRITE ME - not a high priority right now.
985 "elinstall-stage-arrange-preloads: Action not
989 ;;;_ , elinstall-stage-byte-compile
990 (defun elinstall-stage-byte-compile (actions)
991 "Do any byte-compilation mentioned in ACTIONS."
996 ;;$$IMPROVE ME Understand flags to control second
997 ;;argument (whether to load file after
1000 (byte-compile-file (second act
)))
1003 "elinstall-stage-arrange-preloads: Action not
1006 ;;;_ , elinstall-do-segment
1009 (defun elinstall-do-segment (segment force use-load-path
)
1010 "Do all the actions in SEGMENT.
1011 FORCE has its usual meaning.
1012 USE-LOAD-PATH is the effective load-path."
1015 ((deffile (car segment
)))
1016 (if (stringp deffile
)
1017 (elinstall-update-deffile deffile
(cdr segment
) force
1019 ;;Do other actions: link-in actions and cleanups.
1026 ((proceed (car act
)))
1028 #'elinstall-arrange-preload
1032 ;;$$WRITE ME - not a high priority right now.
1035 ;;$$IMPROVE ME Understand flags to control second
1036 ;;argument (whether to load file after
1039 (byte-compile-file (second act
)))))
1046 (defun elinstall-x (dir spec
&optional force
)
1050 ;;This is just the default deffile, spec can override it.
1052 (elinstall-expand-deffile-name nil
))
1054 (elinstall-find-actions-by-spec
1059 (def-file .
,def-file
))))
1060 (stages (elinstall-segregate-actions actions
))
1062 (elinstall-get-relevant-load-path
1065 (elinstall-stage-update-deffiles
1066 (elinstall-stages->build-deffiles stages
)
1069 (elinstall-stage-arrange-preloads
1070 (elinstall-stages->arrange-preloads stages
)
1073 (elinstall-stages->build-deffiles stages
)))
1079 (defun elinstall (project-name path spec
&optional force
)
1080 "Install elisp files.
1081 They need not be a formal package.
1085 PROJECT-NAME - the name of the project
1087 PATH - Path to the project.
1088 Suggestion: (elinstall-directory-true-name)
1090 SPEC - a spec for the autoloads etc to make. It can be as simple as
1091 \(dir \"\.\") for installing one directory.
1093 If FORCE is t, install a package even if it has already been
1094 installed. Other non-nil cases of FORCE are reserved for future
1101 (not (elinstall-already-installed project-name
)))
1102 (yes-or-no-p (format "Re-install %s? " project-name
)))
1105 `(def-file "loaddefs.el" (t ,project-name
) ,spec
)
1107 (elinstall-record-installed project-name
)))
1111 ;;;_ , elinstall-update-directory-autoloads
1114 (defun elinstall-update-directory-autoloads (dir)
1117 (interactive "DInstall all elisp files from directory: ")
1122 (elinstall-expand-deffile-name
1123 generated-autoload-file
)))
1127 `(def-file ,def-file-name
(nil) (dir "."))
1132 ;;;_ , elinstall-update-file-autoloads
1135 (defun elinstall-update-file-autoloads (file)
1138 (interactive "fInstall elisp file: ")
1142 (elinstall-maybe-get-deffile file
)
1143 (elinstall-expand-deffile-name
1144 generated-autoload-file
))))
1147 `(def-file ,def-file-name
(nil) (file ,file
)))))
1152 (provide 'elinstall
)
1154 ;;;_ * Local emacs vars.
1155 ;;;_ + Local variables:
1160 ;;; elinstall.el ends here