From a179e3f7b472b3b5075a98e3b33852e9f223cd83 Mon Sep 17 00:00:00 2001
From: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Sat, 26 May 2012 11:52:27 -0400
Subject: [PATCH] Use `declare' in `lambda' and mis minor changes. *
 lisp/subr.el (lambda): Use declare. * lisp/emacs-lisp/lisp-mode.el (lambda):
 * lisp/emacs-lisp/edebug.el (lambda): Move properties to its definition. *
 lisp/gnus/legacy-gnus-agent.el (gnus-agent-unhook-expire-days): *
 lisp/gnus/gnus-demon.el (gnus-demon-init): Don't bother with type-of.

---
 lisp/ChangeLog                 |  6 ++++++
 lisp/emacs-lisp/edebug.el      |  6 ------
 lisp/emacs-lisp/lisp-mode.el   |  2 --
 lisp/emacs-lisp/pcase.el       |  7 +++++--
 lisp/gnus/ChangeLog            |  5 +++++
 lisp/gnus/gnus-demon.el        |  5 ++---
 lisp/gnus/legacy-gnus-agent.el | 18 ++++++++++--------
 lisp/subr.el                   |  5 +++++
 src/print.c                    |  4 +---
 9 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 97c1e4b5320..78551914fee 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* subr.el (lambda): Use declare.
+	* emacs-lisp/lisp-mode.el (lambda):
+	* emacs-lisp/edebug.el (lambda): Move properties to its definition.
+
 2012-05-26  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
 
 	* thingatpt.el (forward-same-syntax): Handle no ARG case.  (Bug#11560)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 2c7e7cf6362..9d3ee307083 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -2010,12 +2010,6 @@ expressions; a `progn' form will be returned enclosing these forms."
 ;; A macro is allowed by Emacs.
 (def-edebug-spec function (&or symbolp lambda-expr))
 
-;; lambda is a macro in emacs 19.
-(def-edebug-spec lambda (&define lambda-list
-				 [&optional stringp]
-				 [&optional ("interactive" interactive)]
-				 def-body))
-
 ;; A macro expression is a lambda expression with "macro" prepended.
 (def-edebug-spec macro (&define "lambda" lambda-list def-body))
 
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index dfdac92ae32..d76c1ad3e72 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -140,7 +140,6 @@ It has `lisp-mode-abbrev-table' as its parent."
 (put 'defvar   'doc-string-elt 3)
 (put 'defconst 'doc-string-elt 3)
 (put 'defmacro 'doc-string-elt 3)
-(put 'lambda 'doc-string-elt 2)
 (put 'defalias 'doc-string-elt 3)
 (put 'defvaralias 'doc-string-elt 3)
 (put 'define-category 'doc-string-elt 2)
@@ -1213,7 +1212,6 @@ Lisp function does not specify a special indentation."
 ;; like defun if the first form is placed on the next line, otherwise
 ;; it is indented like any other form (i.e. forms line up under first).
 
-(put 'lambda 'lisp-indent-function 'defun)
 (put 'autoload 'lisp-indent-function 'defun)
 (put 'progn 'lisp-indent-function 0)
 (put 'prog1 'lisp-indent-function 1)
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 67b19443967..363c0965c3e 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -39,12 +39,15 @@
 ;; - along these lines, provide patterns to match CL structs.
 ;; - provide something like (setq VAR) so a var can be set rather than
 ;;   let-bound.
-;; - provide a way to fallthrough to subsequent cases.
+;; - provide a way to fallthrough to subsequent cases (not sure what I meant by
+;;   this :-()
 ;; - try and be more clever to reduce the size of the decision tree, and
 ;;   to reduce the number of leaves that need to be turned into function:
 ;;   - first, do the tests shared by all remaining branches (it will have
-;;     to be performed anyway, so better so it first so it's shared).
+;;     to be performed anyway, so better do it first so it's shared).
 ;;   - then choose the test that discriminates more (?).
+;; - provide Agda's `with' (along with its `...' companion).
+;; - implement (not UPAT).  This might require a significant redesign.
 ;; - ideally we'd want (pcase s ((re RE1) E1) ((re RE2) E2)) to be able to
 ;;   generate a lex-style DFA to decide whether to run E1 or E2.
 
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 1c5984e96cd..50ce9075dc0 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* legacy-gnus-agent.el (gnus-agent-unhook-expire-days):
+	* gnus-demon.el (gnus-demon-init): Don't bother with type-of.
+
 2012-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* gnus-win.el (gnus-configure-frame): Don't signal an error when
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index d0baf25d5d9..2a4fa6f483e 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -116,7 +116,6 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
     ;; Set up the timer.
     (let* ((func (nth 0 handler))
            (time (nth 1 handler))
-           (time-type (type-of time))
            (idle (nth 2 handler))
            ;; Compute time according with timestep.
            ;; If t, replace by 1
@@ -140,10 +139,10 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
               (run-with-idle-timer idle t 'gnus-demon-run-callback func))
              ;; (func number any)
              ;; Call every `time'
-             ((eq time-type 'integer)
+             ((integerp time)
               (run-with-timer time time 'gnus-demon-run-callback func idle))
              ;; (func string any)
-             ((eq time-type 'string)
+             ((stringp time)
               (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback func idle)))))
       (when timer
         (add-to-list 'gnus-demon-timers timer)))))
diff --git a/lisp/gnus/legacy-gnus-agent.el b/lisp/gnus/legacy-gnus-agent.el
index afbebbff79f..ecde35dca8f 100644
--- a/lisp/gnus/legacy-gnus-agent.el
+++ b/lisp/gnus/legacy-gnus-agent.el
@@ -206,29 +206,31 @@ converted to the compressed format."
 (gnus-convert-mark-converter-prompt 'gnus-agent-unlist-expire-days t)
 
 (defun gnus-agent-unhook-expire-days (converting-to)
-  "Remove every lambda from gnus-group-prepare-hook that mention the
-symbol gnus-agent-do-once in their definition.  This should NOT be
+  "Remove every lambda from `gnus-group-prepare-hook' that mention the
+symbol `gnus-agent-do-once' in their definition.  This should NOT be
 necessary as gnus-agent.el no longer adds them.  However, it is
 possible that the hook was persistently saved."
-    (let ((h t)) ; iterate from bgn of hook
+    (let ((h t)) ; Iterate from bgn of hook.
       (while h
         (let ((func (progn (when (eq h t)
-                             ;; init h to list of functions
+                             ;; Init h to list of functions.
                              (setq h (cond ((listp gnus-group-prepare-hook)
                                             gnus-group-prepare-hook)
                                            ((boundp 'gnus-group-prepare-hook)
                                             (list gnus-group-prepare-hook)))))
                            (pop h))))
 
-          (when (cond ((eq (type-of func) 'compiled-function)
-                       ;; Search def. of compiled function for gnus-agent-do-once string
+          (when (cond ((byte-code-function-p func)
+                       ;; Search def. of compiled function for
+                       ;; gnus-agent-do-once string.
                        (let* (definition
                                print-level
                                print-length
                                (standard-output
                                 (lambda (char)
                                   (setq definition (cons char definition)))))
-                         (princ func) ; populates definition with reversed list of characters
+                         (princ func) ; Populates definition with reversed list
+				      ; of characters.
                          (let* ((i (length definition))
                                 (s (make-string i 0)))
                            (while definition
@@ -236,7 +238,7 @@ possible that the hook was persistently saved."
 
                            (string-match "\\bgnus-agent-do-once\\b" s))))
                       ((listp func)
-                       (eq (cadr (nth 2 func)) 'gnus-agent-do-once) ; handles eval'd lambda
+                       (eq (cadr (nth 2 func)) 'gnus-agent-do-once) ; Handles eval'd lambda.
                        ))
 
             (remove-hook 'gnus-group-prepare-hook func)
diff --git a/lisp/subr.el b/lisp/subr.el
index 0166a3276a8..0078fca8033 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -112,6 +112,11 @@ It may also be omitted.
 BODY should be a list of Lisp expressions.
 
 \(fn ARGS [DOCSTRING] [INTERACTIVE] BODY)"
+  (declare (doc-string 2) (indent defun)
+           (debug (&define lambda-list
+                           [&optional stringp]
+                           [&optional ("interactive" interactive)]
+                           def-body)))
   ;; Note that this definition should not use backquotes; subr.el should not
   ;; depend on backquote.el.
   (list 'function (cons 'lambda cdr)))
diff --git a/src/print.c b/src/print.c
index 2912396bd33..2158d06dbca 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1086,9 +1086,7 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
 
       if (HASH_TABLE_P (Vprint_number_table))
 	{ /* Remove unnecessary objects, which appear only once in OBJ;
-	     that is, whose status is Qt.
-	     Maybe a better way to do that is to copy elements to
-	     a new hash table.  */
+	     that is, whose status is Qt.  */
 	  struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table);
 	  ptrdiff_t i;
 
-- 
2.39.5