widget.el 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ;;; widget.el --- a library of user interface components
  2. ;;
  3. ;; Copyright (C) 1996-1997, 2001-2012 Free Software Foundation, Inc.
  4. ;;
  5. ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
  6. ;; Keywords: help, extensions, faces, hypermedia
  7. ;; Version: 1.9920
  8. ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
  9. ;; Package: emacs
  10. ;; This file is part of GNU Emacs.
  11. ;; GNU Emacs is free software: you can redistribute it and/or modify
  12. ;; it under the terms of the GNU General Public License as published by
  13. ;; the Free Software Foundation, either version 3 of the License, or
  14. ;; (at your option) any later version.
  15. ;; GNU Emacs is distributed in the hope that it will be useful,
  16. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;; GNU General Public License for more details.
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  21. ;;; Commentary:
  22. ;;
  23. ;; The widget library is partially documented in the `widget' Info
  24. ;; file.
  25. ;;
  26. ;; This file only contains the code needed to define new widget types.
  27. ;; Everything else is autoloaded from `wid-edit.el'.
  28. ;;; Code:
  29. ;; Doing this is unnecessary in Emacs 20. Kept as dummy in case
  30. ;; external libraries call it. We save a kb or two of purespace by
  31. ;; dummying-out such definitions generally.
  32. (defmacro define-widget-keywords (&rest _keys)
  33. ;; ;; Don't use backquote, since that makes trouble trying to
  34. ;; ;; re-bootstrap from just the .el files.
  35. ;; (list 'eval-and-compile
  36. ;; (list 'let (list (list 'keywords (list 'quote keys)))
  37. ;; (list 'while 'keywords
  38. ;; (list 'or (list 'boundp (list 'car 'keywords))
  39. ;; (list 'set (list 'car 'keywords) (list 'car 'keywords)))
  40. ;; (list 'setq 'keywords (list 'cdr 'keywords)))))
  41. )
  42. ;;(define-widget-keywords :documentation-indent
  43. ;; :complete-function :complete :button-overlay
  44. ;; :field-overlay
  45. ;; :documentation-shown :button-prefix
  46. ;; :button-suffix :mouse-down-action :glyph-up :glyph-down :glyph-inactive
  47. ;; :prompt-internal :prompt-history :prompt-match
  48. ;; :prompt-value :deactivate :active
  49. ;; :inactive :activate :sibling-args :delete-button-args
  50. ;; :insert-button-args :append-button-args :button-args
  51. ;; :tag-glyph :off-glyph :on-glyph :valid-regexp
  52. ;; :secret :sample-face :sample-face-get :case-fold
  53. ;; :create :convert-widget :format :value-create :offset :extra-offset
  54. ;; :tag :doc :from :to :args :value :action
  55. ;; :value-set :value-delete :match :parent :delete :menu-tag-get
  56. ;; :value-get :choice :void :menu-tag :on :off :on-type :off-type
  57. ;; :notify :entry-format :button :children :buttons :insert-before
  58. ;; :delete-at :format-handler :widget :value-pos :value-to-internal
  59. ;; :indent :size :value-to-external :validate :error :directory
  60. ;; :must-match :type-error :value-inline :inline :match-inline :greedy
  61. ;; :button-face-get :button-face :value-face :keymap :entry-from
  62. ;; :entry-to :help-echo :documentation-property :tab-order)
  63. (put 'define-widget 'doc-string-elt 3) ;`declare' doesn't work in functions.
  64. (defun define-widget (name class doc &rest args)
  65. "Define a new widget type named NAME from CLASS.
  66. NAME and CLASS should both be symbols, CLASS should be one of the
  67. existing widget types, or nil to create the widget from scratch.
  68. After the new widget has been defined, the following two calls will
  69. create identical widgets:
  70. * (widget-create NAME)
  71. * (apply 'widget-create CLASS ARGS)
  72. The third argument DOC is a documentation string for the widget."
  73. (put name 'widget-type (cons class args))
  74. (put name 'widget-documentation (purecopy doc))
  75. name)
  76. ;; This is used by external widget code (in W3, at least).
  77. (defalias 'widget-plist-member 'plist-member)
  78. ;;; The End.
  79. (provide 'widget)
  80. ;;; widget.el ends here