[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`y-or-n-p' does not wait for input - assumes `n'
From: |
Drew Adams |
Subject: |
`y-or-n-p' does not wait for input - assumes `n' |
Date: |
Sat, 22 Jan 2005 15:11:55 -0800 |
Eval the following code, then open a Customize buffer, click State for some
item, and choose Foo Bar in the State menu. No `y-or-n-p' question is asked,
and "No" appears immediately in the echo area.
This is just the standard `custom-variable-menu', with one addition: "Foo
Bar":
(setq custom-variable-menu
'(("Set for Current Session" custom-variable-set
(lambda (widget)
(eq (widget-get widget :custom-state) 'modified)))
("Save for Future Sessions" custom-variable-save
(lambda (widget)
(memq (widget-get widget :custom-state) '(modified set changed
rogue))))
("Foo Bar" custom-foobar
(lambda (widget) (eq (widget-get widget :custom-state) 'set)))
("Reset to Current" custom-redraw
(lambda (widget)
(and (default-boundp (widget-value widget))
(memq (widget-get widget :custom-state) '(modified changed)))))
("Reset to Saved" custom-variable-reset-saved
(lambda (widget)
(and (or (get (widget-value widget) 'saved-value)
(get (widget-value widget) 'saved-variable-comment))
(memq (widget-get widget :custom-state)
'(modified set changed rogue)))))
("Reset to Standard Setting" custom-variable-reset-standard
(lambda (widget)
(and (get (widget-value widget) 'standard-value)
(memq (widget-get widget :custom-state)
'(modified set changed saved rogue)))))
("Use Backup Value" custom-variable-reset-backup
(lambda (widget)
(and (>= emacs-major-version 21)
(get (widget-value widget) 'backup-value))))
("---" ignore ignore)
("Add Comment" custom-comment-show
(lambda (widget) (and (boundp 'custom-comment-invisible-p)
custom-comment-invisible-p)))
("---" ignore ignore)
("Don't show as Lisp expression" custom-variable-edit
(lambda (widget)
(eq (widget-get widget :custom-form) 'lisp)))
("Show initial Lisp expression" custom-variable-edit-lisp
(lambda (widget)
(eq (widget-get widget :custom-form) 'edit)))))
Function `custom-foo-bar' is this:
(defun custom-foobar (widget)
(if (y-or-n-p "foo: ")
(progn (message "Yes")(sit-for 1))
(message "No")(sit-for 1)))
1. This code works perfectly in Emacs 20.7 - the `y-or-no-p' question
is posed, and the proper value echoed (Yes or No), depending on the
input (y or n).
2. When I create a customize buffer using this in Emacs 21, the
`y-or-n-p' question never appears when I choose the Foo Bar menu
item in the State menu. The message "No" appears immediately.
3. This happens whether I load the source code or the byte-compiled
source code.
4. When I debug-on-entry `custom-foobar', it steps through and
executes normally.
It has me stumped.
In GNU Emacs 21.3.50.1 (i386-mingw-nt5.1.2600)
of 2004-07-26 on BERATUNG4
configured using `configure --with-gcc
(3.3) --cflags -I../../jpeg-6b-1/include -I../../libpng-1.2.4-1/include -I..
/../tiff-3.5.7/include -I../../xpm-nox-4.2.0/include -I../../zlib-1.1.4-1/in
clude'
- `y-or-n-p' does not wait for input - assumes `n',
Drew Adams <=
- Re: `y-or-n-p' does not wait for input - assumes `n', Richard Stallman, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23
- RE: `y-or-n-p' does not wait for input - assumes `n', Drew Adams, 2005/01/23
- Re: `y-or-n-p' does not wait for input - assumes `n', Luc Teirlinck, 2005/01/23