aboutsummaryrefslogtreecommitdiff
path: root/generic/proof-utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'generic/proof-utils.el')
-rw-r--r--generic/proof-utils.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/generic/proof-utils.el b/generic/proof-utils.el
index 7c8cfa54..50c2f926 100644
--- a/generic/proof-utils.el
+++ b/generic/proof-utils.el
@@ -7,6 +7,9 @@
;;
;; $Id$
;;
+;;
+;; Loading note: this file is required immediately from proof.el, so
+;; no autoloads are used here.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -380,6 +383,36 @@ Returns non-nil if response buffer was cleared."
http://zermelo.dcs.ed.ac.uk/~proofgen/ProofGeneral/BUGS ]")))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; Utils for making functions to adjust user settings
+;;;
+
+
+(defun proof-deftoggle-fn (var &optional othername)
+ "Define a function <VAR>-toggle for toggling a boolean customize setting VAR.
+The toggle function uses customize-set-variable to change the variable.
+OTHERNAME gives an alternative name than the default <VAR>-toggle."
+ (eval
+ `(defun ,(if othername othername
+ (intern (concat (symbol-name var) "-toggle"))) (arg)
+ ,(concat "Toggle `" (symbol-name var) "'. With ARG, turn on iff ARG>0.
+This function simply uses customize-set-variable to set the variable.
+It was constructed with `proof-customize-toggle-fn'.")
+ (interactive "P")
+ (customize-set-variable
+ (quote ,var)
+ (if (null arg) (not ,var)
+ (> (prefix-numeric-value arg) 0))))))
+
+(defmacro proof-deftoggle (var &optional othername)
+ "Define a function VAR-toggle for toggling a boolean customize setting VAR.
+VAR, OTHERNAME are not evaluated.
+The function is defined with `proof-customize-toggle-fn', which see."
+ `(proof-deftoggle-fn (quote ,var) (quote ,othername)))
+
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Stuff for developing PG, not needed for ordinary users really.