0

How do you wrote an abortable function, so that when user presses C-g during execution, this function is "stopped"

;; my function so far
(defun my/elfeed-extra-info-2 ()
  (interactive)
  (next-line)
  (message "here1")
  (sleep-for 0.5)
  (next-line)
  (message "here2")
  (sleep-for 0.5)
  (next-line)
  (message "here3")
  (sleep-for 0.5)
  (next-line)
  (message "here4")
  (sleep-for 0.5)
  (next-line)
  (message "here5")
  (sleep-for 0.5)
  (next-line)
  (message "here6")
  (sleep-for 0.5)
  (next-line)
  (message "here7")
  (sleep-for 0.5)
  (next-line)
  (message "here8")
  (sleep-for 0.5)
)
  • This is pretty much a duplicate of your other question, don't use sleep-for. – wasamasa Jul 6 '18 at 17:15
  • This works just fine for me: C-g aborts the function. – Tyler Jul 6 '18 at 17:41
  • In my experience it depends on the operating system whether quit works reliable. Under Linux it works perfect (also for my/elfeed-extra-info-2) while under cygwin I often have emacs hanging without being able to quit via C-g. I have to use pkill -SIGUSR2 emacs from the command line in those cases. If you experience problems with your function please extend your question with system information and with a detailed description what happens on your system if you press C-g. – Tobias Jul 6 '18 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.