unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefankangas@gmail.com>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: emacs-devel@gnu.org
Subject: Re: master d378615: Cancel timer when world-clock buffer is killed
Date: Thu, 3 Sep 2020 17:22:34 +0000	[thread overview]
Message-ID: <CADwFkmkSZ_kC2M8F=+s3hSXuM7QbTDi61aBz4nreN4+tJxTUCw@mail.gmail.com> (raw)
In-Reply-To: <87sgbzrn0l.fsf@tcd.ie>

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

>> +    (add-hook 'kill-buffer-hook #'world-clock-cancel-timer))
>
> Should this be hooked buffer-locally?

Yup.

>> +(defvar world-clock-timer nil)
>
> Should this be given an internal name (and docstring)?
>
>> +(defun world-clock-cancel-timer ()
>> +  "Cancel the world clock timer."
>> +  (when world-clock-timer
>> +    (cancel-timer world-clock-timer)
>> +    (setq world-clock-timer nil)))
>> +
>
> It seems to me that world-clock-cancel-timer and world-clock-update are
> duplicating each other.  Or am I missing something?

Oh, right...  I've pushed a fixed version where I removed the above new
variable and moved the code to cancel the timer from
`world-clock-update' to `world-clock-cancel-timer'.

(I couldn't just add `world-clock-cancel-timer' to `kill-buffer-hook'
because the buffer still exists when the hook is run.)

Thanks for the review!



  reply	other threads:[~2020-09-03 17:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200903105449.22858.36474@vcs0.savannah.gnu.org>
     [not found] ` <20200903105450.8CD2D20A15@vcs0.savannah.gnu.org>
2020-09-03 13:46   ` master d378615: Cancel timer when world-clock buffer is killed Basil L. Contovounesios
2020-09-03 17:22     ` Stefan Kangas [this message]
2020-09-04  9:58       ` Basil L. Contovounesios
2020-09-06 15:38         ` Stefan Kangas
2020-09-06 15:55           ` Basil L. Contovounesios

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CADwFkmkSZ_kC2M8F=+s3hSXuM7QbTDi61aBz4nreN4+tJxTUCw@mail.gmail.com' \
    --to=stefankangas@gmail.com \
    --cc=contovob@tcd.ie \
    --cc=emacs-devel@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 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).