GNU bug report logs - #59856
29.0.50; [PATCH] Feature suggestion, Newsticker runs ticker only periodically

Previous Next

Package: emacs;

Reported by: Alex Bochannek <alex <at> bochannek.com>

Date: Tue, 6 Dec 2022 11:15:01 UTC

Severity: wishlist

Tags: patch

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59856 in the body.
You can then email your comments to 59856 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Tue, 06 Dec 2022 11:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Bochannek <alex <at> bochannek.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Dec 2022 11:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alex Bochannek <alex <at> bochannek.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] Feature suggestion, Newsticker runs ticker only
 periodically
Date: Tue, 06 Dec 2022 03:14:17 -0800
[Message part 1 (text/plain, inline)]
Hello!

I started using the Ticker frontend of Newsticker and didn't like that
it continuously scrolls the echo area.

I am submitting the below patch, which only displays the list of items
once, at `newsticker-ticker-period` intervals. The default behavior has
not changed. Not sure if this warrants a change in NEWS.

Thanks!

	Newsticker ticker scrolling options to only display periodically

	* lisp/net/newst-ticker.el (newsticker-ticker-period): 
	Scroll news items only once each period.

	* doc/misc/newsticker.texi (Frontends):
	Document ticker scolling behavior.

[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/net/newst-ticker.el b/lisp/net/newst-ticker.el
index ef0fe83803..abd7c3d04b 100644
--- a/lisp/net/newst-ticker.el
+++ b/lisp/net/newst-ticker.el
@@ -44,8 +44,10 @@ newsticker--prev-message
   "Last message that the newsticker displayed.")
 (defvar newsticker--scrollable-text ""
   "The text which is scrolled smoothly in the echo area.")
+(defvar newsticker--ticker-period-timer nil
+  "Timer for newsticker ticker display.")
 (defvar newsticker--ticker-timer nil
-  "Timer for newsticker ticker.")
+  "Timer for newsticker ticker scrolling.")
 
 ;;;###autoload
 (defun newsticker-ticker-running-p ()
@@ -77,7 +79,7 @@ newsticker--set-customvar-ticker
 
 (defcustom newsticker-ticker-interval
   0.3
-  "Time interval for displaying news items in the echo area (seconds).
+  "Time interval for scrolling news items in the echo area (seconds).
 If equal or less than 0 no messages are shown in the echo area.  For
 smooth display (see `newsticker-scroll-smoothly') a value of 0.3 seems
 reasonable.  For non-smooth display a value of 10 is a good starting
@@ -86,6 +88,17 @@ newsticker-ticker-interval
   :set #'newsticker--set-customvar-ticker
   :group 'newsticker-ticker)
 
+(defcustom newsticker-ticker-period
+  0
+  "Time interval for displaying news items in the echo area (seconds).
+If equal or less than 0 messages are shown continuously.  In order not
+to miss new items, a value of equal or less than the shortest feed
+retrieval interval (or the global `newsticker-retrieval-interval`) is
+recommended."
+  :type 'number
+  :set #'newsticker--set-customvar-ticker
+  :group 'newsticker-ticker)
+
 (defcustom newsticker-scroll-smoothly
   t
   "Decides whether to flash or scroll news items.
@@ -129,9 +142,16 @@ newsticker--display-tick
   "Called from the display timer.
 This function calls a display function, according to the variable
 `newsticker-scroll-smoothly'."
-  (if newsticker-scroll-smoothly
-      (newsticker--display-scroll)
-    (newsticker--display-jump)))
+  (when (not newsticker--ticker-timer)
+      (if newsticker-scroll-smoothly
+       (setq newsticker--ticker-timer
+             (run-at-time 1
+                          newsticker-ticker-interval
+                          #'newsticker--display-scroll))
+     (setq newsticker--ticker-timer
+           (run-at-time nil
+                        newsticker-ticker-interval
+                        #'newsticker--display-jump)))))
 
 (defsubst newsticker--echo-area-clean-p ()
   "Check whether somebody is using the echo area / minibuffer.
@@ -149,7 +169,12 @@ newsticker--display-jump
     (when (newsticker--echo-area-clean-p)
       (setq newsticker--item-position (1+ newsticker--item-position))
       (when (>= newsticker--item-position (length newsticker--item-list))
-        (setq newsticker--item-position 0))
+        (setq newsticker--item-position 0)
+        (when (> newsticker-ticker-period 0)
+          (cancel-timer newsticker--ticker-timer)
+          (setq newsticker--ticker-timer nil)
+          (run-at-time newsticker-ticker-interval nil
+                       (lambda () (message "")))))
       (setq newsticker--prev-message
             (nth newsticker--item-position newsticker--item-list))
       (message "%s" newsticker--prev-message))))
@@ -192,7 +217,12 @@ newsticker--display-scroll
         (setq newsticker--prev-message subtext)
         (setq newsticker--item-position (1+ i))
         (when (>= newsticker--item-position l)
-          (setq newsticker--item-position 0))))))
+          (setq newsticker--item-position 0)
+          (when (> newsticker-ticker-period 0)
+            (cancel-timer newsticker--ticker-timer)
+            (setq newsticker--ticker-timer nil)
+            (run-at-time newsticker-ticker-interval nil
+                         (lambda () (message "")))))))))
 
 ;;;###autoload
 (defun newsticker-start-ticker ()
@@ -200,19 +230,26 @@ newsticker-start-ticker
 Start display timer for the actual ticker if wanted and not
 running already."
   (interactive)
-  (if (and (> newsticker-ticker-interval 0)
-           (not newsticker--ticker-timer))
-      (setq newsticker--ticker-timer
-            (run-at-time newsticker-ticker-interval
-                         newsticker-ticker-interval
-                         #'newsticker--display-tick))))
+  (when (and (> newsticker-ticker-interval 0)
+             (not newsticker--ticker-period-timer)
+             (not newsticker--ticker-timer))
+      (if (> newsticker-ticker-period 0)
+          (setq newsticker--ticker-period-timer
+                (run-at-time nil
+                             newsticker-ticker-period
+                             #'newsticker--display-tick))
+        (newsticker--display-tick))))
 
 (defun newsticker-stop-ticker ()
   "Stop newsticker's ticker (but not the news retrieval)."
   (interactive)
-  (when newsticker--ticker-timer
-    (cancel-timer newsticker--ticker-timer)
-    (setq newsticker--ticker-timer nil)))
+  (progn
+    (when newsticker--ticker-timer
+      (cancel-timer newsticker--ticker-timer)
+      (setq newsticker--ticker-timer nil))
+    (when newsticker--ticker-period-timer
+      (cancel-timer newsticker--ticker-period-timer)
+      (setq newsticker--ticker-period-timer nil))))
 
 ;; ======================================================================
 ;;; Manipulation of ticker text
diff --git a/doc/misc/newsticker.texi b/doc/misc/newsticker.texi
index fec571d923..01384b5850 100644
--- a/doc/misc/newsticker.texi
+++ b/doc/misc/newsticker.texi
@@ -307,11 +307,16 @@ Frontends
 
 @findex newsticker-start-ticker
 @findex newsticker-stop-ticker
+@vindex newsticker-ticker-period
 Headlines can be displayed in the echo area, either scrolling like
 messages in a stock-quote ticker, or just changing.  This can be
 started with the command @code{newsticker-start-ticker}.  It can be
 stopped with @code{newsticker-stop-ticker}.
 
+The ticker by default runs continuously.  To only run it once, at a
+specific time interval, set the @code{newsticker-ticker-period}
+variable.
+
 
 @node Navigation
 @section Navigation
@@ -542,8 +547,10 @@ Configuration
 @itemize
 @item
 @vindex newsticker-display-interval
+@vindex newsticker-ticker-period
 @vindex newsticker-scroll-smoothly
-@code{newsticker-ticker-interval} and
+@code{newsticker-ticker-interval},
+@code{newsticker-ticker-period}, and
 @code{newsticker-scroll-smoothly} define how headlines are shown in
 the echo area.
 @end itemize
[Message part 3 (text/plain, inline)]
-- 
Alex.

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 13 Dec 2022 01:21:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Thu, 12 Jan 2023 01:49:02 GMT) Full text and rfc822 format available.

Message #10 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Alex Bochannek <alex <at> bochannek.com>
To: 59856 <at> debbugs.gnu.org
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Wed, 11 Jan 2023 17:48:37 -0800
I am curious if there is anything I can do to help get this patch
accepted. I have been running Newsticker with the feature since I
submitted it and it's been working well.

Thanks!

-- 
Alex.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Thu, 12 Jan 2023 09:50:02 GMT) Full text and rfc822 format available.

Message #13 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alex Bochannek <alex <at> bochannek.com>, Ulf Jasper <ulf.jasper <at> web.de>
Cc: 59856 <at> debbugs.gnu.org
Subject: Re: bug#59856: Acknowledgement (29.0.50;
 [PATCH] Feature suggestion, Newsticker runs ticker only periodically)
Date: Thu, 12 Jan 2023 11:49:29 +0200
> From: Alex Bochannek <alex <at> bochannek.com>
> Date: Wed, 11 Jan 2023 17:48:37 -0800
> 
> I am curious if there is anything I can do to help get this patch
> accepted. I have been running Newsticker with the feature since I
> submitted it and it's been working well.

Ulf, could you please review the patch and comment on it?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Thu, 12 Jan 2023 20:44:01 GMT) Full text and rfc822 format available.

Message #16 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Ulf Jasper <ulf.jasper <at> web.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59856 <at> debbugs.gnu.org, Alex Bochannek <alex <at> bochannek.com>
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Thu, 12 Jan 2023 21:42:42 +0100
Am 12.01.2023 um 11:49 (+0200) schrieb Eli Zaretskii:
> Ulf, could you please review the patch and comment on it?

The patch looks good.  I can apply it when copyright things are settled.
(I guess that the patch does not count as "tiny" enough to be exempt
from that.)

Best,
ulf




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Thu, 12 Jan 2023 22:03:02 GMT) Full text and rfc822 format available.

Message #19 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Alex Bochannek <alex <at> bochannek.com>
To: Ulf Jasper <ulf.jasper <at> web.de>
Cc: 59856 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Thu, 12 Jan 2023 14:01:57 -0800
Ulf Jasper <ulf.jasper <at> web.de> writes:

> Am 12.01.2023 um 11:49 (+0200) schrieb Eli Zaretskii:
>> Ulf, could you please review the patch and comment on it?
>
> The patch looks good.  I can apply it when copyright things are settled.
> (I guess that the patch does not count as "tiny" enough to be exempt
> from that.)

Appreciate the feedback!

My copyright assignment should be on file.

-- 
Alex.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Fri, 13 Jan 2023 06:37:01 GMT) Full text and rfc822 format available.

Message #22 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alex Bochannek <alex <at> bochannek.com>
Cc: ulf.jasper <at> web.de, 59856 <at> debbugs.gnu.org
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Fri, 13 Jan 2023 08:35:56 +0200
> From: Alex Bochannek <alex <at> bochannek.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  59856 <at> debbugs.gnu.org
> Date: Thu, 12 Jan 2023 14:01:57 -0800
> 
> Ulf Jasper <ulf.jasper <at> web.de> writes:
> 
> > Am 12.01.2023 um 11:49 (+0200) schrieb Eli Zaretskii:
> >> Ulf, could you please review the patch and comment on it?
> >
> > The patch looks good.  I can apply it when copyright things are settled.
> > (I guess that the patch does not count as "tiny" enough to be exempt
> > from that.)
> 
> Appreciate the feedback!
> 
> My copyright assignment should be on file.

Right, it's there.

Ulf, please install this on the master branch.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59856; Package emacs. (Mon, 16 Jan 2023 08:23:02 GMT) Full text and rfc822 format available.

Message #25 received at 59856 <at> debbugs.gnu.org (full text, mbox):

From: Ulf Jasper <ulf.jasper <at> web.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59856 <at> debbugs.gnu.org, Alex Bochannek <alex <at> bochannek.com>
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Mon, 16 Jan 2023 09:22:07 +0100
Am 13.01.2023 um 08:35 (+0200) schrieb Eli Zaretskii:
> Ulf, please install this on the master branch.

Done.





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 16 Jan 2023 13:50:02 GMT) Full text and rfc822 format available.

Notification sent to Alex Bochannek <alex <at> bochannek.com>:
bug acknowledged by developer. (Mon, 16 Jan 2023 13:50:02 GMT) Full text and rfc822 format available.

Message #30 received at 59856-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulf Jasper <ulf.jasper <at> web.de>
Cc: 59856-done <at> debbugs.gnu.org, alex <at> bochannek.com
Subject: Re: bug#59856: Acknowledgement (29.0.50; [PATCH] Feature
 suggestion, Newsticker runs ticker only periodically)
Date: Mon, 16 Jan 2023 15:49:57 +0200
> From: Ulf Jasper <ulf.jasper <at> web.de>
> Cc: Alex Bochannek <alex <at> bochannek.com>,  59856 <at> debbugs.gnu.org
> Date: Mon, 16 Jan 2023 09:22:07 +0100
> 
> Am 13.01.2023 um 08:35 (+0200) schrieb Eli Zaretskii:
> > Ulf, please install this on the master branch.
> 
> Done.

Thanks, I'm therefore closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Feb 2023 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 71 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.