Subject: 23.2.91; default-terminal-coding-system not inherited by created terminals
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Date: Thu, 13 Jan 2011 22:45:57 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

I have this in my ~/.emacs:

    (set-terminal-coding-system 'utf-8)

This is supposed to set the value of default-terminal-coding-system,
and it indeed does.  However, creating a new terminal, e.g. with
"emacsclient -t" when an Emacs daemon is running, does not set the
terminal encoding of the newly created terminal to utf-8.  I don't see
any code that attempts doing so; the only place where we do anything
with the terminal encoding is in create_terminal:

  terminal->keyboard_coding =
    (struct coding_system *) xmalloc (sizeof (struct coding_system));
  terminal->terminal_coding =
    (struct coding_system *) xmalloc (sizeof (struct coding_system));

  setup_coding_system (Qno_conversion, terminal->keyboard_coding);
  setup_coding_system (Qundecided, terminal->terminal_coding);

The net effect is that the user _must_ manually set up the terminal
and keyboard encoding on every terminal created by emacsclient.  I
think that's a misfeature.

Any reason not to honor default-terminal-coding-system and
default-keyboard-coding-system when we create a new terminal?

In GNU Emacs 23.2.91.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.12.9)
 of 2010-12-11 on fencepost
configured using `configure  '--with-jpeg=no' '--with-gif=no' '--with-tiff=no''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  flyspell-mode: t
  display-time-mode: t
  show-paren-mode: t
  savehist-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
u c t SPC t e r m i n a l C-r C-r C-r C-r C-r C-r ESC 
[ 6 ~ ESC [ 6 ~ ESC O B ESC O B ESC O B ESC O B ESC 
O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B 
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O D ESC 
O D ESC O D ESC O D ESC x g r e p RET C-a f C-e ESC 
O B DEL c RET ESC C-v ESC C-v ESC C-v ESC C-v ESC C-v 
ESC C-v ESC C-v ESC C-v ESC C-v C-x o ESC [ 5 ~ ESC 
[ 5 ~ ESC O B ESC O A ESC O A ESC O A ESC O A ESC O 
A ESC O B ESC O B ESC O A RET C-x b I N B TAB RET C-x 
4 C-o ESC O A C-e TAB - TAB RET ESC : ( t e r m i n 
a l - c o d i n g - s y s t e m ) RET ESC p ESC p ESC 
p SPC SPC C-x C-c ESC [ > 0 ; 1 3 6 ; 0 c C-x b RET 
ESC : ESC O A RET C-x RET t ESC O A RET C-l ESC : ESC 
O A RET C-x 2 C-x 4 C-o ESC O A ESC O A RET C-x 0 C-x 
4 b RET C-u 9 C-x ^ ESC x r e p o C-h C-g C-g r ESC 
~ C-x 5 o C-x 5 0 ESC x r e p o r t - e m TAB RET

Recent messages:
Mark set
utf-8
(No files need saving)
When done with this frame, type C-x 5 0
nil
utf-8
Quit [2 times]
Modification-flag cleared
Scanning for dabbrevs...100%
dabbrev-expand: No dynamic expansion for `default-ter' found

Load-path shadows:
None found.

Features:
(shadow emacsbug debug gud easy-mmode grep compile comint ring
find-func pp help-mode view help-fns multi-isearch vc-bzr cc-mode
cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
arc-mode archive-mode newcomment dabbrev flyspell ispell rmailsum
rmailmm message sendmail regexp-opt ecomplete rfc822 mml easymenu
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap
mailabbrev nnheader gnus-util netrc gmm-utils wid-edit mailheader
canlock sha1 hex-util hashcash mail-parse rfc2231 rmail rfc2047
rfc2045 ietf-drums time-date qp mm-util mail-prsvr mail-utils server
time paren cus-start cus-load savehist saveplace tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mldrag mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process font-render-setting gtk x-toolkit x multi-tty
emacs)