list of hooks to run in HOOK, then nothing is done. See `add-hook'.
The optional third argument, LOCAL, if non-nil, says to modify
-the hook's buffer-local value rather than its default value."
+the hook's buffer-local value rather than its default value.
+
+Interactively, prompt for the various arguments (skipping local
+unless HOOK has both local and global functions). If multiple
+functions have the same representation under `princ', the first
+one will be removed."
+ (interactive
+ (let* ((hook (intern (completing-read "Hook variable: " obarray #'boundp t)))
+ (local
+ (and
+ (local-variable-p hook)
+ (symbol-value hook)
+ ;; No need to prompt if there's nothing global
+ (or (not (default-value hook))
+ (y-or-n-p (format "%s has a buffer-local binding, use that? "
+ hook)))))
+ (fn-alist (mapcar
+ (lambda (x) (cons (with-output-to-string (prin1 x)) x))
+ (if local (symbol-value hook) (default-value hook))))
+ (function (alist-get (completing-read
+ (format "%s hook to remove: "
+ (if local "Buffer-local" "Global"))
+ fn-alist
+ nil t)
+ fn-alist nil nil 'string=)))
+ (list hook function local)))
(or (boundp hook) (set hook nil))
(or (default-boundp hook) (set-default hook nil))
;; Do nothing if LOCAL is t but this hook has no local binding.