[Top][All Lists]

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

define-widget-keywords macro in widget.el is not needed

From: Richard Y. Kim
Subject: define-widget-keywords macro in widget.el is not needed
Date: Tue, 17 Apr 2001 16:04:22 -0700

Emacs 20.7 comes with widget.el file which includes the following macro:

  (defmacro define-widget-keywords (&rest keys)
    ;; Don't use backquote, since that makes trouble trying to
    ;; re-bootstrap from just the .el files.
    (list 'eval-and-compile
      (list 'let (list (list 'keywords (list 'quote keys)))
        (list 'while 'keywords
         (list 'or (list 'boundp (list 'car 'keywords))
             (list 'set (list 'car 'keywords) (list 'car 'keywords)))
         (list 'setq 'keywords (list 'cdr 'keywords))))))

All that this macro does is to set it's argument to itself, i.e., to
self-evaluating forms.  This macro is then used to setup many dozens
of keywords, i.e., symbols whose name starts with ":", e.g.,

    (define-widget-keywords :prefix :tag :load :link :options :type :group)

Although this code may have been valid in earlier versions of emacs,
it seems like this is unnecessary in modern versions of emacs since
all `keyword' symbols are self-evaluating forms anyways according to
the info node "(elisp)Constant Variables" which says:

    File: elisp,  Node: Constant Variables

    Variables That Never Change

       In Emacs Lisp, certain symbols normally evaluate to themselves.
    These include `nil' and `t', as well as any symbol whose name starts
    with `:'.  These symbols cannot be rebound, nor can their values be
    changed.  Any attempt to set or bind `nil' or `t' signals a
    `setting-constant' error.  The same is true for a symbol whose name
    starts with `:', except that you are allowed to set such a symbol to

         nil == 'nil
              => nil
         (setq nil 500)
         error--> Attempt to set constant symbol: nil

     - Variable: keyword-symbols-constant-flag
         If this variable is `nil', you are allowed to set and bind symbols
         whose names start with `:' as you wish.  This is to make it
         possible to run old Lisp programs which do that.

Isn't it time to rip out all code having to do with

reply via email to

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