comparison lisp/disp-table.el @ 24813:f581efbf0caf

(standard-display-european): For an interactive call by the user, don't set enable-multibyte-characters, and don't set the terminal coding system.
author Karl Heuer <kwzh@gnu.org>
date Fri, 04 Jun 1999 18:42:20 +0000
parents cff6faa1cf82
children ee67b2340a0f
comparison
equal deleted inserted replaced
24812:4bdc30f27628 24813:f581efbf0caf
175 (setq glyph-table (vconcat glyph-table (list string))) 175 (setq glyph-table (vconcat glyph-table (list string)))
176 (1- (length glyph-table))) 176 (1- (length glyph-table)))
177 177
178 ;;;###autoload 178 ;;;###autoload
179 (defun standard-display-european (arg &optional auto) 179 (defun standard-display-european (arg &optional auto)
180 "Toggle display of European characters encoded with ISO 8859. 180 "Semi-obsolete way to toggle display of ISO 8859 European characters.
181 181
182 This function is semi-obsolete; you can use `set-language-environment' 182 This function is semi-obsolete; if you want to do your editing with
183 coupled with either the `--unibyte' option, the EMACS_UNIBYTE 183 unibyte characters, it is better to `set-language-environment' coupled
184 environment variable or customizing `enable-multibyte-characters' if 184 with either the `--unibyte' option or the EMACS_UNIBYTE environment
185 you prefer to use unibyte characters. 185 variable, or else customize `enable-multibyte-characters'.
186 186
187 When enabled, characters in the range of 160 to 255 display not 187 With prefix argument, this command enables European character display
188 as octal escapes, but as accented characters. Codes 146 and 160 188 if arg is positive, disables it otherwise. Otherwise, it toggles
189 display as apostrophe and space, even though they are not the ASCII 189 European character display.
190 codes for apostrophe and space. 190
191 191 When this mode is enabled, characters in the range of 160 to 255
192 With prefix argument, enable European character display iff arg is positive. 192 display not as octal escapes, but as accented characters. Codes 146
193 193 and 160 display as apostrophe and space, even though they are not the
194 Normally, this function turns off `enable-multibyte-characters' for 194 ASCII codes for apostrophe and space.
195 existing and subsequently created Emacs buffers. This is because 195
196 users who call this function probably want to edit European characters 196 Enabling European character display with this command noninteractively
197 in single-byte mode." 197 from Lisp code also selects Latin-1 as the language environment, and
198 selects unibyte mode for all Emacs buffers \(both existing buffers and
199 those created subsequently). This provides increased compatibility
200 for users who call this function in `.emacs'."
198 201
199 ;; If the optional argument AUTO is non-nil, this function 202 ;; If the optional argument AUTO is non-nil, this function
200 ;; does not alter `enable-multibyte-characters'. 203 ;; does not alter `enable-multibyte-characters'.
201 ;; AUTO also specifies, in this case, the coding system for terminal output. 204 ;; AUTO also specifies, in this case, the coding system for terminal output.
202 ;; The AUTO argument is meant for use by startup.el only. 205 ;; The AUTO argument is meant for use by startup.el only.
203 ;; which is why it is not in the doc string. 206 ;; which is why it is not in the doc string.
204 (interactive "P") 207
208 ;; AUTO is `lambda' for an interactive call so that it will not
209 ;; set enable-multibyte-characters but also will not call
210 ;; set-terminal-coding-system.
211 (interactive (list current-prefix-arg 'lambda))
205 (if (or (<= (prefix-numeric-value arg) 0) 212 (if (or (<= (prefix-numeric-value arg) 0)
206 (and (null arg) 213 (and (null arg)
207 (char-table-p standard-display-table) 214 (char-table-p standard-display-table)
208 ;; Test 161, because 160 displays as a space. 215 ;; Test 161, because 160 displays as a space.
209 (equal (aref standard-display-table 161) [161]))) 216 (equal (aref standard-display-table 161) [161])))
210 (progn 217 (progn
211 (standard-display-default 160 255) 218 (standard-display-default 160 255)
212 (unless (memq window-system '(x w32)) 219 (unless (or (memq window-system '(x w32))
213 (set-terminal-coding-system nil))) 220 (eq auto 'lambda))
214 ;; If the user does this explicitly, 221 (and (terminal-coding-system)
222 (set-terminal-coding-system nil))))
223 ;; If the user does this explicitly from Lisp (as in .emacs),
215 ;; turn off multibyte chars for more compatibility. 224 ;; turn off multibyte chars for more compatibility.
216 (unless auto 225 (unless auto
217 (setq-default enable-multibyte-characters nil) 226 (setq-default enable-multibyte-characters nil)
218 (mapcar (lambda (buffer) 227 (mapcar (lambda (buffer)
219 (with-current-buffer buffer 228 (with-current-buffer buffer
224 ;; switch to Latin-1 language environment 233 ;; switch to Latin-1 language environment
225 ;; unless some other has been specified. 234 ;; unless some other has been specified.
226 (unless auto 235 (unless auto
227 (if (equal current-language-environment "English") 236 (if (equal current-language-environment "English")
228 (set-language-environment "latin-1"))) 237 (set-language-environment "latin-1")))
229 (unless (or noninteractive (memq window-system '(x w32))) 238 (unless (or noninteractive (memq window-system '(x w32))
239 (eq auto 'lambda))
230 ;; Send those codes literally to a non-X terminal. 240 ;; Send those codes literally to a non-X terminal.
231 ;; If AUTO is nil, we are using single-byte characters, 241 ;; If AUTO is nil, we are using single-byte characters,
232 ;; so it doesn't matter which one we use. 242 ;; so it doesn't matter which one we use.
233 (set-terminal-coding-system 243 (set-terminal-coding-system
234 (cond ((not (equal current-language-environment "English")) 244 (cond ((not (equal current-language-environment "English"))