Now on revision 105310. ------------------------------------------------------------ revno: 105310 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-07-23 08:15:53 -0400 message: Fix compilation with GLYPH_DEBUG. src/xfns.c (unwind_create_frame) [GLYPH_DEBUG]: Adapt to changes in revision 84777 on 2008-02-22. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-23 10:46:21 +0000 +++ src/ChangeLog 2011-07-23 12:15:53 +0000 @@ -1,5 +1,8 @@ 2011-07-23 Eli Zaretskii + * xfns.c (unwind_create_frame) [GLYPH_DEBUG]: Adapt to changes in + revision 84777 on 2008-02-22. + * xdisp.c (move_it_in_display_line_to): Record the best matching position for TO_CHARPOS while scanning the line, and restore it on exit if none of the characters scanned was an exact match. Fixes === modified file 'src/xfns.c' --- src/xfns.c 2011-07-10 08:20:10 +0000 +++ src/xfns.c 2011-07-23 12:15:53 +0000 @@ -2933,7 +2933,7 @@ #if GLYPH_DEBUG /* Check that reference counts are indeed correct. */ xassert (dpyinfo->reference_count == dpyinfo_refcount); - xassert (dpyinfo->image_cache->refcount == image_cache_refcount); + xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); #endif return Qt; } ------------------------------------------------------------ revno: 105309 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-07-23 06:58:44 -0400 message: src/xdisp.c: Fix a typo in a comment. diff: === modified file 'src/xdisp.c' --- src/xdisp.c 2011-07-23 10:46:21 +0000 +++ src/xdisp.c 2011-07-23 10:58:44 +0000 @@ -23256,7 +23256,7 @@ base_width = font->average_width; /* Get a face ID for the glyph by utilizing a cache (the same way as - doen for `escape-glyph' in get_next_display_element). */ + done for `escape-glyph' in get_next_display_element). */ if (it->f == last_glyphless_glyph_frame && it->face_id == last_glyphless_glyph_face_id) { ------------------------------------------------------------ revno: 105308 [merge] committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-07-23 13:46:21 +0300 message: Fix pos-visible-in-window-p under bidi redisplay. src/xdisp.c (move_it_in_display_line_to): Record the best matching position for TO_CHARPOS while scanning the line, and restore it on exit if none of the characters scanned was an exact match. Fixes vertical-motion and pos-visible-in-window-p under bidi redisplay when exact match is impossible due to invisible text, and the lines are truncated. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-23 08:33:06 +0000 +++ src/ChangeLog 2011-07-23 10:46:21 +0000 @@ -1,3 +1,12 @@ +2011-07-23 Eli Zaretskii + + * xdisp.c (move_it_in_display_line_to): Record the best matching + position for TO_CHARPOS while scanning the line, and restore it on + exit if none of the characters scanned was an exact match. Fixes + vertical-motion and pos-visible-in-window-p under bidi redisplay + when exact match is impossible due to invisible text, and the + lines are truncated. + 2011-07-23 Jan Djärv * nsterm.m (initFrameFromEmacs): Set NSTitledWindowMask in styleMask === modified file 'src/xdisp.c' --- src/xdisp.c 2011-07-23 07:42:56 +0000 +++ src/xdisp.c 2011-07-23 10:46:21 +0000 @@ -7641,8 +7641,9 @@ { enum move_it_result result = MOVE_UNDEFINED; struct glyph_row *saved_glyph_row; - struct it wrap_it, atpos_it, atx_it; + struct it wrap_it, atpos_it, atx_it, ppos_it; void *wrap_data = NULL, *atpos_data = NULL, *atx_data = NULL; + void *ppos_data = NULL; int may_wrap = 0; enum it_method prev_method = it->method; EMACS_INT prev_pos = IT_CHARPOS (*it); @@ -7661,6 +7662,19 @@ atpos_it.sp = -1; atx_it.sp = -1; + /* Use ppos_it under bidi reordering to save a copy of IT for the + position > CHARPOS that is the closest to CHARPOS. We restore + that position in IT when we have scanned the entire display line + without finding a match for CHARPOS and all the character + positions are greater than CHARPOS. */ + if (it->bidi_p) + { + SAVE_IT (ppos_it, *it, ppos_data); + SET_TEXT_POS (ppos_it.current.pos, ZV, ZV_BYTE); + if ((op & MOVE_TO_POS) && IT_CHARPOS (*it) >= to_charpos) + SAVE_IT (ppos_it, *it, ppos_data); + } + #define BUFFER_POS_REACHED_P() \ ((op & MOVE_TO_POS) != 0 \ && BUFFERP (it->object) \ @@ -7786,6 +7800,11 @@ if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); + if (it->bidi_p + && (op & MOVE_TO_POS) + && IT_CHARPOS (*it) > to_charpos + && IT_CHARPOS (*it) < IT_CHARPOS (ppos_it)) + SAVE_IT (ppos_it, *it, ppos_data); continue; } @@ -7996,7 +8015,11 @@ if ((op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) - result = MOVE_POS_MATCH_OR_ZV; + { + result = MOVE_POS_MATCH_OR_ZV; + if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + RESTORE_IT (it, &ppos_it, ppos_data); + } else result = MOVE_NEWLINE_OR_CR; break; @@ -8012,6 +8035,11 @@ SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); if (IT_CHARPOS (*it) < to_charpos) saw_smaller_pos = 1; + if (it->bidi_p + && (op & MOVE_TO_POS) + && IT_CHARPOS (*it) >= to_charpos + && IT_CHARPOS (*it) < IT_CHARPOS (ppos_it)) + SAVE_IT (ppos_it, *it, ppos_data); /* Stop if lines are truncated and IT's current x-position is past the right edge of the window now. */ @@ -8021,7 +8049,9 @@ if (!FRAME_WINDOW_P (it->f) || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) { - if (!get_next_display_element (it) + int at_eob_p = 0; + + if ((at_eob_p = !get_next_display_element (it)) || BUFFER_POS_REACHED_P () /* If we are past TO_CHARPOS, but never saw any character positions smaller than TO_CHARPOS, @@ -8032,6 +8062,8 @@ && IT_CHARPOS (*it) > to_charpos)) { result = MOVE_POS_MATCH_OR_ZV; + if (it->bidi_p && !at_eob_p && IT_CHARPOS (ppos_it) < ZV) + RESTORE_IT (it, &ppos_it, ppos_data); break; } if (ITERATOR_AT_END_OF_LINE_P (it)) @@ -8045,6 +8077,8 @@ && IT_CHARPOS (*it) > to_charpos) { result = MOVE_POS_MATCH_OR_ZV; + if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + RESTORE_IT (it, &ppos_it, ppos_data); break; } result = MOVE_LINE_TRUNCATED; @@ -8070,6 +8104,8 @@ xfree (atx_data); if (wrap_data) xfree (wrap_data); + if (ppos_data) + xfree (ppos_data); /* Restore the iterator settings altered at the beginning of this function. */ ------------------------------------------------------------ revno: 105307 committer: Jan D. branch nick: trunk timestamp: Sat 2011-07-23 10:33:06 +0200 message: Fix title and toolbar not shown in OSX 10.7. * nsterm.m (initFrameFromEmacs): Set NSTitledWindowMask in styleMask for OSX >= 10.7. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-23 07:42:56 +0000 +++ src/ChangeLog 2011-07-23 08:33:06 +0000 @@ -1,3 +1,8 @@ +2011-07-23 Jan Djärv + + * nsterm.m (initFrameFromEmacs): Set NSTitledWindowMask in styleMask + for OSX >= 10.7. + 2011-07-22 Eli Zaretskii Fix a significant slow-down of cursor motion with C-n, C-p, === modified file 'src/nsterm.m' --- src/nsterm.m 2011-07-08 15:39:40 +0000 +++ src/nsterm.m 2011-07-23 08:33:06 +0000 @@ -5304,6 +5304,9 @@ win = [[EmacsWindow alloc] initWithContentRect: r styleMask: (NSResizableWindowMask | +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + NSTitledWindowMask | +#endif NSMiniaturizableWindowMask | NSClosableWindowMask) backing: NSBackingStoreBuffered ------------------------------------------------------------ revno: 105306 [merge] committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-07-23 10:42:56 +0300 message: Speed up keyboard auto-repeat cursor motion under bidi redisplay. src/xdisp.c (compute_stop_pos_backwards): New function. (next_element_from_buffer): Call compute_stop_pos_backwards to find a suitable prev_stop when we find ourselves before base_level_stop. (reseat): Don't look for prev_stop, as that could mean a very long run. : Cache for last found display string position. (compute_display_string_pos): Return the cached position if asked about the same buffer in the same area of character positions, and the buffer wasn't changed since the time the display string position was cached. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-22 17:42:43 +0000 +++ src/ChangeLog 2011-07-23 07:42:56 +0000 @@ -1,5 +1,24 @@ 2011-07-22 Eli Zaretskii + Fix a significant slow-down of cursor motion with C-n, C-p, + C-f/C-b, and C-v/M-v that couldn't keep up with keyboard + auto-repeat under bidi redisplay in fontified buffers. + * xdisp.c (compute_stop_pos_backwards): New function. + (next_element_from_buffer): Call compute_stop_pos_backwards to + find a suitable prev_stop when we find ourselves before + base_level_stop. + (reseat): Don't look for prev_stop, as that could mean a very long + run. + + : Cache for last found display string + position. + (compute_display_string_pos): Return the cached position if asked + about the same buffer in the same area of character positions, and + the buffer wasn't changed since the time the display string + position was cached. + +2011-07-22 Eli Zaretskii + * xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object is an integer, which is important for empty lines. (Bug#9149) === modified file 'src/xdisp.c' --- src/xdisp.c 2011-07-22 17:42:43 +0000 +++ src/xdisp.c 2011-07-23 07:42:56 +0000 @@ -3134,6 +3134,14 @@ return endpos; } +/* Record one cached display string position found recently by + compute_display_string_pos. */ +static EMACS_INT cached_disp_pos; +static EMACS_INT cached_prev_pos; +static struct buffer *cached_disp_buffer; +static int cached_disp_modiff; +static int cached_disp_overlay_modiff; + /* Return the character position of a display string at or after position specified by POSITION. If no display string exists at or after POSITION, return ZV. A display string is either an overlay @@ -3155,6 +3163,7 @@ EMACS_INT begb = string_p ? 0 : BEGV; EMACS_INT bufpos, charpos = CHARPOS (*position); struct text_pos tpos; + struct buffer *b; if (charpos >= eob /* We don't support display properties whose values are strings @@ -3164,6 +3173,33 @@ || (string->s && !STRINGP (object))) return eob; + /* Check the cached values. */ + if (!STRINGP (object)) + { + if (NILP (object)) + b = current_buffer; + else + b = XBUFFER (object); + if (b == cached_disp_buffer + && BUF_MODIFF (b) == cached_disp_modiff + && BUF_OVERLAY_MODIFF (b) == cached_disp_overlay_modiff) + { + if (cached_prev_pos + && cached_prev_pos < charpos && charpos <= cached_disp_pos) + return cached_disp_pos; + /* Handle overstepping either end of the known interval. */ + if (charpos > cached_disp_pos) + cached_prev_pos = cached_disp_pos; + else /* charpos <= cached_prev_pos */ + cached_prev_pos = max (charpos - 1, BEGV); + } + + /* Record new values in the cache. */ + cached_disp_buffer = b; + cached_disp_modiff = BUF_MODIFF (b); + cached_disp_overlay_modiff = BUF_OVERLAY_MODIFF (b); + } + /* If the character at CHARPOS is where the display string begins, return CHARPOS. */ pos = make_number (charpos); @@ -3179,7 +3215,11 @@ spec)) && handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, frame_window_p)) - return charpos; + { + if (!STRINGP (object)) + cached_disp_pos = charpos; + return charpos; + } /* Look forward for the first character with a `display' property that will replace the underlying text when displayed. */ @@ -3199,6 +3239,8 @@ || !handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos, frame_window_p)); + if (!STRINGP (object)) + cached_disp_pos = CHARPOS (tpos); return CHARPOS (tpos); } @@ -5731,17 +5773,19 @@ { /* For bidi iteration, we need to prime prev_stop and base_level_stop with our best estimations. */ - if (CHARPOS (pos) < it->prev_stop) - { - handle_stop_backwards (it, BEGV); - if (CHARPOS (pos) < it->base_level_stop) - it->base_level_stop = 0; - } - else if (CHARPOS (pos) > it->stop_charpos - && it->stop_charpos >= BEGV) - handle_stop_backwards (it, it->stop_charpos); - else /* force_p */ - handle_stop (it); + /* Implementation note: Of course, POS is not necessarily a + stop position, so assigning prev_pos to it is a lie; we + should have called compute_stop_backwards. However, if + the current buffer does not include any R2L characters, + that call would be a waste of cycles, because the + iterator will never move back, and thus never cross this + "fake" stop position. So we delay that backward search + until the time we really need it, in next_element_from_buffer. */ + if (CHARPOS (pos) != it->prev_stop) + it->prev_stop = CHARPOS (pos); + if (CHARPOS (pos) < it->base_level_stop) + it->base_level_stop = 0; /* meaning it's unknown */ + handle_stop (it); } else { @@ -7008,10 +7052,10 @@ embedding level, so test for that explicitly. */ && !BIDI_AT_BASE_LEVEL (it->bidi_it)) { - /* If we lost track of base_level_stop, we have no better place - for handle_stop_backwards to start from than BEGV. This - happens, e.g., when we were reseated to the previous - screenful of text by vertical-motion. */ + /* If we lost track of base_level_stop, we have no better + place for handle_stop_backwards to start from than string + beginning. This happens, e.g., when we were reseated to + the previous screenful of text by vertical-motion. */ if (it->base_level_stop <= 0 || IT_STRING_CHARPOS (*it) < it->base_level_stop) it->base_level_stop = 0; @@ -7199,6 +7243,50 @@ return 1; } +/* Scan backwards from IT's current position until we find a stop + position, or until BEGV. This is called when we find ourself + before both the last known prev_stop and base_level_stop while + reordering bidirectional text. */ + +static void +compute_stop_pos_backwards (struct it *it) +{ + const int SCAN_BACK_LIMIT = 1000; + struct text_pos pos; + struct display_pos save_current = it->current; + struct text_pos save_position = it->position; + EMACS_INT charpos = IT_CHARPOS (*it); + EMACS_INT where_we_are = charpos; + EMACS_INT save_stop_pos = it->stop_charpos; + EMACS_INT save_end_pos = it->end_charpos; + + xassert (NILP (it->string) && !it->s); + xassert (it->bidi_p); + it->bidi_p = 0; + do + { + it->end_charpos = min (charpos + 1, ZV); + charpos = max (charpos - SCAN_BACK_LIMIT, BEGV); + SET_TEXT_POS (pos, charpos, BYTE_TO_CHAR (charpos)); + reseat_1 (it, pos, 0); + compute_stop_pos (it); + /* We must advance forward, right? */ + if (it->stop_charpos <= charpos) + abort (); + } + while (charpos > BEGV && it->stop_charpos >= it->end_charpos); + + if (it->stop_charpos <= where_we_are) + it->prev_stop = it->stop_charpos; + else + it->prev_stop = BEGV; + it->bidi_p = 1; + it->current = save_current; + it->position = save_position; + it->stop_charpos = save_stop_pos; + it->end_charpos = save_end_pos; +} + /* Scan forward from CHARPOS in the current buffer/string, until we find a stop position > current IT's position. Then handle the stop position before that. This is called when we bump into a stop @@ -7218,6 +7306,7 @@ EMACS_INT next_stop; /* Scan in strict logical order. */ + xassert (it->bidi_p); it->bidi_p = 0; do { @@ -7237,11 +7326,11 @@ } while (charpos <= where_we_are); + it->bidi_p = 1; + it->current = save_current; + it->position = save_position; next_stop = it->stop_charpos; it->stop_charpos = it->prev_stop; - it->bidi_p = 1; - it->current = save_current; - it->position = save_position; handle_stop (it); it->stop_charpos = next_stop; } @@ -7338,14 +7427,19 @@ embedding level, so test for that explicitly. */ && !BIDI_AT_BASE_LEVEL (it->bidi_it)) { - /* If we lost track of base_level_stop, we have no better place - for handle_stop_backwards to start from than BEGV. This - happens, e.g., when we were reseated to the previous - screenful of text by vertical-motion. */ if (it->base_level_stop <= 0 || IT_CHARPOS (*it) < it->base_level_stop) - it->base_level_stop = BEGV; - handle_stop_backwards (it, it->base_level_stop); + { + /* If we lost track of base_level_stop, we need to find + prev_stop by looking backwards. This happens, e.g., when + we were reseated to the previous screenful of text by + vertical-motion. */ + it->base_level_stop = BEGV; + compute_stop_pos_backwards (it); + handle_stop_backwards (it, it->prev_stop); + } + else + handle_stop_backwards (it, it->base_level_stop); return GET_NEXT_DISPLAY_ELEMENT (it); } else ------------------------------------------------------------ revno: 105305 fixes bug(s): http://debbugs.gnu.org/9149 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-07-22 20:42:43 +0300 message: Fix bug #9149 with mouse highlight of empty lines. src/xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object is an integer, which is important for empty lines. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-22 05:02:24 +0000 +++ src/ChangeLog 2011-07-22 17:42:43 +0000 @@ -1,3 +1,8 @@ +2011-07-22 Eli Zaretskii + + * xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object + is an integer, which is important for empty lines. (Bug#9149) + 2011-07-22 Chong Yidong * frame.c (Fmodify_frame_parameters): In tty case, update the === modified file 'src/xdisp.c' --- src/xdisp.c 2011-07-18 02:34:14 +0000 +++ src/xdisp.c 2011-07-22 17:42:43 +0000 @@ -25029,7 +25029,7 @@ while (g < e) { - if (BUFFERP (g->object) + if ((BUFFERP (g->object) || INTEGERP (g->object)) && start_charpos <= g->charpos && g->charpos < end_charpos) *start = row; g++; @@ -25079,7 +25079,7 @@ while (g < e) { - if (BUFFERP (g->object) + if ((BUFFERP (g->object) || INTEGERP (g->object)) && start_charpos <= g->charpos && g->charpos < end_charpos) break; g++; ------------------------------------------------------------ revno: 105304 committer: Alan Mackenzie branch nick: trunk timestamp: Fri 2011-07-22 12:53:46 +0000 message: Prevent cc-langs.elc being loaded at run time. cc-mode.el: Remove two autoload forms which loaded cc-langs. cc-langs.el (c-make-init-lang-vars-fun): Don't emit "(require 'cc-langs)". Quote a form so it will evaluate at (cc-mode's) compilation time. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-07-22 11:04:55 +0000 +++ lisp/ChangeLog 2011-07-22 12:53:46 +0000 @@ -1,3 +1,14 @@ +2011-07-22 Alan Mackenzie + + Prevent cc-langs.elc being loaded at run time. + + * progmodes/cc-mode.el: Remove two autoload forms which loaded + cc-langs. + + * /progmodes/cc-langs.el (c-make-init-lang-vars-fun): Don't emit + "(require 'cc-langs)". Quote a form so it will evaluate at + (cc-mode's) compilation time. + 2011-07-22 Michael Albinus * net/tramp.el (tramp-file-name-handler): Avoid recursive === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2011-07-18 17:15:24 +0000 +++ lisp/progmodes/cc-langs.el 2011-07-22 12:53:46 +0000 @@ -3092,10 +3092,9 @@ ;; ',mode ,c-version c-version) ;; (put ',mode 'c-has-warned-lang-consts t)) - (require 'cc-langs) (setq source-eval t) - (let ((init (append (cdr c-emacs-variable-inits) - (cdr c-lang-variable-inits)))) + (let ((init ',(append (cdr c-emacs-variable-inits) + (cdr c-lang-variable-inits)))) (while init (setq current-var (caar init)) (set (caar init) (eval (cadar init))) === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2011-06-30 20:45:12 +0000 +++ lisp/progmodes/cc-mode.el 2011-07-22 12:53:46 +0000 @@ -120,11 +120,6 @@ ; ' (require 'cc-fonts) ;) -;; cc-langs isn't loaded when we're byte compiled, so add autoload -;; directives for the interface functions. -(autoload 'c-make-init-lang-vars-fun "cc-langs") -(autoload 'c-init-language-vars "cc-langs" nil nil 'macro) - ;; Other modes and packages which depend on CC Mode should do the ;; following to make sure everything is loaded and available for their ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.