all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: LdBeth <andpuke@foxmail.com>
To: 60328@debbugs.gnu.org
Subject: bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p.
Date: Sun, 25 Dec 2022 19:07:40 -0600	[thread overview]
Message-ID: <tencent_A3CF30C688CEBF95C19FAE5B7BB7B6A35506@qq.com> (raw)

[-- 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


             reply	other threads:[~2022-12-26  1:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-26  1:07 LdBeth [this message]
2023-09-01 19:55 ` bug#60328: 30.0.50; [PATCH] Replace newsticker--lists-intersect-p Stefan Kangas
2023-09-02  8:21   ` Ulf Jasper
2023-09-02  8:35     ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_A3CF30C688CEBF95C19FAE5B7BB7B6A35506@qq.com \
    --to=andpuke@foxmail.com \
    --cc=60328@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.