unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition
@ 2022-07-29 12:01 Philip Kaludercic
  2022-07-29 12:04 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Kaludercic @ 2022-07-29 12:01 UTC (permalink / raw)
  To: 56821

[-- Attachment #1: Type: text/plain, Size: 804 bytes --]

Tags: patch


The proposed patch adds a simple condition to buffer-match-p, that had
previously either be expressed using an empty string (or any regular
expression that matches all words), an empty (and) or a symbol like
`always'.  I think it would be intuitive to add t, especially when
considering new user options like `outline-minor-mode-use-buttons' being
added that indicate they should be used as boolean value.

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-07-29 built on rhea
Repository revision: dedd05d2831d650b07cd9f0c639bdc8eb3bef1e4
Repository branch: master
System Description: Fedora Linux 36 (Workstation Edition)

Configured using:
 'configure --with-pgtk --with-imagemagick 'CFLAGS=-march=native -O2
 -pipe' LDFLAGS=-flto'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-subr.el-buffer-match-p-Add-t-as-trivial-a-condition.patch --]
[-- Type: text/patch, Size: 1127 bytes --]

From 816ad61536b5c2697d8a160e425296f9c26ca46f Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Fri, 29 Jul 2022 13:54:47 +0200
Subject: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition

---
 lisp/subr.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/subr.el b/lisp/subr.el
index 6b121a314a..9f7cb3ab6a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6899,6 +6899,7 @@ string-lines
 (defun buffer-match-p (condition buffer-or-name &optional arg)
   "Return non-nil if BUFFER-OR-NAME matches CONDITION.
 CONDITION is either:
+- the symbol t, to always match
 - a regular expression, to match a buffer name,
 - a predicate function that takes a buffer object and ARG as
   arguments, and returns non-nil if the buffer matches,
@@ -6921,6 +6922,7 @@ buffer-match-p
           (catch 'match
             (dolist (condition conditions)
               (when (cond
+                     ((eq condition t))
                      ((stringp condition)
                       (string-match-p condition (buffer-name buffer)))
                      ((functionp condition)
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition
  2022-07-29 12:01 bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition Philip Kaludercic
@ 2022-07-29 12:04 ` Lars Ingebrigtsen
  2022-07-29 15:54   ` Philip Kaludercic
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-29 12:04 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 56821

Philip Kaludercic <philipk@posteo.net> writes:

> The proposed patch adds a simple condition to buffer-match-p, that had
> previously either be expressed using an empty string (or any regular
> expression that matches all words), an empty (and) or a symbol like
> `always'.  I think it would be intuitive to add t, especially when
> considering new user options like `outline-minor-mode-use-buttons' being
> added that indicate they should be used as boolean value.

Makes sense to me.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition
  2022-07-29 12:04 ` Lars Ingebrigtsen
@ 2022-07-29 15:54   ` Philip Kaludercic
  2022-07-30 10:43     ` Philip Kaludercic
  0 siblings, 1 reply; 4+ messages in thread
From: Philip Kaludercic @ 2022-07-29 15:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56821

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> The proposed patch adds a simple condition to buffer-match-p, that had
>> previously either be expressed using an empty string (or any regular
>> expression that matches all words), an empty (and) or a symbol like
>> `always'.  I think it would be intuitive to add t, especially when
>> considering new user options like `outline-minor-mode-use-buttons' being
>> added that indicate they should be used as boolean value.
>
> Makes sense to me.

Ok, I would push the commit in that case.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition
  2022-07-29 15:54   ` Philip Kaludercic
@ 2022-07-30 10:43     ` Philip Kaludercic
  0 siblings, 0 replies; 4+ messages in thread
From: Philip Kaludercic @ 2022-07-30 10:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56821-done

Philip Kaludercic <philip.kaludercic@fau.de> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> The proposed patch adds a simple condition to buffer-match-p, that had
>>> previously either be expressed using an empty string (or any regular
>>> expression that matches all words), an empty (and) or a symbol like
>>> `always'.  I think it would be intuitive to add t, especially when
>>> considering new user options like `outline-minor-mode-use-buttons' being
>>> added that indicate they should be used as boolean value.
>>
>> Makes sense to me.
>
> Ok, I would push the commit in that case.

Done.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-30 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-29 12:01 bug#56821: [PATCH] * subr.el (buffer-match-p): Add t as trivial a condition Philip Kaludercic
2022-07-29 12:04 ` Lars Ingebrigtsen
2022-07-29 15:54   ` Philip Kaludercic
2022-07-30 10:43     ` Philip Kaludercic

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).