all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: stardiviner <numbchild@gmail.com>
Cc: Emacs Help <help-gnu-emacs@gnu.org>
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	[thread overview]
Message-ID: <87ftfy9s8z.fsf@gmx.net> (raw)
In-Reply-To: <87v9ou5lyq.fsf@gmail.com> (stardiviner's message of "Wed, 29 Jan 2020 23:19:41 +0800")

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	other threads:[~2020-01-29 15:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 15:19 Need help on writing an Emacs extension to help reading text content with timer stardiviner
2020-01-29 15:50 ` Stephen Berman [this message]
2020-01-30  6:25   ` [SOLVED] " stardiviner

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

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

  git send-email \
    --in-reply-to=87ftfy9s8z.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=numbchild@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.