emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hexl-find-file is sloooow


From: Masatake YAMATO
Subject: Re: hexl-find-file is sloooow
Date: Tue, 21 Dec 2004 17:50:09 +0900 (JST)

> hexl-find-file is quite slow -- loading a 4MByte font takes more than
> half a minute on my laptop...
> 
> I ask to add progress information while hexl-find-file is running.
> 
> Of course, this isn't something urgent, but perhaps it can be added to
> the post-release TODO list.

It seems that fontification takes long time.
As far as I can remember the area fontification is introduced by me.
Do you want to turn off the fortification?

Anyway, here is a progress reporter. If there is no objection,
I will install this patch in a day.

Regards,
Masatake YAMATO

2004-12-21  Masatake YAMATO  <address@hidden>

        * hexl.el (hexlify-buffer): Report fontification progress.

Index: hexl.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/hexl.el,v
retrieving revision 1.90
diff -u -r1.90 hexl.el
--- hexl.el     21 Nov 2004 00:38:34 -0000      1.90
+++ hexl.el     21 Dec 2004 08:46:23 -0000
@@ -680,19 +680,26 @@
   ;; Don't decode text in the ASCII part of `hexl' program output.
   (let ((coding-system-for-read 'raw-text)
        (coding-system-for-write buffer-file-coding-system)
-       (buffer-undo-list t))
+       (buffer-undo-list t)
+       progress pmax)
     (apply 'call-process-region (point-min) (point-max)
           (expand-file-name hexl-program exec-directory)
           t t nil (split-string hexl-options))
+    (setq pmax (point-max)
+          progress (make-progress-reporter "Hexl Buffer Fontification " 
+                                          (point-min) (* 2 pmax)))
     (save-excursion
       (goto-char (point-min))
       (while (re-search-forward "^[0-9a-f]+:" nil t)
+       (progress-reporter-update progress (point))
        (put-text-property (match-beginning 0) (match-end 0)
                           'font-lock-face 'hexl-address-area))
       (goto-char (point-min))
       (while (re-search-forward "  \\(.+$\\)" nil t)
+       (progress-reporter-update progress (+ pmax (point)))
        (put-text-property (match-beginning 1) (match-end 1) 
                           'font-lock-face 'hexl-ascii-area)))
+    (progress-reporter-done progress)
     (if (> (point) (hexl-address-to-marker hexl-max-address))
        (hexl-goto-address hexl-max-address))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]