[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/international/mule.el [lexbind]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/international/mule.el [lexbind] |
Date: |
Mon, 25 Oct 2004 00:41:47 -0400 |
Index: emacs/lisp/international/mule.el
diff -c emacs/lisp/international/mule.el:1.147.2.12
emacs/lisp/international/mule.el:1.147.2.13
*** emacs/lisp/international/mule.el:1.147.2.12 Mon Oct 25 04:19:43 2004
--- emacs/lisp/international/mule.el Mon Oct 25 04:22:30 2004
***************
*** 2017,2022 ****
--- 2017,2050 ----
(put symbol 'translation-table-id id)
id))
+ (defun translate-region (start end table)
+ "From START to END, translate characters according to TABLE.
+ TABLE is a string or a char-table.
+ If TABLE is a string, the Nth character in it is the mapping
+ for the character with code N.
+ If TABLE is a char-table, the element for character N is the mapping
+ for the character with code N.
+ It returns the number of characters changed."
+ (interactive
+ (list (region-beginning)
+ (region-end)
+ (let (table l)
+ (dotimes (i (length translation-table-vector))
+ (if (consp (aref translation-table-vector i))
+ (push (list (symbol-name
+ (car (aref translation-table-vector i)))) l)))
+ (if (not l)
+ (error "No translation table defined"))
+ (while (not table)
+ (setq table (completing-read "Translation table: " l nil t)))
+ (intern table))))
+ (if (symbolp table)
+ (let ((val (get table 'translation-table)))
+ (or (char-table-p val)
+ (error "Invalid translation table name: %s" table))
+ (setq table val)))
+ (translate-region-internal start end table))
+
(put 'with-category-table 'lisp-indent-function 1)
(defmacro with-category-table (table &rest body)
- [Emacs-diffs] Changes to emacs/lisp/international/mule.el [lexbind],
Miles Bader <=