[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cursor-in-non-selected-windows as buffer-local
From: |
md5i |
Subject: |
Re: cursor-in-non-selected-windows as buffer-local |
Date: |
Thu, 01 Nov 2001 15:13:18 -0500 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu) |
Richard Stallman <address@hidden> writes:
> Your patch is basically good, but here are some comments on specific
> points.
[...]
Here is a new patch with those comments addressed:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.2143
diff -u -r1.2143 ChangeLog
--- ChangeLog 2001/11/01 19:55:51 1.2143
+++ ChangeLog 2001/11/01 20:05:27
@@ -1,3 +1,10 @@
+2001-11-01 Michael Welsh Duggan <address@hidden>
+
+ * buffer.c (Fbuffer_local_value): New function.
+
+ * xterm.c, w32term.c (x_display_and_set_cursor): Use buffer-local
+ value of `cursor-in-non-selected-windows'.
+
2001-11-01 Richard M. Stallman <address@hidden>
* keymap.c (Fdescribe_buffer_bindings): Print character property
Index: buffer.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
retrieving revision 1.368
diff -u -r1.368 buffer.c
--- buffer.c 2001/11/01 10:23:52 1.368
+++ buffer.c 2001/11/01 20:05:32
@@ -808,6 +808,58 @@
return base_buffer;
}
+DEFUN ("buffer-local-value", Fbuffer_local_value,
+ Sbuffer_local_value, 2, 2, 0,
+ doc: /* Return the value of VARIABLE in BUFFER.
+If VARIABLE does not have a buffer-local binding in BUFFER, the value
+is the default binding of variable. */)
+ (symbol, buffer)
+ register Lisp_Object symbol;
+ register Lisp_Object buffer;
+{
+ register struct buffer *buf;
+ register Lisp_Object result;
+
+ CHECK_SYMBOL (symbol, 0);
+ CHECK_BUFFER (buffer, 0);
+ buf = XBUFFER (buffer);
+
+ /* Look in local_var_list */
+ result = Fassoc (symbol, buf->local_var_alist);
+ if (NILP (result))
+ {
+ int offset, idx;
+ int found = 0;
+
+ /* Look in special slots */
+ for (offset = PER_BUFFER_VAR_OFFSET (name);
+ offset < sizeof (struct buffer);
+ /* sizeof EMACS_INT == sizeof Lisp_Object */
+ offset += (sizeof (EMACS_INT)))
+ {
+ idx = PER_BUFFER_IDX (offset);
+ if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
+ && SYMBOLP (PER_BUFFER_SYMBOL (offset))
+ && EQ (PER_BUFFER_SYMBOL (offset), symbol))
+ {
+ result = PER_BUFFER_VALUE (buf, offset);
+ found = 1;
+ break;
+ }
+ }
+
+ if (!found)
+ result = Fdefault_value (symbol);
+ }
+ else
+ result = XCDR (result);
+
+ if (EQ (result, Qunbound))
+ return Fsignal (Qvoid_variable, Fcons (symbol, Qnil));
+
+ return result;
+}
+
DEFUN ("buffer-local-variables", Fbuffer_local_variables,
Sbuffer_local_variables, 0, 1, 0,
doc: /* Return an alist of variables that are buffer-local in BUFFER.
@@ -5571,6 +5623,7 @@
/*defsubr (&Sbuffer_number);*/
defsubr (&Sbuffer_file_name);
defsubr (&Sbuffer_base_buffer);
+ defsubr (&Sbuffer_local_value);
defsubr (&Sbuffer_local_variables);
defsubr (&Sbuffer_modified_p);
defsubr (&Sset_buffer_modified_p);
Index: lisp.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lisp.h,v
retrieving revision 1.392
diff -u -r1.392 lisp.h
--- lisp.h 2001/10/31 02:18:32 1.392
+++ lisp.h 2001/11/01 20:05:35
@@ -2270,6 +2270,7 @@
extern Lisp_Object Qinhibit_redisplay, Qdisplay;
extern Lisp_Object Qinhibit_eval_during_redisplay;
extern Lisp_Object Qmessage_truncate_lines;
+extern Lisp_Object Qcursor_in_non_selected_windows;
extern Lisp_Object Vmessage_log_max;
extern int message_enable_multibyte;
extern Lisp_Object echo_area_buffer[2];
Index: w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.120
diff -u -r1.120 w32term.c
--- w32term.c 2001/10/27 22:21:24 1.120
+++ w32term.c 2001/11/01 20:05:45
@@ -9492,6 +9492,7 @@
struct glyph_matrix *current_glyphs;
struct glyph_row *glyph_row;
struct glyph *glyph;
+ int cursor_non_selected;
int active_cursor = 1;
/* This is pointless on invisible frames, and dangerous on garbaged
@@ -9528,6 +9529,9 @@
the cursor type given by the frame parameter. If explicitly
marked off, draw no cursor. In all other cases, we want a hollow
box cursor. */
+ cursor_non_selected
+ = !NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows
+ w->buffer));
new_cursor_width = -1;
if (cursor_in_echo_area
&& FRAME_HAS_MINIBUF_P (f)
@@ -9546,11 +9550,10 @@
if (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame
|| w != XWINDOW (f->selected_window))
{
- extern int cursor_in_non_selected_windows;
active_cursor = 0;
if (MINI_WINDOW_P (w)
- || !cursor_in_non_selected_windows
+ || !cursor_non_selected
|| NILP (XBUFFER (w->buffer)->cursor_type))
new_cursor_type = NO_CURSOR;
else
Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.700
diff -u -r1.700 xdisp.c
--- xdisp.c 2001/10/31 10:32:57 1.700
+++ xdisp.c 2001/11/01 20:05:58
@@ -517,6 +517,7 @@
selected. Zero means there's no cursor in such windows. */
int cursor_in_non_selected_windows;
+Lisp_Object Qcursor_in_non_selected_windows;
/* A scratch glyph row with contents used for generating truncation
glyphs. Also used in direct_output_for_insert. */
@@ -14655,6 +14656,8 @@
staticpro (&Qimage);
Qmessage_truncate_lines = intern ("message-truncate-lines");
staticpro (&Qmessage_truncate_lines);
+ Qcursor_in_non_selected_windows = intern ("cursor-in-non-selected-windows");
+ staticpro (&Qcursor_in_non_selected_windows);
Qgrow_only = intern ("grow-only");
staticpro (&Qgrow_only);
Qinhibit_menubar_update = intern ("inhibit-menubar-update");
Index: xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.678
diff -u -r1.678 xterm.c
--- xterm.c 2001/11/01 11:24:41 1.678
+++ xterm.c 2001/11/01 20:06:11
@@ -11460,6 +11460,7 @@
struct glyph_matrix *current_glyphs;
struct glyph_row *glyph_row;
struct glyph *glyph;
+ int cursor_non_selected;
/* This is pointless on invisible frames, and dangerous on garbaged
windows and frames; in the latter case, the frame or window may
@@ -11495,6 +11496,9 @@
the cursor type given by the frame parameter. If explicitly
marked off, draw no cursor. In all other cases, we want a hollow
box cursor. */
+ cursor_non_selected
+ = !NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
+ w->buffer));
new_cursor_width = -1;
if (cursor_in_echo_area
&& FRAME_HAS_MINIBUF_P (f)
@@ -11502,7 +11506,7 @@
{
if (w == XWINDOW (echo_area_window))
new_cursor_type = FRAME_DESIRED_CURSOR (f);
- else if (cursor_in_non_selected_windows)
+ else if (cursor_non_selected)
new_cursor_type = HOLLOW_BOX_CURSOR;
else
new_cursor_type = NO_CURSOR;
@@ -11512,10 +11516,8 @@
if (f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
|| w != XWINDOW (f->selected_window))
{
- extern int cursor_in_non_selected_windows;
-
if (MINI_WINDOW_P (w)
- || !cursor_in_non_selected_windows
+ || !cursor_non_selected
|| NILP (XBUFFER (w->buffer)->cursor_type))
new_cursor_type = NO_CURSOR;
else
--
Michael Welsh Duggan
(address@hidden)