[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erbot-cvs] erbot erbim.el
From: |
Vivek Dasmohapatra |
Subject: |
[Erbot-cvs] erbot erbim.el |
Date: |
Tue, 10 Apr 2007 11:45:01 +0000 |
CVSROOT: /sources/erbot
Module name: erbot
Changes by: Vivek Dasmohapatra <fledermaus> 07/04/10 11:45:01
Modified files:
. : erbim.el
Log message:
Add some unicode character description functions (string or code-point
to unicode data file description)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/erbot/erbim.el?cvsroot=erbot&r1=1.4&r2=1.5
Patches:
Index: erbim.el
===================================================================
RCS file: /sources/erbot/erbot/erbim.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- erbim.el 22 Aug 2006 10:20:50 -0000 1.4
+++ erbim.el 10 Apr 2007 11:45:01 -0000 1.5
@@ -146,6 +146,37 @@
;; load iso-transl's inverted keymap
(add-to-list 'erbim-keymaps-map
(cons "iso-transl" (erbim-map iso-transl-ctl-x-8-map)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Unicode information functions:
+(defvar erbim-unidata-file "/usr/share/perl/5.8.4/unicore/UnicodeData.txt")
+
+(defun erbim-name-by-character (thing)
+ (let ((char (if (stringp thing) (string-to-char thing) thing))
+ (unicode nil))
+ (setq unicode
+ (when (or (< char 256)
+ (memq 'coding-category-utf-8
+ (mapcar 'coding-system-category
+ (find-coding-systems-string thing))))
+ (encode-char char 'ucs)) )
+ (unicode-name-by-codepoint unicode)) )
+
+(defun erbim-name-by-codepoint (codepoint)
+ (let ((cpstring (format "%04X" codepoint))
+ (unidata (find-file-noselect erbim-unidata-file)))
+ (with-current-buffer unidata
+ (goto-char (point-min))
+ (if (re-search-forward (concat "^" cpstring ";\\([^;]*\\);") nil t)
+ (format "Codepoint %s: %s" cpstring (match-string 1))
+ (format "Unknown character number %s" cpstring) )) ))
+
+(defun fs-unicode-describe (&optional thing)
+ (cond ((integerp thing) (erbim-name-by-codepoint thing))
+ ((symbolp thing) (erbim-name-by-character (symbol-name thing)))
+ (key (erbim-name-by-character thing)) ))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
;; trigger the preprocessing of the rest of the input methods:
(where-is-char "x")
- [Erbot-cvs] erbot erbim.el,
Vivek Dasmohapatra <=