Mercurial > hg > xemacs-beta
comparison lisp/descr-text.el @ 4474:78738a40e31e
Don't leak the Unihan database handle when looking up non-Han characters.
2008-06-29 Aidan Kehoe <kehoea@parhasard.net>
* descr-text.el (describe-char-unicode-data):
Don't leak the Unihan database handle when looking up non-Han
characters.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 29 Jun 2008 11:06:16 +0200 |
parents | 0204391fc17c |
children | 74caf140505b |
comparison
equal
deleted
inserted
replaced
4473:0204391fc17c | 4474:78738a40e31e |
---|---|
727 ;; Don't use -literally in case of DOS line endings. | 727 ;; Don't use -literally in case of DOS line endings. |
728 (insert-file-contents describe-char-unicodedata-file))) | 728 (insert-file-contents describe-char-unicodedata-file))) |
729 | 729 |
730 (goto-char (point-min)) | 730 (goto-char (point-min)) |
731 (let ((hex (format "%04X" char)) | 731 (let ((hex (format "%04X" char)) |
732 found first last unihan-match unihan-info | 732 found first last unihan-match unihan-info unihan-database-handle |
733 (unihan-database-handle | |
734 (and describe-char-unihan-file | |
735 (open-database (unidata-generate-database-file-name | |
736 describe-char-unihan-file | |
737 (eighth (file-attributes | |
738 describe-char-unihan-file)) | |
739 unidata-database-format) | |
740 unidata-database-format | |
741 nil "r" #o644 'no-conversion-unix))) | |
742 (coding-system-for-read 'no-conversion-unix)) | 733 (coding-system-for-read 'no-conversion-unix)) |
743 (if (re-search-forward (concat "^" hex) nil t) | 734 (if (re-search-forward (concat "^" hex) nil t) |
744 (setq found t) | 735 (setq found t) |
745 ;; It's not listed explicitly. Look for ranges, e.g. CJK | 736 ;; It's not listed explicitly. Look for ranges, e.g. CJK |
746 ;; ideographs, and check whether it's in one of them. | 737 ;; ideographs, and check whether it's in one of them. |
918 ;; the Unihan information, or tell the user that it's not | 909 ;; the Unihan information, or tell the user that it's not |
919 ;; available. | 910 ;; available. |
920 (if (and (> (length (nth 0 fields)) 13) | 911 (if (and (> (length (nth 0 fields)) 13) |
921 (equal "<CJK Ideograph" | 912 (equal "<CJK Ideograph" |
922 (substring (nth 0 fields) 0 14))) | 913 (substring (nth 0 fields) 0 14))) |
923 (if (and unihan-database-handle | 914 (if (and describe-char-unihan-file |
915 (setq unihan-database-handle | |
916 (open-database | |
917 (unidata-generate-database-file-name | |
918 describe-char-unihan-file | |
919 (eighth (file-attributes | |
920 describe-char-unihan-file)) | |
921 unidata-database-format) | |
922 unidata-database-format | |
923 nil "r" #o644 'no-conversion-unix)) | |
924 (setq unihan-match | 924 (setq unihan-match |
925 (get-database (format "%04X" char) | 925 (get-database (format "%04X" char) |
926 unihan-database-handle) | 926 unihan-database-handle) |
927 unihan-match | 927 unihan-match |
928 (and unihan-match (read unihan-match)))) | 928 (and unihan-match (read unihan-match)))) |