Now on revision 105414. ------------------------------------------------------------ revno: 105414 fixes bug(s): http://debbugs.gnu.org/9224 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-08-06 14:49:35 +0300 message: Really fix bug #9224 with vertical-motion under word-wrap. src/xdisp.c (move_it_in_display_line_to): Fix vertical-motion in a buffer with word-wrap under bidirectional display. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-06 10:59:36 +0000 +++ src/ChangeLog 2011-08-06 11:49:35 +0000 @@ -3,6 +3,8 @@ * xdisp.c (set_cursor_from_row): Fix cursor positioning when a display property strides EOL and includes a newline, as in longlines-mode. (Bug#9254) + (move_it_in_display_line_to): Fix vertical-motion in a buffer with + word-wrap under bidirectional display. (Bug#9224) * bidi.c (bidi_unshelve_cache): Don't reset the cache if JUST_FREE is non-zero, even if the data buffer is NULL. Fixes a crash in === modified file 'src/xdisp.c' --- src/xdisp.c 2011-08-06 10:59:36 +0000 +++ src/xdisp.c 2011-08-06 11:49:35 +0000 @@ -8009,13 +8009,19 @@ positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - if (it->bidi_p && (op & MOVE_TO_POS) != 0 - && !saw_smaller_pos - && IT_CHARPOS (*it) > to_charpos) + if (it->bidi_p && (op & MOVE_TO_POS) != 0) { - if (IT_CHARPOS (ppos_it) < ZV) - RESTORE_IT (it, &ppos_it, ppos_data); - goto buffer_pos_reached; + if (!saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) + { + if (IT_CHARPOS (ppos_it) < ZV) + RESTORE_IT (it, &ppos_it, ppos_data); + goto buffer_pos_reached; + } + else if (it->line_wrap == WORD_WRAP && atpos_it.sp >= 0 + && IT_CHARPOS (*it) > to_charpos) + goto buffer_pos_reached; + else + result = MOVE_NEWLINE_OR_CR; } else result = MOVE_NEWLINE_OR_CR; ------------------------------------------------------------ revno: 105413 fixes bug(s): http://debbugs.gnu.org/9254 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-08-06 13:59:36 +0300 message: Fix bug #9254 with crash and cursor positioning under longlines-mode. src/xdisp.c (set_cursor_from_row): Fix cursor positioning when a display property strides EOL and includes a newline, as in longlines-mode. src/bidi.c (bidi_unshelve_cache): Don't reset the cache if JUST_FREE is non-zero, even if the data buffer is NULL. Fixes a crash in vertical-motion with longlines-mode. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-05 14:31:40 +0000 +++ src/ChangeLog 2011-08-06 10:59:36 +0000 @@ -1,3 +1,13 @@ +2011-08-06 Eli Zaretskii + + * xdisp.c (set_cursor_from_row): Fix cursor positioning when a + display property strides EOL and includes a newline, as in + longlines-mode. (Bug#9254) + + * bidi.c (bidi_unshelve_cache): Don't reset the cache if JUST_FREE + is non-zero, even if the data buffer is NULL. Fixes a crash in + vertical-motion with longlines-mode. (Bug#9254) + 2011-08-05 Eli Zaretskii * bidi.c : Now static. === modified file 'src/bidi.c' --- src/bidi.c 2011-08-05 14:08:16 +0000 +++ src/bidi.c 2011-08-06 10:59:36 +0000 @@ -666,7 +666,11 @@ return databuf; } -/* Restore the cache state from a copy stashed away by bidi_shelve_cache. */ +/* Restore the cache state from a copy stashed away by + bidi_shelve_cache, and free the buffer used to stash that copy. + JUST_FREE non-zero means free the buffer, but don't restore the + cache; used when the corresponding iterator is discarded instead of + being restored. */ void bidi_unshelve_cache (void *databuf, int just_free) { @@ -674,10 +678,13 @@ if (!p) { - /* A NULL pointer means an empty cache. */ - bidi_cache_start = 0; - bidi_cache_sp = 0; - bidi_cache_reset (); + if (!just_free) + { + /* A NULL pointer means an empty cache. */ + bidi_cache_start = 0; + bidi_cache_sp = 0; + bidi_cache_reset (); + } } else { === modified file 'src/xdisp.c' --- src/xdisp.c 2011-08-05 11:04:44 +0000 +++ src/xdisp.c 2011-08-06 10:59:36 +0000 @@ -13285,6 +13285,9 @@ /* Last buffer position covered by an overlay string with an integer `cursor' property. */ EMACS_INT bpos_covered = 0; + /* Non-zero means the display string on which to display the cursor + comes from a text property, not from an overlay. */ + int string_from_text_prop = 0; /* Skip over glyphs not having an object at the start and the end of the row. These are special glyphs like truncation marks on @@ -13603,9 +13606,14 @@ { Lisp_Object str; EMACS_INT tem; + /* If the display property covers the newline, we + need to search for it one position farther. */ + EMACS_INT lim = pos_after + + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta); + string_from_text_prop = 0; str = glyph->object; - tem = string_buffer_position_lim (str, pos, pos_after, 0); + tem = string_buffer_position_lim (str, pos, lim, 0); if (tem == 0 /* from overlay */ || pos <= tem) { @@ -13629,7 +13637,10 @@ EMACS_INT strpos = glyph->charpos; if (tem) - cursor = glyph; + { + cursor = glyph; + string_from_text_prop = 1; + } for ( ; (row->reversed_p ? glyph > stop : glyph < stop) && EQ (glyph->object, str); @@ -13730,8 +13741,17 @@ /* previous candidate is a glyph from a string that has a non-nil `cursor' property */ || (STRINGP (g1->object) - && !NILP (Fget_char_property (make_number (g1->charpos), - Qcursor, g1->object))))) + && (!NILP (Fget_char_property (make_number (g1->charpos), + Qcursor, g1->object)) + /* pevious candidate is from the same display + string as this one, and the display string + came from a text property */ + || (EQ (g1->object, glyph->object) + && string_from_text_prop) + /* this candidate is from newline and its + position is not an exact match */ + || (INTEGERP (glyph->object) + && glyph->charpos != pt_old))))) return 0; /* If this candidate gives an exact match, use that. */ if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) ------------------------------------------------------------ revno: 105412 author: Andrew Cohen committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2011-08-05 23:29:17 +0000 message: gnus-sum.el (gnus-summary-refer-article): Warp to article. This allows article-referral to work from an nnir group. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-08-04 22:14:04 +0000 +++ lisp/gnus/ChangeLog 2011-08-05 23:29:17 +0000 @@ -1,3 +1,8 @@ +2011-08-05 Andrew Cohen + + * gnus-sum.el (gnus-summary-refer-article): Warp to article. This + allows article-referral to work from an nnir group. + 2011-08-04 Andrew Cohen * gnus.el (registry-ignore): Add nnir groups to the ignore-list. === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2011-07-31 22:15:44 +0000 +++ lisp/gnus/gnus-sum.el 2011-08-05 23:29:17 +0000 @@ -9037,6 +9037,7 @@ (defun gnus-summary-refer-article (message-id) "Fetch an article specified by MESSAGE-ID." (interactive "sMessage-ID: ") + (gnus-warp-to-article) (when (and (stringp message-id) (not (zerop (length message-id)))) (setq message-id (gnus-replace-in-string message-id " " "")) ------------------------------------------------------------ revno: 105411 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9183 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2011-08-05 15:53:46 -0400 message: * lisp/progmodes/js.el (js--regexp-literal): Accept regexps at the beginning of statements and in a few more cases. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-08-05 16:31:21 +0000 +++ lisp/ChangeLog 2011-08-05 19:53:46 +0000 @@ -1,5 +1,8 @@ 2011-08-05 Stefan Monnier + * progmodes/js.el (js--regexp-literal): Accept regexps at the beginning + of statements and in a few more cases (bug#9183). + * emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args): New functions. (cl-transform-lambda): Use them (bug#9239). === modified file 'lisp/progmodes/js.el' --- lisp/progmodes/js.el 2011-06-30 16:22:33 +0000 +++ lisp/progmodes/js.el 2011-08-05 19:53:46 +0000 @@ -1658,15 +1658,19 @@ ;; below. (eval-and-compile (defconst js--regexp-literal - "[=(,:]\\(?:\\s-\\|\n\\)*\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)" + (concat + ;; We want to match regular expressions only at the beginning of + ;; expressions. + ;; FIXME: Should we also allow /regexp/ after infix operators such as +, + ;; /, -, *, >, ...? + "\\(?:\\`\\|[=([{,:;]\\)\\(?:\\s-\\|\n\\)*" + "\\(/\\)\\(?:\\\\.\\|[^/*\\]\\)\\(?:\\\\.\\|[^/\\]\\)*\\(/\\)") "Regexp matching a JavaScript regular expression literal. Match groups 1 and 2 are the characters forming the beginning and end of the literal.")) (defconst js-syntax-propertize-function (syntax-propertize-rules - ;; We want to match regular expressions only at the beginning of - ;; expressions. (js--regexp-literal (1 "\"") (2 "\"")))) ;;; Indentation ------------------------------------------------------------ revno: 105410 fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9239 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2011-08-05 12:31:21 -0400 message: * lisp/emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args): New functions. (cl-transform-lambda): Use them. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-08-05 06:23:23 +0000 +++ lisp/ChangeLog 2011-08-05 16:31:21 +0000 @@ -1,3 +1,9 @@ +2011-08-05 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl--make-usage-var, cl--make-usage-args): + New functions. + (cl-transform-lambda): Use them (bug#9239). + 2011-08-05 Martin Rudalics * window.el (display-buffer-same-window) === modified file 'lisp/emacs-lisp/cl-loaddefs.el' --- lisp/emacs-lisp/cl-loaddefs.el 2011-08-03 10:20:59 +0000 +++ lisp/emacs-lisp/cl-loaddefs.el 2011-08-05 16:31:21 +0000 @@ -282,7 +282,7 @@ ;;;;;; flet progv psetq do-all-symbols do-symbols dotimes dolist ;;;;;; do* do loop return-from return block etypecase typecase ecase ;;;;;; case load-time-value eval-when destructuring-bind function* -;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "21df83d6106cb0c3d037e75ad79359dc") +;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "0907093f7720996444ededb4edfe8072") ;;; Generated autoloads from cl-macs.el (autoload 'gensym "cl-macs" "\ === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2011-08-02 18:49:12 +0000 +++ lisp/emacs-lisp/cl-macs.el 2011-08-05 16:31:21 +0000 @@ -238,6 +238,37 @@ (declare-function help-add-fundoc-usage "help-fns" (docstring arglist)) +(defun cl--make-usage-var (x) + "X can be a var or a (destructuring) lambda-list." + (cond + ((symbolp x) (make-symbol (upcase (symbol-name x)))) + ((consp x) (cl--make-usage-args x)) + (t x))) + +(defun cl--make-usage-args (arglist) + ;; `orig-args' can contain &cl-defs (an internal + ;; CL thingy I don't understand), so remove it. + (let ((x (memq '&cl-defs arglist))) + (when x (setq arglist (delq (car x) (remq (cadr x) arglist))))) + (let ((state nil)) + (mapcar (lambda (x) + (cond + ((symbolp x) + (if (eq ?\& (aref (symbol-name x) 0)) + (setq state x) + (make-symbol (upcase (symbol-name x))))) + ((not (consp x)) x) + ((memq state '(nil &rest)) (cl--make-usage-args x)) + (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). + (list* + (if (and (consp (car x)) (eq state '&key)) + (list (caar x) (cl--make-usage-var (nth 1 (car x)))) + (cl--make-usage-var (car x))) + (nth 1 x) ;INITFORM. + (cl--make-usage-args (nthcdr 2 x)) ;SVAR. + )))) + arglist))) + (defun cl-transform-lambda (form bind-block) (let* ((args (car form)) (body (cdr form)) (orig-args args) (bind-defs nil) (bind-enquote nil) @@ -282,11 +313,8 @@ (require 'help-fns) (cons (help-add-fundoc-usage (if (stringp (car hdr)) (pop hdr)) - ;; orig-args can contain &cl-defs (an internal - ;; CL thingy I don't understand), so remove it. - (let ((x (memq '&cl-defs orig-args))) - (if (null x) orig-args - (delq (car x) (remq (cadr x) orig-args))))) + (format "(fn %S)" + (cl--make-usage-args orig-args))) hdr))) (list (nconc (list 'let* bind-lets) (nreverse bind-forms) body))))))) === modified file 'lisp/help-fns.el' --- lisp/help-fns.el 2011-06-27 21:39:03 +0000 +++ lisp/help-fns.el 2011-08-05 16:31:21 +0000 @@ -65,7 +65,9 @@ (defun help-split-fundoc (docstring def) "Split a function DOCSTRING into the actual doc and the usage info. -Return (USAGE . DOC) or nil if there's no usage info. +Return (USAGE . DOC) or nil if there's no usage info, where USAGE info +is a string describing the argument list of DEF, such as +\"(apply FUNCTION &rest ARGUMENTS)\". DEF is the function whose usage we're looking for in DOCSTRING." ;; Functions can get the calling sequence at the end of the doc string. ;; In cases where `function' has been fset to a subr we can't search for @@ -156,12 +158,7 @@ (defun help-make-usage (function arglist) (cons (if (symbolp function) function 'anonymous) (mapcar (lambda (arg) - (if (not (symbolp arg)) - (if (and (consp arg) (symbolp (car arg))) - ;; CL style default values for optional args. - (cons (intern (upcase (symbol-name (car arg)))) - (cdr arg)) - arg) + (if (not (symbolp arg)) arg (let ((name (symbol-name arg))) (cond ((string-match "\\`&" name) arg) ------------------------------------------------------------ revno: 105409 fixes bug(s): http://debbugs.gnu.org/9224 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-08-05 17:31:40 +0300 message: Bug #9224 was fixed together with bug #9221. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-05 14:08:16 +0000 +++ src/ChangeLog 2011-08-05 14:31:40 +0000 @@ -19,7 +19,7 @@ (move_it_vertically_backward, move_it_by_lines): Replace the call to xfree to an equivalent call to bidi_unshelve_cache. (move_it_in_display_line_to): Fix logic of returning - MOVE_POS_MATCH_OR_ZV in the bidi case. + MOVE_POS_MATCH_OR_ZV in the bidi case. (Bug#9224) 2011-08-05 Eli Zaretskii ------------------------------------------------------------ revno: 105408 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-08-05 17:08:16 +0300 message: Make bidi_cache_total_alloc static. src/bidi.c : Now static. (bidi_initialize): Initialize bidi_cache_total_alloc. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-05 11:04:44 +0000 +++ src/ChangeLog 2011-08-05 14:08:16 +0000 @@ -1,5 +1,8 @@ 2011-08-05 Eli Zaretskii + * bidi.c : Now static. + (bidi_initialize): Initialize bidi_cache_total_alloc. + *xdisp.c (display_line): Release buffer allocated for shelved bidi cache. (Bug#9221) === modified file 'src/bidi.c' --- src/bidi.c 2011-08-05 11:04:44 +0000 +++ src/bidi.c 2011-08-05 14:08:16 +0000 @@ -620,7 +620,7 @@ bidi_cache_last_idx = -1; } -ptrdiff_t bidi_cache_total_alloc; +static ptrdiff_t bidi_cache_total_alloc; /* Stash away a copy of the cache and its control variables. */ void * @@ -768,6 +768,7 @@ staticpro (¶graph_separate_re); bidi_cache_sp = 0; + bidi_cache_total_alloc = 0; bidi_initialized = 1; } ------------------------------------------------------------ revno: 105407 [merge] fixes bug(s): http://debbugs.gnu.org/9221 committer: Eli Zaretskii branch nick: trunk timestamp: Fri 2011-08-05 14:04:44 +0300 message: Fix bug #9221 with memory leak in bidi display. Add code to monitor memory allocation for bidi cache shelving. src/xdisp.c (display_line): Release buffer allocated for shelved bidi cache. src/bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total amount allocated this far in `bidi_cache_total_alloc'. (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if non-zero, only free the data buffer without restoring the cache contents. All callers changed. src/dispextern.h (bidi_unshelve_cache): Update prototype. src/xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to) (move_it_in_display_line, move_it_to) (move_it_vertically_backward, move_it_by_lines): Replace the call to xfree to an equivalent call to bidi_unshelve_cache. (move_it_in_display_line_to): Fix logic of returning MOVE_POS_MATCH_OR_ZV in the bidi case. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-08-05 10:32:06 +0000 +++ src/ChangeLog 2011-08-05 11:04:44 +0000 @@ -1,5 +1,25 @@ 2011-08-05 Eli Zaretskii + *xdisp.c (display_line): Release buffer allocated for shelved bidi + cache. (Bug#9221) + + * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total + amount allocated this far in `bidi_cache_total_alloc'. + (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if + non-zero, only free the data buffer without restoring the cache + contents. All callers changed. + + * dispextern.h (bidi_unshelve_cache): Update prototype. + + * xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to) + (move_it_in_display_line, move_it_to) + (move_it_vertically_backward, move_it_by_lines): Replace the call + to xfree to an equivalent call to bidi_unshelve_cache. + (move_it_in_display_line_to): Fix logic of returning + MOVE_POS_MATCH_OR_ZV in the bidi case. + +2011-08-05 Eli Zaretskii + * xdisp.c (set_cursor_from_row): Prefer the candidate glyph that came from a string character with a `cursor' property. (Bug#9229) === modified file 'src/bidi.c' --- src/bidi.c 2011-08-02 19:16:32 +0000 +++ src/bidi.c 2011-08-05 11:04:44 +0000 @@ -620,12 +620,15 @@ bidi_cache_last_idx = -1; } +ptrdiff_t bidi_cache_total_alloc; + /* Stash away a copy of the cache and its control variables. */ void * bidi_shelve_cache (void) { unsigned char *databuf; + /* Empty cache. */ if (bidi_cache_idx == 0) return NULL; @@ -634,6 +637,12 @@ + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx)); + bidi_cache_total_alloc += + sizeof (bidi_cache_idx) + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + + sizeof (bidi_cache_sp) + sizeof (bidi_cache_start) + + sizeof (bidi_cache_last_idx); + memcpy (databuf, &bidi_cache_idx, sizeof (bidi_cache_idx)); memcpy (databuf + sizeof (bidi_cache_idx), bidi_cache, bidi_cache_idx * sizeof (struct bidi_it)); @@ -659,7 +668,7 @@ /* Restore the cache state from a copy stashed away by bidi_shelve_cache. */ void -bidi_unshelve_cache (void *databuf) +bidi_unshelve_cache (void *databuf, int just_free) { unsigned char *p = databuf; @@ -672,30 +681,47 @@ } else { - memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); - bidi_cache_ensure_space (bidi_cache_idx); - memcpy (bidi_cache, p + sizeof (bidi_cache_idx), - bidi_cache_idx * sizeof (struct bidi_it)); - memcpy (bidi_cache_start_stack, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it), - sizeof (bidi_cache_start_stack)); - memcpy (&bidi_cache_sp, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack), - sizeof (bidi_cache_sp)); - memcpy (&bidi_cache_start, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), - sizeof (bidi_cache_start)); - memcpy (&bidi_cache_last_idx, - p + sizeof (bidi_cache_idx) - + bidi_cache_idx * sizeof (struct bidi_it) - + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) - + sizeof (bidi_cache_start), - sizeof (bidi_cache_last_idx)); + if (just_free) + { + ptrdiff_t idx; + + memcpy (&idx, p, sizeof (bidi_cache_idx)); + bidi_cache_total_alloc -= + sizeof (bidi_cache_idx) + idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx); + } + else + { + memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); + bidi_cache_ensure_space (bidi_cache_idx); + memcpy (bidi_cache, p + sizeof (bidi_cache_idx), + bidi_cache_idx * sizeof (struct bidi_it)); + memcpy (bidi_cache_start_stack, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it), + sizeof (bidi_cache_start_stack)); + memcpy (&bidi_cache_sp, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack), + sizeof (bidi_cache_sp)); + memcpy (&bidi_cache_start, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), + sizeof (bidi_cache_start)); + memcpy (&bidi_cache_last_idx, + p + sizeof (bidi_cache_idx) + + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start), + sizeof (bidi_cache_last_idx)); + bidi_cache_total_alloc -= + sizeof (bidi_cache_idx) + bidi_cache_idx * sizeof (struct bidi_it) + + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) + + sizeof (bidi_cache_start) + sizeof (bidi_cache_last_idx); + } xfree (p); } === modified file 'src/dispextern.h' --- src/dispextern.h 2011-08-02 19:16:32 +0000 +++ src/dispextern.h 2011-08-05 11:04:44 +0000 @@ -2978,7 +2978,7 @@ extern void bidi_push_it (struct bidi_it *); extern void bidi_pop_it (struct bidi_it *); extern void *bidi_shelve_cache (void); -extern void bidi_unshelve_cache (void *); +extern void bidi_unshelve_cache (void *, int); /* Defined in xdisp.c */ === modified file 'src/dispnew.c' --- src/dispnew.c 2011-07-14 20:40:35 +0000 +++ src/dispnew.c 2011-08-05 11:04:44 +0000 @@ -5282,7 +5282,7 @@ argument is ZV to prevent move_it_in_display_line from matching based on buffer positions. */ move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); Fset_buffer (old_current_buffer); === modified file 'src/indent.c' --- src/indent.c 2011-07-14 21:35:23 +0000 +++ src/indent.c 2011-08-05 11:04:44 +0000 @@ -2135,7 +2135,7 @@ } SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } if (BUFFERP (old_buffer)) === modified file 'src/window.c' --- src/window.c 2011-07-14 17:28:42 +0000 +++ src/window.c 2011-08-05 11:04:44 +0000 @@ -1379,7 +1379,7 @@ if (it.current_y < it.last_visible_y) move_it_past_eol (&it); value = make_number (IT_CHARPOS (it)); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (old_buffer) set_buffer_internal (old_buffer); @@ -4273,7 +4273,7 @@ } start = it.current.pos; - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else if (auto_window_vscroll_p) { @@ -4417,7 +4417,7 @@ } else { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (noerror) return; else if (n < 0) /* could happen with empty buffers */ @@ -4434,7 +4434,7 @@ w->vscroll = 0; else { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (noerror) return; else @@ -4583,7 +4583,7 @@ SET_PT_BOTH (charpos, bytepos); } } - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } @@ -5010,7 +5010,7 @@ start_display (&it, w, start); move_it_vertically (&it, height); bottom_y = line_bottom_y (&it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); /* rms: On a non-window display, the value of it.vpos at the bottom of the screen @@ -5116,7 +5116,7 @@ move_it_vertically_backward (&it, window_box_height (w) / 2); charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else if (iarg < 0) { @@ -5164,7 +5164,7 @@ } if (h <= 0) { - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); return Qnil; } @@ -5187,7 +5187,7 @@ charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); } else { === modified file 'src/xdisp.c' --- src/xdisp.c 2011-08-05 10:32:06 +0000 +++ src/xdisp.c 2011-08-05 11:04:44 +0000 @@ -604,7 +604,7 @@ #define SAVE_IT(ITCOPY,ITORIG,CACHE) \ do { \ if (CACHE) \ - xfree (CACHE); \ + bidi_unshelve_cache (CACHE, 1); \ ITCOPY = ITORIG; \ CACHE = bidi_shelve_cache(); \ } while (0) @@ -613,7 +613,7 @@ do { \ if (pITORIG != pITCOPY) \ *(pITORIG) = *(pITCOPY); \ - bidi_unshelve_cache (CACHE); \ + bidi_unshelve_cache (CACHE, 0); \ CACHE = NULL; \ } while (0) @@ -1341,9 +1341,9 @@ *vpos = it2.vpos; } else - xfree (it2data); + bidi_unshelve_cache (it2data, 1); } - bidi_unshelve_cache (itdata); + bidi_unshelve_cache (itdata, 0); if (old_buffer) set_buffer_internal_1 (old_buffer); @@ -2627,7 +2627,7 @@ it->paragraph_embedding = R2L; else it->paragraph_embedding = NEUTRAL_DIR; - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); } @@ -5618,7 +5618,7 @@ pos = --IT_CHARPOS (it2); --IT_BYTEPOS (it2); it2.sp = 0; - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); it2.string_from_display_prop_p = 0; it2.from_disp_prop_p = 0; if (handle_display_prop (&it2) == HANDLED_RETURN @@ -5828,7 +5828,7 @@ { bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), &it->bidi_it); - bidi_unshelve_cache (NULL); + bidi_unshelve_cache (NULL, 0); it->bidi_it.paragraph_dir = NEUTRAL_DIR; it->bidi_it.string.s = NULL; it->bidi_it.string.lstring = Qnil; @@ -8009,13 +8009,13 @@ positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - if ((op & MOVE_TO_POS) != 0 + if (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + if (IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); + goto buffer_pos_reached; } else result = MOVE_NEWLINE_OR_CR; @@ -8054,14 +8054,13 @@ character positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - || ((op & MOVE_TO_POS) != 0 + || (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos)) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && !at_eob_p && IT_CHARPOS (ppos_it) < ZV) + if (!at_eob_p && IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); - break; + goto buffer_pos_reached; } if (ITERATOR_AT_END_OF_LINE_P (it)) { @@ -8069,14 +8068,13 @@ break; } } - else if ((op & MOVE_TO_POS) != 0 + else if (it->bidi_p && (op & MOVE_TO_POS) != 0 && !saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) { - result = MOVE_POS_MATCH_OR_ZV; - if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) + if (IT_CHARPOS (ppos_it) < ZV) RESTORE_IT (it, &ppos_it, ppos_data); - break; + goto buffer_pos_reached; } result = MOVE_LINE_TRUNCATED; break; @@ -8096,13 +8094,13 @@ done: if (atpos_data) - xfree (atpos_data); + bidi_unshelve_cache (atpos_data, 1); if (atx_data) - xfree (atx_data); + bidi_unshelve_cache (atx_data, 1); if (wrap_data) - xfree (wrap_data); + bidi_unshelve_cache (wrap_data, 1); if (ppos_data) - xfree (ppos_data); + bidi_unshelve_cache (ppos_data, 1); /* Restore the iterator settings altered at the beginning of this function. */ @@ -8137,7 +8135,7 @@ (it, -1, prev_x, MOVE_TO_X); } else - xfree (save_data); + bidi_unshelve_cache (save_data, 1); } else move_it_in_display_line_to (it, to_charpos, to_x, op); @@ -8396,7 +8394,7 @@ } if (backup_data) - xfree (backup_data); + bidi_unshelve_cache (backup_data, 1); TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); } @@ -8475,7 +8473,7 @@ RESTORE_IT (it, it, it2data); if (nlines > 0) move_it_by_lines (it, nlines); - xfree (it3data); + bidi_unshelve_cache (it3data, 1); } else { @@ -8671,7 +8669,7 @@ if (IT_CHARPOS (*it) >= start_charpos) RESTORE_IT (it, &it2, it2data); else - xfree (it2data); + bidi_unshelve_cache (it2data, 1); } else RESTORE_IT (it, it, it2data); @@ -18779,6 +18777,9 @@ } } + if (wrap_data) + bidi_unshelve_cache (wrap_data, 1); + /* If line is not empty and hscrolled, maybe insert truncation glyphs at the left window margin. */ if (it->first_visible_x ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.