emacs-devel
[Top][All Lists]
Advanced

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

Loading UnicodeData.txt in an internal buffer


From: Juanma Barranquero
Subject: Loading UnicodeData.txt in an internal buffer
Date: Sat, 2 Dec 2006 14:23:23 +0100

When `describe-char-unicodedata-file' is set, the Unicode Data file is
read through `find-file-noselect', which visits the file. As a
consequence, the file (usually UnicodeData.txt) is visible in buffer
lists, and it is also saved/restored by desktop.el.

However, the use of `describe-char-unicodedata-file' is an
implementation detail of `describe-char', and there's not much point
in loading the data in a normal buffer. The file is not going to be
edited by the user, and if it were to, the user should `find-file' it,
not load it as a side effect of `describe-char'.

So I propose the following simple patch to load the file in a internal
buffer " *Unicode Data*", via `insert-file-contents'.

                   /L/e/k/t/u


Index: lisp/descr-text.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/descr-text.el,v
retrieving revision 1.52
diff -u -2 -r1.52 descr-text.el
--- lisp/descr-text.el  1 Dec 2006 14:04:54 -0000       1.52
+++ lisp/descr-text.el  2 Dec 2006 13:03:32 -0000
@@ -213,9 +213,8 @@
    (unless (file-exists-p describe-char-unicodedata-file)
      (error "`unicodedata-file' %s not found" describe-char-unicodedata-file))
-    (with-current-buffer
-       ;; Find file in fundamental mode to avoid, e.g. flyspell turned
-       ;; on for .txt.  Don't use RAWFILE arg in case of DOS line endings.
-       (let ((auto-mode-alist))
-         (find-file-noselect describe-char-unicodedata-file))
+    (with-current-buffer (get-buffer-create " *Unicode Data*")
+      (when (zerop (buffer-size))
+       ;; Don't use -literally in case of DOS line endings.
+       (insert-file-contents describe-char-unicodedata-file))
      (goto-char (point-min))
      (let ((hex (format "%04X" char))




reply via email to

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