unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p.
@ 2022-12-26  1:07 LdBeth
  2023-09-01 19:55 ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: LdBeth @ 2022-12-26  1:07 UTC (permalink / raw)
  To: 60328

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

All the patterns that calls `newsticker--lists-intersect-p' in
lisp/net/newst-plainview.el like:

(newsticker--lists-intersect-p
 (get-text-property (point) 'invisible)
  buffer-invisibility-spec)

Can be replace by `(invisible-p (point))' accordingly to reduce
boilerplate.

This patch would also remove the definition of
`newsticker--lists-intersect-p' from lisp/net/newst-backend.el
since is it not referenced elsewhere.

---
ldb


[-- Attachment #2: 0001-newsticker-Remove-newsticker-lists-intersect-p.patch --]
[-- Type: text/plain, Size: 5502 bytes --]

From cd998ae051115b34bbd7c0af7724487e96aa6122 Mon Sep 17 00:00:00 2001
From: LdBeth <andpuke@foxmail.com>
Date: Sun, 25 Dec 2022 18:55:03 -0600
Subject: [PATCH] (newsticker): Remove newsticker--lists-intersect-p.

newst-backend.el: Remove newsticker--lists-intersect-p.
newst-plainview.el: Replace corresponding calls by `invisible-p'.
---
 lisp/net/newst-backend.el   |  9 ---------
 lisp/net/newst-plainview.el | 40 ++++++++++---------------------------
 2 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index 2a87742..333552c 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -1676,15 +1676,6 @@ Sat, 07 Sep 2002 00:00:01 GMT
              nil))))
     nil))
 
-;; FIXME: Can this be replaced by seq-intersection?
-(defun newsticker--lists-intersect-p (list1 list2)
-  "Return t if LIST1 and LIST2 share elements."
-  (let ((result nil))
-    (dolist (elt list1)
-      (if (memq elt list2)
-          (setq result t)))
-    result))
-
 (defun newsticker--update-process-ids ()
   "Update list of ids of active newsticker processes.
 Checks list of active processes against list of newsticker processes."
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 4eb6f6c..f6370c2 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -573,14 +573,10 @@ calls `w3m-toggle-inline-image'.  It works only if
                 (when pos
                   (goto-char pos)
                   (when (get-text-property pos 'w3m-image)
-                    (let ((invis (newsticker--lists-intersect-p
-                                  (get-text-property (1- (point))
-                                                     'invisible)
-                                  buffer-invisibility-spec)))
-                      (unless  (car (get-text-property (1- (point))
-                                                       'display))
-                        (unless invis
-                          (w3m-toggle-inline-image t)))))))))))))
+                    (unless (car (get-text-property (1- (point))
+                                                    'display))
+                      (unless (invisible-p (1- (point)))
+                        (w3m-toggle-inline-image t))))))))))))
 
 ;; ======================================================================
 ;;; Keymap stuff
@@ -606,9 +602,7 @@ is non-nil."
 	  (goto-char (point-min))
 	  (newsticker-next-new-item t))
 	(setq go-ahead nil))
-      (unless (newsticker--lists-intersect-p
-               (get-text-property (point) 'invisible)
-               buffer-invisibility-spec)
+      (unless (invisible-p (point))
 	;; this item is invisible -- continue search
         (setq go-ahead nil))))
   (run-hooks 'newsticker-select-item-hook)
@@ -627,9 +621,7 @@ is non-nil."
 	(unless do-not-wrap-at-bob
 	  (goto-char (point-max))
 	  (newsticker--buffer-goto '(item) 'new t)))
-      (unless (newsticker--lists-intersect-p
-               (get-text-property (point) 'invisible)
-		    buffer-invisibility-spec)
+      (unless (invisible-p (point))
 	(setq go-ahead nil))))
   (run-hooks 'newsticker-select-item-hook)
   (point))
@@ -652,9 +644,7 @@ non-nil."
 	(unless do-not-wrap-at-eob
 	  (goto-char (point-min)))
 	(setq go-ahead nil))
-      (unless (newsticker--lists-intersect-p
-               (get-text-property (point) 'invisible)
-		    buffer-invisibility-spec)
+      (unless (invisible-p (point))
 	(setq go-ahead nil))))
   (run-hooks 'newsticker-select-item-hook)
   (force-mode-line-update)
@@ -673,9 +663,7 @@ auto-narrow-to-item is enabled, nil is returned."
       (while go-ahead
         (unless (newsticker--buffer-goto '(item))
           (setq go-ahead nil))
-        (unless (newsticker--lists-intersect-p
-                 (get-text-property (point) 'invisible)
-                 buffer-invisibility-spec)
+        (unless (invisible-p (point))
           (setq go-ahead nil)))
       (if (and (> (point) current-pos)
                (< (point) end-of-feed))
@@ -700,9 +688,7 @@ is non-nil."
 	(goto-char (point-max))))
     (while go-ahead
       (if (newsticker--buffer-goto search-list nil t)
-          (unless (newsticker--lists-intersect-p
-                   (get-text-property (point) 'invisible)
-                   buffer-invisibility-spec)
+          (unless (invisible-p (point))
             (setq go-ahead nil))
         (goto-char (point-min))
         (setq go-ahead nil))))
@@ -1079,9 +1065,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on."
       (while (< (point) (point-max))
         (unless (newsticker--buffer-goto '(item))
           (throw 'result nil))
-        (unless (newsticker--lists-intersect-p
-                 (get-text-property (point) 'invisible)
-                 buffer-invisibility-spec)
+        (unless (invisible-p (point))
           (throw 'result t))))))
 
 (defun newsticker-previous-item-available-p ()
@@ -1091,9 +1075,7 @@ If VALUE is nil, auto-narrowing is turned off, otherwise it is turned on."
       (while (> (point) (point-min))
         (unless (newsticker--buffer-goto '(item) nil t)
           (throw 'result nil))
-        (unless (newsticker--lists-intersect-p
-                 (get-text-property (point) 'invisible)
-                 buffer-invisibility-spec)
+        (unless (invisible-p (point))
           (throw 'result t))))))
 
 (defun newsticker-item-not-old-p ()
-- 
2.33.1


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

* bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p.
  2022-12-26  1:07 bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p LdBeth
@ 2023-09-01 19:55 ` Stefan Kangas
  2023-09-02  8:21   ` Ulf Jasper
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2023-09-01 19:55 UTC (permalink / raw)
  To: LdBeth; +Cc: 60328, Ulf Jasper

LdBeth <andpuke@foxmail.com> writes:

> All the patterns that calls `newsticker--lists-intersect-p' in
> lisp/net/newst-plainview.el like:
>
> (newsticker--lists-intersect-p
>  (get-text-property (point) 'invisible)
>   buffer-invisibility-spec)
>
> Can be replace by `(invisible-p (point))' accordingly to reduce
> boilerplate.
>
> This patch would also remove the definition of
> `newsticker--lists-intersect-p' from lisp/net/newst-backend.el
> since is it not referenced elsewhere.

Ulf, do you have any comments on this patch?





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

* bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p.
  2023-09-01 19:55 ` Stefan Kangas
@ 2023-09-02  8:21   ` Ulf Jasper
  2023-09-02  8:35     ` Stefan Kangas
  0 siblings, 1 reply; 4+ messages in thread
From: Ulf Jasper @ 2023-09-02  8:21 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 60328, LdBeth

Am 01.09.2023 um 21:55 (+0200) schrieb Stefan Kangas:
> Ulf, do you have any comments on this patch?

I did not try it out but that patch looks good to me.  Go ahead!





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

* bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p.
  2023-09-02  8:21   ` Ulf Jasper
@ 2023-09-02  8:35     ` Stefan Kangas
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kangas @ 2023-09-02  8:35 UTC (permalink / raw)
  To: Ulf Jasper; +Cc: 60328-done, LdBeth

Version: 30.1

Ulf Jasper <ulf.jasper@web.de> writes:

> Am 01.09.2023 um 21:55 (+0200) schrieb Stefan Kangas:
> > Ulf, do you have any comments on this patch?
>
> I did not try it out but that patch looks good to me.  Go ahead!

Thanks, so let's install it.  I fixed the commit message to include a
ChangeLog and pushed to master as commit 03a7e448a26.

LdBeth, please include a ChangeLog according to CONTRIBUTE with your
next patch.  It will save us some work when we apply it.  Thanks in
advance.





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

end of thread, other threads:[~2023-09-02  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26  1:07 bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p LdBeth
2023-09-01 19:55 ` Stefan Kangas
2023-09-02  8:21   ` Ulf Jasper
2023-09-02  8:35     ` Stefan Kangas

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).