Mercurial > hg > xemacs-beta
annotate lisp/mule/korea-util.el @ 5892:053ef01b71a8
Import the #'clear-string API from GNU, use it in tls.c
src/ChangeLog addition:
2015-04-18 Aidan Kehoe <kehoea@parhasard.net>
* sequence.c (Fclear_string): New, API from GNU. Zero a string's
contents, making sure the text is not kept around even when the
string's data is reallocated because of a changed character
length.
* sequence.c (syms_of_sequence): Make it available to Lisp.
* lisp.h: Make it available to C code.
* tls.c (nss_pk11_password): Use it.
* tls.c (gnutls_pk11_password): Use it.
* tls.c (openssl_password): Use it.
tests/ChangeLog addition:
2015-04-18 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
Test #'clear-string, just added. Unfortunately there's no way to
be certain from Lisp that the old password data has been erased
after realloc; it may be worth adding a test to tests.c, but
*we'll be reading memory we shouldn't be*, so that gives me pause.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 18 Apr 2015 23:00:14 +0100 |
parents | bbe4146603db |
children |
rev | line source |
---|---|
771 | 1 ;;; korea-util.el --- utilities for Korean -*- coding: iso-2022-7bit; -*- |
2 | |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
4 | |
5 ;; Keywords: mule, multilingual, Korean | |
6 | |
7 ;; This file is part of XEmacs. | |
8 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
9 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
10 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
11 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
12 ;; option) any later version. |
771 | 13 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
14 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
16 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
17 ;; for more details. |
771 | 18 |
19 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
788
diff
changeset
|
20 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
771 | 21 |
778 | 22 ;;; Synched up with: Emacs 21.1 (language/korea-util.el). |
23 | |
24 ;;; Commentary: | |
771 | 25 |
26 ;;; Code: | |
27 | |
788 | 28 (globally-declare-boundp '(input-method-function |
29 isearch-input-method-function | |
30 isearch-input-method-local-p)) | |
31 | |
771 | 32 ;;;###autoload |
33 (defvar default-korean-keyboard | |
5882
bbe4146603db
Reduce regexp usage, now CL-oriented non-regexp code available, core Lisp
Aidan Kehoe <kehoea@parhasard.net>
parents:
5819
diff
changeset
|
34 (if (find ?3 (getenv "HANGUL_KEYBOARD_TYPE")) |
771 | 35 "3" |
36 "") | |
37 "*The kind of Korean keyboard for Korean input method. | |
38 \"\" for 2, \"3\" for 3.") | |
39 | |
40 ;; functions useful for Korean text input | |
41 | |
42 (defun toggle-korean-input-method () | |
43 "Turn on or off a Korean text input method for the current buffer." | |
44 (interactive) | |
45 (if current-input-method | |
46 (inactivate-input-method) | |
47 (activate-input-method | |
48 (concat "korean-hangul" default-korean-keyboard)))) | |
49 | |
50 (defun quail-hangul-switch-symbol-ksc (&rest ignore) | |
51 "Swith to/from Korean symbol package." | |
52 (interactive "i") | |
53 (and current-input-method | |
54 (if (string-equal current-input-method "korean-symbol") | |
55 (activate-input-method (concat "korean-hangul" | |
56 default-korean-keyboard)) | |
57 (activate-input-method "korean-symbol")))) | |
58 | |
59 (defun quail-hangul-switch-hanja (&rest ignore) | |
60 "Swith to/from Korean hanja package." | |
61 (interactive "i") | |
62 (and current-input-method | |
5882
bbe4146603db
Reduce regexp usage, now CL-oriented non-regexp code available, core Lisp
Aidan Kehoe <kehoea@parhasard.net>
parents:
5819
diff
changeset
|
63 (if (search "korean-hanja" current-input-method :test #'equalp) |
771 | 64 (activate-input-method (concat "korean-hangul" |
65 default-korean-keyboard)) | |
66 (activate-input-method (concat "korean-hanja" | |
67 default-korean-keyboard))))) | |
68 | |
69 ;; The following three commands are set in isearch-mode-map. | |
70 | |
71 (defun isearch-toggle-korean-input-method () | |
72 (interactive) | |
73 (let ((overriding-terminal-local-map nil)) | |
74 (toggle-korean-input-method)) | |
75 (setq isearch-input-method-function input-method-function | |
76 isearch-input-method-local-p t) | |
77 (setq input-method-function nil) | |
78 (isearch-update)) | |
79 | |
80 (defun isearch-hangul-switch-symbol-ksc () | |
81 (interactive) | |
82 (let ((overriding-terminal-local-map nil)) | |
83 (quail-hangul-switch-symbol-ksc)) | |
84 (setq isearch-input-method-function input-method-function | |
85 isearch-input-method-local-p t) | |
86 (setq input-method-function nil) | |
87 (isearch-update)) | |
88 | |
89 (defun isearch-hangul-switch-hanja () | |
90 (interactive) | |
91 (let ((overriding-terminal-local-map nil)) | |
92 (quail-hangul-switch-hanja)) | |
93 (setq isearch-input-method-function input-method-function | |
94 isearch-input-method-local-p t) | |
95 (setq input-method-function nil) | |
96 (isearch-update)) | |
97 | |
98 ;; Information for setting and exiting Korean environment. | |
99 (defvar korean-key-bindings | |
5819
ba0ff364bd94
Repair invalid GNU-style key-bindings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5402
diff
changeset
|
100 `((global [(shift space)] toggle-korean-input-method nil) |
ba0ff364bd94
Repair invalid GNU-style key-bindings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5402
diff
changeset
|
101 (global [(control f9)] quail-hangul-switch-symbol-ksc nil) |
771 | 102 (global [f9] quail-hangul-switch-hanja nil) |
5819
ba0ff364bd94
Repair invalid GNU-style key-bindings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5402
diff
changeset
|
103 (,isearch-mode-map [(shift space)] isearch-toggle-korean-input-method nil) |
ba0ff364bd94
Repair invalid GNU-style key-bindings.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5402
diff
changeset
|
104 (,isearch-mode-map [(control f9)] isearch-hangul-switch-symbol-ksc nil) |
771 | 105 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil))) |
106 | |
107 ;;;###autoload | |
108 (defun setup-korean-environment-internal () | |
109 (let ((key-bindings korean-key-bindings)) | |
110 (while key-bindings | |
111 (let* ((this (car key-bindings)) | |
112 (key (nth 1 this)) | |
113 (new-def (nth 2 this)) | |
114 old-def) | |
115 (if (eq (car this) 'global) | |
116 (progn | |
117 (setq old-def (global-key-binding key)) | |
118 (global-set-key key new-def)) | |
119 (setq old-def (lookup-key (car this) key)) | |
120 (define-key (car this) key new-def)) | |
121 (setcar (nthcdr 3 this) old-def)) | |
122 (setq key-bindings (cdr key-bindings))))) | |
123 | |
124 (defun exit-korean-environment () | |
125 "Exit Korean language environment." | |
126 (let ((key-bindings korean-key-bindings)) | |
127 (while key-bindings | |
128 (let* ((this (car key-bindings)) | |
129 (key (nth 1 this)) | |
130 (new-def (nth 2 this)) | |
131 (old-def (nth 3 this))) | |
132 (if (eq (car this) 'global) | |
133 (if (eq (global-key-binding key) new-def) | |
134 (global-set-key key old-def)) | |
135 (if (eq (lookup-key (car this) key) new-def) | |
136 (define-key (car this) key old-def)))) | |
137 (setq key-bindings (cdr key-bindings))))) | |
138 | |
139 ;; | |
140 (provide 'korea-util) | |
141 | |
778 | 142 ;;; korea-util.el ends here |