From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: jit lock sit-for provokes redisplay provokes imenu Date: Thu, 03 Aug 2006 11:35:16 +0200 Message-ID: <44D1C354.6060808@gmx.at> References: <81CCA6588E60BB42BE68BD029ED4826008838221@wimex2.wim.midas-kapiti.com> <44C0EA68.40105@gmx.at> <44C1EE07.3080502@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050004050206080909020801" X-Trace: sea.gmane.org 1154597875 24963 80.91.229.2 (3 Aug 2006 09:37:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Aug 2006 09:37:55 +0000 (UTC) Cc: simon.marshall@misys.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 03 11:37:53 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G8Ze5-0004YF-2Z for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2006 11:37:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8Ze3-0001FG-BU for ged-emacs-devel@m.gmane.org; Thu, 03 Aug 2006 05:37:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G8Zdn-0001Ef-L8 for emacs-devel@gnu.org; Thu, 03 Aug 2006 05:37:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G8Zdm-0001Dw-KX for emacs-devel@gnu.org; Thu, 03 Aug 2006 05:37:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G8Zdl-0001Dj-JQ for emacs-devel@gnu.org; Thu, 03 Aug 2006 05:37:17 -0400 Original-Received: from [213.165.64.21] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.52) id 1G8Zh1-0003qc-Nb for emacs-devel@gnu.org; Thu, 03 Aug 2006 05:40:41 -0400 Original-Received: (qmail invoked by alias); 03 Aug 2006 09:37:08 -0000 Original-Received: from N879P007.adsl.highway.telekom.at (EHLO [62.47.53.199]) [62.47.53.199] by mail.gmx.net (mp040) with SMTP; 03 Aug 2006 11:37:08 +0200 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: rms@gnu.org In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58040 Archived-At: This is a multi-part message in MIME format. --------------050004050206080909020801 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Attached find ChangeLog entries and patches for this. martin. --------------050004050206080909020801 Content-Type: text/plain; name="modiff.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="modiff.patch" 2006-08-03 Martin Rudalics * buffer.h (struct buffer_text): New field chars_modiff. (CHARS_MODIFF, BUF_CHARS_MODIFF): New macros. * buffer.c (Fbuffer_chars_modified_tick): New function returning value of BUF_CHARS_MODIFF. (syms_of_buffer): Defsubr it. (Fget_buffer_create): Initialize BUF_CHARS_MODIFF. * INSDEL.c (modify_region): New argument preserve_chars_modiff. Set CHARS_MODIFF to MODIFF provided preserve_chars_modiff is zero. (insert_1_both, insert_from_string_1, insert_from_buffer_1) (adjust_after_replace, adjust_after_replace_noundo) (replace_range, replace_range_2, del_range_2): Set CHARS_MODIFF to new value of MODIFF. * lisp.h (modify_region): Add fourth argument in extern. * casefiddle.c (casify_region): Call modify_region with fourth argument zero to assert that CHARS_MODIFF is updated. * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) (Ftranspose_regions): Likewise. * textprop.c (Fadd_text_properties, Fset_text_properties) (Fremove_text_properties, Fremove_list_of_text_properties): Call modify_region with fourth argument 1 to avoid that CHARS_MODIFF is updated. 2006-08-03 Martin Rudalics * imenu.el (imenu-update-menubar): Use `buffer-chars-modified-tick' instead of `buffer-modified-tick'. (imenu-menubar-modified-tick): Update doc-string accordingly. *** buffer.c Tue Jun 6 19:20:40 2006 --- buffer.c Wed Jul 26 12:30:46 2006 *************** *** 371,376 **** --- 371,377 ---- BUF_ZV_BYTE (b) = BEG_BYTE; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; + BUF_CHARS_MODIFF (b) = 1; BUF_OVERLAY_MODIFF (b) = 1; BUF_SAVE_MODIFF (b) = 1; BUF_INTERVALS (b) = 0; *************** *** 1145,1150 **** --- 1146,1176 ---- return make_number (BUF_MODIFF (buf)); } + + DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, Sbuffer_chars_modified_tick, + 0, 1, 0, + doc: /* Return BUFFER's character-change tick counter. + Each buffer has a character-change tick counter, which is set to the + value of the buffer's tick counter \(see `buffer-modified-tick'), each + time text in that buffer is inserted or deleted. By comparing the + values returned by two individual calls of buffer-chars-modified-tick, + you can tell whether a character change occurred in that buffer in + between these calls. No argument or nil as argument means use current + buffer as BUFFER. */) + (buffer) + register Lisp_Object buffer; + { + register struct buffer *buf; + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + } + + return make_number (BUF_CHARS_MODIFF (buf)); + } DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, "sRename buffer (to new name): \nP", *************** *** 6014,6019 **** --- 6040,6046 ---- defsubr (&Sbuffer_modified_p); defsubr (&Sset_buffer_modified_p); defsubr (&Sbuffer_modified_tick); + defsubr (&Sbuffer_chars_modified_tick); defsubr (&Srename_buffer); defsubr (&Sother_buffer); defsubr (&Sbuffer_enable_undo); *** buffer.h Tue Apr 11 16:24:24 2006 --- buffer.h Wed Jul 26 11:08:36 2006 *************** *** 82,87 **** --- 82,90 ---- /* Modification count. */ #define MODIFF (current_buffer->text->modiff) + /* Character modification count. */ + #define CHARS_MODIFF (current_buffer->text->chars_modiff) + /* Overlay modification count. */ #define OVERLAY_MODIFF (current_buffer->text->overlay_modiff) *************** *** 147,152 **** --- 150,158 ---- /* Modification count. */ #define BUF_MODIFF(buf) ((buf)->text->modiff) + /* Character modification count. */ + #define BUF_CHARS_MODIFF(buf) ((buf)->text->chars_modiff) + /* Modification count as of last visit or save. */ #define BUF_SAVE_MODIFF(buf) ((buf)->text->save_modiff) *************** *** 406,411 **** --- 412,421 ---- for this buffer. It is incremented for each such event, and never otherwise changed. */ + int chars_modiff; /* This is modified with character-change + events for this buffer. It is set to + modiff for each such event, and never + otherwise changed. */ int save_modiff; /* Previous value of modiff, as of last time buffer visited or saved a file. */ *** casefiddle.c Tue Apr 11 16:24:24 2006 --- casefiddle.c Tue Jul 25 18:41:12 2006 *************** *** 189,195 **** validate_region (&b, &e); start = XFASTINT (b); end = XFASTINT (e); ! modify_region (current_buffer, start, end); record_change (start, end - start); start_byte = CHAR_TO_BYTE (start); end_byte = CHAR_TO_BYTE (end); --- 189,195 ---- validate_region (&b, &e); start = XFASTINT (b); end = XFASTINT (e); ! modify_region (current_buffer, start, end, 0); record_change (start, end - start); start_byte = CHAR_TO_BYTE (start); end_byte = CHAR_TO_BYTE (end); *** editfns.c Sun Jul 2 09:50:00 2006 --- editfns.c Tue Jul 25 18:41:54 2006 *************** *** 2785,2791 **** if (! changed) { changed = pos; ! modify_region (current_buffer, changed, XINT (end)); if (! NILP (noundo)) { --- 2785,2791 ---- if (! changed) { changed = pos; ! modify_region (current_buffer, changed, XINT (end), 0); if (! NILP (noundo)) { *************** *** 2897,2903 **** pos = XINT (start); pos_byte = CHAR_TO_BYTE (pos); end_pos = XINT (end); ! modify_region (current_buffer, pos, XINT (end)); cnt = 0; for (; pos < end_pos; ) --- 2897,2903 ---- pos = XINT (start); pos_byte = CHAR_TO_BYTE (pos); end_pos = XINT (end); ! modify_region (current_buffer, pos, XINT (end), 0); cnt = 0; for (; pos < end_pos; ) *************** *** 4162,4168 **** if (end1 == start2) /* adjacent regions */ { ! modify_region (current_buffer, start1, end2); record_change (start1, len1 + len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); --- 4162,4168 ---- if (end1 == start2) /* adjacent regions */ { ! modify_region (current_buffer, start1, end2, 0); record_change (start1, len1 + len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); *************** *** 4218,4225 **** { USE_SAFE_ALLOCA; ! modify_region (current_buffer, start1, end1); ! modify_region (current_buffer, start2, end2); record_change (start1, len1); record_change (start2, len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); --- 4218,4225 ---- { USE_SAFE_ALLOCA; ! modify_region (current_buffer, start1, end1, 0); ! modify_region (current_buffer, start2, end2, 0); record_change (start1, len1); record_change (start2, len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); *************** *** 4248,4254 **** { USE_SAFE_ALLOCA; ! modify_region (current_buffer, start1, end2); record_change (start1, (end2 - start1)); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); --- 4248,4254 ---- { USE_SAFE_ALLOCA; ! modify_region (current_buffer, start1, end2, 0); record_change (start1, (end2 - start1)); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); *************** *** 4279,4285 **** USE_SAFE_ALLOCA; record_change (start1, (end2 - start1)); ! modify_region (current_buffer, start1, end2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); --- 4279,4285 ---- USE_SAFE_ALLOCA; record_change (start1, (end2 - start1)); ! modify_region (current_buffer, start1, end2, 0); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); *** insdel.c Tue Apr 11 16:24:24 2006 --- insdel.c Wed Jul 26 17:40:24 2006 *************** *** 1007,1012 **** --- 1007,1013 ---- will add up to the right stuff in the undo list. */ record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; bcopy (string, GPT_ADDR, nbytes); *************** *** 1144,1149 **** --- 1145,1151 ---- record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; GAP_SIZE -= outgoing_nbytes; GPT += nchars; *************** *** 1295,1300 **** --- 1297,1303 ---- record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; GAP_SIZE -= outgoing_nbytes; GPT += nchars; *************** *** 1403,1408 **** --- 1406,1412 ---- if (len == 0) evaporate_overlays (from); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Like adjust_after_replace, but doesn't require PREV_TEXT. *************** *** 1453,1458 **** --- 1457,1463 ---- if (len == 0) evaporate_overlays (from); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Record undo information, adjust markers and position keepers for an *************** *** 1645,1650 **** --- 1650,1656 ---- CHECK_MARKERS (); MODIFF++; + CHARS_MODIFF = MODIFF; UNGCPRO; signal_after_change (from, nchars_del, GPT - from); *************** *** 1769,1774 **** --- 1775,1781 ---- CHECK_MARKERS (); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Delete characters in current buffer *************** *** 1950,1955 **** --- 1957,1963 ---- if (! EQ (current_buffer->undo_list, Qt)) record_delete (from, deletion); MODIFF++; + CHARS_MODIFF = MODIFF; /* Relocate point as if it were a marker. */ if (from < PT) *************** *** 1990,2001 **** character positions START to END. This checks the read-only properties of the region, calls the necessary modification hooks, and warns the next redisplay that it should pay attention to that ! area. */ void ! modify_region (buffer, start, end) struct buffer *buffer; ! int start, end; { struct buffer *old_buffer = current_buffer; --- 1998,2012 ---- character positions START to END. This checks the read-only properties of the region, calls the necessary modification hooks, and warns the next redisplay that it should pay attention to that ! area. ! ! If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF. ! Otherwise set CHARS_MODIFF to the new value of MODIFF. */ void ! modify_region (buffer, start, end, preserve_chars_modiff) struct buffer *buffer; ! int start, end, preserve_chars_modiff; { struct buffer *old_buffer = current_buffer; *************** *** 2009,2014 **** --- 2020,2027 ---- if (MODIFF <= SAVE_MODIFF) record_first_change (); MODIFF++; + if (! preserve_chars_modiff) + CHARS_MODIFF = MODIFF; buffer->point_before_scroll = Qnil; *** lisp.h Tue Jun 6 19:20:40 2006 --- lisp.h Tue Jul 25 18:42:54 2006 *************** *** 2451,2457 **** extern void del_range_byte P_ ((int, int, int)); extern void del_range_both P_ ((int, int, int, int, int)); extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); ! extern void modify_region P_ ((struct buffer *, int, int)); extern void prepare_to_modify_buffer P_ ((int, int, int *)); extern void signal_before_change P_ ((int, int, int *)); extern void signal_after_change P_ ((int, int, int)); --- 2451,2457 ---- extern void del_range_byte P_ ((int, int, int)); extern void del_range_both P_ ((int, int, int, int, int)); extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); ! extern void modify_region P_ ((struct buffer *, int, int, int)); extern void prepare_to_modify_buffer P_ ((int, int, int *)); extern void signal_before_change P_ ((int, int, int *)); extern void signal_after_change P_ ((int, int, int)); *** textprop.c Sun Jul 2 09:50:00 2006 --- textprop.c Tue Jul 25 18:45:36 2006 *************** *** 1247,1253 **** } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); /* We are at the beginning of interval I, with LEN chars to scan. */ for (;;) --- 1247,1253 ---- } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); /* We are at the beginning of interval I, with LEN chars to scan. */ for (;;) *************** *** 1387,1393 **** } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); set_text_properties_1 (start, end, properties, object, i); --- 1387,1393 ---- } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); set_text_properties_1 (start, end, properties, object, i); *************** *** 1535,1541 **** } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); /* We are at the beginning of an interval, with len to scan */ for (;;) --- 1535,1541 ---- } if (BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); /* We are at the beginning of an interval, with len to scan */ for (;;) *************** *** 1649,1655 **** if (LENGTH (i) == len) { if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), --- 1649,1655 ---- if (LENGTH (i) == len) { if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), *************** *** 1662,1668 **** i = split_interval_left (i, len); copy_properties (unchanged, i); if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), --- 1662,1668 ---- i = split_interval_left (i, len); copy_properties (unchanged, i); if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), *************** *** 1673,1679 **** if (interval_has_some_properties_list (properties, i)) { if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end)); remove_properties (Qnil, properties, i, object); modified = 1; } --- 1673,1679 ---- if (interval_has_some_properties_list (properties, i)) { if (!modified && BUFFERP (object)) ! modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); modified = 1; } *** imenu.el Mon May 1 10:08:52 2006 --- imenu.el Wed Jul 26 11:20:28 2006 *************** *** 968,982 **** (defvar imenu-buffer-menubar nil) (defvar imenu-menubar-modified-tick 0 ! "The value of (buffer-modified-tick) as of last call to `imenu-update-menubar'.") (make-variable-buffer-local 'imenu-menubar-modified-tick) (defun imenu-update-menubar () (when (and (current-local-map) (keymapp (lookup-key (current-local-map) [menu-bar index])) ! (not (eq (buffer-modified-tick) ! imenu-menubar-modified-tick))) ! (setq imenu-menubar-modified-tick (buffer-modified-tick)) (let ((index-alist (imenu--make-index-alist t))) ;; Don't bother updating if the index-alist has not changed ;; since the last time we did it. --- 968,981 ---- (defvar imenu-buffer-menubar nil) (defvar imenu-menubar-modified-tick 0 ! "The value of (buffer-chars-modified-tick) as of last call to `imenu-update-menubar'.") (make-variable-buffer-local 'imenu-menubar-modified-tick) (defun imenu-update-menubar () (when (and (current-local-map) (keymapp (lookup-key (current-local-map) [menu-bar index])) ! (/= (buffer-chars-modified-tick) imenu-menubar-modified-tick)) ! (setq imenu-menubar-modified-tick (buffer-chars-modified-tick)) (let ((index-alist (imenu--make-index-alist t))) ;; Don't bother updating if the index-alist has not changed ;; since the last time we did it. --------------050004050206080909020801 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------050004050206080909020801--