GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
#include "composite.h"
#include "coding.h"
#include "window.h"
+#include "frame.h"
+#include "termhooks.h"
Lisp_Object Vcoding_system_hash_table;
Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source;
Lisp_Object Qinterrupted, Qinsufficient_memory;
+extern Lisp_Object Qcompletion_ignore_case;
+
/* If a symbol has this property, evaluate the value to define the
symbol as a coding system. */
static Lisp_Object Qcoding_system_define_form;
/* Flag to make buffer-file-coding-system inherit from process-coding. */
int inherit_process_coding_system;
-/* Coding system to be used to encode text for terminal display. */
-struct coding_system terminal_coding;
-
/* Coding system to be used to encode text for terminal display when
terminal coding system is nil. */
struct coding_system safe_terminal_coding;
-/* Coding system of what is sent from terminal keyboard. */
-struct coding_system keyboard_coding;
-
Lisp_Object Vfile_coding_system_alist;
Lisp_Object Vprocess_coding_system_alist;
Lisp_Object Vnetwork_coding_system_alist;
break;
single_shifting = 0;
rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_8BIT;
- found |= CATEGORY_MASK_ISO_ELSE;
break;
case ISO_CODE_CSI:
DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
doc: /* Read a coding system from the minibuffer, prompting with string PROMPT.
-If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. */)
+If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
+Ignores case when completing coding systems (all Emacs coding systems
+are lower-case). */)
(prompt, default_coding_system)
Lisp_Object prompt, default_coding_system;
{
Lisp_Object val;
+ int count = SPECPDL_INDEX ();
+
if (SYMBOLP (default_coding_system))
- XSETSTRING (default_coding_system, XPNTR (SYMBOL_NAME (default_coding_system)));
+ default_coding_system = SYMBOL_NAME (default_coding_system);
+ specbind (Qcompletion_ignore_case, Qt);
val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
Qt, Qnil, Qcoding_system_history,
default_coding_system, Qnil);
+ unbind_to (count, Qnil);
return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
}
START and END are buffer positions.
Optional 4th arguments DESTINATION specifies where the decoded text goes.
-If nil, the region between START and END is replace by the decoded text.
+If nil, the region between START and END is replaced by the decoded text.
If buffer, the decoded text is inserted in the buffer.
If t, the decoded text is returned.
}
\f
-DEFUN ("set-terminal-coding-system-internal",
- Fset_terminal_coding_system_internal,
- Sset_terminal_coding_system_internal, 1, 1, 0,
+DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_internal,
+ Sset_terminal_coding_system_internal, 1, 2, 0,
doc: /* Internal use only. */)
- (coding_system)
+ (coding_system, terminal)
Lisp_Object coding_system;
+ Lisp_Object terminal;
{
+ struct coding_system *terminal_coding = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
CHECK_SYMBOL (coding_system);
- setup_coding_system (Fcheck_coding_system (coding_system),
- &terminal_coding);
-
+ setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
/* We had better not send unsafe characters to terminal. */
- terminal_coding.mode |= CODING_MODE_SAFE_ENCODING;
+ terminal_coding->mode |= CODING_MODE_SAFE_ENCODING;
/* Characer composition should be disabled. */
- terminal_coding.common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
- terminal_coding.src_multibyte = 1;
- terminal_coding.dst_multibyte = 0;
+ terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
+ terminal_coding->src_multibyte = 1;
+ terminal_coding->dst_multibyte = 0;
return Qnil;
}
return Qnil;
}
-DEFUN ("terminal-coding-system",
- Fterminal_coding_system, Sterminal_coding_system, 0, 0, 0,
- doc: /* Return coding system specified for terminal output. */)
- ()
+DEFUN ("terminal-coding-system", Fterminal_coding_system,
+ Sterminal_coding_system, 0, 1, 0,
+ doc: /* Return coding system specified for terminal output on the given terminal.
+TERMINAL may be a terminal id, a frame, or nil for the selected
+frame's terminal device. */)
+ (terminal)
+ Lisp_Object terminal;
{
- Lisp_Object coding_system;
+ struct coding_system *terminal_coding
+ = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1));
+ Lisp_Object coding_system = CODING_ID_NAME (terminal_coding->id);
- coding_system = CODING_ID_NAME (terminal_coding.id);
/* For backward compatibility, return nil if it is `undecided'. */
return (! EQ (coding_system, Qundecided) ? coding_system : Qnil);
}
-DEFUN ("set-keyboard-coding-system-internal",
- Fset_keyboard_coding_system_internal,
- Sset_keyboard_coding_system_internal, 1, 1, 0,
+DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_internal,
+ Sset_keyboard_coding_system_internal, 1, 2, 0,
doc: /* Internal use only. */)
- (coding_system)
+ (coding_system, terminal)
Lisp_Object coding_system;
+ Lisp_Object terminal;
{
+ struct terminal *t = get_terminal (terminal, 1);
CHECK_SYMBOL (coding_system);
setup_coding_system (Fcheck_coding_system (coding_system),
- &keyboard_coding);
+ TERMINAL_KEYBOARD_CODING (t));
/* Characer composition should be disabled. */
- keyboard_coding.common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
+ TERMINAL_KEYBOARD_CODING (t)->common_flags
+ &= ~CODING_ANNOTATE_COMPOSITION_MASK;
return Qnil;
}
DEFUN ("keyboard-coding-system",
- Fkeyboard_coding_system, Skeyboard_coding_system, 0, 0, 0,
+ Fkeyboard_coding_system, Skeyboard_coding_system, 0, 1, 0,
doc: /* Return coding system specified for decoding keyboard input. */)
- ()
+ (terminal)
+ Lisp_Object terminal;
{
- return CODING_ID_NAME (keyboard_coding.id);
+ return CODING_ID_NAME (TERMINAL_KEYBOARD_CODING
+ (get_terminal (terminal, 1))->id);
}
\f
else
{
charset_list = Fcopy_sequence (charset_list);
- for (tail = charset_list; !NILP (tail); tail = Fcdr (tail))
+ for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
{
struct charset *charset;
- val = Fcar (tail);
+ val = XCAR (tail);
CHECK_CHARSET_GET_CHARSET (val, charset);
if (EQ (coding_type, Qiso_2022)
? CHARSET_ISO_FINAL (charset) < 0
Fdefine_coding_system_internal (coding_arg_max, args);
}
- setup_coding_system (Qno_conversion, &keyboard_coding);
- setup_coding_system (Qundecided, &terminal_coding);
setup_coding_system (Qno_conversion, &safe_terminal_coding);
{