help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] Re: Need help on writing an Emacs extension to help reading tex


From: stardiviner
Subject: [SOLVED] Re: Need help on writing an Emacs extension to help reading text content with timer
Date: Thu, 30 Jan 2020 14:25:12 +0800
User-agent: mu4e 1.3.2; emacs 27.0.50

Stephen Berman <stephen.berman@gmx.net> writes:

> On Wed, 29 Jan 2020 23:19:41 +0800 stardiviner <numbchild@gmail.com> wrote:
>
> [...]
>> (defun amread-start ()
>>   "Start / resume amread."
>>   (interactive)
>>   (setq qamread--running
>           ^
>           |:-)
>
>>         (run-with-timer 0 (/ 1.0 amread-wps) #'amread--update)))
>>
>> (defun amread-stop ()
>>   "Stop amread."
>>   (interactive)
>>   (prog1 amread--running
>>     (when amread--running
>>       (cancel-timer amread--running)
>>       (setq amread--running nil)
>>       (delete-overlay amread--overlay))))
>>
>> (defvar amread-mode-map
>>   (let ((map (make-sparse-keymap)))
>>     (define-key map (kbd "q") 'amread-stop)
>>     (define-key map [remap keyaobrd-quit] 'amread-stop)
>>     map)
>>   "Keymap for amread-mode buffers.")
>>
>> (define-minor-mode amread-mode
>>   "I'm reading qmode."
>>   :init nil
>>   :keymap amread-mode-map
>>   (if amread--running
>>       (amread-stop)
>>     (amread-start)))
>> #+end_src
>>
>> But the problem is that I can't stop this timer with defined keybinding 
>> =[q]= nor
>> with minor mode toggle command =amread-mode=.
>>
>> I don't know where is the problem. can someone help me to review my code?
>
> See above. :-)
>
> Steve Berman

Aha, right. I guess this bug is introduced when I write code and testing.
Accidentally press =[q]= for testing quit timer. Now it works.

Thanks Steve.

-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      



reply via email to

[Prev in Thread] Current Thread [Next in Thread]