GNU bug report logs - #7875
point preserved incorrectly with minibuffer-frame

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 20 Jan 2011 17:32:02 UTC

Severity: normal

Found in version 24.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7875 in the body.
You can then email your comments to 7875 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7875; Package emacs. (Thu, 20 Jan 2011 17:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 20 Jan 2011 17:32:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: point preserved incorrectly with minibuffer-frame
Date: Thu, 20 Jan 2011 12:38:51 -0500
Package: Emacs
Version: 24.0.50

When I do

   % src/emacs -Q --eval '(setq default-frame-alist (quote ((minibuffer . nil))))'
   M-: (goto-char (point-min)) RET

the cursor stays at EOB rather than going to BOB.  I suspect this is due
to the recent change with the Fset_window_configuration issue.


        Stefan




In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2011-01-19 on ceviche
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O1 -I/usr/include/GNUstep' '--enable-maintainer-mode' '--with-x-toolkit=lucid''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_CH.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Minibuffer-Area

Minor modes in effect:
  diff-auto-refine-mode: t
  electric-pair-mode: t
  electric-indent-mode: t
  url-handler-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<switch-frame> <switch-frame> M-x b b d b <return> 
<return> C-x C-s C-x 5 f b b <tab> <return> C-x v = 
<switch-frame> <help-echo> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <help-echo> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
M-> <up> <up> <up> <up> <right> C-s C-w C-w C-r C-r 
C-s C-s C-r C-r C-s C-s C-r C-r C-s C-s C-r C-r C-a 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> M-p M-> C-r C-g M-v M-v M-v M-< C-v 
C-v C-v C-v C-v C-v C-v C-v C-v C-v C-v M-v <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> M-x r 
e p <tab> o <tab> r <tab> <return>

Recent messages:
Formatting...done.
Saving file /home/monnier/share/misc/bbdb...
Wrote /home/monnier/share/misc/bbdb
Finding changes in /home/monnier/share/misc/bbdb...done
Mark set
Mark saved where search started
Mark set
Quit
Mark set
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mail-utils gmm-utils mailheader emacsbug smerge-mode multi-isearch
diff-mode vc vc-dispatcher warnings executable copyright byte-opt
bytecomp byte-compile bbdb-migrate vc-bzr sha1 hex-util filecache
bbdb-com mailabbrev bbdb timezone server noutline outline easy-mmode
flyspell ispell eldoc checkdoc regexp-opt thingatpt help-mode easymenu
view prog-mode electric url-handlers url-parse auth-source netrc
gnus-util url-vars mm-util mail-prsvr reveal autoinsert uniquify advice
help-fns advice-preload savehist minibuf-eldef cl cl-loaddefs proof-site
proof-autoloads pg-vars bbdb-autoloads agda2 tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe
lisp-mode register page newcomment menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face files text-properties overlay
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting x-toolkit
x multi-tty emacs)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7875; Package emacs. (Fri, 21 Jan 2011 07:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 7875 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7875 <at> debbugs.gnu.org
Subject: Re: bug#7875: point preserved incorrectly with minibuffer-frame
Date: Fri, 21 Jan 2011 08:41:25 +0100
[Message part 1 (text/plain, inline)]
> When I do
>
>    % src/emacs -Q --eval '(setq default-frame-alist (quote ((minibuffer . nil))))'
>    M-: (goto-char (point-min)) RET
>
> the cursor stays at EOB rather than going to BOB.  I suspect this is due
> to the recent change with the Fset_window_configuration issue.

I have posted two possible fixes: Either you replace the code

  if (EQ (window, selected_window))
    return window;

in Fselect_window with

  if (EQ (window, selected_window))
    {
     inhibit_point_swap = 0;
     return window;
    }

or you try the attached patch.  If possible, try both fixes.

martin, who should think about a better solution
[window.c.diff (text/plain, inline)]
=== modified file 'src/window.c'
*** src/window.c	2011-01-15 23:16:57 +0000
--- src/window.c	2011-01-16 10:18:51 +0000
***************
*** 85,90 ****
--- 85,91 ----
                               int (* fn) (struct window *, void *),
                               void *);
  static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
+ static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
  
  /* This is the window in which the terminal's cursor should
     be left when nothing is being done with it.  This must
***************
*** 158,168 ****
  
  static int window_initialized;
  
- /* Set in `set-window-configuration' to prevent "swapping out point"
-    in the old selected window.  */
- 
- static int inhibit_point_swap;
- 
  /* Hook to run when window config changes.  */
  
  static Lisp_Object Qwindow_configuration_change_hook;
--- 159,164 ----
***************
*** 3550,3569 ****
    return Qnil;
  }
  
- /* Note that selected_window can be nil when this is called from
-    Fset_window_configuration.  */
  
! DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
!        doc: /* Select WINDOW.  Most editing will apply to WINDOW's buffer.
! If WINDOW is not already selected, make WINDOW's buffer current
! and make WINDOW the frame's selected window.  Return WINDOW.
! Optional second arg NORECORD non-nil means do not put this buffer
! at the front of the list of recently selected ones and do not
! make this window the most recently selected one.
  
! Note that the main editor command loop selects the buffer of the
! selected window before each command.  */)
!   (register Lisp_Object window, Lisp_Object norecord)
  {
    register struct window *w;
    register struct window *ow;
--- 3546,3560 ----
    return Qnil;
  }
  
  
! /* If select_window is called with inhibit_point_swap non-zero it will
!    not store point of the old selected window's buffer back into that
!    window's pointm slot.  This is needed by Fset_window_configuration to
!    avoid that the display routine is called with selected_window set to
!    Qnil causing a subsequent crash.  */
  
! static Lisp_Object
! select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
  {
    register struct window *w;
    register struct window *ow;
***************
*** 3603,3611 ****
    /* Store the current buffer's actual point into the
       old selected window.  It belongs to that window,
       and when the window is not selected, must be in the window.  */
!   if (inhibit_point_swap)
!     inhibit_point_swap = 0;
!   else
      {
        ow = XWINDOW (selected_window);
        if (! NILP (ow->buffer))
--- 3594,3600 ----
    /* Store the current buffer's actual point into the
       old selected window.  It belongs to that window,
       and when the window is not selected, must be in the window.  */
!   if (! inhibit_point_swap)
      {
        ow = XWINDOW (selected_window);
        if (! NILP (ow->buffer))
***************
*** 3639,3644 ****
--- 3628,3648 ----
    return window;
  }
  
+ DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
+        doc: /* Select WINDOW.  Most editing will apply to WINDOW's buffer.
+ If WINDOW is not already selected, make WINDOW's buffer current
+ and make WINDOW the frame's selected window.  Return WINDOW.
+ Optional second arg NORECORD non-nil means do not put this buffer
+ at the front of the list of recently selected ones and do not
+ make this window the most recently selected one.
+ 
+ Note that the main editor command loop selects the buffer of the
+ selected window before each command.  */)
+   (register Lisp_Object window, Lisp_Object norecord)
+ {
+   select_window (window, norecord, 0);
+ }
+ 
  static Lisp_Object
  select_window_norecord (Lisp_Object window)
  {
***************
*** 6167,6174 ****
  	 out point" in the old selected window using the buffer that
  	 has been restored into it.  We already swapped out that point
  	 from that window's old buffer.  */
!       inhibit_point_swap = 1;
!       Fselect_window (data->current_window, Qnil);
        XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
  	= selected_window;
  
--- 6171,6177 ----
  	 out point" in the old selected window using the buffer that
  	 has been restored into it.  We already swapped out that point
  	 from that window's old buffer.  */
!       select_window (data->current_window, Qnil, 1);
        XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
  	= selected_window;
  
***************
*** 7099,7106 ****
    window_scroll_preserve_hpos = -1;
    window_scroll_preserve_vpos = -1;
  
-   inhibit_point_swap = 0;
- 
    DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
  	       doc: /* Non-nil means call as function to display a help buffer.
  The function is called with one argument, the buffer to be displayed.
--- 7102,7107 ----


Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7875; Package emacs. (Sun, 23 Jan 2011 20:53:04 GMT) Full text and rfc822 format available.

Message #11 received at 7875 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 7875 <at> debbugs.gnu.org
Subject: Re: bug#7875: point preserved incorrectly with minibuffer-frame
Date: Sun, 23 Jan 2011 16:00:56 -0500
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> Package: Emacs
> Version: 24.0.50
>
> When I do
>
>    % src/emacs -Q --eval '(setq default-frame-alist (quote ((minibuffer . nil))))'
>    M-: (goto-char (point-min)) RET
>
> the cursor stays at EOB rather than going to BOB.  I suspect this is due
> to the recent change with the Fset_window_configuration issue.

Is emacs-23 affected?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7875; Package emacs. (Mon, 24 Jan 2011 18:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 7875 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 7875 <at> debbugs.gnu.org
Subject: Re: bug#7875: point preserved incorrectly with minibuffer-frame
Date: Mon, 24 Jan 2011 13:32:55 -0500
>> the cursor stays at EOB rather than going to BOB.  I suspect this is due
>> to the recent change with the Fset_window_configuration issue.
> Is emacs-23 affected?

Yes, the emacs-23 code was also affected.  But it's fixed now,


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 24 Jan 2011 18:25:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Mon, 24 Jan 2011 18:25:02 GMT) Full text and rfc822 format available.

Message #19 received at 7875-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 7875-done <at> debbugs.gnu.org
Subject: Re: bug#7875: point preserved incorrectly with minibuffer-frame
Date: Mon, 24 Jan 2011 13:32:28 -0500
> or you try the attached patch.  If possible, try both fixes.

I see you've installed that one in the emacs-23 branch and indeed it
appears to fix the problem.  Thank you,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Feb 2011 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 121 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.