unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sean O'Rourke" <sorourke@cs.ucsd.edu>
To: Thien-Thi Nguyen <ttn@gnuvola.org>
Cc: emacs-devel@gnu.org
Subject: Re: remove dabbrev--scanning-message?
Date: Mon, 23 Jul 2007 17:40:29 -0700	[thread overview]
Message-ID: <m2ps2i8whu.fsf@cs.ucsd.edu> (raw)
In-Reply-To: <87abtm4slu.fsf@ambire.localdomain> (Thien-Thi Nguyen's message of "Tue\, 24 Jul 2007 01\:18\:05 +0200")

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> () "Sean O'Rourke" <sorourke@cs.ucsd.edu>
> () Mon, 23 Jul 2007 15:58:56 -0700
>
>        (1) Replace the messages with a progress-reporter (assuming
>            it's faster), since the filenames probably go by too fast
>            to read anyways.
>        (2) Provide a user option `dabbrev-report-progress', true by
>            default, to enable/disable this feedback.
>
> a progress reporter displays nothing until a certain threshold is
> reached (arg MIN-TIME to make-progress-reporter).

Thanks for the info.  Here's a patch that does this with a
1.5-sec delay.  I left out the current window-minibuffer-p check,
because it seems like the progress-reporter-* functions should
control this behavior.

2007-07-22  Sean O'Rourke <sorourke@cs.ucsd.edu>

	* dabbrev.el (dabbrev--scanning-message): removed.
        (dabbrev--find-expansion): use a progress reporter
        instead of dabbrev--scanning-message.
        (dabbrev--progress-reporter): new variable.

/s


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2639 bytes --]

Index: dabbrev.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/dabbrev.el,v
retrieving revision 1.85
diff -u -r1.85 dabbrev.el
--- dabbrev.el	16 May 2007 13:13:20 -0000	1.85
+++ dabbrev.el	24 Jul 2007 00:40:05 -0000
@@ -332,6 +332,9 @@
 ;; The regexp for recognizing a character in an abbreviation.
 (defvar dabbrev--abbrev-char-regexp nil)
 
+;; The progress reporter for buffer-scanning progress.
+(defvar dabbrev--progress-reporter nil)
+
 ;;----------------------------------------------------------------
 ;; Macros
 ;;----------------------------------------------------------------
@@ -711,10 +714,6 @@
 	(setq all-expansions (cons expansion all-expansions))))
     all-expansions))
 
-(defun dabbrev--scanning-message ()
-  (unless (window-minibuffer-p (selected-window))
-    (message "Scanning `%s'" (buffer-name (current-buffer)))))
-
 (defun dabbrev--ignore-buffer-p (buffer)
   "Return non-nil if BUFFER should be ignored by dabbrev."
   (let ((bn (buffer-name buffer)))
@@ -740,8 +739,7 @@
     ;; If we were scanning something other than the current buffer,
     ;; continue scanning there.
     (when dabbrev--last-buffer
-      (set-buffer dabbrev--last-buffer)
-      (dabbrev--scanning-message))
+      (set-buffer dabbrev--last-buffer))
     (or
      ;; ------------------------------------------
      ;; Look backward in current buffer.
@@ -773,15 +771,20 @@
 	 ;; If we have just now begun to search other buffers,
 	 ;; determine which other buffers we should check.
 	 ;; Put that list in dabbrev--friend-buffer-list.
-	 (or dabbrev--friend-buffer-list
-	     (setq dabbrev--friend-buffer-list
-		   (dabbrev--make-friend-buffer-list))))
+	 (unless dabbrev--friend-buffer-list
+           (setq dabbrev--friend-buffer-list
+                 (dabbrev--make-friend-buffer-list))
+           (setq dabbrev--progress-reporter
+                 (make-progress-reporter
+                  "Scanning for dabbrevs..."
+                  (- (length dabbrev--friend-buffer-list)) 0 0 1 1.5))))
        ;; Walk through the buffers till we find a match.
        (let (expansion)
 	 (while (and (not expansion) dabbrev--friend-buffer-list)
 	   (setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list))
 	   (set-buffer dabbrev--last-buffer)
-	   (dabbrev--scanning-message)
+           (progress-reporter-update dabbrev--progress-reporter
+                                     (- (length dabbrev--friend-buffer-list)))
 	   (setq dabbrev--last-expansion-location (point-min))
 	   (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case)))
 	 expansion)))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-07-24  0:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-23  5:16 remove dabbrev--scanning-message? Sean O'Rourke
2007-07-23  8:37 ` Thien-Thi Nguyen
2007-07-23 13:40   ` Sean O'Rourke
2007-07-23 19:19     ` Eli Zaretskii
2007-07-23 19:18 ` Eli Zaretskii
2007-07-24 16:46   ` Richard Stallman
2007-07-24 17:16     ` Sean O'Rourke
2007-07-23 22:30 ` Richard Stallman
2007-07-23 22:58   ` Sean O'Rourke
2007-07-23 23:18     ` Thien-Thi Nguyen
2007-07-24  0:40       ` Sean O'Rourke [this message]
2007-07-24 22:16         ` Richard Stallman
2007-08-22  1:35         ` Thien-Thi Nguyen
2007-08-22  1:49           ` Sean O'Rourke
2007-08-22 21:27           ` Richard Stallman
2007-08-23  9:38             ` Thien-Thi Nguyen
2007-08-22 19:49         ` Thien-Thi Nguyen

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=m2ps2i8whu.fsf@cs.ucsd.edu \
    --to=sorourke@cs.ucsd.edu \
    --cc=emacs-devel@gnu.org \
    --cc=ttn@gnuvola.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).