aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-05-01 19:23:22 +0000
committerKaroly Lorentey2004-05-01 19:23:22 +0000
commitb160ff41a813213adfa745a9d009ab638a22d7b1 (patch)
treecee50a478285aa9d2d5e99acbcf31f64c7dc3cde /src
parente6da77e898ea743bc416517542eae446e573b6b5 (diff)
parent4ae73f87a0f3ab6f9b7cdca19a3df40d945fc7a9 (diff)
downloademacs-b160ff41a813213adfa745a9d009ab638a22d7b1.tar.gz
emacs-b160ff41a813213adfa745a9d009ab638a22d7b1.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-262 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264 Update from CVS: lispref/display.texi: emacs -> Emacs. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-266 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-267 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-156
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog29
-rw-r--r--src/buffer.c22
-rw-r--r--src/data.c14
-rw-r--r--src/dispextern.h7
-rw-r--r--src/xdisp.c178
5 files changed, 198 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 386c3d99a47..f8a9e5fb767 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,32 @@
12004-04-30 Kim F. Storm <storm@cua.dk>
2
3 * buffer.c (syms_of_buffer) <line-spacing>: Allow float value.
4 (syms_of_buffer) <cursor-type>: Doc fix.
5
6 * dispextern.h (struct it): Remove member use_default_face.
7 Add members override_ascent, override_descent, override_boff.
8
9 * xdisp.c (init_iterator): Handle line-spacing float value.
10 Initialize override_ascent member.
11 (append_space_for_newline): Reset override_ascent.
12 Remove use_default_face.
13 (calc_line_height_property): New function to calculate value of
14 line-height and line-spacing properties. Look at overlays, too.
15 Set override_ascent, override_descent, override_boff members when
16 using another face than the current face. Float values are now
17 relative to the frame default font, by default; accept a cons
18 of ratio and face name to specify value relative to a specific face.
19 (x_produce_glyphs): Use calc_line_height_property.
20 Use override_ascent etc. when set to handle different face heights.
21 A negative line-spacing property value is interpreted as a total
22 line height, rather than inter-line spacing.
23 (note_mouse_highlight): Allocate room for 40 overlays initially.
24
252004-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
26
27 * data.c (Fsubr_name): New fun.
28 (syms_of_data): Defsubr it.
29
12004-04-29 Kim F. Storm <storm@cua.dk> 302004-04-29 Kim F. Storm <storm@cua.dk>
2 31
3 * xdisp.c (null_glyph_slice): New var. 32 * xdisp.c (null_glyph_slice): New var.
diff --git a/src/buffer.c b/src/buffer.c
index db16b22e35a..7560e696685 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2143,7 +2143,7 @@ current buffer is cleared. */)
2143 GPT = GPT_BYTE; 2143 GPT = GPT_BYTE;
2144 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); 2144 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE);
2145 2145
2146 2146
2147 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) 2147 for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
2148 tail->charpos = tail->bytepos; 2148 tail->charpos = tail->bytepos;
2149 2149
@@ -3339,7 +3339,7 @@ fix_start_end_in_overlays (start, end)
3339 3339
3340 if (endpos < start) 3340 if (endpos < start)
3341 break; 3341 break;
3342 3342
3343 if (endpos < end 3343 if (endpos < end
3344 || (startpos >= start && startpos < end)) 3344 || (startpos >= start && startpos < end))
3345 { 3345 {
@@ -3382,7 +3382,7 @@ fix_start_end_in_overlays (start, end)
3382 { 3382 {
3383 startpos = endpos; 3383 startpos = endpos;
3384 Fset_marker (OVERLAY_START (overlay), make_number (startpos), 3384 Fset_marker (OVERLAY_START (overlay), make_number (startpos),
3385 Qnil); 3385 Qnil);
3386 } 3386 }
3387 3387
3388 if (startpos >= end) 3388 if (startpos >= end)
@@ -4193,7 +4193,7 @@ report_overlay_modification (start, end, after, arg1, arg2, arg3)
4193 add_overlay_mod_hooklist (prop, overlay); 4193 add_overlay_mod_hooklist (prop, overlay);
4194 } 4194 }
4195 } 4195 }
4196 4196
4197 for (tail = current_buffer->overlays_after; tail; tail = tail->next) 4197 for (tail = current_buffer->overlays_after; tail; tail = tail->next)
4198 { 4198 {
4199 int startpos, endpos; 4199 int startpos, endpos;
@@ -5856,9 +5856,13 @@ Values are interpreted as follows:
5856 5856
5857 t use the cursor specified for the frame 5857 t use the cursor specified for the frame
5858 nil don't display a cursor 5858 nil don't display a cursor
5859 bar display a bar cursor with default width 5859 box display a filled box cursor
5860 (bar . WIDTH) display a bar cursor with width WIDTH 5860 hollow display a hollow box cursor
5861 ANYTHING ELSE display a box cursor. 5861 bar display a vertical bar cursor with default width
5862 (bar . WIDTH) display a vertical bar cursor with width WIDTH
5863 hbar display a horisontal bar cursor with default width
5864 (hbar . WIDTH) display a horisontal bar cursor with width WIDTH
5865 ANYTHING ELSE display a hollow box cursor.
5862 5866
5863When the buffer is displayed in a nonselected window, 5867When the buffer is displayed in a nonselected window,
5864this variable has no effect; the cursor appears as a hollow box. */); 5868this variable has no effect; the cursor appears as a hollow box. */);
@@ -5866,7 +5870,9 @@ this variable has no effect; the cursor appears as a hollow box. */);
5866 DEFVAR_PER_BUFFER ("line-spacing", 5870 DEFVAR_PER_BUFFER ("line-spacing",
5867 &current_buffer->extra_line_spacing, Qnil, 5871 &current_buffer->extra_line_spacing, Qnil,
5868 doc: /* Additional space to put between lines when displaying a buffer. 5872 doc: /* Additional space to put between lines when displaying a buffer.
5869The space is measured in pixels, and put below lines on window systems. */); 5873The space is measured in pixels, and put below lines on window systems.
5874If value is a floating point number, it specifies the spacing relative
5875to the default frame line height. */);
5870 5876
5871 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions, 5877 DEFVAR_LISP ("kill-buffer-query-functions", &Vkill_buffer_query_functions,
5872 doc: /* List of functions called with no args to query before killing a buffer. */); 5878 doc: /* List of functions called with no args to query before killing a buffer. */);
diff --git a/src/data.c b/src/data.c
index a5f28375635..c94723d09d0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -761,6 +761,19 @@ function with `&rest' args, or `unevalled' for a special form. */)
761 return Fcons (make_number (minargs), make_number (maxargs)); 761 return Fcons (make_number (minargs), make_number (maxargs));
762} 762}
763 763
764DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0,
765 doc: /* Return name of subroutine SUBR.
766SUBR must be a built-in function. */)
767 (subr)
768 Lisp_Object subr;
769{
770 const char *name;
771 if (!SUBRP (subr))
772 wrong_type_argument (Qsubrp, subr);
773 name = XSUBR (subr)->symbol_name;
774 return make_string (name, strlen (name));
775}
776
764DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0, 777DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
765 doc: /* Return the interactive form of CMD or nil if none. 778 doc: /* Return the interactive form of CMD or nil if none.
766CMD must be a command. Value, if non-nil, is a list 779CMD must be a command. Value, if non-nil, is a list
@@ -3319,6 +3332,7 @@ syms_of_data ()
3319 defsubr (&Slognot); 3332 defsubr (&Slognot);
3320 defsubr (&Sbyteorder); 3333 defsubr (&Sbyteorder);
3321 defsubr (&Ssubr_arity); 3334 defsubr (&Ssubr_arity);
3335 defsubr (&Ssubr_name);
3322 3336
3323 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; 3337 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;
3324 3338
diff --git a/src/dispextern.h b/src/dispextern.h
index 8e79211b319..8a56e1dcc28 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1923,9 +1923,6 @@ struct it
1923 descent/ascent (line-height property). Reset after this glyph. */ 1923 descent/ascent (line-height property). Reset after this glyph. */
1924 unsigned constrain_row_ascent_descent_p : 1; 1924 unsigned constrain_row_ascent_descent_p : 1;
1925 1925
1926 /* If 1, show current glyph in default face. Reset after this glyph. */
1927 unsigned use_default_face : 1;
1928
1929 /* The ID of the default face to use. One of DEFAULT_FACE_ID, 1926 /* The ID of the default face to use. One of DEFAULT_FACE_ID,
1930 MODE_LINE_FACE_ID, etc, depending on what we are displaying. */ 1927 MODE_LINE_FACE_ID, etc, depending on what we are displaying. */
1931 int base_face_id; 1928 int base_face_id;
@@ -1992,6 +1989,10 @@ struct it
1992 only.) */ 1989 only.) */
1993 int extra_line_spacing; 1990 int extra_line_spacing;
1994 1991
1992 /* Override font height information for this glyph.
1993 Used if override_ascent >= 0. Cleared after this glyph. */
1994 int override_ascent, override_descent, override_boff;
1995
1995 /* If non-null, glyphs are produced in glyph_row with each call to 1996 /* If non-null, glyphs are produced in glyph_row with each call to
1996 produce_glyphs. */ 1997 produce_glyphs. */
1997 struct glyph_row *glyph_row; 1998 struct glyph_row *glyph_row;
diff --git a/src/xdisp.c b/src/xdisp.c
index 4a79521f65d..f01d3f00b2f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2069,6 +2069,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
2069 { 2069 {
2070 if (NATNUMP (current_buffer->extra_line_spacing)) 2070 if (NATNUMP (current_buffer->extra_line_spacing))
2071 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing); 2071 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing);
2072 else if (FLOATP (current_buffer->extra_line_spacing))
2073 it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing)
2074 * FRAME_LINE_HEIGHT (it->f));
2072 else if (it->f->extra_line_spacing > 0) 2075 else if (it->f->extra_line_spacing > 0)
2073 it->extra_line_spacing = it->f->extra_line_spacing; 2076 it->extra_line_spacing = it->f->extra_line_spacing;
2074 } 2077 }
@@ -2086,6 +2089,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
2086 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil; 2089 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
2087 it->space_width = Qnil; 2090 it->space_width = Qnil;
2088 it->font_height = Qnil; 2091 it->font_height = Qnil;
2092 it->override_ascent = -1;
2089 2093
2090 /* Are control characters displayed as `^C'? */ 2094 /* Are control characters displayed as `^C'? */
2091 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow); 2095 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow);
@@ -14201,7 +14205,7 @@ append_space_for_newline (it, default_face_p)
14201 14205
14202 PRODUCE_GLYPHS (it); 14206 PRODUCE_GLYPHS (it);
14203 14207
14204 it->use_default_face = 0; 14208 it->override_ascent = -1;
14205 it->constrain_row_ascent_descent_p = 0; 14209 it->constrain_row_ascent_descent_p = 0;
14206 it->current_x = saved_x; 14210 it->current_x = saved_x;
14207 it->object = saved_object; 14211 it->object = saved_object;
@@ -18509,6 +18513,97 @@ produce_stretch_glyph (it)
18509 take_vertical_position_into_account (it); 18513 take_vertical_position_into_account (it);
18510} 18514}
18511 18515
18516/* Calculate line-height and line-spacing properties.
18517 An integer value specifies explicit pixel value.
18518 A float value specifies relative value to current face height.
18519 A cons (float . face-name) specifies relative value to
18520 height of specified face font.
18521
18522 Returns height in pixels, or nil. */
18523
18524static Lisp_Object
18525calc_line_height_property (it, prop, font, boff)
18526 struct it *it;
18527 Lisp_Object prop;
18528 XFontStruct *font;
18529 int boff;
18530{
18531 Lisp_Object val;
18532 Lisp_Object face_name = Qnil;
18533 int ascent, descent, height, override;
18534
18535 val = Fget_char_property (make_number (IT_CHARPOS (*it)),
18536 prop, it->object);
18537
18538 if (NILP (val))
18539 return val;
18540
18541 if (INTEGERP (val))
18542 return val;
18543
18544 if (CONSP (val))
18545 {
18546 face_name = XCDR (val);
18547 val = XCAR (val);
18548 }
18549 else if (SYMBOLP (val))
18550 {
18551 face_name = val;
18552 val = Qnil;
18553 }
18554
18555 override = EQ (prop, Qline_height);
18556
18557 if (NILP (face_name))
18558 {
18559 font = FRAME_FONT (it->f);
18560 boff = FRAME_BASELINE_OFFSET (it->f);
18561 }
18562 else if (EQ (face_name, Qt))
18563 {
18564 override = 0;
18565 }
18566 else
18567 {
18568 int face_id;
18569 struct face *face;
18570 struct font_info *font_info;
18571
18572 face_id = lookup_named_face (it->f, face_name, ' ');
18573 if (face_id < 0)
18574 return -1;
18575
18576 face = FACE_FROM_ID (it->f, face_id);
18577 font = face->font;
18578 if (font == NULL)
18579 return -1;
18580
18581 font_info = FONT_INFO_FROM_ID (it->f, face->font_info_id);
18582 boff = font_info->baseline_offset;
18583 if (font_info->vertical_centering)
18584 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
18585 }
18586
18587 ascent = FONT_BASE (font) + boff;
18588 descent = FONT_DESCENT (font) - boff;
18589
18590 if (override)
18591 {
18592 it->override_ascent = ascent;
18593 it->override_descent = descent;
18594 it->override_boff = boff;
18595 }
18596
18597 height = ascent + descent;
18598 if (FLOATP (val))
18599 height = (int)(XFLOAT_DATA (val) * height);
18600 else if (INTEGERP (val))
18601 height *= XINT (val);
18602
18603 return make_number (height);
18604}
18605
18606
18512/* RIF: 18607/* RIF:
18513 Produce glyphs/get display metrics for the display element IT is 18608 Produce glyphs/get display metrics for the display element IT is
18514 loaded with. See the description of struct display_iterator in 18609 loaded with. See the description of struct display_iterator in
@@ -18595,17 +18690,20 @@ x_produce_glyphs (it)
18595 18690
18596 it->nglyphs = 1; 18691 it->nglyphs = 1;
18597 18692
18598 if (it->use_default_face) 18693 pcm = FRAME_RIF (it->f)->per_char_metric
18599 {
18600 font = FRAME_FONT (it->f);
18601 boff = FRAME_BASELINE_OFFSET (it->f);
18602 }
18603
18604 pcm = FRAME_RIF (it->f)->per_char_metric
18605 (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display)); 18694 (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
18606 18695
18607 it->ascent = FONT_BASE (font) + boff; 18696 if (it->override_ascent >= 0)
18608 it->descent = FONT_DESCENT (font) - boff; 18697 {
18698 it->ascent = it->override_ascent;
18699 it->descent = it->override_descent;
18700 boff = it->override_boff;
18701 }
18702 else
18703 {
18704 it->ascent = FONT_BASE (font) + boff;
18705 it->descent = FONT_DESCENT (font) - boff;
18706 }
18609 18707
18610 if (pcm) 18708 if (pcm)
18611 { 18709 {
@@ -18708,26 +18806,27 @@ x_produce_glyphs (it)
18708 But if previous part of the line set a height, don't 18806 But if previous part of the line set a height, don't
18709 increase that height */ 18807 increase that height */
18710 18808
18711 Lisp_Object lsp, lh; 18809 Lisp_Object height, spacing;
18712 18810
18811 it->override_ascent = -1;
18713 it->pixel_width = 0; 18812 it->pixel_width = 0;
18714 it->nglyphs = 0; 18813 it->nglyphs = 0;
18715 18814
18716 lh = Fget_text_property (make_number (IT_CHARPOS (*it)), 18815 height = calc_line_height_property(it, Qline_height, font, boff);
18717 Qline_height, it->object);
18718 18816
18719 if (EQ (lh, Qt)) 18817 if (it->override_ascent >= 0)
18720 { 18818 {
18721 it->use_default_face = 1; 18819 it->ascent = it->override_ascent;
18722 font = FRAME_FONT (it->f); 18820 it->descent = it->override_descent;
18723 boff = FRAME_BASELINE_OFFSET (it->f); 18821 boff = it->override_boff;
18724 font_info = NULL; 18822 }
18823 else
18824 {
18825 it->ascent = FONT_BASE (font) + boff;
18826 it->descent = FONT_DESCENT (font) - boff;
18725 } 18827 }
18726 18828
18727 it->ascent = FONT_BASE (font) + boff; 18829 if (EQ (height, make_number(0)))
18728 it->descent = FONT_DESCENT (font) - boff;
18729
18730 if (EQ (lh, make_number (0)))
18731 { 18830 {
18732 if (it->descent > it->max_descent) 18831 if (it->descent > it->max_descent)
18733 { 18832 {
@@ -18746,7 +18845,6 @@ x_produce_glyphs (it)
18746 } 18845 }
18747 else 18846 else
18748 { 18847 {
18749 int explicit_height = -1;
18750 it->phys_ascent = it->ascent; 18848 it->phys_ascent = it->ascent;
18751 it->phys_descent = it->descent; 18849 it->phys_descent = it->descent;
18752 18850
@@ -18757,23 +18855,20 @@ x_produce_glyphs (it)
18757 it->ascent += face->box_line_width; 18855 it->ascent += face->box_line_width;
18758 it->descent += face->box_line_width; 18856 it->descent += face->box_line_width;
18759 } 18857 }
18760 if (INTEGERP (lh)) 18858 if (!NILP (height)
18761 explicit_height = XINT (lh); 18859 && XINT (height) > it->ascent + it->descent)
18762 else if (FLOATP (lh)) 18860 it->ascent = XINT (height) - it->descent;
18763 explicit_height = (it->phys_ascent + it->phys_descent)
18764 * XFLOAT_DATA (lh);
18765
18766 if (explicit_height > it->ascent + it->descent)
18767 it->ascent = explicit_height - it->descent;
18768 } 18861 }
18769 18862
18770 lsp = Fget_text_property (make_number (IT_CHARPOS (*it)), 18863 spacing = calc_line_height_property(it, Qline_spacing, font, boff);
18771 Qline_spacing, it->object); 18864 if (!NILP (spacing))
18772 if (INTEGERP (lsp)) 18865 {
18773 extra_line_spacing = XINT (lsp); 18866 int sp = XINT (spacing);
18774 else if (FLOATP (lsp)) 18867 if (sp < 0)
18775 extra_line_spacing = (it->phys_ascent + it->phys_descent) 18868 extra_line_spacing = (-sp) - (it->phys_ascent + it->phys_descent);
18776 * XFLOAT_DATA (lsp); 18869 else
18870 extra_line_spacing = sp;
18871 }
18777 } 18872 }
18778 else if (it->char_to_display == '\t') 18873 else if (it->char_to_display == '\t')
18779 { 18874 {
@@ -19150,7 +19245,8 @@ x_produce_glyphs (it)
19150 if (it->area == TEXT_AREA) 19245 if (it->area == TEXT_AREA)
19151 it->current_x += it->pixel_width; 19246 it->current_x += it->pixel_width;
19152 19247
19153 it->descent += extra_line_spacing; 19248 if (extra_line_spacing > 0)
19249 it->descent += extra_line_spacing;
19154 19250
19155 it->max_ascent = max (it->max_ascent, it->ascent); 19251 it->max_ascent = max (it->max_ascent, it->ascent);
19156 it->max_descent = max (it->max_descent, it->descent); 19252 it->max_descent = max (it->max_descent, it->descent);
@@ -20813,9 +20909,9 @@ note_mouse_highlight (f, x, y)
20813 if (BUFFERP (object)) 20909 if (BUFFERP (object))
20814 { 20910 {
20815 /* Put all the overlays we want in a vector in overlay_vec. 20911 /* Put all the overlays we want in a vector in overlay_vec.
20816 Store the length in len. If there are more than 10, make 20912 Store the length in len. If there are more than 40, make
20817 enough space for all, and try again. */ 20913 enough space for all, and try again. */
20818 len = 10; 20914 len = 40;
20819 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); 20915 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
20820 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0); 20916 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
20821 if (noverlays > len) 20917 if (noverlays > len)