From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Q: How to programatically terminate repeat-mode Date: Mon, 03 Oct 2022 08:48:21 -0400 Message-ID: References: <86r10jghs7.fsf@mail.linkov.net> <86czba2jib.fsf@mail.linkov.net> <86mtadv0kv.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29930"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: "T.V Raman" , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 03 14:55:59 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofKzH-0007YF-2J for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Oct 2022 14:55:59 +0200 Original-Received: from localhost ([::1]:55630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofKzF-0003Ed-Se for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Oct 2022 08:55:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofKs6-0000LL-0f for emacs-devel@gnu.org; Mon, 03 Oct 2022 08:48:34 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39974) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofKs3-0001bw-M8 for emacs-devel@gnu.org; Mon, 03 Oct 2022 08:48:32 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A1CA14406B6; Mon, 3 Oct 2022 08:48:29 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F259D440646; Mon, 3 Oct 2022 08:48:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1664801304; bh=XL2baDLF/g02bMcsRfRMpy4L9/+bFBfSTt7g5HaHcNA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pv/y0ynGwcrWH3NfINDKO7N041p1co0WE8RBc6wZcPapDnnRSSlVep1cyamyxqRoU AbqVWZc4qID+BBMaqFpoE7o/w2zNKmLAT/egyKjgaBzWusap0ibO/tKIljQ27CMWGv 9wOrMYpsxFFkzfYVFNFqMDv5ckxPgKvYpB27NYNkezjfijbfs37B7jZCsiS35FONa0 47AuyQXqbhx3aucbSL+fxRLEMd40mGj70QvEzvwIWG5pknd23CQXIM7DUN7Dj8ewT5 CWgLnxN8bFKexP1+9jwNvGqA4wsCooBEWSWc0dBHOL3Wy+DL+RT8ngUwrl0cQW2++M Gh9fI9mN08xNQ== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 919381203F3; Mon, 3 Oct 2022 08:48:23 -0400 (EDT) In-Reply-To: <86mtadv0kv.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 03 Oct 2022 09:56:32 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296741 Archived-At: Juri Linkov [2022-10-03 09:56:32] wrote: >> Replacing the earlier (push 7 unread-command-events) >> with >> (when repeat-exit-timer >> (timer-set-idle-time repeat-exit-timer 0)) >> >> in my disable-repeat function that I called from the process-sentinel of >> the media player -- with check for exit as the guard condition has no >> effect and the repeat remains in effect. > > Maybe you are starting multiple timers? Currently repeat-mode cancels > all previously started timers, but unfortunately cancel-timer for > repeat-exit-timer doesn't run its timer function that should exit > the repeat map. I propose to add a new optional argument RUN-FUNCTION > to cancel-timer, that will run the timer function after canceling the timer. > This means copying this part of timer-event-handler to cancel-timer: I don't see any need to add some weird `run-function` arg to `cancel-timer`, here. Why can't the repeat-map code offer a function to ... "programatically terminate repeat-mode"? Since it set up the timer, it can know what function the timer will run and with what args and can thus run that same code if it wants to. Stefan