1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

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.
This commit is contained in:
Stefan Monnier 2012-05-26 11:52:27 -04:00
parent 53a63be64d
commit a179e3f7b4
9 changed files with 34 additions and 24 deletions

View File

@ -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)

View File

@ -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))

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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)))))

View File

@ -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)

View File

@ -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)))

View File

@ -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;