1 ;;; hvar.el --- Variable manipulation routines for Hyperbole.
3 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
4 ;; Developed with support from Motorola Inc.
6 ;; Author: Bob Weiner, Brown U.
7 ;; Maintainer: Mats Lidell <matsl@contactor.se>
8 ;; Keywords: extensions, hypermedia
10 ;; This file is part of GNU Hyperbole.
12 ;; GNU Hyperbole is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 3, or (at
15 ;; your option) any later version.
17 ;; GNU Hyperbole is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
32 ;;; Other required Elisp libraries
42 (defun var:append (var-symbol-name list-to-add)
43 "Appends to value held by VAR-SYMBOL-NAME, LIST-TO-ADD. Returns new value.
44 If VAR-SYMBOL-NAME is unbound, it is set to LIST-TO-ADD.
45 Often used to append to 'hook' variables."
47 (if (and (boundp var-symbol-name)
48 (setq val (symbol-value var-symbol-name))
49 (or (if (symbolp val) (setq val (cons val nil)))
51 ;; Don't add if list elts are already there.
52 (if (memq nil (mapcar (function
53 (lambda (elt) (set:member elt val)))
55 (set-variable var-symbol-name
56 (if (eq (car val) 'lambda)
57 (apply 'list val list-to-add)
58 (append val list-to-add)))
60 (set-variable var-symbol-name list-to-add))))