home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / alt / lucidem / help / 803 < prev    next >
Encoding:
Text File  |  1992-12-15  |  8.5 KB  |  223 lines

  1. Newsgroups: alt.lucid-emacs.help
  2. Path: sparky!uunet!mcsun!sunic!dkuug!daimi!lynbech
  3. From: lynbech@daimi.aau.dk (Christian Lynbech)
  4. Subject: Proposed change to byte-recompile-directory
  5. Message-ID: <1992Dec15.091234.5065@daimi.aau.dk>
  6. Keywords: bytecomp byte-recompile-directory 
  7. Sender: news@daimi.aau.dk
  8. Organization: DAIMI: Computer Science Department, Aarhus University, Denmark
  9. Date: Tue, 15 Dec 92 09:12:34 GMT
  10. Lines: 211
  11.  
  12. I would like to propose the following change to the function
  13. byte-recompile-directory in lisp/bytecomp/bytecomp.el
  14.  
  15. In the current implementation, a recompilation is aborted whenever a file fails
  16. to be compiled. An error is generated and the rest of the files in the
  17. specified directories is discarded.
  18.  
  19. Instead, I will suggest, it should be possible to continue to compile the rest
  20. of the files. I hit this problem when I was trying to recompile the lucid lisp
  21. distribution from scratch. There are files which cannot (and some should not)
  22. be compiled, for instance some epoch related files, and as I maintain the lucid
  23. distribution under cvs, I do not by default store the .elc files, and I would
  24. like to be able to use the cvs export facility.
  25.  
  26. Below my signature is a patch included, containing my own attempt of
  27. implementing the above functionality. Note that this has not been extensively
  28. tested.
  29.  
  30. I have labelled this version as 2.08a so it may be distinguished from the
  31. official versions.
  32.  
  33.  
  34. ------------------------------------------------------------------------------
  35. Christian Lynbech
  36.  
  37. DAIMI                        office: R0.32   phone: 5034
  38. University of Aarhus,DK-Denmark                 email: lynbech@daimi.aau.dk
  39. ------------------------------------------------------------------------------
  40.               EMACS, The One True Editor                       
  41.  
  42.  
  43. Hit the philistines three times over the head with the Elisp reference manual.
  44.  
  45.                                         - petonic@hal.com (Michael A. Petonic)
  46.  
  47.  
  48.  
  49. ===================================================================
  50. RCS file: /users/src/LucidEmacs-19/REPOSITORY/LucidEmacs/lisp/bytecomp/bytecomp.el,v
  51. retrieving revision 1.1.1.1
  52. diff -c -r1.1.1.1 bytecomp.el
  53. *** 1.1.1.1    1992/09/30 13:53:02
  54. --- bytecomp.el    1992/12/15 08:58:20
  55. ***************
  56. *** 4,11 ****
  57.   
  58.   ;; By Jamie Zawinski <jwz@lucid.com> and Hallvard Furuseth <hbf@ulrik.uio.no>.
  59.   
  60. ! (defconst byte-compile-version "2.08; 27-aug-92.")
  61.   
  62.   ;; This file is part of GNU Emacs.
  63.   
  64.   ;; GNU Emacs is free software; you can redistribute it and/or modify
  65. --- 4,14 ----
  66.   
  67.   ;; By Jamie Zawinski <jwz@lucid.com> and Hallvard Furuseth <hbf@ulrik.uio.no>.
  68.   
  69. ! ;; byte-recompile-directory enhanced by
  70. ! ;; Christian Lynbech <lynbech@daimi.aau.dk>
  71.   
  72. + (defconst byte-compile-version "2.08a; 15-Dec-92.")
  73.   ;; This file is part of GNU Emacs.
  74.   
  75.   ;; GNU Emacs is free software; you can redistribute it and/or modify
  76. ***************
  77. *** 53,58 ****
  78. --- 56,62 ----
  79.   ;;;  + correct compilation of nested defuns, defmacros, defvars and defsubsts;
  80.   ;;;  + correct compilation of top-level uses of macros;
  81.   ;;;  + the ability to generate a histogram of functions called.
  82. + ;;;  + recompilation can continue even if some files fails
  83.   
  84.   ;;; User customization variables:
  85.   ;;;
  86. ***************
  87. *** 106,111 ****
  88. --- 110,118 ----
  89.   ;;;                see also the function byte-compile-dest-file.
  90.   ;;; byte-compile-overwrite-file    If nil, delete old .elc files before saving.
  91.   ;;;
  92. + ;;; byte-compile-recompile-continue     Determine what should happen when a
  93. + ;;;                             file fails compilation.
  94. + ;;;                             
  95.   ;;; Most of the above parameters can also be set on a file-by-file basis; see
  96.   ;;; the documentation of the `byte-compiler-options' macro.
  97.   
  98. ***************
  99. *** 162,167 ****
  100. --- 169,179 ----
  101.   ;;;  o  If you run byte-compile-file on a filename which is visited in a 
  102.   ;;;     buffer, and that buffer is modified, you are asked whether you want
  103.   ;;;     to save the buffer before compiling.
  104. + ;;;
  105. + ;;;  o  If you run byte-recompile-directory and a file fails compilation
  106. + ;;;     there are several options for handling this, including continuing.
  107. + ;;;     See variable byte-compile-recompile-continue for further information.
  108. + ;;;
  109.   
  110.   (or (fboundp 'defsubst)
  111.       ;; This really ought to be loaded already!
  112. ***************
  113. *** 325,330 ****
  114. --- 337,350 ----
  115.   is a symbolic link will be turned into a normal file, instead of the file
  116.   which the link points to being overwritten.")
  117.   
  118. + (defvar byte-compile-recompile-continue nil
  119. +   "*If this variable is nil, recompilation is stopped with an error if any
  120. + file fails compilation.
  121. + If it is t, recompilation is just continued with the remaining files.
  122. + If not nil and not t, ask for confirmation before continuing.
  123. + If recompilation is continued, a note is made int the buffer
  124. + `*Recompile Log*', describing which file failed and what the error was.")
  125.   (defvar byte-compile-constants nil
  126.     "list of all constants encountered during compilation of this form")
  127.   (defvar byte-compile-variables nil
  128. ***************
  129. *** 1096,1107 ****
  130.   If the `.elc' file does not exist, normally the `.el' file is *not* compiled.
  131.   But a prefix argument (optional second arg) means ask user,
  132.   for each such `.el' file, whether to compile it.  Prefix argument 0 means
  133. ! don't ask and compile the file anyway."
  134.     (interactive "DByte recompile directory: \nP")
  135.     (save-some-buffers)
  136.     (set-buffer-modified-p (buffer-modified-p))  ;Update the mode line.
  137.     (let ((directories (list (expand-file-name directory)))
  138.       (file-count 0)
  139.       (dir-count 0)
  140.       last-dir)
  141.       (displaying-byte-compile-warnings
  142. --- 1116,1133 ----
  143.   If the `.elc' file does not exist, normally the `.el' file is *not* compiled.
  144.   But a prefix argument (optional second arg) means ask user,
  145.   for each such `.el' file, whether to compile it.  Prefix argument 0 means
  146. ! don't ask and compile the file anyway.
  147. ! What should happen if a file fails compilation is determined by the variable
  148. ! byte-compile-recompile-continue. See this for a further explanation."
  149.     (interactive "DByte recompile directory: \nP")
  150.     (save-some-buffers)
  151.     (set-buffer-modified-p (buffer-modified-p))  ;Update the mode line.
  152. +   (and (get-buffer "*Recompile Log*")
  153. +        (kill-buffer "*Recompile Log*"))    ;remove old recompilation log
  154.     (let ((directories (list (expand-file-name directory)))
  155.       (file-count 0)
  156. +     (fail-count 0)
  157.       (dir-count 0)
  158.       last-dir)
  159.       (displaying-byte-compile-warnings
  160. ***************
  161. *** 1127,1134 ****
  162.               (and arg
  163.                    (or (eq 0 arg)
  164.                    (y-or-n-p (concat "Compile " source "? "))))))
  165. !          (progn (byte-compile-file source)
  166. !             (setq file-count (1+ file-count))
  167.               (if (not (eq last-dir directory))
  168.                   (setq last-dir directory
  169.                     dir-count (1+ dir-count)))
  170. --- 1153,1172 ----
  171.               (and arg
  172.                    (or (eq 0 arg)
  173.                    (y-or-n-p (concat "Compile " source "? "))))))
  174. !          (progn (condition-case err
  175. !                 (progn (byte-compile-file source)
  176. !                    (setq file-count (1+ file-count)))
  177. !               (error (if (or
  178. !                       (null byte-compile-recompile-continue)
  179. !                       (and (not (equal t byte-compile-recompile-continue))
  180. !                        (not (y-or-n-p "Continue recompilation? "))))
  181. !                      (error "Compilation error %s" (cdr err))
  182. !                    (setq fail-count (1+ fail-count))
  183. !                    (save-excursion
  184. !                      (set-buffer (get-buffer-create
  185. !                           "*Recompile Log*"))
  186. !                      (insert (format "** Error in file %s\n\t%s\n\n"
  187. !                              source err))))))
  188.               (if (not (eq last-dir directory))
  189.                   (setq last-dir directory
  190.                     dir-count (1+ dir-count)))
  191. ***************
  192. *** 1135,1143 ****
  193.               )))
  194.          (setq files (cdr files))))
  195.          (setq directories (cdr directories))))
  196. !     (message "Done (Total of %d file%s compiled%s)"
  197.            file-count (if (= file-count 1) "" "s")
  198. !          (if (> dir-count 1) (format " in %d directories" dir-count) ""))))
  199.   
  200.   (defun byte-compile-file (filename &optional load)
  201.     "Compile a file of Lisp code named FILENAME into a file of byte code.
  202. --- 1173,1188 ----
  203.               )))
  204.          (setq files (cdr files))))
  205.          (setq directories (cdr directories))))
  206. !     (and (get-buffer "*Recompile Log*")
  207. !      (display-buffer "*Recompile Log*"))
  208. !     (message "Done (Total of %d file%s compiled%s%s)"
  209.            file-count (if (= file-count 1) "" "s")
  210. !          (if (> dir-count 1) (format " in %d directories" dir-count) "")
  211. !          (if (> fail-count 0)
  212. !          (format ". %d file%s failed compilation"
  213. !              fail-count (if (> fail-count 1) "s" ""))
  214. !            "")
  215. !     )))
  216.   
  217.   (defun byte-compile-file (filename &optional load)
  218.     "Compile a file of Lisp code named FILENAME into a file of byte code.
  219.  
  220.