all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "B. T. Raven" <nihil@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: No sound with Emacs 23.1.1 on Ubuntu 9.10
Date: Mon, 04 Jan 2010 12:03:20 -0600	[thread overview]
Message-ID: <O_6dnX_FLJL9sN_WnZ2dnUVZ_judnZ2d@sysmatrix.net> (raw)
In-Reply-To: <n_KdnTP2Us8JptzWnZ2dnUVZ_hydnZ2d@sysmatrix.net>

B. T. Raven wrote:
> B. T. Raven wrote:
>> Joe Casadonte wrote:
>>> On Jan 1, 7:41 pm, "B. T. Raven" <ni...@nihilo.net> wrote:
>>>
>>>> If you position cursor after
>>>>
>>>> (ding)
>>>>
>>>> in *scratch* and evaluate with
>>>>
>>>> C-x C-e do you hear anything?
>>> Sadly -- nothing.
>> Maybe your Ubuntu build didn't have this in term.c for some reason:
>>
>> DEFVAR_LISP ("ring-bell-function", &Vring_bell_function,
>>     doc: /* Non-nil means call this function to ring the bell.
>> The function should accept no arguments.  */);
>>   Vring_bell_function = Qnil;
>>
>> If this variable names some function then maybe the problem is with that
>> function.
>>
>> I tried to write a countdown timer in elisp once but could't get the
>> bell, C-g or char 7, to work in a loop; it would only ring once when the
>> counter went to zero. This is all it does now:
>>
>> (defun alarm-message (text)
>>   "Pop up alarm message"
>>    (ding)
>>    (message-box text))
> 
> 
> This puts ding in a 30 per minute loop that can't be broken out of:
> 
> (defun alarm-message (text)
>   "Pop up alarm message"
>    (ding)
>    (read-event)
> (while (waiting-for-user-input-p)
>    (sleep-for 2)
>    (ding)
> )
> (message-box text)
> )
> 
> I had to kill the emacs process to escape from this. What's going on here?
> 
> 
>>
>> (defun alarm ()
>>   "Set an alarm.
>> The time format is the same accepted by `run-at-time'.  For
>> example \"11:30am\"."
>>   (interactive)
>>   (let ((time (read-string "Time: "))
>>         (text "Get lead out!"))
>>      (run-at-time time nil 'alarm-message text)))
>>
>> Does any of you know how to get (ding) to work in a loop that breaks
>> when a key is pressed?
>>
>> Ed
>>
>>


Replacing alarm-message with this sort of works, in case anyone is
interested:

(defun alarm-message (text)
  "Pop up alarm message"
  (while (not (read-char nil nil 1))
   (sleep-for 2)
   (ding)
  )
 (message-box text)
)

The number of more elegant solutions is probably legion.



  parent reply	other threads:[~2010-01-04 18:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 17:56 No sound with Emacs 23.1.1 on Ubuntu 9.10 Joe Casadonte
2009-12-31 23:03 ` B. T. Raven
2010-01-01 20:20   ` Joe Casadonte
2010-01-02  0:41     ` B. T. Raven
2010-01-03  2:24       ` Joe Casadonte
2010-01-04  0:17         ` B. T. Raven
     [not found]           ` <n_KdnTP2Us8JptzWnZ2dnUVZ_hydnZ2d@sysmatrix.net>
2010-01-04 18:03             ` B. T. Raven [this message]
2010-01-18 13:47         ` Joe Casadonte
2010-01-01  4:52 ` Óscar Fuentes
     [not found] ` <mailman.508.1262321580.18930.help-gnu-emacs@gnu.org>
2010-01-01 20:21   ` Joe Casadonte

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=O_6dnX_FLJL9sN_WnZ2dnUVZ_judnZ2d@sysmatrix.net \
    --to=nihil@nihilo.net \
    --cc=help-gnu-emacs@gnu.org \
    /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.