unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Subject: [rudalics@gmx.at: Re: jit lock sit-for provokes redisplay provokes imenu]
Date: Mon, 28 Aug 2006 05:52:17 -0400	[thread overview]
Message-ID: <E1GHdmz-0005RD-V6@fencepost.gnu.org> (raw)

This is what we're thinking of using instead of
buffer-chars-modified-tick.  It is a smaller change and more modular;
presuming it solves the problem well enough, it is definitely
preferable for installation now.

So, what do people think of this change?

------- Start of forwarded message -------
Date: Sun, 27 Aug 2006 12:14:22 +0200
From: martin rudalics <rudalics@gmx.at>
MIME-Version: 1.0
To:  rms@gnu.org
Subject: Re: jit lock sit-for provokes redisplay provokes imenu
In-Reply-To: <E1GF7hm-0001aP-NB@fencepost.gnu.org>
Content-Type: multipart/mixed;
 boundary="------------090602040009010004050308"
X-Spam-Status: No, score=1.0 required=5.0 tests=RCVD_IN_NJABL_PROXY 
	autolearn=no version=3.0.4

This is a multi-part message in MIME format.
- --------------090602040009010004050308
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Sorry for procrastinating.  Is the attached patch acceptable?

- --------------090602040009010004050308
Content-Type: text/plain;
 name="buffer-hash.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="buffer-hash.patch"

*** buffer.c.~1.506.~	Tue Aug 15 10:01:00 2006
- --- buffer.c	Sun Aug 27 11:41:52 2006
***************
*** 1148,1153 ****
- --- 1148,1187 ----

    return make_number (BUF_MODIFF (buf));
  }
+ 
+ DEFUN ("buffer-hash", Fbuffer_hash, Sbuffer_hash,
+        0, 1, 0,
+        doc: /* Return hash code for BUFFER.
+ No argument or nil as argument means use current buffer as BUFFER.  */)
+      (buffer)
+      register Lisp_Object buffer;
+ {
+   register struct buffer *buf;
+   register unsigned char *at, *to;
+   register unsigned int hash = 0;
+ 
+   if (NILP (buffer))
+     buf = current_buffer;
+   else
+     {
+       CHECK_BUFFER (buffer);
+       buf = XBUFFER (buffer);
+     }
+ 
+   at = BUF_BEG_ADDR (buf);
+   to = BUF_GPT_ADDR (buf);
+   while (at < to)
+     hash = ((((unsigned)(hash) << 4) + (((unsigned)(hash) >> 24) & 0x0fffffff))
+ 	    + (unsigned)(*at++));
+ 
+   at =  BUF_GAP_END_ADDR (buf);
+   to = BUF_Z_ADDR (buf);
+   while (at < to)
+     hash = ((((unsigned)(hash) << 4) + (((unsigned)(hash) >> 24) & 0x0fffffff))
+ 	    + (unsigned)(*at++));
+ 
+   return make_number (hash & INTMASK);
+ }
  \f
  DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
         "sRename buffer (to new name): \nP",
***************
*** 6024,6029 ****
- --- 6058,6064 ----
    defsubr (&Sbuffer_modified_p);
    defsubr (&Sset_buffer_modified_p);
    defsubr (&Sbuffer_modified_tick);
+   defsubr (&Sbuffer_hash);
    defsubr (&Srename_buffer);
    defsubr (&Sother_buffer);
    defsubr (&Sbuffer_enable_undo);


*** imenu.el.~1.118.~	Tue Aug 15 10:00:50 2006
- --- imenu.el	Sun Aug 27 11:32:36 2006
***************
*** 970,981 ****
    "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.
- --- 970,988 ----
    "The value of (buffer-modified-tick) as of last call to `imenu-update-menubar'.")
  (make-variable-buffer-local 'imenu-menubar-modified-tick)

+ (defvar imenu-buffer-hash 0
+   "The value returned by `buffer-hash' as of last call to `imenu-update-menubar'.")
+ (make-variable-buffer-local 'imenu-buffer-hash)
+ 
  (defun imenu-update-menubar ()
    (when (and (current-local-map)
  	     (keymapp (lookup-key (current-local-map) [menu-bar index]))
! 	     (let ((tick (buffer-modified-tick)))
! 	       (when (/= tick imenu-menubar-modified-tick)
! 		 (setq imenu-menubar-modified-tick tick)))
! 	     (let ((hash (buffer-hash)))
! 	       (when (/= hash imenu-buffer-hash)
! 		 (setq imenu-buffer-hash hash))))
      (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.

- --------------090602040009010004050308--
------- End of forwarded message -------

             reply	other threads:[~2006-08-28  9:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-28  9:52 Richard Stallman [this message]
2006-08-28 10:01 ` [rudalics@gmx.at: Re: jit lock sit-for provokes redisplay provokes imenu] David Kastrup
2006-08-28 11:47   ` Kim F. Storm
2006-08-29 17:18   ` Richard Stallman
2006-08-28 16:22 ` Chong Yidong
2006-08-28 16:44   ` Stefan Monnier
2006-08-29 11:47     ` Richard Stallman
2006-08-30  2:43       ` Chong Yidong
2006-08-30  3:41         ` Stefan Monnier
2006-08-30  7:52           ` Kim F. Storm
2006-08-31  0:28           ` Chong Yidong
2006-08-31  4:01             ` Stefan Monnier
2006-08-30 17:59         ` Richard Stallman
2006-08-30 18:29           ` martin rudalics
2006-08-31  0:29             ` Chong Yidong
2006-08-31  6:11               ` martin rudalics
2006-08-31  7:49                 ` Kim F. Storm
2006-08-31 13:12                   ` Chong Yidong
2006-08-31 22:57                     ` Richard Stallman
2006-09-01 13:42                       ` Chong Yidong
2006-08-31 18:16             ` Richard Stallman
2006-09-01  6:41               ` martin rudalics
2006-09-01 12:47                 ` Richard Stallman
2006-08-30 20:49           ` Stefan Monnier
2006-08-31 18:16             ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1GHdmz-0005RD-V6@fencepost.gnu.org \
    --to=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).