APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1535918604 -3600
#      Sun Sep 02 21:03:24 2018 +0100
# Node ID 9851c4a033df9f2b33ae5cea984efa69ef1f8012
# Parent  a771016803ed16b7d614d188f8ae21cc2056e396
Use #'eval-when in those places it's clearer than #'eval-when-compile
lisp/ChangeLog addition:
2018-09-02  Aidan Kehoe  <kehoea(a)parhasard.net>
	* byte-optimize.el:
	* byte-optimize.el (:execute):
	* bytecomp.el (:execute):
	* cl-extra.el:
	* cl-extra.el (:execute):
	* cl-extra.el (streamp):
	* cl-macs.el:
	* cus-face.el:
	* cus-face.el (:compile-toplevel):
	* easy-mmode.el:
	* help.el:
	* help.el (:execute):
	* info.el (:compile-toplevel):
	* info.el (unless):
	* regexp-opt.el (regexp-opt-group):
	* syntax-ppss.el (font-lock-beginning-of-syntax-function):
	* syntax-ppss.el (syntax-ppss-depth):
	* wid-browse.el:
	* wid-browse.el (widget-browse):
	* x-init.el (:compile-toplevel):
	Now #'eval-when is in bytecomp-runtime, use it in those places
	where it is clearer than #'eval-when-compile.
	Many of the places #'eval-when-compile were used were actually
	unnecessary; remove them.
	* bytecomp-runtime.el (eval-when):
	Document #'eval-when in a little more detail.
diff -r a771016803ed -r 9851c4a033df lisp/ChangeLog
--- a/lisp/ChangeLog	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/ChangeLog	Sun Sep 02 21:03:24 2018 +0100
@@ -1,3 +1,32 @@
+2018-09-02  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* byte-optimize.el:
+	* byte-optimize.el (:execute):
+	* bytecomp.el (:execute):
+	* cl-extra.el:
+	* cl-extra.el (:execute):
+	* cl-extra.el (streamp):
+	* cl-macs.el:
+	* cus-face.el:
+	* cus-face.el (:compile-toplevel):
+	* easy-mmode.el:
+	* help.el:
+	* help.el (:execute):
+	* info.el (:compile-toplevel):
+	* info.el (unless):
+	* regexp-opt.el (regexp-opt-group):
+	* syntax-ppss.el (font-lock-beginning-of-syntax-function):
+	* syntax-ppss.el (syntax-ppss-depth):
+	* wid-browse.el:
+	* wid-browse.el (widget-browse):
+	* x-init.el (:compile-toplevel):
+	Now #'eval-when is in bytecomp-runtime, use it in those places
+	where it is clearer than #'eval-when-compile.
+	Many of the places #'eval-when-compile were used were actually
+	unnecessary; remove them.
+	* bytecomp-runtime.el (eval-when):
+	Document #'eval-when in a little more detail.
+
 2018-09-02  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* bytecomp.el (byte-compile-initial-macro-environment):
diff -r a771016803ed -r 9851c4a033df lisp/byte-optimize.el
--- a/lisp/byte-optimize.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/byte-optimize.el	Sun Sep 02 21:03:24 2018 +0100
@@ -2152,24 +2152,22 @@
 ;; To avoid "lisp nesting exceeds max-lisp-eval-depth" when this file compiles
 ;; itself, compile some of its most used recursive functions (at load time).
 ;;
-(eval-when-compile
- (or (compiled-function-p (symbol-function 'byte-optimize-form))
-     (assq 'byte-code (symbol-function 'byte-optimize-form))
-     (let ((byte-optimize nil)
-	   (byte-compile-warnings nil))
-       (mapcar
-	#'(lambda (x)
-	    (or noninteractive (message "compiling %s..." x))
-	    (byte-compile x)
-	    (or noninteractive (message "compiling %s...done" x)))
-	'(byte-optimize-form
-	  byte-optimize-body
-	  byte-optimize-predicate
-	  byte-optimize-binary-predicate
-	  ;; Inserted some more than necessary, to speed it up.
-	  byte-optimize-form-code-walker
-	  byte-optimize-lapcode))))
- nil)
+(eval-when (:execute)
+  (let ((byte-optimize nil)
+        (byte-compile-warnings nil))
+    (map nil (if noninteractive
+                 #'byte-compile
+               #'(lambda (x)
+                   (message "compiling %s..." x)
+                   (byte-compile x)
+                   (message "compiling %s...done" x)))
+         '(byte-optimize-form
+           byte-optimize-body
+           byte-optimize-predicate
+           byte-optimize-binary-predicate
+           ;; Inserted some more than necessary, to speed it up.
+           byte-optimize-form-code-walker
+           byte-optimize-lapcode))))
 
 ;; END SYNC WITH 20.7.
 
diff -r a771016803ed -r 9851c4a033df lisp/bytecomp-runtime.el
--- a/lisp/bytecomp-runtime.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/bytecomp-runtime.el	Sun Sep 02 21:03:24 2018 +0100
@@ -221,6 +221,14 @@
 The symbols `compile', `load' and `eval' are accepted as synonyms for
 :compile-toplevel, :load-toplevel and :execute, respectively.
 
+A top-level `eval-when' where :compile-toplevel is in WITH, differs from
+`eval-when-compile' in that the latter is also run when
+interpreted. `eval-when-compile' also allows non-top-level code to be run at
+compile time, something the Common Lisp form does not.
+
+A top-level `eval-when' where :execute, and only :execute, is in WITH, is a
+mechanism to have code run when interpreted, and only when interpreted.
+
 arguments: ((&rest WHEN) &body BODY)"
   (if (set-difference when '(:compile-toplevel :load-toplevel :execute
 			     compile load eval))
diff -r a771016803ed -r 9851c4a033df lisp/bytecomp.el
--- a/lisp/bytecomp.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/bytecomp.el	Sun Sep 02 21:03:24 2018 +0100
@@ -5180,24 +5180,23 @@
 ;; To avoid "lisp nesting exceeds max-lisp-eval-depth" when bytecomp compiles
 ;; itself, compile some of its most used recursive functions (at load time).
 ;;
-(eval-when-compile
- (or (compiled-function-p (symbol-function 'byte-compile-form))
-     (let ((byte-optimize nil) ; do it fast
-	   (byte-compile-warnings nil))
-       (map nil (if noninteractive
-		    #'byte-compile
-		  #'(lambda (x)
-		      (message "compiling %s..." x)
-		      (byte-compile x)
-		      (message "compiling %s...done" x)))
-	    '(byte-compile-normal-call
-	      byte-compile-form
-	      byte-compile-body
-	      ;; Inserted some more than necessary, to speed it up.
-	      byte-compile-top-level
-	      byte-compile-out-toplevel
-	      byte-compile-constant
-	      byte-compile-variable-ref)))))
+(eval-when (:execute)
+  (let ((byte-optimize nil) ; do it fast
+        (byte-compile-warnings nil))
+    (map nil (if noninteractive
+                 #'byte-compile
+               #'(lambda (x)
+                   (message "compiling %s..." x)
+                   (byte-compile x)
+                   (message "compiling %s...done" x)))
+         '(byte-compile-normal-call
+           byte-compile-form
+           byte-compile-body
+           ;; Inserted some more than necessary, to speed it up.
+           byte-compile-top-level
+           byte-compile-out-toplevel
+           byte-compile-constant
+           byte-compile-variable-ref))))
 
 ;;; Some packages byte-compile with -no-autoloads, so this is necessary:
 (autoload 'cl-compile-time-init "cl-macs")
diff -r a771016803ed -r 9851c4a033df lisp/cl-extra.el
--- a/lisp/cl-extra.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/cl-extra.el	Sun Sep 02 21:03:24 2018 +0100
@@ -45,8 +45,6 @@
 
 
 ;;; Code:
-;; XEmacs addition
-(eval-when-compile (require 'obsolete))
 
 ;;; Type coercion.
 
@@ -646,7 +644,7 @@
 ;; XEmacs addition; force cl-macs to be available from here on when
 ;; compiling files to be dumped.  This is more reasonable than forcing other
 ;; files to do the same, multiple times.
-(eval-when-compile (or (cl-compiling-file) (load "cl-macs")))
+(eval-when (:execute) (load "cl-macs"))
 
 ;; XEmacs, functions from Common Lisp.
 (defun streamp (object)
diff -r a771016803ed -r 9851c4a033df lisp/cl-macs.el
--- a/lisp/cl-macs.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/cl-macs.el	Sun Sep 02 21:03:24 2018 +0100
@@ -2038,7 +2038,8 @@
 	      call)))))
 
 ;;; Some standard place types from Common Lisp.
-(eval-when-compile (defvar ignored-arg)) ; XEmacs: warning suppression
+; XEmacs: warning suppression
+(eval-when (:compile-toplevel) (defvar ignored-arg))
 (defsetf aref aset)
 (defsetf car setcar)
 (defsetf cdr setcdr)
diff -r a771016803ed -r 9851c4a033df lisp/cus-face.el
--- a/lisp/cus-face.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/cus-face.el	Sun Sep 02 21:03:24 2018 +0100
@@ -39,8 +39,7 @@
 (require 'custom)
 
 ;; To elude the warnings for font functions.
-(eval-when-compile
-  (require 'font))
+(eval-when (:compile-toplevel) (or (featurep 'font) (require 'font)))
 
 ;;; Declaring a face.
 
diff -r a771016803ed -r 9851c4a033df lisp/easy-mmode.el
--- a/lisp/easy-mmode.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/easy-mmode.el	Sun Sep 02 21:03:24 2018 +0100
@@ -54,8 +54,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;;; This file uses two functions that did not exist in some versions of
 ;;; XEmacs: propertize and replace-regexp-in-string.  We provide these
 ;;; functions here for such XEmacsen.
diff -r a771016803ed -r 9851c4a033df lisp/help.el
--- a/lisp/help.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/help.el	Sun Sep 02 21:03:24 2018 +0100
@@ -37,7 +37,7 @@
 
 ;; Get the macro make-help-screen when this is compiled,
 ;; or run interpreted, but not when the compiled code is loaded.
-(eval-when-compile (require 'help-macro))
+(eval-when (:execute :compile-toplevel) (require 'help-macro))
 
 (globally-declare-boundp
  (unless (featurep 'menubar) '(last-popup-menu-event)))
diff -r a771016803ed -r 9851c4a033df lisp/info.el
--- a/lisp/info.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/info.el	Sun Sep 02 21:03:24 2018 +0100
@@ -314,7 +314,7 @@
 ;; Use the new macro `with-search-caps-disable-folding'
 
 ;; Code:
-(eval-when-compile
+(eval-when (:compile-toplevel)
   (condition-case nil (require 'browse-url) (error nil)))
 
 (globally-declare-fboundp
diff -r a771016803ed -r 9851c4a033df lisp/regexp-opt.el
--- a/lisp/regexp-opt.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/regexp-opt.el	Sun Sep 02 21:03:24 2018 +0100
@@ -150,9 +150,6 @@
 
 ;;; Workhorse functions.
 
-(eval-when-compile
-  (require 'cl))
-
 (defun regexp-opt-group (strings &optional paren lax)
   "Return a regexp to match a string in STRINGS.
 If PAREN non-nil, output regexp parentheses around returned regexp.
diff -r a771016803ed -r 9851c4a033df lisp/syntax-ppss.el
--- a/lisp/syntax-ppss.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/syntax-ppss.el	Sun Sep 02 21:03:24 2018 +0100
@@ -45,8 +45,6 @@
 
 ;; Note: PPSS stands for `parse-partial-sexp state'
 
-(eval-when-compile (require 'cl))
-
 (defvar font-lock-beginning-of-syntax-function)
 
 (defsubst syntax-ppss-depth (ppss)
diff -r a771016803ed -r 9851c4a033df lisp/wid-browse.el
--- a/lisp/wid-browse.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/wid-browse.el	Sun Sep 02 21:03:24 2018 +0100
@@ -31,7 +31,6 @@
 (require 'easymenu)
 (require 'custom)
 (require 'wid-edit)
-(eval-when-compile (require 'cl))
 
 (defgroup widget-browse nil
   "Customization support for browsing widgets."
diff -r a771016803ed -r 9851c4a033df lisp/x-init.el
--- a/lisp/x-init.el	Sun Sep 02 16:37:33 2018 +0100
+++ b/lisp/x-init.el	Sun Sep 02 21:03:24 2018 +0100
@@ -137,8 +137,8 @@
                  (x-keysym-hash-table device))
 	t)))
 
-(eval-when-compile
-  (load "x-win-sun"     nil t)
+(eval-when (:compile-toplevel)
+  (load "x-win-sun" nil t)
   (load "x-win-xfree86" nil t))
 
 (defun x-initialize-keyboard (device)
-- 
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)