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

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

Re: Need help on writing an Emacs extension to help reading text content


From: Stephen Berman
Subject: Re: Need help on writing an Emacs extension to help reading text content with timer
Date: Wed, 29 Jan 2020 16:50:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

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