unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15457: 24.3.50; buffer local `window-point-insertion-type'
@ 2013-09-24 17:18 Michael Heerdegen
  2014-04-16 14:00 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Heerdegen @ 2013-09-24 17:18 UTC (permalink / raw)
  To: 15457

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


Hello,

while experimenting with my logging mode, I stumbled over an
inconsistency regarding `window-point-insertion-type'.  Recipe from
emacs -Q:

(1)  Eval the attached defun

(2a) Eval (window-point-insertion-type-test t)


Result: After hitting RET (or C-g), window-point of the second window is
restored to the value it had before the recursive edit (i.e. 1 in this
case).

Now, repeat the recipe, but with

(2b) Eval (window-point-insertion-type-test nil)

Result: window-point in the second window remains at the end of the
buffer.

`window-point-insertion-type' is always bound to t in the test buffer;
the difference between the two recipes is just that it is set to t
buffer-locally in (2a), and globally in (2b).  I would expect that the
behavior is identical for both recipes.

BTW, for my mode, I want the behavior of (2b), but, of course, without
modifying a global variable binding.  let-binding also doesn't help.


Thanks,

Michael.



[-- Attachment #2: insertion-type-bug.el --]
[-- Type: application/emacs-lisp, Size: 815 bytes --]

[-- Attachment #3: Type: text/plain, Size: 231 bytes --]





In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.4)
 of 2013-09-24 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux testing (jessie)



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

* bug#15457: 24.3.50; buffer local `window-point-insertion-type'
  2013-09-24 17:18 bug#15457: 24.3.50; buffer local `window-point-insertion-type' Michael Heerdegen
@ 2014-04-16 14:00 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-04-16 14:00 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 15457-done

> while experimenting with my logging mode, I stumbled over an
> inconsistency regarding `window-point-insertion-type'.  Recipe from
> emacs -Q:

> (1)  Eval the attached defun

> (2a) Eval (window-point-insertion-type-test t)


> Result: After hitting RET (or C-g), window-point of the second window is
> restored to the value it had before the recursive edit (i.e. 1 in this
> case).

> Now, repeat the recipe, but with

> (2b) Eval (window-point-insertion-type-test nil)

> Result: window-point in the second window remains at the end of the
> buffer.

That seems to be because the insertion type of the markers saved by
window-configuration is determined by the value of
window-point-insertion-type in the current-buffer rather than each
window's buffer.

I installed the patch below into emacs-24, which should fix it,


        Stefan


=== modified file 'src/window.c'
--- src/window.c	2014-03-07 15:11:12 +0000
+++ src/window.c	2014-04-16 13:58:18 +0000
@@ -55,6 +55,7 @@
 static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
 static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of;
 static Lisp_Object Qfloor, Qceiling;
+static Lisp_Object Qwindow_point_insertion_type;
 
 static int displayed_window_lines (struct window *);
 static int count_windows (struct window *);
@@ -124,7 +125,7 @@
 /* Hook to run when window config changes.  */
 static Lisp_Object Qwindow_configuration_change_hook;
 
-/* Used by the function window_scroll_pixel_based */
+/* Used by the function window_scroll_pixel_based.  */
 static int window_scroll_pixel_based_preserve_x;
 static int window_scroll_pixel_based_preserve_y;
 
@@ -6618,7 +6619,8 @@
 	  else
 	    p->pointm = Fcopy_marker (w->pointm, Qnil);
 	  XMARKER (p->pointm)->insertion_type
-	    = !NILP (Vwindow_point_insertion_type);
+	    = !NILP (buffer_local_value_1 /* Don't signal error if void.  */
+		     (Qwindow_point_insertion_type, w->contents));
 
 	  p->start = Fcopy_marker (w->start, Qnil);
 	  p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
@@ -7235,6 +7237,7 @@
   DEFVAR_LISP ("window-point-insertion-type", Vwindow_point_insertion_type,
 	       doc: /* Type of marker to use for `window-point'.  */);
   Vwindow_point_insertion_type = Qnil;
+  DEFSYM (Qwindow_point_insertion_type, "window_point_insertion_type");
 
   DEFVAR_LISP ("window-configuration-change-hook",
 	       Vwindow_configuration_change_hook,






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

end of thread, other threads:[~2014-04-16 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24 17:18 bug#15457: 24.3.50; buffer local `window-point-insertion-type' Michael Heerdegen
2014-04-16 14:00 ` 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).