+ "If non-nil disable notice, when call `ptexinfmt-broken-facility'.
+This is last argument in `ptexinfmt-broken-facility'.")
+
+(put 'ptexinfmt-broken-facility 'lisp-indent-function 'defun)
+(defmacro ptexinfmt-broken-facility (facility docstring assertion
+ &optional dummy)
+ "Declare a symbol FACILITY is broken if ASSERTION is nil.
+DOCSTRING will be printed if ASSERTION is nil and
+`ptexinfmt-disable-broken-notice-flag' is nil."
+ (` (let ((facility '(, facility))
+ (docstring (, docstring))
+ (assertion (eval '(, assertion))))
+ (put facility 'broken (not assertion))
+ (if assertion
+ nil
+ (put facility 'broken-docstring docstring)
+ (if ptexinfmt-disable-broken-notice-flag
+ nil
+ (message "BROKEN FACILITY DETECTED: %s" docstring))))))
+
+(put 'ptexinfmt-defun-if-broken 'lisp-indent-function 'defun)
+(defmacro ptexinfmt-defun-if-broken (&rest args)
+ "Redefine a function just like `defun' if it is considered broken."
+ (let ((name (list 'quote (car args))))
+ (setq args (cdr args))
+ (` (prog1
+ (, name)
+ (if (get (, name) 'broken)
+ (defalias (, name)
+ (function (lambda (,@ args)))))))))
+
+(put 'ptexinfmt-defun-if-void 'lisp-indent-function 'defun)
+(defmacro ptexinfmt-defun-if-void (&rest args)
+ "Define a function just like `defun' unless it is already defined."
+ (let ((name (list 'quote (car args))))
+ (setq args (cdr args))
+ (` (prog1
+ (, name)
+ (if (fboundp (, name))
+ nil
+ (defalias (, name)
+ (function (lambda (,@ args)))))))))
+
+(put 'ptexinfmt-defvar-if-void 'lisp-indent-function 'defun)
+(defmacro ptexinfmt-defvar-if-void (&rest args)
+ "Define a variable just like `defvar' unless it is already defined."
+ (let ((name (car args)))
+ (setq args (cdr args))
+ (` (prog1
+ (defvar (, name))
+ (if (boundp '(, name))
+ nil
+ (defvar (, name) (,@ args)))))))