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

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

Widget-mode does not handle windows correctly after clicking buttons


From: Torsten Hilbrich
Subject: Widget-mode does not handle windows correctly after clicking buttons
Date: Tue, 23 Oct 2001 20:12:04 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.1.2 (i386-debian-linux-gnu, X toolkit)
 of 2001-10-22 on myrkr
configured using `configure  --prefix=/usr --with-pop --with-gcc 
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info 
--sharedstatedir=/var/lib --localstatedir=/var/lib --with-tiff --with-xpm 
--with-jpeg --with-png --with-x --with-x-toolkit=athena --with-gif 
--enable-ipv6 i386-debian-linux-gnu'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: de_DE
  value of $LC_MESSAGES: POSIX
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I have created a package using the widget package.  It uses
widget-create to create some push-button, one of them closing the
current buffer and restoring the previously saved window
configuration.  Up to emacs version 20.7 this has worked without
problems but now I have tested the code in the new version 21.

I except the code presented below (the minimal subset of my package)
to restore the window configuration before evaluating the code (the
code itself splits the frame vertically using one window to display
the current buffer and the other window to display the newly created
"Widget bug" buffer).  But I get a 

 Debugger entered--Lisp error: (wrong-type-argument window-live-p #<window 15>)
  select-window(#<window 15>)
  (unwind-protect (progn (save-excursion ... ...) (unless ... ... ... ...)) 
(select-window save-selected-window-window))
  (let ((save-selected-window-window ...)) (unwind-protect (progn ... ...) 
(select-window save-selected-window-window)))
  (save-selected-window (save-excursion (mouse-set-point event) (let* ... ...)) 
(unless (pos-visible-in-window-p ...) (mouse-set-point event) 
(beginning-of-line) (recenter)))
  (if button (save-selected-window (save-excursion ... ...) (unless ... ... ... 
...)) (let (... command) (mouse-set-point event) (if ... ... ...) (when up ...) 
(when command ...)))
  (let* ((pos ...) (button ...)) (if button (save-selected-window ... ...) (let 
... ... ... ... ...)))
  (if (widget-event-point event) (let* (... ...) (if button ... ...)) (message 
"You clicked somewhere weird."))
  widget-button-click((down-mouse-2 (#<window 15> 4 (20 . 9) -88356453)))
  call-interactively(widget-button-click)

(Sorry for the long lines but I didn't want to shorten it)

Here is the example code which can be evaluated to reproduce the
error:

;; ------------------------------------------------------------------
(require 'widget)
(setq window-conf nil)
(let ((buffer (generate-new-buffer "Widget bug")))
  (setq window-conf (current-window-configuration))
  (switch-to-buffer-other-window buffer)
  (widget-create 'push-button
                 :notify (lambda (&rest ignore)
                           (set-window-configuration window-conf))
                 "Close")
  (use-local-map widget-keymap))
;; ------------------------------------------------------------------

I made sure this error also occurs without loading any of the init
files (-no-site-init -no-init-file).

When my debugging is correct the problem is the save-selected-window
call within widget-click-action:

(defun widget-button-click (event)
  "Invoke the button that the mouse is pointing at."
  (interactive "@e")
  (if (widget-event-point event)
      (let* ((pos (widget-event-point event))
             (button (get-char-property pos 'button)))
        (if button
            ;; Mouse click on a widget button.  Do the following
            ;; in a save-excursion so that the click on the button
            ;; doesn't change point.
            (save-selected-window
            ^^^^^^^^^^^^^^^^^^^^^

It tries to reselect the previous window which has been removed by my
restored window-configuration.

I tried the above code with XEmacs 21.4 (and the supplied widget
package) and with Emacs 21.1 and the widget package version 1.9962
from the authors web page.  With both setups the code sample worked
without any problems, just the widget package built into Emacs 21.1
gives the above error message. 




Recent input:
<down> <up> M-x d e <backspace> <backspace> e d e b 
u g - d e f u n <tab> <up> <up> <up> <up> <return> 
( s e t q SPC w i n d o w - c o n f SPC n i l ) <down> 
<C-left> <C-left> <C-left> <C-left> <C-right> <right> 
<right> C-SPC <down> C-w <down> C-a C-y <up> <tab> 
<C-left> s e t q SPC <down> <tab> C-x C-s M-x <up> 
<return> <help-echo> <down-mouse-2> <mouse-movement> 
<mouse-2> M-x b u <tab> <backspace> <backspace> r e 
p <tab> <tab> o <tab> r t - e m <tab> <return>

Recent messages:
Loading debug...done
Entering debugger...
 [2 times]
Back to top level.
call-interactively: Quit
Mark set [2 times]
Wrote /home/torsten/tmp/bug.el
widget-button-click: Wrong type argument: window-live-p, #<window 44>
Making completion list... [3 times]
Loading emacsbug...done


It would be nice if you could fix this bug for the next emacs release.
One possibility of fixing it is to use the lastest widget version from
http://www.dina.kvl.dk/~abraham/custom/

Thank you,

        Torsten

BTW: Please tell me if you need any additional information regarding
this bug.




reply via email to

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