diff options
| author | Dmitry Antipov | 2013-09-06 20:40:12 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-09-06 20:40:12 +0400 |
| commit | 77394d40d90fe4ba150444c0160654c608ef227d (patch) | |
| tree | 3deb81e4974e1974bac3f5e2cbabefcac3ebebf4 /src | |
| parent | 86cf73299170efd02eb9ede42547eca65df83c86 (diff) | |
| download | emacs-77394d40d90fe4ba150444c0160654c608ef227d.tar.gz emacs-77394d40d90fe4ba150444c0160654c608ef227d.zip | |
* lisp.h (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
(last_glyphless_glyph_merged_face_id): Remove declarations.
* dispextern.h (merge_glyphless_glyph_face): Add prototype.
* xdisp.c (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
(last_glyphless_glyph_merged_face_id): Now static.
(merge_escape_glyph_face): New function, refactored from...
(get_next_display_element): ...here.
(merge_glyphless_glyph_face): New function, refactored from...
(produce_glyphless_glyph): ...here...
* term.c (produce_glyphless_glyph): ...and here.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/lisp.h | 3 | ||||
| -rw-r--r-- | src/term.c | 19 | ||||
| -rw-r--r-- | src/xdisp.c | 117 |
5 files changed, 72 insertions, 81 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 526b05fbd9f..7f41abc46bb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-09-06 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * lisp.h (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) | ||
| 4 | (last_glyphless_glyph_merged_face_id): Remove declarations. | ||
| 5 | * dispextern.h (merge_glyphless_glyph_face): Add prototype. | ||
| 6 | * xdisp.c (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) | ||
| 7 | (last_glyphless_glyph_merged_face_id): Now static. | ||
| 8 | (merge_escape_glyph_face): New function, refactored from... | ||
| 9 | (get_next_display_element): ...here. | ||
| 10 | (merge_glyphless_glyph_face): New function, refactored from... | ||
| 11 | (produce_glyphless_glyph): ...here... | ||
| 12 | * term.c (produce_glyphless_glyph): ...and here. | ||
| 13 | |||
| 1 | 2013-09-06 Stefan Monnier <monnier@iro.umontreal.ca> | 14 | 2013-09-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 15 | ||
| 3 | * eval.c (eval_sub): Only call Ffunction if necessary. | 16 | * eval.c (eval_sub): Only call Ffunction if necessary. |
diff --git a/src/dispextern.h b/src/dispextern.h index 864229e1d04..f15da1e6564 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3208,6 +3208,7 @@ extern ptrdiff_t compute_display_string_pos (struct text_pos *, | |||
| 3208 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, | 3208 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, |
| 3209 | struct bidi_string_data *); | 3209 | struct bidi_string_data *); |
| 3210 | extern void produce_stretch_glyph (struct it *); | 3210 | extern void produce_stretch_glyph (struct it *); |
| 3211 | extern int merge_glyphless_glyph_face (struct it *); | ||
| 3211 | 3212 | ||
| 3212 | #ifdef HAVE_WINDOW_SYSTEM | 3213 | #ifdef HAVE_WINDOW_SYSTEM |
| 3213 | 3214 | ||
diff --git a/src/lisp.h b/src/lisp.h index 27359ffeb3f..38b538d9bc2 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3359,9 +3359,6 @@ extern Lisp_Object Qglyphless_char; | |||
| 3359 | extern Lisp_Object QCdata, QCfile; | 3359 | extern Lisp_Object QCdata, QCfile; |
| 3360 | extern Lisp_Object QCmap; | 3360 | extern Lisp_Object QCmap; |
| 3361 | extern Lisp_Object Qrisky_local_variable; | 3361 | extern Lisp_Object Qrisky_local_variable; |
| 3362 | extern struct frame *last_glyphless_glyph_frame; | ||
| 3363 | extern int last_glyphless_glyph_face_id; | ||
| 3364 | extern int last_glyphless_glyph_merged_face_id; | ||
| 3365 | extern int noninteractive_need_newline; | 3362 | extern int noninteractive_need_newline; |
| 3366 | extern Lisp_Object echo_area_buffer[2]; | 3363 | extern Lisp_Object echo_area_buffer[2]; |
| 3367 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); | 3364 | extern void add_to_log (const char *, Lisp_Object, Lisp_Object); |
diff --git a/src/term.c b/src/term.c index aa61fde06ee..0270c1eefa6 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1800,27 +1800,10 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str) | |||
| 1800 | static void | 1800 | static void |
| 1801 | produce_glyphless_glyph (struct it *it, Lisp_Object acronym) | 1801 | produce_glyphless_glyph (struct it *it, Lisp_Object acronym) |
| 1802 | { | 1802 | { |
| 1803 | int face_id; | 1803 | int len, face_id = merge_glyphless_glyph_face (it); |
| 1804 | int len; | ||
| 1805 | char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)]; | 1804 | char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)]; |
| 1806 | char const *str = " "; | 1805 | char const *str = " "; |
| 1807 | 1806 | ||
| 1808 | /* Get a face ID for the glyph by utilizing a cache (the same way as | ||
| 1809 | done for `escape-glyph' in get_next_display_element). */ | ||
| 1810 | if (it->f == last_glyphless_glyph_frame | ||
| 1811 | && it->face_id == last_glyphless_glyph_face_id) | ||
| 1812 | { | ||
| 1813 | face_id = last_glyphless_glyph_merged_face_id; | ||
| 1814 | } | ||
| 1815 | else | ||
| 1816 | { | ||
| 1817 | /* Merge the `glyphless-char' face into the current face. */ | ||
| 1818 | face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); | ||
| 1819 | last_glyphless_glyph_frame = it->f; | ||
| 1820 | last_glyphless_glyph_face_id = it->face_id; | ||
| 1821 | last_glyphless_glyph_merged_face_id = face_id; | ||
| 1822 | } | ||
| 1823 | |||
| 1824 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) | 1807 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) |
| 1825 | { | 1808 | { |
| 1826 | /* As there's no way to produce a thin space, we produce a space | 1809 | /* As there's no way to produce a thin space, we produce a space |
diff --git a/src/xdisp.c b/src/xdisp.c index a7f7fc88198..d5def065936 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6666,17 +6666,59 @@ lookup_glyphless_char_display (int c, struct it *it) | |||
| 6666 | return glyphless_method; | 6666 | return glyphless_method; |
| 6667 | } | 6667 | } |
| 6668 | 6668 | ||
| 6669 | /* Load IT's display element fields with information about the next | 6669 | /* Merge escape glyph face and cache the result. */ |
| 6670 | display element from the current position of IT. Value is zero if | ||
| 6671 | end of buffer (or C string) is reached. */ | ||
| 6672 | 6670 | ||
| 6673 | static struct frame *last_escape_glyph_frame = NULL; | 6671 | static struct frame *last_escape_glyph_frame = NULL; |
| 6674 | static int last_escape_glyph_face_id = (1 << FACE_ID_BITS); | 6672 | static int last_escape_glyph_face_id = (1 << FACE_ID_BITS); |
| 6675 | static int last_escape_glyph_merged_face_id = 0; | 6673 | static int last_escape_glyph_merged_face_id = 0; |
| 6676 | 6674 | ||
| 6677 | struct frame *last_glyphless_glyph_frame = NULL; | 6675 | static int |
| 6678 | int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); | 6676 | merge_escape_glyph_face (struct it *it) |
| 6679 | int last_glyphless_glyph_merged_face_id = 0; | 6677 | { |
| 6678 | int face_id; | ||
| 6679 | |||
| 6680 | if (it->f == last_escape_glyph_frame | ||
| 6681 | && it->face_id == last_escape_glyph_face_id) | ||
| 6682 | face_id = last_escape_glyph_merged_face_id; | ||
| 6683 | else | ||
| 6684 | { | ||
| 6685 | /* Merge the `escape-glyph' face into the current face. */ | ||
| 6686 | face_id = merge_faces (it->f, Qescape_glyph, 0, it->face_id); | ||
| 6687 | last_escape_glyph_frame = it->f; | ||
| 6688 | last_escape_glyph_face_id = it->face_id; | ||
| 6689 | last_escape_glyph_merged_face_id = face_id; | ||
| 6690 | } | ||
| 6691 | return face_id; | ||
| 6692 | } | ||
| 6693 | |||
| 6694 | /* Likewise for glyphless glyph face. */ | ||
| 6695 | |||
| 6696 | static struct frame *last_glyphless_glyph_frame = NULL; | ||
| 6697 | static int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); | ||
| 6698 | static int last_glyphless_glyph_merged_face_id = 0; | ||
| 6699 | |||
| 6700 | int | ||
| 6701 | merge_glyphless_glyph_face (struct it *it) | ||
| 6702 | { | ||
| 6703 | int face_id; | ||
| 6704 | |||
| 6705 | if (it->f == last_glyphless_glyph_frame | ||
| 6706 | && it->face_id == last_glyphless_glyph_face_id) | ||
| 6707 | face_id = last_glyphless_glyph_merged_face_id; | ||
| 6708 | else | ||
| 6709 | { | ||
| 6710 | /* Merge the `glyphless-char' face into the current face. */ | ||
| 6711 | face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); | ||
| 6712 | last_glyphless_glyph_frame = it->f; | ||
| 6713 | last_glyphless_glyph_face_id = it->face_id; | ||
| 6714 | last_glyphless_glyph_merged_face_id = face_id; | ||
| 6715 | } | ||
| 6716 | return face_id; | ||
| 6717 | } | ||
| 6718 | |||
| 6719 | /* Load IT's display element fields with information about the next | ||
| 6720 | display element from the current position of IT. Value is zero if | ||
| 6721 | end of buffer (or C string) is reached. */ | ||
| 6680 | 6722 | ||
| 6681 | static int | 6723 | static int |
| 6682 | get_next_display_element (struct it *it) | 6724 | get_next_display_element (struct it *it) |
| @@ -6824,24 +6866,10 @@ get_next_display_element (struct it *it) | |||
| 6824 | g = GLYPH_CODE_CHAR (gc); | 6866 | g = GLYPH_CODE_CHAR (gc); |
| 6825 | lface_id = GLYPH_CODE_FACE (gc); | 6867 | lface_id = GLYPH_CODE_FACE (gc); |
| 6826 | } | 6868 | } |
| 6827 | if (lface_id) | 6869 | |
| 6828 | { | 6870 | face_id = (lface_id |
| 6829 | face_id = merge_faces (it->f, Qt, lface_id, it->face_id); | 6871 | ? merge_faces (it->f, Qt, lface_id, it->face_id) |
| 6830 | } | 6872 | : merge_escape_glyph_face (it)); |
| 6831 | else if (it->f == last_escape_glyph_frame | ||
| 6832 | && it->face_id == last_escape_glyph_face_id) | ||
| 6833 | { | ||
| 6834 | face_id = last_escape_glyph_merged_face_id; | ||
| 6835 | } | ||
| 6836 | else | ||
| 6837 | { | ||
| 6838 | /* Merge the escape-glyph face into the current face. */ | ||
| 6839 | face_id = merge_faces (it->f, Qescape_glyph, 0, | ||
| 6840 | it->face_id); | ||
| 6841 | last_escape_glyph_frame = it->f; | ||
| 6842 | last_escape_glyph_face_id = it->face_id; | ||
| 6843 | last_escape_glyph_merged_face_id = face_id; | ||
| 6844 | } | ||
| 6845 | 6873 | ||
| 6846 | XSETINT (it->ctl_chars[0], g); | 6874 | XSETINT (it->ctl_chars[0], g); |
| 6847 | XSETINT (it->ctl_chars[1], c ^ 0100); | 6875 | XSETINT (it->ctl_chars[1], c ^ 0100); |
| @@ -6873,27 +6901,10 @@ get_next_display_element (struct it *it) | |||
| 6873 | escape_glyph = GLYPH_CODE_CHAR (gc); | 6901 | escape_glyph = GLYPH_CODE_CHAR (gc); |
| 6874 | lface_id = GLYPH_CODE_FACE (gc); | 6902 | lface_id = GLYPH_CODE_FACE (gc); |
| 6875 | } | 6903 | } |
| 6876 | if (lface_id) | 6904 | |
| 6877 | { | 6905 | face_id = (lface_id |
| 6878 | /* The display table specified a face. | 6906 | ? merge_faces (it->f, Qt, lface_id, it->face_id) |
| 6879 | Merge it into face_id and also into escape_glyph. */ | 6907 | : merge_escape_glyph_face (it)); |
| 6880 | face_id = merge_faces (it->f, Qt, lface_id, | ||
| 6881 | it->face_id); | ||
| 6882 | } | ||
| 6883 | else if (it->f == last_escape_glyph_frame | ||
| 6884 | && it->face_id == last_escape_glyph_face_id) | ||
| 6885 | { | ||
| 6886 | face_id = last_escape_glyph_merged_face_id; | ||
| 6887 | } | ||
| 6888 | else | ||
| 6889 | { | ||
| 6890 | /* Merge the escape-glyph face into the current face. */ | ||
| 6891 | face_id = merge_faces (it->f, Qescape_glyph, 0, | ||
| 6892 | it->face_id); | ||
| 6893 | last_escape_glyph_frame = it->f; | ||
| 6894 | last_escape_glyph_face_id = it->face_id; | ||
| 6895 | last_escape_glyph_merged_face_id = face_id; | ||
| 6896 | } | ||
| 6897 | 6908 | ||
| 6898 | /* Draw non-ASCII hyphen with just highlighting: */ | 6909 | /* Draw non-ASCII hyphen with just highlighting: */ |
| 6899 | 6910 | ||
| @@ -24895,21 +24906,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) | |||
| 24895 | base_height = it->ascent + it->descent; | 24906 | base_height = it->ascent + it->descent; |
| 24896 | base_width = font->average_width; | 24907 | base_width = font->average_width; |
| 24897 | 24908 | ||
| 24898 | /* Get a face ID for the glyph by utilizing a cache (the same way as | 24909 | face_id = merge_glyphless_glyph_face (it); |
| 24899 | done for `escape-glyph' in get_next_display_element). */ | ||
| 24900 | if (it->f == last_glyphless_glyph_frame | ||
| 24901 | && it->face_id == last_glyphless_glyph_face_id) | ||
| 24902 | { | ||
| 24903 | face_id = last_glyphless_glyph_merged_face_id; | ||
| 24904 | } | ||
| 24905 | else | ||
| 24906 | { | ||
| 24907 | /* Merge the `glyphless-char' face into the current face. */ | ||
| 24908 | face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id); | ||
| 24909 | last_glyphless_glyph_frame = it->f; | ||
| 24910 | last_glyphless_glyph_face_id = it->face_id; | ||
| 24911 | last_glyphless_glyph_merged_face_id = face_id; | ||
| 24912 | } | ||
| 24913 | 24910 | ||
| 24914 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) | 24911 | if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE) |
| 24915 | { | 24912 | { |