Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
0e86dca1
Commit
0e86dca1
authored
Oct 22, 2004
by
Kenichi Handa
Browse files
(translate-region): Implement it in Lisp
as a front end of translate-region-internal.
parent
365d1467
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
lisp/international/mule.el
lisp/international/mule.el
+28
-0
No files found.
lisp/international/mule.el
View file @
0e86dca1
...
@@ -2015,6 +2015,34 @@ the table in `translation-table-vector'."
...
@@ -2015,6 +2015,34 @@ the table in `translation-table-vector'."
(
put
symbol
'translation-table-id
id
)
(
put
symbol
'translation-table-id
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
)
(
put
'with-category-table
'lisp-indent-function
1
)
(
defmacro
with-category-table
(
table
&rest
body
)
(
defmacro
with-category-table
(
table
&rest
body
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment