annotate lisp/hyperbole/hvar.el @ 80:1ce6082ce73f r20-0b90

Import from CVS: tag r20-0b90
author cvs
date Mon, 13 Aug 2007 09:06:37 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hvar.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Variable manipulation routines for Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: extensions, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; ORG: Brown U.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 1-Oct-91 at 14:00:24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; LAST-MOD: 14-Apr-95 at 16:13:46 by Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (require 'set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defun var:append (var-symbol-name list-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 "Appends to value held by VAR-SYMBOL-NAME, LIST-TO-ADD. Returns new value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 If VAR-SYMBOL-NAME is unbound, it is set to LIST-TO-ADD.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 Often used to append to 'hook' variables."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (let ((val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (if (and (boundp var-symbol-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (setq val (symbol-value var-symbol-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (or (if (symbolp val) (setq val (cons val nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (listp val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; Don't add if list elts are already there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (if (memq nil (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (lambda (elt) (set:member elt val)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 list-to-add))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (set-variable var-symbol-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 (if (eq (car val) 'lambda)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (apply 'list val list-to-add)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (append val list-to-add)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (set-variable var-symbol-name list-to-add))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (provide 'hvar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55