1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-14 16:50:58 +00:00

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.
This commit is contained in:
Lars Ingebrigtsen 2022-09-04 16:29:06 +02:00
parent 9aed695241
commit ad6878005d
3 changed files with 11 additions and 3 deletions

View File

@ -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. 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 Note that this feature is not meant to be used in editing
buffers (yet) -- that will be amended in a future version." buffers (yet) -- that will be amended in a future version."
;; FIXME -- is there a `buffer-match-p' defcustom type somewhere? :type 'buffer-predicate
:type 'sexp
:safe #'booleanp :safe #'booleanp
:version "29.1") :version "29.1")

View File

@ -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 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) derive from `special-mode', which means that it's on (by default)
in all editing buffers." in all editing buffers."
:type 'sexp :type 'buffer-predicate
:safe #'booleanp :safe #'booleanp
:version "29.1") :version "29.1")

View File

@ -4145,6 +4145,15 @@ is inline."
(define-obsolete-function-alias 'widget-visibility-value-create (define-obsolete-function-alias 'widget-visibility-value-create
#'widget-toggle-value-create "29.1") #'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) (provide 'wid-edit)
;;; wid-edit.el ends here ;;; wid-edit.el ends here