emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lazy-completion-table's args are evaluated too late


From: Richard M. Stallman
Subject: Re: lazy-completion-table's args are evaluated too late
Date: Tue, 20 Dec 2005 00:32:07 -0500

Is this correct?  It seems to work right when I try it.


(defmacro lazy-completion-table (var fun &rest args)
  "Initialize variable VAR as a lazy completion table.
If the completion table VAR is used for the first time (e.g., by passing VAR
as an argument to `try-completion'), the function FUN is called with arguments
ARGS.  FUN must return the completion table that will be stored in VAR.
If completion is requested in the minibuffer, FUN will be called in the buffer
from which the minibuffer was entered.  The return value of
`lazy-completion-table' must be used to initialize the value of VAR."
  (declare (debug (symbol lambda-expr def-body)))
  (let ((str (make-symbol "string")))
    `(let ((arglist (list ,@args)))
       (dynamic-completion-table
        `(lambda (,',str)
           (when (functionp ,',var)
             (setq ,',var (apply ',',fun ',arglist)))
           ,',var)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]