comparison lisp/coding.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 2f8bb876ab1d
children ebe98a74bd68
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details. 21 ;; General Public License for more details.
22 22
23 ;; You should have received a copy of the GNU General Public License 23 ;; You should have received a copy of the GNU General Public License
24 ;; along with XEmacs; see the file COPYING. If not, write to the 24 ;; along with XEmacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA. 26 ;; Boston, MA 02111-1307, USA.
27 27
28 ;;; Commentary: 28 ;;; Commentary:
29 29
102 (defun set-keyboard-coding-system (coding-system) 102 (defun set-keyboard-coding-system (coding-system)
103 "Set the coding system used for TTY keyboard input. Currently broken." 103 "Set the coding system used for TTY keyboard input. Currently broken."
104 (interactive "zkeyboard-coding-system: ") 104 (interactive "zkeyboard-coding-system: ")
105 (get-coding-system coding-system) ; correctness check 105 (get-coding-system coding-system) ; correctness check
106 (setq keyboard-coding-system coding-system) 106 (setq keyboard-coding-system coding-system)
107 (if (eq (device-type) 'tty)
108 (set-console-tty-input-coding-system
109 (device-console) keyboard-coding-system))
110 (redraw-modeline t)) 107 (redraw-modeline t))
111 108
112 (defsubst terminal-coding-system () 109 (defsubst terminal-coding-system ()
113 "Return coding-system of your terminal." 110 "Return coding-system of your terminal."
114 terminal-coding-system) 111 terminal-coding-system)
116 (defun set-terminal-coding-system (coding-system) 113 (defun set-terminal-coding-system (coding-system)
117 "Set the coding system used for TTY display output. Currently broken." 114 "Set the coding system used for TTY display output. Currently broken."
118 (interactive "zterminal-coding-system: ") 115 (interactive "zterminal-coding-system: ")
119 (get-coding-system coding-system) ; correctness check 116 (get-coding-system coding-system) ; correctness check
120 (setq terminal-coding-system coding-system) 117 (setq terminal-coding-system coding-system)
121 ; #### should this affect all current tty consoles ? 118 (set-console-tty-coding-system (device-console) terminal-coding-system)
122 (if (eq (device-type) 'tty)
123 (set-console-tty-output-coding-system
124 (device-console) terminal-coding-system))
125 (redraw-modeline t)) 119 (redraw-modeline t))
126 120
127 (defun set-pathname-coding-system (coding-system) 121 (defun set-pathname-coding-system (coding-system)
128 "Set the coding system used for file system path names." 122 "Set the coding system used for file system path names."
129 (interactive "zPathname-coding-system: ") 123 (interactive "zPathname-coding-system: ")
184 178
185 (defun coding-system-base (coding-system) 179 (defun coding-system-base (coding-system)
186 "Return the base coding system of CODING-SYSTEM." 180 "Return the base coding system of CODING-SYSTEM."
187 (if (not (coding-system-eol-type coding-system)) 181 (if (not (coding-system-eol-type coding-system))
188 coding-system 182 coding-system
189 (find-coding-system 183 (find-coding-system
190 (intern 184 (intern
191 (substring 185 (substring
192 (symbol-name (coding-system-name coding-system)) 186 (symbol-name (coding-system-name coding-system))
193 0 187 0
194 (string-match "-unix$\\|-dos$\\|-mac$" 188 (string-match "-unix$\\|-dos$\\|-mac$"
195 (symbol-name (coding-system-name coding-system)))))))) 189 (symbol-name (coding-system-name coding-system))))))))
196 190
199 (make-coding-system 193 (make-coding-system
200 'undecided 'undecided 194 'undecided 'undecided
201 "Automatic conversion." 195 "Automatic conversion."
202 '(mnemonic "Auto")) 196 '(mnemonic "Auto"))
203 197
204 ;;; Make certain variables equivalent to coding-system aliases 198 ;; these are so that gnus and friends work when not mule
205 (defun dontusethis-set-value-file-name-coding-system-handler (sym args fun harg handlers) 199 (or (featurep 'mule)
206 (define-coding-system-alias 'file-name (or (car args) 'binary))) 200 (progn
207 201 (copy-coding-system 'undecided 'iso-8859-1)
208 (dontusethis-set-symbol-value-handler 202 (copy-coding-system 'undecided 'iso-8859-2)))
209 'file-name-coding-system
210 'set-value
211 'dontusethis-set-value-file-name-coding-system-handler)
212
213 (defun dontusethis-set-value-terminal-coding-system-handler (sym args fun harg handlers)
214 (define-coding-system-alias 'terminal (or (car args) 'binary)))
215
216 (dontusethis-set-symbol-value-handler
217 'terminal-coding-system
218 'set-value
219 'dontusethis-set-value-terminal-coding-system-handler)
220
221 (defun dontusethis-set-value-keyboard-coding-system-handler (sym args fun harg handlers)
222 (define-coding-system-alias 'keyboard (or (car args) 'binary)))
223
224 (dontusethis-set-symbol-value-handler
225 'keyboard-coding-system
226 'set-value
227 'dontusethis-set-value-keyboard-coding-system-handler)
228
229 (unless (boundp 'file-name-coding-system)
230 (setq file-name-coding-system nil))
231
232 (when (not (featurep 'mule))
233 ;; these are so that gnus and friends work when not mule
234 (copy-coding-system 'undecided 'iso-8859-1)
235 (copy-coding-system 'undecided 'iso-8859-2)
236
237 (define-coding-system-alias 'ctext 'binary))
238
239 203
240 ;; compatibility for old XEmacsen (don't use it) 204 ;; compatibility for old XEmacsen (don't use it)
241 (copy-coding-system 'undecided 'automatic-conversion) 205 (copy-coding-system 'undecided 'automatic-conversion)
242 206
207 (copy-coding-system 'no-conversion 'raw-text)
208
243 (make-compatible-variable 'enable-multibyte-characters "Unimplemented") 209 (make-compatible-variable 'enable-multibyte-characters "Unimplemented")
244 210
245 (define-obsolete-variable-alias 211 (define-obsolete-variable-alias
246 'pathname-coding-system 'file-name-coding-system) 212 'pathname-coding-system 'file-name-coding-system)
247 213