all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [rudalics@gmx.at: Re: jit lock sit-for provokes redisplay provokes imenu]
@ 2006-08-28  9:52 Richard Stallman
  2006-08-28 10:01 ` David Kastrup
  2006-08-28 16:22 ` Chong Yidong
  0 siblings, 2 replies; 25+ messages in thread
From: Richard Stallman @ 2006-08-28  9:52 UTC (permalink / 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 -------

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2006-09-01 13:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28  9:52 [rudalics@gmx.at: Re: jit lock sit-for provokes redisplay provokes imenu] Richard Stallman
2006-08-28 10:01 ` 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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.