summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-09-04 16:29:06 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-09-04 16:29:06 +0200
commitad6878005dbde428809c1f587555238892dd253d (patch)
treecaa0740feaa03f1a91f9ef7a42c941d2daff9bf5
parent9aed695241a8919d422d5812dd62325720961153 (diff)
downloademacs-ad6878005dbde428809c1f587555238892dd253d.tar.gz
Add a basic widget type for buffer predicates
* lisp/paren.el (show-paren-predicate): * lisp/outline.el (outline-minor-mode-use-buttons): Use it. * lisp/wid-edit.el (buffer-predicate): New widget type.
-rw-r--r--lisp/outline.el3
-rw-r--r--lisp/paren.el2
-rw-r--r--lisp/wid-edit.el9
3 files changed, 11 insertions, 3 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index 2e18fd5b8fe..178cbe30715 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -288,8 +288,7 @@ The value should be a `buffer-match-p' condition.
These buttons can be used to hide and show the body under the heading.
Note that this feature is not meant to be used in editing
buffers (yet) -- that will be amended in a future version."
- ;; FIXME -- is there a `buffer-match-p' defcustom type somewhere?
- :type 'sexp
+ :type 'buffer-predicate
:safe #'booleanp
:version "29.1")
diff --git a/lisp/paren.el b/lisp/paren.el
index 13e219c8f60..e2c060ceb96 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -123,7 +123,7 @@ On non-graphical frames, the context is shown in the echo area."
The default is to enable the mode in all buffers that have don't
derive from `special-mode', which means that it's on (by default)
in all editing buffers."
- :type 'sexp
+ :type 'buffer-predicate
:safe #'booleanp
:version "29.1")
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index ec2eb146e90..9aec6b02441 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -4145,6 +4145,15 @@ is inline."
(define-obsolete-function-alias 'widget-visibility-value-create
#'widget-toggle-value-create "29.1")
+;;; Buffer predicates.
+(define-widget 'buffer-predicate 'lazy
+ "A buffer predicate."
+ :tag "Buffer predicate"
+ :type '(choice (const :tag "All buffers" t)
+ (const :tag "No buffers" nil)
+ ;; FIXME: This should be expanded somehow.
+ sexp))
+
(provide 'wid-edit)
;;; wid-edit.el ends here