Added COPYING (GPL3)
[elinstall.git] / elinstall.el
blobc70c9d2123a882a6d7451c98ac4f69cbd82280ac
1 ;;;_ elinstall.el --- Automatically and flexibly install elisp files
3 ;;;_. Headers
4 ;;;_ , License
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)
13 ;; any later version.
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.
25 ;;;_ , Commentary:
27 ;; Entry points:
28 ;; elinstall Use this for overall loading
30 ;; elinstall-link-on-emacs-start - Use this for non-autogenerated
31 ;; files that need to be linked in.
33 ;;;_ , Requires
35 (require 'autoload)
36 (require 'pp)
37 (require 'cus-edit) ;;Because we save "installedness" manually
40 ;;;_. Body
41 ;;;_ , Customizations
42 (defgroup elinstall
43 '()
44 "Customizations for elinstall"
45 :group 'elinstall)
47 (defcustom elinstall-default-priority
49 "Default priority for site-start"
50 :group 'elinstall
51 :type 'integer)
53 (defcustom elinstall-default-target-dir
54 "~/.emacs.d/site-start.d/"
55 "Default target for registering autoloads"
56 :group 'elinstall
57 :type
58 '(choice
59 (const "~/.emacs.d/site-start.d/")
60 (const "/etc/emacs/site-start.d/")
61 (directory "" )
62 (const 'dot-emacs)))
65 (defcustom elinstall-already-installed
66 '()
67 "Things that have already been installed.
68 This exists for recording what has been installed. User interaction is not
69 contemplated at this time." )
71 ;;;_ , Utilities
72 ;;;_ . elinstall-directory-true-name
73 (defun elinstall-directory-true-name ()
74 "Get the true name of the directory the calling code lives in.
75 CAUTION: This is sensitive to where it's called. That's the point of it."
76 (file-name-directory
77 (if load-file-name
78 (file-truename load-file-name)
79 (file-truename buffer-file-name))))
80 ;;;_ . Checking installedness
81 ;;;_ , elinstall-already-installed
82 (defun elinstall-already-installed (project-name)
83 "Return non-nil if PROJECT-NAME has been installed."
84 (member project-name elinstall-already-installed))
86 ;;;_ , elinstall-record-installed
87 (defun elinstall-record-installed (project-name)
88 "Record that PROJECT-NAME has been installed."
90 (add-to-list 'elinstall-already-installed project-name)
91 (customize-save-variable
92 'elinstall-already-installed
93 elinstall-already-installed
94 "Set by elinstall-record-installed"))
96 ;;;_ , Regular expressions
97 ;;;_ . elinstall-elisp-regexp
98 (defconst elinstall-elisp-regexp
99 (let ((tmp nil))
100 (dolist
101 (suf (get-load-suffixes))
102 (unless (string-match "\\.elc" suf) (push suf tmp)))
103 (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))
104 "Regular expression that matches elisp files" )
106 ;;;_ , Work
107 ;;;_ . Doing actions
108 ;;;_ , elinstall-insert-add-to-path
109 (defun elinstall-insert-add-to-path (new path-sym)
110 "Insert code to add NEW to PATH-SYM.
111 Insert this at point in current buffer."
112 (insert "\n")
114 `(add-to-list ',path-sym
115 (expand-file-name ,new
116 (if load-file-name
117 (file-name-directory
118 (file-truename load-file-name)))))
119 (current-buffer)))
121 ;;;_ , elinstall-insert-add-to-load-path
122 (defun elinstall-insert-add-to-load-path (new)
123 "Insert code to add NEW to load-path.
124 Insert this at point in current buffer."
125 (elinstall-insert-add-to-path new 'load-path))
127 ;;;_ , elinstall-insert-add-to-info-path
128 (defun elinstall-insert-add-to-info-path (new)
129 "Insert code to add NEW to info-path.
130 Insert this at point in current buffer."
131 (elinstall-insert-add-to-path new 'Info-default-directory-list))
133 ;;;_ , Linking on start
134 ;;;_ . elinstall-insert-dir-autoloads
135 (defun elinstall-symlink-on-emacs-start
136 (filename target-basename target-dir &optional priority force)
137 "Symlink to TARGET-BASENAME.el in TARGET-DIR
139 If PRIORITY is given, it will be used as the priority prefix,
140 otherwise elinstall-default-priority will be.
141 PRIORITY must be an integer or nil.
142 If FORCE is `t', do it regardless of timestamps etc.
143 Other non-nil cases of FORCE are reserved for future development."
144 (let*
146 (priority (or priority elinstall-default-priority))
147 (target-name-nodir
148 (format
149 "%d%s.el"
150 priority
151 target-basename))
152 (target
153 (expand-file-name target-name-nodir target-dir)))
156 (cond
157 ;;Path should already exist.
158 ((not
159 (file-exists-p target-dir))
160 (message "The target directory doesn't exist."))
161 ;;Target shouldn't already exist, but if force is given, let
162 ;;user override.
163 ((and
164 (file-exists-p target)
166 (not force)
167 (not
168 (yes-or-no-p
169 (format "Really overwrite %s? " project-name))))
170 (message "No symlink made to %s" target)))
173 (make-symbolic-link
174 filename
175 target
176 nil)))))
178 ;;;_ . elinstall-add-to-dot-emacs
179 (defun elinstall-add-to-dot-emacs (dot-emacs-name filename force &rest r)
180 "Add code to load FILENAME to .emacs.
181 FILENAME should not have an extension"
183 ;;Visit .emacs
184 (with-current-buffer (find-file-noselect dot-emacs-name)
185 (save-excursion
186 ;;add at end of file
187 (goto-char (point-max))
188 (insert "\n;;Added by elinstall")
189 (insert "\n;;Consider using my-site-start to manage .emacs\n")
190 (pp `(load ,filename) (current-buffer))
191 (save-buffer))))
194 ;;;_ . elinstall-link-on-emacs-start
195 ;;;###autoload
196 (defun elinstall-link-on-emacs-start (filename force basename priority)
199 ;;Figure out parameters, using defaults when needed.
200 (let*
201 ( (target-dir elinstall-default-target-dir))
203 ;;Dispatch the possibilities.
204 (cond
205 ((eq target-dir 'dot-emacs)
206 (elinstall-add-to-dot-emacs "~/.emacs" filename))
207 ((stringp target-dir)
208 (elinstall-symlink-on-emacs-start
209 filename basename target-dir priority force))
212 (message "I don't recognize that")))))
214 ;;;_ , elinstall-insert-dir-autoloads
215 (defun elinstall-insert-dir-autoloads (autoloads-file directory)
216 "Generate autoloads for DIRECTORY into AUTOLOADS-FILE."
217 (declare (special generated-autoload-file))
218 (let ((generated-autoload-file autoloads-file))
219 (elinstall-update-directory-autoloads directory)))
221 ;;;_ , elinstall-segregate-actions
222 (defun elinstall-segregate-actions (actions)
223 "Return actions segregated by deffile.
225 Returns a list whose elements are each a cons of:
226 * deffile filename or nil
227 * A list of actions to be done for that deffile."
229 (let
230 ((segment-list '()))
231 (dolist (act actions)
232 (when act
233 (let*
234 ( (deffile-name
235 (case (car act)
236 ((add-file-autoloads
237 add-to-info-path
238 add-to-load-path)
239 (second act))
240 (preload-file nil)))
242 (cell (assoc deffile-name segment-list)))
243 (if cell
244 (setcdr cell (cons act (cdr cell)))
245 (setq segment-list
246 (cons
247 (cons
248 deffile-name
249 (list act))
250 segment-list))))))
251 segment-list))
254 ;;;_ , elinstall-do-segment
255 (defun elinstall-do-segment (segment force)
258 (let*
259 ((deffile (car segment)))
260 (if deffile
261 nil ;;
262 ;;Do other actions, which will be all link-in actions.
263 (mapcar
264 #'(lambda (act)
265 (apply #'elinstall-link-on-emacs-start force (cdr action))
267 (cdr segment)))))
271 ;;;_ . Overrides (All adapted from autoload.el)
272 ;;;_ , elinstall-generate-file-autoloads
273 ;;override to allow slashed load-paths
274 ;;Quick and dirty: We just adapt `generate-file-autoloads' and add
275 ;;a new arg.
276 ;;`relative-to' can be:
277 ;; * nil: act as at present. Assume that FILE's immediate directory
278 ;;is in load-path.
279 ;; * t :: use default-directory
280 ;; * a string :: relative to it, as a filename
282 (defun elinstall-generate-file-autoloads (file load-name)
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
287 are used.
288 Return non-nil in the case where no autoloads were added at point."
289 (interactive "fGenerate autoloads for file: ")
290 (let ((outbuf (current-buffer))
291 (autoloads-done '())
292 (print-length nil)
293 (print-readably t) ; This does something in Lucid Emacs.
294 (float-output-format nil)
295 (done-any nil)
296 (visited (get-file-buffer file))
297 output-start)
299 ;; If the autoload section we create here uses an absolute
300 ;; file name for FILE in its header, and then Emacs is installed
301 ;; under a different path on another system,
302 ;; `update-autoloads-here' won't be able to find the files to be
303 ;; autoloaded. So, if FILE is in the same directory or a
304 ;; subdirectory of the current buffer's directory, we'll make it
305 ;; relative to the current buffer's directory.
306 (setq file (expand-file-name file))
307 (let* ((source-truename (file-truename file))
308 (dir-truename (file-name-as-directory
309 (file-truename default-directory)))
310 (len (length dir-truename)))
311 (if (and (< len (length source-truename))
312 (string= dir-truename (substring source-truename 0 len)))
313 (setq file (substring source-truename len))))
315 (with-current-buffer (or visited
316 ;; It is faster to avoid visiting the file.
317 (autoload-find-file file))
318 ;; Obey the no-update-autoloads file local variable.
319 (unless no-update-autoloads
320 (message "Generating autoloads for %s..." file)
321 (setq output-start (with-current-buffer outbuf (point)))
322 (save-excursion
323 (save-restriction
324 (widen)
325 (goto-char (point-min))
326 (while (not (eobp))
327 (skip-chars-forward " \t\n\f")
328 (cond
329 ((looking-at (regexp-quote generate-autoload-cookie))
330 (search-forward generate-autoload-cookie)
331 (skip-chars-forward " \t")
332 (setq done-any t)
333 (if (eolp)
334 ;; Read the next form and make an autoload.
335 (let* ((form (prog1 (read (current-buffer))
336 (or (bolp) (forward-line 1))))
337 (autoload (make-autoload form load-name)))
338 (if autoload
339 (push (nth 1 form) autoloads-done)
340 (setq autoload form))
341 (let ((autoload-print-form-outbuf outbuf))
342 (autoload-print-form autoload)))
344 ;; Copy the rest of the line to the output.
345 (princ (buffer-substring
346 (progn
347 ;; Back up over whitespace, to preserve it.
348 (skip-chars-backward " \f\t")
349 (if (= (char-after (1+ (point))) ? )
350 ;; Eat one space.
351 (forward-char 1))
352 (point))
353 (progn (forward-line 1) (point)))
354 outbuf)))
355 ((looking-at ";")
356 ;; Don't read the comment.
357 (forward-line 1))
359 (forward-sexp 1)
360 (forward-line 1))))))
362 (when done-any
363 (with-current-buffer outbuf
364 (save-excursion
365 ;; Insert the section-header line which lists the file name
366 ;; and which functions are in it, etc.
367 (goto-char output-start)
368 (autoload-insert-section-header
369 outbuf autoloads-done load-name file
370 (nth 5 (file-attributes file)))
371 (insert ";;; Generated autoloads from "
372 (autoload-trim-file-name file) "\n"))
373 (insert generate-autoload-section-trailer)))
374 (message "Generating autoloads for %s...done" file))
375 (or visited
376 ;; We created this buffer, so we should kill it.
377 (kill-buffer (current-buffer))))
378 (not done-any)))
380 ;;;_ , elinstall-old-prepare-deffile
381 ;;Old code from autoload.
382 (defun elinstall-old-prepare-deffile (deffile)
385 (autoload-ensure-default-file deffile)
386 (with-current-buffer (find-file-noselect deffile)
389 ;; We must read/write the file without any code conversion,
390 ;; but still decode EOLs.
391 (let ((coding-system-for-read 'raw-text))
393 ;; This is to make generated-autoload-file have Unix EOLs, so
394 ;; that it is portable to all platforms.
395 (setq buffer-file-coding-system 'raw-text-unix))
396 (or (> (buffer-size) 0)
397 (error "Autoloads file %s does not exist" buffer-file-name))
398 (or (file-writable-p buffer-file-name)
399 (error "Autoloads file %s is not writable"
400 buffer-file-name))))
402 ;;;_ , elinstall-old-get-deffile
403 ;;Old code from autoload.
405 (defun elinstall-old-get-deffile (file)
406 "Return the appropriate loaddefs file for FILE."
408 (save-excursion
409 (let*
410 ((existing-buffer (get-file-buffer file)))
412 ;; We want to get a value for generated-autoload-file from
413 ;; the local variables section if it's there.
414 ;;But if it's not loaded, we don't? Maybe should use
415 ;; `autoload-find-file' and load it.
416 (if existing-buffer
417 (set-buffer existing-buffer))
418 ;;No, we only want it if a local variable forces it to this
419 ;; value.
420 (expand-file-name generated-autoload-file
421 (expand-file-name "lisp"
422 source-directory)))))
426 ;;;_ , elinstall-deffile-insert
427 ;;This now operates in the current buffer. We already did most of
428 ;;this checking on setup.
429 ;; Removed
430 ;; * buffer optional save,
431 ;; * converting file to load-name
432 ;; * checking for timestamp
433 (defun elinstall-deffile-insert-x (file load-name)
434 "Update the autoloads for FILE in `generated-autoload-file'
435 \(which FILE might bind in its local variables).
437 LOAD-NAME is the full name of the file
440 Return FILE if there was no autoload cookie in it, else nil."
441 (let (
442 (found nil)
443 (no-autoloads nil))
445 (save-excursion
446 (save-restriction
447 (widen)
448 (goto-char (point-min))
449 ;; Look for the section for FILE
450 (while (and (not found)
451 (search-forward generate-autoload-section-header nil t))
452 (let ((form (autoload-read-section-header)))
453 (cond
454 ((string= (nth 2 form) file)
455 ;; We found the section for this file.
456 ;; Check if it is up to date.
457 (let ((begin (match-beginning 0)))
458 (progn
459 (search-forward generate-autoload-section-trailer)
460 (delete-region begin (point))
461 (setq found t))))
462 ((string< file (nth 2 form))
463 ;; We've come to a section alphabetically later than
464 ;; FILE. We assume the file is in order and so
465 ;; there must be no section for FILE. We will
466 ;; insert one before the section here.
467 (goto-char (match-beginning 0))
468 (setq found 'new)))))
469 (unless found
470 (progn
471 (setq found 'new)
472 ;; No later sections in the file. Put before the last page.
473 (goto-char (point-max))
474 (search-backward "\f" nil t)))
475 (setq no-autoloads
476 (elinstall-generate-file-autoloads file load-name))))
478 (if no-autoloads file nil)))
480 ;;;_ , elinstall-deffile-insert
482 (defun elinstall-deffile-insert (action)
483 "Insert autoloads or similar into current file according to ACTION.
484 The format of ACTION is described in the design docs.
486 Return filename if this action belongs in the no-autoload section."
488 (when action
489 (case (car action)
490 (let
491 ((filename
492 (third action)))
493 (add-file-autoloads
494 (elinstall-deffile-insert-x
495 filename
496 (expand-file-name
497 filename
498 (fourth action)))))
500 (add-to-load-path
501 ;;Go to the right position, then call:
502 '(elinstall-insert-add-to-load-path)
503 nil)
505 ;;Similar, but for info-path.
506 (add-to-info-path
507 'elinstall-insert-add-to-info-path
508 nil)
510 (preload-file
511 (error "This case should not come here.")))))
514 ;;;_ , elinstall-remove-autogen-action
515 (defun elinstall-remove-autogen-action (file actions)
516 "Return ACTIONS minus any add-file-autoloads on FILE removed."
518 (delq nil
519 (mapcar
520 #'(lambda (act)
521 (case (car act)
522 (add-file-autoloads
523 (if (equal file (third act))
525 act))))
526 actions)))
527 ;;;_ , elinstall-get-autogen-action
528 (defun elinstall-get-autogen-action (file actions)
530 (let
531 ((the-act))
532 (dolist (act actions)
533 (case (car act)
534 (add-file-autoloads
535 (when (equal file (third act))
536 (setq the-act act)))))
537 the-act))
539 ;;;_ , elinstall-update-deffile
541 ;;Adapted from autoload.el `update-directory-autoloads'.
542 ;;Still being adapted:
544 ;; * Still need to treat add-to-info-path and
545 ;;add-to-load-path. Both recognize them and insert them.
546 ;; * Adapt `elinstall-update-file-autoloads' to understand actions.
548 ;; * Finding "file" among actions is rickety. Maybe knowing the
549 ;; respective load-path element would help.
551 (defun elinstall-update-deffile (target actions &optional
552 use-load-path force)
554 Update file TARGET with current autoloads as specified by ACTIONS.
555 Also remove any old definitions pointing to libraries that can no
556 longer be found.
558 ACTIONS must be a list of actions (See the format doc). Each one's
559 filename must be relative to some element of load-path.
561 USE-LOAD-PATH is a list to use as load-path. It should include
562 any new load-path that we are arranging to create. If it's not given,
563 load-path itself is used.
565 If FORCE is `t', do it regardless of timestamps etc. (Not implemented)
566 Other non-nil cases of FORCE are reserved for future development.
568 This uses `update-file-autoloads' (which see) to do its work.
569 In an interactive call, you must give one argument, the name
570 of a single directory."
571 (let
573 (use-load-path (or use-load-path load-path))
574 (this-time (current-time))
575 ;;files with no autoload cookies.
576 (no-autoloads nil))
579 (with-current-buffer
580 (find-file-noselect target)
581 (save-excursion
582 (setq actions
583 (elinstall-remove-autogen-action
584 (autoload-trim-file-name target)
585 actions))
587 (goto-char (point-min))
588 (while (search-forward generate-autoload-section-header nil t)
589 (let* ((form (autoload-read-section-header))
590 (file (nth 3 form)))
591 (cond ((and (consp file) (stringp (car file)))
592 ;; This is a list of files that have no
593 ;; autoload cookies.
594 ;; There shouldn't be more than one such entry.
595 ;; Remove the obsolete section.
596 (autoload-remove-section (match-beginning 0))
597 (let ((last-time (nth 4 form)))
598 (dolist (file file)
599 (let ((file-time (nth 5 (file-attributes file))))
600 (when (and file-time
601 (not (time-less-p last-time file-time)))
602 ;; file unchanged
603 (push file no-autoloads)
604 (setq actions
605 (elinstall-remove-autogen-action
606 file actions)))))))
607 ((not (stringp file)))
609 (let
610 ((file-path
611 (locate-library file nil use-load-path)))
612 (cond
613 ;;File doesn't exist, so remove its
614 ;;section.
615 ((not file-path)
616 (autoload-remove-section
617 (match-beginning 0)))
619 ;; File hasn't changed, so do nothing.
620 ((equal
621 (nth 4 form)
622 (nth 5 (file-attributes file-path)))
623 nil)
625 (elinstall-deffile-insert
626 (elinstall-get-autogen-action file))))
628 (setq actions
629 (elinstall-remove-autogen-action
630 file actions))))))))
632 ;; Remaining actions have no existing autoload sections yet.
633 (setq no-autoloads
634 (append no-autoloads
635 (delq nil (mapcar #'elinstall-deffile-insert actions))))
636 (when no-autoloads
637 ;; Sort them for better readability.
638 (setq no-autoloads (sort no-autoloads 'string<))
639 ;; Add the `no-autoloads' section.
640 (goto-char (point-max))
641 (search-backward "\f" nil t)
642 (autoload-insert-section-header
643 (current-buffer) nil nil no-autoloads this-time)
644 (insert generate-autoload-section-trailer))
645 (save-buffer))))
647 ;;;_ . Finding actions
648 ;;;_ , Treating the parameter list
649 ;;;_ . elinstall-add-parameter
650 (defun elinstall-add-parameter (alist key new-value)
651 "Add a new value for KEY to ALIST"
653 (cons
654 (cons key new-value)
655 (assq-delete-all key (copy-list alist))))
657 ;;;_ . elinstall-get-parameter
658 (defun elinstall-get-parameter (alist key)
659 "Get the value of KEY from ALIST"
661 (cdr (assq key alist)))
662 ;;;_ . elinstall-expand-filename
663 (defun elinstall-expand-filename (filename alist)
664 "Expand FILENAME by the value of `path' in ALIST"
666 (expand-file-name
667 filename
668 (elinstall-get-parameter alist 'path)))
670 ;;;_ , elinstall-find-actions-by-spec
672 (defun elinstall-find-actions-by-spec (spec load-path-element path parameters)
673 "Return a list of actions to do, controlled by SPEC and PARAMETERS.
675 LOAD-PATH-ELEMENT is the conceptual element of load-path that
676 surrounds PATH. It may not yet have been added to load-path."
677 (if (consp spec)
678 ;;$$IMPROVE ME by adding the other cases in the design.
679 (case (car spec)
681 (let
682 ((new-path
683 (expand-filename
684 (second spec)
685 path)))
687 (elinstall-find-actions-by-spec
688 (third spec)
689 load-path-element
690 new-path
691 parameters)))
693 (all
694 (apply #'append
695 (mapcar
696 #'(lambda (sub-spec)
697 (elinstall-find-actions-by-spec
698 sub-spec
699 load-path-element
700 path
701 parameters))
702 (cdr spec))))
704 (dir
705 (let
706 ((dirname
707 (expand-filename
708 (second spec)
709 path))
710 (load-path-here
711 (not
712 (elinstall-get-parameter
713 parameters 'block-add-to-load-path))))
714 (cons
715 (if load-path-here
716 `(add-to-load-path
717 ,(elinstall-get-parameter
718 parameters 'def-file)
719 ,dirname)
720 '())
721 ;;$$IMPROVE ME
722 ;; We want to get a value for generated-autoload-file
723 ;; from the local variables section if it's there.
724 ;; Otherwise we'll use `def-file' in parameters.
726 ;;$$FIXME This isn't quite right. If directory
727 ;;itself is not in load-path, this will be wrong.
728 ;;Gotta know where our encompassing part of
729 ;;load-path is.
730 (mapcar
731 #'(lambda (filename)
732 `(add-file-autoloads
733 ,(elinstall-get-parameter
734 parameters 'def-file)
735 (file-relative-name
736 (expand-filename filename path)
737 load-path-element)
738 load-path-element))
740 (directory-files
741 dirname
742 nil ;;Relative filenames
743 elinstall-elisp-regexp)))))
745 (def-file
746 (let
747 ((new-def-file
748 (elinstall-expand-filename
749 (second spec)
750 parameters)))
751 (elinstall-find-actions-by-spec
752 (third spec)
753 load-path-element
754 path
755 (elinstall-add-parameter parameters
756 'def-file new-def-file)))))
758 ;;$$IMPROVE ME by adding the other cases in the design.
759 (case spec
760 (t))))
762 ;;;_ . Cleaning up
763 ;;Nothing yet
764 ;;;_ . elinstall-x
765 (defun elinstall-x (dir spec &optional target force)
768 (let*
772 ;;;_ , Entry points
773 (defun elinstall (project-name dir spec &optional target force)
774 "Install elisp files.
776 They need not be presented as a package.
778 Parameters:
779 PROJECT-NAME - the name of the project
780 DIR - the root directory of the project.
781 Suggestion: (elinstall-directory-true-name)
783 SPEC - a spec for the autoloads etc to make. It can be as simple as
784 `(in DIRECTORY t).
785 Suggestion: `(in ,(elinstall-directory-true-name) t)
786 TARGET is where the autoload files are to be symlinked in. If
787 `nil' `elinstall-default-target' is used instead.
789 If FORCE is t, install a package even if it has already been
790 installed.
791 Other non-nil cases of FORCE are reserved for future development."
793 (when
794 (and
795 (or
796 force
797 (not (elinstall-already-installed project-name)))
798 ;;$$REMOVE ME - I commented it out just for development.
799 '(yes-or-no-p (format "Install %s " project-name)))
800 (let *
801 ((actions
802 (elinstall-find-actions-by-spec
803 spec
807 ;;$$RETHINK ME - maybe hand this work off to autoload?
808 ;;This is just the default loaddefs file, spec actually
809 ;;controls it.
810 (def-file . "elinstall-loaddefs.el" ))))
811 (segment-list (elinstall-segregate-actions actions)))
813 (mapcar
814 #'(lambda (segment)
815 (elinstall-do-segment segment force))
816 segment-list)
817 ;;$$REMOVE ME - I commented it out just for development.
818 '(elinstall-record-installed project-name))))
821 ;;;_ , elinstall-update-directory-autoloads
822 ;;$$PUNT
823 (defun elinstall-update-directory-autoloads (dir)
826 (interactive "DUpdate autoloads from directory: ")
828 (elinstall
829 ;;$$IMPROVE ME make DIR absolute
830 (format "Elisp files of %s" dir)
832 '(dir ".")
833 (autoload-ensure-default-file
834 (expand-file-name generated-autoload-file
835 (expand-file-name "lisp" source-directory)))))
838 ;;;_ , elinstall-update-file-autoloads
839 ;;$$PUNT
840 (defun elinstall-update-file-autoloads (file &optional save-after)
843 (interactive "fUpdate autoloads for file: \np")
844 (elinstall
845 (format "Elisp file %s" file)
847 `(file ,file)
848 (autoload-ensure-default-file
849 (expand-file-name generated-autoload-file
850 (expand-file-name "lisp" source-directory))))
856 ;;;_. Footers
857 ;;;_ , Provides
859 (provide 'elinstall)
861 ;;;_ * Local emacs vars.
862 ;;;_ + Local variables:
863 ;;;_ + mode: allout
864 ;;;_ + End:
866 ;;;_ , End
867 ;;; elinstall.el ends here