unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7875: point preserved incorrectly with minibuffer-frame
@ 2011-01-20 17:38 Stefan Monnier
  2011-01-21  7:41 ` martin rudalics
  2011-01-23 21:00 ` Chong Yidong
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-01-20 17:38 UTC (permalink / raw)
  To: 7875

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)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7875: point preserved incorrectly with minibuffer-frame
  2011-01-20 17:38 bug#7875: point preserved incorrectly with minibuffer-frame Stefan Monnier
@ 2011-01-21  7:41 ` martin rudalics
  2011-01-24 18:32   ` Stefan Monnier
  2011-01-23 21:00 ` Chong Yidong
  1 sibling, 1 reply; 5+ messages in thread
From: martin rudalics @ 2011-01-21  7:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7875

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

 > 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

[-- Attachment #2: window.c.diff --]
[-- Type: text/plain, Size: 4926 bytes --]

=== 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 ----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7875: point preserved incorrectly with minibuffer-frame
  2011-01-20 17:38 bug#7875: point preserved incorrectly with minibuffer-frame Stefan Monnier
  2011-01-21  7:41 ` martin rudalics
@ 2011-01-23 21:00 ` Chong Yidong
  2011-01-24 18:32   ` Stefan Monnier
  1 sibling, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2011-01-23 21:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7875

Stefan Monnier <monnier@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?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7875: point preserved incorrectly with minibuffer-frame
  2011-01-21  7:41 ` martin rudalics
@ 2011-01-24 18:32   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-01-24 18:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: 7875-done

> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7875: point preserved incorrectly with minibuffer-frame
  2011-01-23 21:00 ` Chong Yidong
@ 2011-01-24 18:32   ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-01-24 18:32 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 7875

>> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-24 18:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-20 17:38 bug#7875: point preserved incorrectly with minibuffer-frame Stefan Monnier
2011-01-21  7:41 ` martin rudalics
2011-01-24 18:32   ` Stefan Monnier
2011-01-23 21:00 ` Chong Yidong
2011-01-24 18:32   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).