From 4215a5b56e03a612236e29a20362978e8442d392 Mon Sep 17 00:00:00 2001 From: "Tom Breton (Tehom)" Date: Thu, 11 Nov 2010 11:19:23 -0500 Subject: [PATCH] elinstall-do-segment distinguishes cases --- elinstall.el | 181 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/elinstall.el b/elinstall.el index 4b44b8c..ca07531 100644 --- a/elinstall.el +++ b/elinstall.el @@ -122,7 +122,8 @@ CAUTION: This is sensitive to where it's called. That's the point of it." (add-file-autoloads (if (equal file (third act)) nil - act)))) + act)) + (t act))) actions))) ;;;_ , elinstall-get-autogen-action (defun elinstall-get-autogen-action (file actions) @@ -158,83 +159,82 @@ Return non-nil in the case where no autoloads were added at point. FULL-NAME is the absolute name of the file. RELATIVE-NAME is its name respective to some component of load-path." (let ((outbuf (current-buffer)) - (autoloads-done '()) - (print-length nil) - (print-readably t) ; This does something in Lucid Emacs. - (float-output-format nil) - (done-any nil) - (visited (get-file-buffer full-name)) - output-start) - - ;;Older code massaged `file' but we take both `relative-name' and - ;;`full-name', so we don't. - - (with-current-buffer (or visited - ;; It is faster to avoid visiting the file. - (autoload-find-file full-name)) - ;;$$MOVE ME - this should be checked in action-finding. - ;; Obey the no-update-autoloads file local variable. - (unless no-update-autoloads - (message "Generating autoloads for %s..." relative-name) - (setq output-start (with-current-buffer outbuf (point))) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (not (eobp)) - (skip-chars-forward " \t\n\f") - (cond - ((looking-at (regexp-quote generate-autoload-cookie)) - (search-forward generate-autoload-cookie) - (skip-chars-forward " \t") - (setq done-any t) - (if (eolp) - ;; Read the next form and make an autoload. - (let* ((form (prog1 (read (current-buffer)) - (or (bolp) (forward-line 1)))) - (autoload (make-autoload form load-name))) - (if autoload - (push (nth 1 form) autoloads-done) - (setq autoload form)) - (let ((autoload-print-form-outbuf outbuf)) - (autoload-print-form autoload))) - - ;; Copy the rest of the line to the output. - (princ (buffer-substring - (progn - ;; Back up over whitespace, to preserve it. - (skip-chars-backward " \f\t") - (if (= (char-after (1+ (point))) ? ) - ;; Eat one space. - (forward-char 1)) - (point)) - (progn (forward-line 1) (point))) - outbuf))) - ((looking-at ";") - ;; Don't read the comment. - (forward-line 1)) - (t - (forward-sexp 1) - (forward-line 1)))))) - - (when done-any - (with-current-buffer outbuf - (save-excursion - ;; Insert the section-header line which lists the file name - ;; and which functions are in it, etc. - (goto-char output-start) - (autoload-insert-section-header - outbuf autoloads-done relative-name full-name - (nth 5 (file-attributes full-name))) - (insert ";;; Generated autoloads from " - (autoload-trim-file-name full-name) "\n")) - (insert generate-autoload-section-trailer))) - (message "Generating autoloads for %s...done" relative-name)) - ;;$$OBSOLETE - (unless visited - ;; We created this buffer, so we should kill it. - (kill-buffer (current-buffer)))) - (not done-any))) + (autoloads-done '()) + (print-length nil) + (print-readably t) ; This does something in Lucid Emacs. + (float-output-format nil) + (done-any nil) + (visited (get-file-buffer full-name)) + (source-buf + (or visited + ;; It is faster to avoid visiting the file. + (autoload-find-file full-name))) + output-start) + + (with-current-buffer source-buf + ;;$$MOVE ME - this should be checked in action-finding. + ;; Obey the no-update-autoloads file local variable. + (unless no-update-autoloads + (message "Generating autoloads for %s..." relative-name) + (setq output-start (with-current-buffer outbuf (point))) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (while (not (eobp)) + (skip-chars-forward " \t\n\f") + (cond + ((looking-at (regexp-quote generate-autoload-cookie)) + (search-forward generate-autoload-cookie) + (skip-chars-forward " \t") + (setq done-any t) + (if (eolp) + ;; Read the next form and make an autoload. + (let* ((form (prog1 (read (current-buffer)) + (or (bolp) (forward-line 1)))) + (autoload (make-autoload form load-name))) + (if autoload + (push (nth 1 form) autoloads-done) + (setq autoload form)) + (let ((autoload-print-form-outbuf outbuf)) + (autoload-print-form autoload))) + + ;; Copy the rest of the line to the output. + (princ (buffer-substring + (progn + ;; Back up over whitespace, to preserve it. + (skip-chars-backward " \f\t") + (if (= (char-after (1+ (point))) ? ) + ;; Eat one space. + (forward-char 1)) + (point)) + (progn (forward-line 1) (point))) + outbuf))) + ((looking-at ";") + ;; Don't read the comment. + (forward-line 1)) + (t + (forward-sexp 1) + (forward-line 1)))))) + + (when done-any + (with-current-buffer outbuf + (save-excursion + ;; Insert the section-header line which lists the file name + ;; and which functions are in it, etc. + (goto-char output-start) + (autoload-insert-section-header + outbuf autoloads-done relative-name full-name + (nth 5 (file-attributes full-name))) + (insert ";;; Generated autoloads from " + (autoload-trim-file-name full-name) "\n")) + (insert generate-autoload-section-trailer))) + (message "Generating autoloads for %s...done" relative-name)) + + (unless visited + ;; We created this buffer, so we should kill it. + (kill-buffer (current-buffer)))) + (not done-any))) ;; ;;;_ , elinstall-deffile-insert-autoloads @@ -363,7 +363,7 @@ Current buffer must be a loaddef-style file." (goto-char (point-max)) (search-backward "\f" nil t))) - (elinstall-generate-add-to-path file load-name))) + (elinstall-generate-add-to-path path-element type))) ;;This never belongs in the no-autoloads section. nil)) @@ -385,14 +385,13 @@ Return filename if this action belongs in the no-autoload section." (add-to-load-path (elinstall-deffile-insert-add-to-path - (second action) + (third action) 'add-to-load-path) nil) - - ;;Similar, but for info-path. + (add-to-info-path (elinstall-deffile-insert-add-to-path - (second action) + (third action) 'add-to-info-path) nil) @@ -873,11 +872,17 @@ USE-LOAD-PATH is the effective load-path." ;;Do other actions: link-in actions and cleanups. (mapcar #'(lambda (act) - ;;$$FIXME Distinguish link-in and cleanup actions. - (apply - #'elinstall-link-on-emacs-start - force - (cdr act))) + + (case (car act) + (preload-file + (apply + #'elinstall-link-on-emacs-start + force + (cdr act))) + ;;$$PUNT do nothing. + (close-buffer) + (byte-compile))) + (cdr segment))))) -- 2.11.4.GIT