unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* unicode merge failures  2007-10-12
@ 2007-10-11 16:13 Miles Bader
  2007-10-11 22:35 ` Jason Rumney
  0 siblings, 1 reply; 11+ messages in thread
From: Miles Bader @ 2007-10-11 16:13 UTC (permalink / raw)
  To: emacs-unicode; +Cc: emacs-devel

This merge includes the multi-tty merge, so things are probably a bit broken
besides these explicitly conflicts.


M  src/xterm.c
M  src/xdisp.c
M  src/coding.c
M  lisp/term/mac-win.el
M  lisp/international/encoded-kb.el

--- orig/src/xterm.c
+++ mod/src/xterm.c
@@ -6538,42 +6536,43 @@
 	       gives us composition information.  */
 	    coding.composing = COMPOSITION_DISABLED;
 
-	    for (i = 0; i < nbytes; i++)
+	    if (nbytes > 0)
 	      {
-		STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]);
-	      }
+		/* Decode the input data.  */
+		int require;
+		unsigned char *p;
 
-	    {
-	      /* Decode the input data.  */
-	      int require;
-	      unsigned char *p;
-
-	      require = decoding_buffer_size (&coding, nbytes);
-	      p = (unsigned char *) alloca (require);
-	      coding.mode |= CODING_MODE_LAST_BLOCK;
-	      /* We explicitly disable composition handling because
-		 key data should not contain any composition sequence.  */
-	      coding.composing = COMPOSITION_DISABLED;
-	      decode_coding (&coding, copy_bufptr, p, nbytes, require);
-	      nbytes = coding.produced;
-	      nchars = coding.produced_char;
-	      copy_bufptr = p;
-	    }
+		for (i = 0; i < nbytes; i++)
+		  {
+		    STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]);
+		  }
 
-	    /* Convert the input data to a sequence of
-	       character events.  */
-	    for (i = 0; i < nbytes; i += len)
-	      {
-		if (nchars == nbytes)
-		  c = copy_bufptr[i], len = 1;
-		else
-		  c = STRING_CHAR_AND_LENGTH (copy_bufptr + i,
-					      nbytes - i, len);
-		inev.ie.kind = (SINGLE_BYTE_CHAR_P (c)
-			      ? ASCII_KEYSTROKE_EVENT
-			      : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
-		inev.ie.code = c;
-		kbd_buffer_store_event_hold (&inev.ie, hold_quit);
+		require = decoding_buffer_size (&coding, nbytes);
+		p = (unsigned char *) alloca (require);
+		coding.mode |= CODING_MODE_LAST_BLOCK;
+		/* We explicitly disable composition handling because
+		   key data should not contain any composition sequence.  */
+		coding.composing = COMPOSITION_DISABLED;
+		decode_coding (&coding, copy_bufptr, p, nbytes, require);
+		nbytes = coding.produced;
+		nchars = coding.produced_char;
+		copy_bufptr = p;
+
+		/* Convert the input data to a sequence of
+		   character events.  */
+		for (i = 0; i < nbytes; i += len)
+		  {
+		    if (nchars == nbytes)
+		      c = copy_bufptr[i], len = 1;
+		    else
+		      c = STRING_CHAR_AND_LENGTH (copy_bufptr + i,
+						  nbytes - i, len);
+		    inev.ie.kind = (SINGLE_BYTE_CHAR_P (c)
+				    ? ASCII_KEYSTROKE_EVENT
+				    : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
+		    inev.ie.code = c;
+		    kbd_buffer_store_event_hold (&inev.ie, hold_quit);
+		  }
 	      }
 
 	    /* Previous code updated count by nchars rather than nbytes,

--- orig/src/xdisp.c
+++ mod/src/xdisp.c
@@ -18030,8 +18052,8 @@
 	  {
 	    /* No need to mention EOL here--the terminal never needs
 	       to do EOL conversion.  */
-	    p = decode_mode_spec_coding (keyboard_coding.symbol, p, 0);
-	    p = decode_mode_spec_coding (terminal_coding.symbol, p, 0);
+	    p = decode_mode_spec_coding (FRAME_KEYBOARD_CODING (f)->symbol, p, 0);
+	    p = decode_mode_spec_coding (FRAME_TERMINAL_CODING (f)->symbol, p, 0);
 	  }
 	p = decode_mode_spec_coding (b->buffer_file_coding_system,
 				     p, eol_flag);

--- orig/src/coding.c
+++ mod/src/coding.c
@@ -7405,10 +7403,13 @@
 }
 
 DEFUN ("terminal-coding-system", Fterminal_coding_system,
-       Sterminal_coding_system, 0, 0, 0,
-       doc: /* Return coding system specified for terminal output.  */)
-     ()
+       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;
 {
-  return terminal_coding.symbol;
+  return TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1))->symbol;
 }
 
@@ -7427,10 +7432,13 @@
 
 DEFUN ("keyboard-coding-system", Fkeyboard_coding_system,
-       Skeyboard_coding_system, 0, 0, 0,
-       doc: /* Return coding system specified for decoding keyboard input.  */)
-     ()
+       Skeyboard_coding_system, 0, 1, 0,
+       doc: /* Return coding system for decoding keyboard input on TERMINAL.
+TERMINAL may be a terminal id, a frame, or nil for the selected
+frame's terminal device.  */)
+     (terminal)
+     Lisp_Object terminal;
 {
-  return keyboard_coding.symbol;
+  return TERMINAL_KEYBOARD_CODING (get_terminal (terminal, 1))->symbol;
 }
 
 \f
@@ -7695,8 +7703,6 @@
   iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3;
   iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer;
 
-  setup_coding_system (Qnil, &keyboard_coding);
-  setup_coding_system (Qnil, &terminal_coding);
   setup_coding_system (Qnil, &safe_terminal_coding);
   setup_coding_system (Qnil, &default_buffer_file_coding);
 


--- orig/lisp/term/mac-win.el
+++ mod/lisp/term/mac-win.el
@@ -2294,34 +2296,6 @@
 	  (mac-dnd-drop-data event (selected-frame) window
 			     (cdr item) (car item) action)))))
 \f
-;;; Do the actual Windows setup here; the above code just defines
-;;; functions and variables that we use now.
-
-(setq command-line-args (x-handle-args command-line-args))
-
-;;; Make sure we have a valid resource name.
-(or (stringp x-resource-name)
-    (let (i)
-      (setq x-resource-name (invocation-name))
-
-      ;; Change any . or * characters in x-resource-name to hyphens,
-      ;; so as not to choke when we use it in X resource queries.
-      (while (setq i (string-match "[.*]" x-resource-name))
-	(aset x-resource-name i ?-))))
-
-(if (x-display-list)
-    ;; On Mac OS 8/9, Most coding systems used in code conversion for
-    ;; font names are not ready at the time when the terminal frame is
-    ;; created.  So we reconstruct font name table for the initial
-    ;; frame.
-    (mac-clear-font-name-table)
-  (x-open-connection "Mac"
-		     x-command-line-resources
-		     ;; Exit Emacs with fatal error if this fails.
-		     t))
-
-(setq frame-creation-function 'x-create-frame-with-faces)
-
 (defvar mac-font-encoder-list
   '(("mac-roman" mac-roman-encoder
      ccl-encode-mac-roman-font "%s")
@@ -2499,6 +2473,88 @@
     (fontset-add-mac-fonts fontset t)
     fontset))
 
+(defun x-win-suspend-error ()
+  (error "Suspending an Emacs running under Mac makes no sense"))
+
+(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
+
+(defvar mac-initialized nil
+  "Non-nil if the w32 window system has been initialized.")
+
+(defun mac-initialize-window-system ()
+  "Initialize Emacs for Mac GUI frames."
+
+;;; Do the actual Windows setup here; the above code just defines
+;;; functions and variables that we use now.
+
+(setq command-line-args (x-handle-args command-line-args))
+
+;;; Make sure we have a valid resource name.
+(or (stringp x-resource-name)
+    (let (i)
+      (setq x-resource-name (invocation-name))
+
+      ;; Change any . or * characters in x-resource-name to hyphens,
+      ;; so as not to choke when we use it in X resource queries.
+      (while (setq i (string-match "[.*]" x-resource-name))
+	(aset x-resource-name i ?-))))
+
+(if (x-display-list)
+    ;; On Mac OS 8/9, Most coding systems used in code conversion for
+    ;; font names are not ready at the time when the terminal frame is
+    ;; created.  So we reconstruct font name table for the initial
+    ;; frame.
+    (mac-clear-font-name-table)
+  (x-open-connection "Mac"
+		     x-command-line-resources
+		     ;; Exit Emacs with fatal error if this fails.
+		     t))
+
+(add-hook 'suspend-hook 'x-win-suspend-error)
+
+;;; Arrange for the kill and yank functions to set and check the clipboard.
+(setq interprogram-cut-function 'x-select-text)
+(setq interprogram-paste-function 'x-get-selection-value)
+
+
+
+
+;;; Turn off window-splitting optimization; Mac is usually fast enough
+;;; that this is only annoying.
+(setq split-window-keep-point t)
+
+;; Don't show the frame name; that's redundant.
+(setq-default mode-line-frame-identification "  ")
+
+;; Turn on support for mouse wheels.
+(mouse-wheel-mode 1)
+
+
+;; Enable CLIPBOARD copy/paste through menu bar commands.
+(menu-bar-enable-clipboard)
+
+
+;; Initiate drag and drop
+
+(define-key special-event-map [drag-n-drop] 'mac-dnd-handle-drag-n-drop-event)
+
+\f
+;;;; Non-toolkit Scroll bars
+
+(unless x-toolkit-scroll-bars
+
+;; for debugging
+;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event))
+
+;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event)
+
+(global-set-key
+ [vertical-scroll-bar down-mouse-1]
+ 'mac-handle-scroll-bar-event)
+
+(global-unset-key [vertical-scroll-bar drag-mouse-1])
+(global-unset-key [vertical-scroll-bar mouse-1])
+
 ;; Adjust Courier font specifications in x-fixed-font-alist.
 (let ((courier-fonts (assoc "Courier" x-fixed-font-alist)))
   (if courier-fonts

--- orig/lisp/international/encoded-kb.el
+++ mod/lisp/international/encoded-kb.el
@@ -253,59 +253,47 @@
    (t
     nil)))
 
-;; key-translation-map at the time Encoded-kbd mode is turned on is
-;; saved here.
-(defvar saved-key-translation-map nil)
-
-;; Input mode at the time Encoded-kbd mode is turned on is saved here.
-(defvar saved-input-mode nil)
-
-(put 'encoded-kbd-mode 'permanent-local t)
 ;;;###autoload
-(define-minor-mode encoded-kbd-mode
-  "Toggle Encoded-kbd minor mode.
-With arg, turn Encoded-kbd mode on if and only if arg is positive.
-
-You should not turn this mode on manually, instead use the command
-\\[set-keyboard-coding-system] which turns on or off this mode
-automatically.
-
-In Encoded-kbd mode, a text sent from keyboard is accepted
-as a multilingual text encoded in a coding system set by
-\\[set-keyboard-coding-system]."
-  :global t :group 'keyboard :group 'mule
-
-  (if encoded-kbd-mode
-      ;; We are turning on Encoded-kbd mode.
-      (let ((coding (keyboard-coding-system))
-	    result)
-	(or saved-key-translation-map
-	    (if (keymapp key-translation-map)
-		(setq saved-key-translation-map
-		      (copy-keymap key-translation-map))
-	      (setq key-translation-map (make-sparse-keymap))))
-	(or saved-input-mode
-	    (setq saved-input-mode
-		  (current-input-mode)))
-	(setq result (and coding (encoded-kbd-setup-keymap coding)))
-	(if result
-	    (if (eq result 8)
-		(set-input-mode
-		 (nth 0 saved-input-mode) 
-		 (nth 1 saved-input-mode)
-		 'use-8th-bit
-		 (nth 3 saved-input-mode)))
-	  (setq encoded-kbd-mode nil
-		saved-key-translation-map nil
-		saved-input-mode nil)
-	  (error "Unsupported coding system in Encoded-kbd mode: %S"
-		 coding)))
-
-    ;; We are turning off Encoded-kbd mode.
-    (setq key-translation-map saved-key-translation-map
-	  saved-key-translation-map nil)
-    (apply 'set-input-mode saved-input-mode)
-    (setq saved-input-mode nil)))
+(defun encoded-kbd-setup-display (display)
+  "Set up a `input-decode-map' for `keyboard-coding-system' on DISPLAY.
+
+DISPLAY may be a display id, a frame, or nil for the selected frame's display."
+  (let ((frame (if (framep display) display (car (frames-on-display-list display)))))
+    (when frame
+      (with-selected-frame frame
+	;; Remove any previous encoded-kb keymap from input-decode-map.
+	(let ((m input-decode-map))
+	  (if (equal (keymap-prompt m) "encoded-kb")
+	      (setq input-decode-map (keymap-parent m))
+	    (while (keymap-parent m)
+	      (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb")
+		  (set-keymap-parent m (keymap-parent (keymap-parent m))))
+	      (setq m (keymap-parent m)))))
+
+	(if (keyboard-coding-system)
+	    ;; We are turning on Encoded-kbd mode.
+	    (let ((coding (keyboard-coding-system))
+		  (keymap (make-sparse-keymap "encoded-kb"))
+		  (cim (current-input-mode))
+		  result)
+	      (set-keymap-parent keymap input-decode-map)
+	      (setq input-decode-map keymap)
+	      (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)
+		(set-terminal-parameter nil 'encoded-kbd-saved-input-mode (nth 2 cim)))
+	      (setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
+	      (if result
+		  (when (and (eq result 8)
+			     (memq (nth 2 cim) '(t nil)))
+		    (set-input-meta-mode 'use-8th-bit))
+		(set-terminal-parameter nil 'encoded-kbd-saved-input-meta-mode nil)
+		(error "Unsupported coding system in Encoded-kbd mode: %S"
+		       coding)))
+	  ;; We are turning off Encoded-kbd mode.
+	  (when (and (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)
+		     (not (equal (nth 2 (current-input-mode))
+				 (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))))
+	    (set-input-meta-mode (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)))
+	  (set-terminal-parameter nil 'saved-input-meta-mode nil))))))
 
 (provide 'encoded-kb)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures  2007-10-12
  2007-10-11 16:13 unicode merge failures 2007-10-12 Miles Bader
@ 2007-10-11 22:35 ` Jason Rumney
  2007-10-12  1:04   ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Rumney @ 2007-10-11 22:35 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-unicode, emacs-devel

Miles Bader wrote:
> M  src/xdisp.c
> M  src/coding.c
>   
These two look like multi-tty wins - the only difference being that
global variables are replaced with members of the terminal struct.

The others are harder to judge, my approach would be to diff each one
with its branch point, and decide which has the simpler changes, then
try to manually apply the equivalent changes to the other branch's
version. encoded-kb.el seems to have been completely rewritten for
multi-tty, but the others look like the actual changes involved could be
quite simple.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures  2007-10-12
  2007-10-11 22:35 ` Jason Rumney
@ 2007-10-12  1:04   ` Stefan Monnier
  2007-10-12  4:05     ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-10-12  1:04 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-unicode, emacs-devel, Miles Bader

> Miles Bader wrote:
>> M  src/xdisp.c
>> M  src/coding.c
>> 
> These two look like multi-tty wins - the only difference being that
> global variables are replaced with members of the terminal struct.

> The others are harder to judge, my approach would be to diff each one
> with its branch point, and decide which has the simpler changes, then
> try to manually apply the equivalent changes to the other branch's
> version. encoded-kb.el seems to have been completely rewritten for
> multi-tty, but the others look like the actual changes involved could be
> quite simple.

I'm looking into it.


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures  2007-10-12
  2007-10-12  1:04   ` Stefan Monnier
@ 2007-10-12  4:05     ` Stefan Monnier
  2007-10-12 17:43       ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-10-12  4:05 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-unicode, emacs-devel, Miles Bader

>>>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Miles Bader wrote:
>>> M  src/xdisp.c
>>> M  src/coding.c
>>> 
>> These two look like multi-tty wins - the only difference being that
>> global variables are replaced with members of the terminal struct.

>> The others are harder to judge, my approach would be to diff each one
>> with its branch point, and decide which has the simpler changes, then
>> try to manually apply the equivalent changes to the other branch's
>> version. encoded-kb.el seems to have been completely rewritten for
>> multi-tty, but the others look like the actual changes involved could be
>> quite simple.

> I'm looking into it.

I believe the patch below makes it work (*very* lightly tested).
Can people take a look at it and tell me if it makes sense?


        Stefan


* looking for emacs@sv.gnu.org/emacs--unicode--0--patch-258 to compare with
* comparing to emacs@sv.gnu.org/emacs--unicode--0--patch-258
A  etc/buildobj.lst
A  tmp.diff
M  lisp/emacs-lisp/cl-loaddefs.el
M  src/chartab.c
M  lisp/ChangeLog
M  src/coding.h
M  src/coding.c
M  src/term.c
M  src/doc.c
M  src/ChangeLog.10
M  src/w32term.c
M  src/alloc.c
M  lisp/term/w32-win.el
M  src/xterm.c
M  lisp/term/mac-win.el
M  lisp/international/encoded-kb.el
M  src/emacs.c
M  lisp/international/characters.el
M  src/xfaces.c
M  src/lread.c
M  lisp/language/ethio-util.el
M  lisp/version.el
M  src/terminal.c
M  src/fontset.c
M  src/xdisp.c
M  lisp/term/x-win.el
M  lisp/ps-print.el
M  src/Makefile.in
M  lisp/ldefs-boot.el
M  configure

* modified files

--- orig/configure
+++ mod/configure
@@ -18922,11 +18922,13 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
@@ -18966,11 +18968,13 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }


--- orig/lisp/international/encoded-kb.el
+++ mod/lisp/international/encoded-kb.el
@@ -333,53 +333,43 @@
 (defun encoded-kbd-setup-display (display)
   "Set up a `input-decode-map' for `keyboard-coding-system' on DISPLAY.
 
-(put 'encoded-kbd-mode 'permanent-local t)
-;;;###autoload
-(define-minor-mode encoded-kbd-mode
-  "Toggle Encoded-kbd minor mode.
-With arg, turn Encoded-kbd mode on if and only if arg is positive.
-
-You should not turn this mode on manually, instead use the command
-\\[set-keyboard-coding-system] which turns on or off this mode
-automatically.
-
-In Encoded-kbd mode, a text sent from keyboard is accepted
-as a multilingual text encoded in a coding system set by
-\\[set-keyboard-coding-system]."
-  :global t :group 'keyboard :group 'mule
-
-  (if encoded-kbd-mode
-      ;; We are turning on Encoded-kbd mode.
-      (let ((coding (keyboard-coding-system))
-	    result)
-	(or saved-key-translation-map
-	    (if (keymapp key-translation-map)
-		(setq saved-key-translation-map
-		      (copy-keymap key-translation-map))
-	      (setq key-translation-map (make-sparse-keymap))))
-	(or saved-input-mode
-	    (setq saved-input-mode
-		  (current-input-mode)))
-	(setq result (and coding (encoded-kbd-setup-keymap coding)))
-	(if result
-	    (if (eq result 8)
-		(set-input-mode
-		 (nth 0 saved-input-mode) 
-		 (nth 1 saved-input-mode)
-		 'use-8th-bit
-		 (nth 3 saved-input-mode)))
-	  (setq encoded-kbd-mode nil
-		saved-key-translation-map nil
-		saved-input-mode nil)
-	  (error "Unsupported coding system in Encoded-kbd mode: %S"
-		 coding)))
-
-    ;; We are turning off Encoded-kbd mode.
-    (when saved-input-mode
-      (setq key-translation-map saved-key-translation-map
-	    saved-key-translation-map nil)
-      (apply 'set-input-mode saved-input-mode)
-      (setq saved-input-mode nil))))
+DISPLAY may be a display id, a frame, or nil for the selected frame's display."
+  (let ((frame (if (framep display) display (car (frames-on-display-list display)))))
+    (when frame
+      (with-selected-frame frame
+	;; Remove any previous encoded-kb keymap from input-decode-map.
+	(let ((m input-decode-map))
+	  (if (equal (keymap-prompt m) "encoded-kb")
+	      (setq input-decode-map (keymap-parent m))
+	    (while (keymap-parent m)
+	      (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb")
+		  (set-keymap-parent m (keymap-parent (keymap-parent m))))
+	      (setq m (keymap-parent m)))))
+
+	(if (keyboard-coding-system)
+	    ;; We are turning on Encoded-kbd mode.
+	    (let ((coding (keyboard-coding-system))
+		  (keymap (make-sparse-keymap "encoded-kb"))
+		  (cim (current-input-mode))
+		  result)
+	      (set-keymap-parent keymap input-decode-map)
+	      (setq input-decode-map keymap)
+	      (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)
+		(set-terminal-parameter nil 'encoded-kbd-saved-input-mode (nth 2 cim)))
+	      (setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
+	      (if result
+		  (when (and (eq result 8)
+			     (memq (nth 2 cim) '(t nil)))
+		    (set-input-meta-mode 'use-8th-bit))
+		(set-terminal-parameter nil 'encoded-kbd-saved-input-meta-mode nil)
+		(error "Unsupported coding system in Encoded-kbd mode: %S"
+		       coding)))
+	  ;; We are turning off Encoded-kbd mode.
+	  (when (and (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)
+		     (not (equal (nth 2 (current-input-mode))
+				 (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))))
+	    (set-input-meta-mode (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)))
+	  (set-terminal-parameter nil 'saved-input-meta-mode nil))))))
 
 (provide 'encoded-kb)
 


--- orig/lisp/term/mac-win.el
+++ mod/lisp/term/mac-win.el
@@ -2346,34 +2346,6 @@
 	  (mac-dnd-drop-data event (selected-frame) window
 			     (cdr item) (car item) action)))))
 \f
-;;; Do the actual Windows setup here; the above code just defines
-;;; functions and variables that we use now.
-
-(setq command-line-args (x-handle-args command-line-args))
-
-;;; Make sure we have a valid resource name.
-(or (stringp x-resource-name)
-    (let (i)
-      (setq x-resource-name (invocation-name))
-
-      ;; Change any . or * characters in x-resource-name to hyphens,
-      ;; so as not to choke when we use it in X resource queries.
-      (while (setq i (string-match "[.*]" x-resource-name))
-	(aset x-resource-name i ?-))))
-
-(if (x-display-list)
-    ;; On Mac OS 8/9, Most coding systems used in code conversion for
-    ;; font names are not ready at the time when the terminal frame is
-    ;; created.  So we reconstruct font name table for the initial
-    ;; frame.
-    (mac-clear-font-name-table)
-  (x-open-connection "Mac"
-		     x-command-line-resources
-		     ;; Exit Emacs with fatal error if this fails.
-		     t))
-
-(setq frame-creation-function 'x-create-frame-with-faces)
-
 (setq font-encoding-alist
       (append
        '(("mac-roman" . mac-roman)


--- orig/lisp/term/w32-win.el
+++ mod/lisp/term/w32-win.el
@@ -1076,44 +1076,6 @@
 
 See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
-;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
-(when (fboundp 'new-fontset)
-      ;; Setup the default fontset.
-      (setup-default-fontset)
-      ;; Create the standard fontset.
-      (create-fontset-from-fontset-spec w32-standard-fontset-spec t)
-      ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...).
-      (create-fontset-from-x-resource))
-
-;; Apply a geometry resource to the initial frame.  Put it at the end
-;; of the alist, so that anything specified on the command line takes
-;; precedence.
-(let* ((res-geometry (x-get-resource "geometry" "Geometry"))
-       parsed)
-  (if res-geometry
-      (progn
-	(setq parsed (x-parse-geometry res-geometry))
-	;; If the resource specifies a position,
-	;; call the position and size "user-specified".
-	(if (or (assq 'top parsed) (assq 'left parsed))
-	    (setq parsed (cons '(user-position . t)
-			       (cons '(user-size . t) parsed))))
-	;; All geometry parms apply to the initial frame.
-	(setq initial-frame-alist (append initial-frame-alist parsed))
-	;; The size parms apply to all frames.
-	(if (assq 'height parsed)
-	    (push (cons 'height (cdr (assq 'height parsed)))
-		  default-frame-alist))
-	(if (assq 'width parsed)
-	    (push (cons 'width (cdr (assq 'width parsed)))
-		  default-frame-alist)))))
-
-;; Check the reverseVideo resource.
-(let ((case-fold-search t))
-  (let ((rv (x-get-resource "reverseVideo" "ReverseVideo")))
-    (if (and rv (string-match "^\\(true\\|yes\\|on\\)$" rv))
-	(push '(reverse . t) default-frame-alist))))
-
 (defun x-win-suspend-error ()
   "Report an error when a suspend is attempted."
   (error "Suspending an Emacs running under W32 makes no sense"))
@@ -1145,7 +1107,7 @@
       ;; Append list of fontsets currently defined.
       ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
       (if (fboundp 'new-fontset)
-      (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
+          (append w32-fixed-font-alist (list (generate-fontset-menu)))))))
   (if fonts
       (let (font)
 	(while fonts
@@ -1199,30 +1161,6 @@
   (create-fontset-from-fontset-spec w32-standard-fontset-spec t)
   ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1,...).
   (create-fontset-from-x-resource)
-  ;; Try to create a fontset from a font specification which comes
-  ;; from initial-frame-alist, default-frame-alist, or X resource.
-  ;; A font specification in command line argument (i.e. -fn XXXX)
-  ;; should be already in default-frame-alist as a `font'
-  ;; parameter.  However, any font specifications in site-start
-  ;; library, user's init file (.emacs), and default.el are not
-  ;; yet handled here.
-
-  (let ((font (or (cdr (assq 'font initial-frame-alist))
-                  (cdr (assq 'font default-frame-alist))
-                  (x-get-resource "font" "Font")))
-        xlfd-fields resolved-name)
-    (if (and font
-             (not (query-fontset font))
-             (setq resolved-name (x-resolve-font-name font))
-             (setq xlfd-fields (x-decompose-font-name font)))
-        (if (string= "fontset"
-                     (aref xlfd-fields xlfd-regexp-registry-subnum))
-            (new-fontset font
-                         (x-complement-fontset-spec xlfd-fields nil))
-          ;; Create a fontset from FONT.  The fontset name is
-          ;; generated from FONT.
-          (create-fontset-from-ascii-font font
-                                          resolved-name "startup"))))
 
   ;; Apply a geometry resource to the initial frame.  Put it at the end
   ;; of the alist, so that anything specified on the command line takes


--- orig/lisp/term/x-win.el
+++ mod/lisp/term/x-win.el
@@ -2469,28 +2469,6 @@
   ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...).
   (create-fontset-from-x-resource)
 
-  ;; Try to create a fontset from a font specification which comes
-  ;; from initial-frame-alist, default-frame-alist, or X resource.
-  ;; A font specification in command line argument (i.e. -fn XXXX)
-  ;; should be already in default-frame-alist as a `font'
-  ;; parameter.  However, any font specifications in site-start
-  ;; library, user's init file (.emacs), and default.el are not
-  ;; yet handled here.
-
-  (let ((font (or (cdr (assq 'font initial-frame-alist))
-		  (cdr (assq 'font default-frame-alist))
-		  (x-get-resource "font" "Font")))
-	xlfd-fields resolved-name)
-    (if (and font
-	     (not (query-fontset font))
-	     (setq resolved-name (x-resolve-font-name font))
-	     (setq xlfd-fields (x-decompose-font-name font)))
-	(if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum))
-	    (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
-	  ;; Create a fontset from FONT.  The fontset name is
-	  ;; generated from FONT.
-	  (create-fontset-from-ascii-font font resolved-name "startup"))))
-
   ;; Set scroll bar mode to right if set by X resources. Default is left.
   (if (equal (x-get-resource "verticalScrollBars" "ScrollBars") "right")
       (customize-set-variable 'scroll-bar-mode 'right))


--- orig/lisp/version.el
+++ mod/lisp/version.el
@@ -30,7 +30,7 @@
 (defconst emacs-copyright "Copyright (C) 2007 Free Software Foundation, Inc."
   "Short copyright string for this version of Emacs.")
 
-(defconst emacs-version "23.0.50" "\
+(defconst emacs-version "23.0.60" "\
 Version numbers of this version of Emacs.")
 
 (defconst emacs-major-version


--- orig/src/ChangeLog.10
+++ mod/src/ChangeLog.10
@@ -12403,6 +12403,11 @@
 	* regex.c (re_error_msgid): Add an entry for REG_ERANGEX.
 	(regex_compile): Return REG_ERANGEX if appropriate.
 
+2004-10-22  Kenichi Handa  <handa@m17n.org>
+
+	* editfns.c (Ftranslate_region_internal): New function.
+	(syms_of_editfns): Defsubr it.
+
 2004-10-22  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xfns.c (xic_create_xfontset): Initialize missing_list to NULL.


--- orig/src/Makefile.in
+++ mod/src/Makefile.in
@@ -1007,7 +1007,7 @@
 #endif
 
 temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
-	echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
+	echo "${obj} ${otherobj} " OBJECTS_MACHINE > ${etc}buildobj.lst
 	$(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
     -o temacs ${STARTFILES} ${obj} ${otherobj}  \
     OBJECTS_MACHINE ${LIBES}
@@ -1133,7 +1133,7 @@
 	CRT0_COMPILE ${srcdir}/ecrt0.c
 dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
    coding.h regex.h systime.h blockinput.h atimer.h
-dispnew.o: dispnew.c  systty.h systime.h commands.h process.h frame.h \
+dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
    window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
    disptab.h indent.h intervals.h \
    xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \
@@ -1156,7 +1156,7 @@
 frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
    blockinput.h atimer.h systime.h buffer.h character.h fontset.h \
    msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
-fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhook.h $(config_h)
+fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
 font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \
    font.h $(config_h)
 ftfont.o: dispextern.h frame.h character.h charset.h font.h $(config_h)
@@ -1188,7 +1188,7 @@
 md5.o: md5.c md5.h $(config_h)
 minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
    buffer.h commands.h character.h msdos.h $(INTERVAL_SRC) keymap.h \
-   terhooks.h $(config_h)
+   termhooks.h $(config_h)
 mktime.o: mktime.c $(config_h)
 msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
    termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
@@ -1288,11 +1288,10 @@
  keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
  blockinput.h atimer.h systime.h xterm.h termhooks.h
 print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
-   $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h  \
+   $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
    blockinput.h atimer.h systime.h
 lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
- charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h \
- blockinput.h atimer.h systime.h
+ charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
 
 /* Text properties support */
 textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
@@ -1357,7 +1356,7 @@
 	rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a
 	rm -f ../etc/DOC
 	rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT}
-	rm -f buildobj.lst
+	rm -f ${etc}buildobj.lst
 clean: mostlyclean
 	rm -f emacs-*${EXEEXT} emacs${EXEEXT}
 /**/# This is used in making a distribution.


--- orig/src/alloc.c
+++ mod/src/alloc.c
@@ -3070,51 +3070,6 @@
 }
 
 
-DEFUN ("make-char-table", Fmake_char_table, Smake_char_table, 1, 2, 0,
-       doc: /* Return a newly created char-table, with purpose PURPOSE.
-Each element is initialized to INIT, which defaults to nil.
-PURPOSE should be a symbol which has a `char-table-extra-slots' property.
-The property's value should be an integer between 0 and 10.  */)
-     (purpose, init)
-     register Lisp_Object purpose, init;
-{
-  Lisp_Object vector;
-  Lisp_Object n;
-  CHECK_SYMBOL (purpose);
-  n = Fget (purpose, Qchar_table_extra_slots);
-  CHECK_NUMBER (n);
-  if (XINT (n) < 0 || XINT (n) > 10)
-    args_out_of_range (n, Qnil);
-  /* Add 2 to the size for the defalt and parent slots.  */
-  vector = Fmake_vector (make_number (CHAR_TABLE_STANDARD_SLOTS + XINT (n)),
-			 init);
-  XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
-  XCHAR_TABLE (vector)->top = Qt;
-  XCHAR_TABLE (vector)->parent = Qnil;
-  XCHAR_TABLE (vector)->purpose = purpose;
-  XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
-  return vector;
-}
-
-
-/* Return a newly created sub char table with slots initialized by INIT.
-   Since a sub char table does not appear as a top level Emacs Lisp
-   object, we don't need a Lisp interface to make it.  */
-
-Lisp_Object
-make_sub_char_table (init)
-     Lisp_Object init;
-{
-  Lisp_Object vector
-    = Fmake_vector (make_number (SUB_CHAR_TABLE_STANDARD_SLOTS), init);
-  XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
-  XCHAR_TABLE (vector)->top = Qnil;
-  XCHAR_TABLE (vector)->defalt = Qnil;
-  XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
-  return vector;
-}
-
-
 DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
        doc: /* Return a newly created vector with specified arguments as elements.
 Any number of arguments, even zero arguments, are allowed.
@@ -4964,7 +4919,10 @@
       for (i = 0; i < size; i++)
 	vec->contents[i] = Fpurecopy (XVECTOR (obj)->contents[i]);
       if (COMPILEDP (obj))
-	XSETCOMPILED (obj, vec);
+	{
+	  XSETPVECTYPE (vec, PVEC_COMPILED);
+	  XSETCOMPILED (obj, vec);
+	}
       else
 	XSETVECTOR (obj, vec);
       return obj;


--- orig/src/chartab.c
+++ mod/src/chartab.c
@@ -7,7 +7,7 @@
 
 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,
@@ -85,6 +85,7 @@
 
   size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
   vector = Fmake_vector (make_number (size), init);
+  XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
   XCHAR_TABLE (vector)->parent = Qnil;
   XCHAR_TABLE (vector)->purpose = purpose;
   XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
@@ -100,6 +101,7 @@
   int size = VECSIZE (struct Lisp_Sub_Char_Table) - 1 + chartab_size[depth];
 
   table = Fmake_vector (make_number (size), defalt);
+  XSETPVECTYPE (XVECTOR (table), PVEC_SUB_CHAR_TABLE);
   XSUB_CHAR_TABLE (table)->depth = make_number (depth);
   XSUB_CHAR_TABLE (table)->min_char = make_number (min_char);
   XSETSUB_CHAR_TABLE (table, XSUB_CHAR_TABLE (table));
@@ -156,6 +158,7 @@
   int i;
 
   copy = Fmake_vector (make_number (size), Qnil);
+  XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
   XCHAR_TABLE (copy)->defalt = XCHAR_TABLE (table)->defalt;
   XCHAR_TABLE (copy)->parent = XCHAR_TABLE (table)->parent;
   XCHAR_TABLE (copy)->purpose = XCHAR_TABLE (table)->purpose;


--- orig/src/coding.c
+++ mod/src/coding.c
@@ -387,9 +387,6 @@
    terminal coding system is nil.  */
 struct coding_system safe_terminal_coding;
 
-/* Default coding system to be used to write a file.  */
-struct coding_system default_buffer_file_coding;
-
 Lisp_Object Vfile_coding_system_alist;
 Lisp_Object Vprocess_coding_system_alist;
 Lisp_Object Vnetwork_coding_system_alist;
@@ -8329,9 +8326,10 @@
      (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 = TERMINAL_TERMINAL_CODING (get_terminal (terminal, 1))->symbol;
   /* For backward compatibility, return nil if it is `undecided'. */
   return (! EQ (coding_system, Qundecided) ? coding_system : Qnil);
 }
@@ -8354,11 +8352,13 @@
 }
 
 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
@@ -8643,11 +8643,11 @@
   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
@@ -9827,8 +9827,6 @@
     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);
 
   {


--- orig/src/coding.h
+++ mod/src/coding.h
@@ -746,9 +746,6 @@
    terminal coding system is nil.  */
 extern struct coding_system safe_terminal_coding;
 
-/* Default coding system to be used to write a file.  */
-extern struct coding_system default_buffer_file_coding;
-
 /* Default coding systems used for process I/O.  */
 extern Lisp_Object Vdefault_process_coding_system;
 


--- orig/src/doc.c
+++ mod/src/doc.c
@@ -617,8 +617,10 @@
     int nr_read;
     char *cp = NULL;
     char *beg, *end;
+    Lisp_Object buildobj = Fexpand_file_name (build_string ("buildobj.lst"),
+					      Vdoc_directory);
 
-    fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
+    fd = emacs_open (SDATA (buildobj), O_RDONLY, 0);
     if (fd < 0)
       report_file_error ("Opening file buildobj.lst", Qnil);
 


--- orig/src/emacs.c
+++ mod/src/emacs.c
@@ -1324,7 +1324,6 @@
       syms_of_macterm ();
       syms_of_macmenu ();
       syms_of_macselect ();
-      syms_of_data ();
       syms_of_search ();
       syms_of_frame ();
 
@@ -1332,6 +1331,16 @@
       mac_term_init (build_string ("Mac"), NULL, NULL);
       init_keyboard ();
 #endif
+      /* Called before syms_of_fileio, because it sets up Qerror_condition.  */
+      syms_of_data ();
+      syms_of_fileio ();
+      /* Before syms_of_coding to initialize Vgc_cons_threshold.  */
+      syms_of_alloc ();
+      /* Before syms_of_coding because it initializes Qcharsetp.  */
+      syms_of_charset ();
+      /* Before init_window_once, because it sets up the
+	 Vcoding_system_hash_table.  */
+      syms_of_coding ();	/* This should be after syms_of_fileio.  */
 
       init_window_once ();	/* Init the window system.  */
       init_fileio_once ();	/* Must precede any path manipulation.  */
@@ -1553,7 +1562,6 @@
       /* Called before init_window_once for Mac OS Classic.  */
       syms_of_data ();
 #endif
-      syms_of_alloc ();
       syms_of_chartab ();
       syms_of_lread ();
       syms_of_print ();
@@ -1574,7 +1582,6 @@
       syms_of_ccl ();
 #endif
       syms_of_character ();
-      syms_of_charset ();
       syms_of_cmds ();
 #ifndef NO_DIR_LIBRARY
       syms_of_dired ();
@@ -1583,8 +1590,6 @@
       syms_of_doc ();
       syms_of_editfns ();
       syms_of_emacs ();
-      syms_of_fileio ();
-      syms_of_coding ();	/* This should be after syms_of_fileio.  */
 #ifdef CLASH_DETECTION
       syms_of_filelock ();
 #endif /* CLASH_DETECTION */


--- orig/src/fontset.c
+++ mod/src/fontset.c
@@ -1442,7 +1442,7 @@
     {
       Lisp_Object this = AREF (Vfontset_table, id);
 
-      if (EQ (FONTSET_BASE (this), base))
+      if (CHAR_TABLE_P (this) && EQ (FONTSET_BASE (this), base))
 	{
 	  Fclear_face_cache (Qt);
 	  break;


--- orig/src/lread.c
+++ mod/src/lread.c
@@ -2324,7 +2324,7 @@
 	      tmp = read_vector (readcharfun, 0);
 	      if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS)
 		error ("Invalid size char-table");
-	      XSETCHAR_TABLE (tmp, XCHAR_TABLE (tmp));
+	      XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE);
 	      return tmp;
 	    }
 	  else if (c == '^')
@@ -2344,7 +2344,7 @@
 		  size = XVECTOR (tmp)->size - 2;
 		  if (chartab_size [depth] != size)
 		    error ("Invalid size char-table");
-		  XSETSUB_CHAR_TABLE (tmp, XSUB_CHAR_TABLE (tmp));
+		  XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
 		  return tmp;
 		}
 	      invalid_syntax ("#^^", 3);


--- orig/src/term.c
+++ mod/src/term.c
@@ -41,7 +41,6 @@
 #include "lisp.h"
 #include "termchar.h"
 #include "termopts.h"
-#include "lisp.h"
 #include "buffer.h"
 #include "character.h"
 #include "charset.h"


--- orig/src/terminal.c
+++ mod/src/terminal.c
@@ -242,8 +242,8 @@
   terminal->terminal_coding =
     (struct coding_system *) xmalloc (sizeof (struct coding_system));
 
-  setup_coding_system (Qnil, terminal->keyboard_coding);
-  setup_coding_system (Qnil, terminal->terminal_coding);
+  setup_coding_system (Qno_conversion, terminal->keyboard_coding);
+  setup_coding_system (Qundecided, terminal->terminal_coding);
 
   terminal->param_alist = Qnil;
   return terminal;


--- orig/src/xdisp.c
+++ mod/src/xdisp.c
@@ -18210,9 +18210,11 @@
 	  {
 	    /* No need to mention EOL here--the terminal never needs
 	       to do EOL conversion.  */
-	    p = decode_mode_spec_coding (CODING_ID_NAME (keyboard_coding.id),
+	    p = decode_mode_spec_coding (CODING_ID_NAME
+					 (FRAME_KEYBOARD_CODING (f)->id),
 					 p, 0);
-	    p = decode_mode_spec_coding (CODING_ID_NAME (terminal_coding.id),
+	    p = decode_mode_spec_coding (CODING_ID_NAME
+					 (FRAME_TERMINAL_CODING (f)->id),
 					 p, 0);
 	  }
 	p = decode_mode_spec_coding (b->buffer_file_coding_system,
@@ -19615,70 +19617,6 @@
 }
 
 
-/* Get face and two-byte form of character C in face FACE_ID on frame
-   F.  The encoding of C is returned in *CHAR2B.  MULTIBYTE_P non-zero
-   means we want to display multibyte text.  DISPLAY_P non-zero means
-   make sure that X resources for the face returned are allocated.
-   Value is a pointer to a realized face that is ready for display if
-   DISPLAY_P is non-zero.  */
-
-static INLINE struct face *
-get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
-     struct frame *f;
-     int c, face_id;
-     XChar2b *char2b;
-     int multibyte_p, display_p;
-{
-  struct face *face = FACE_FROM_ID (f, face_id);
-
-  if (!multibyte_p)
-    {
-      /* Unibyte case.  We don't have to encode, but we have to make
-	 sure to use a face suitable for unibyte.  */
-      STORE_XCHAR2B (char2b, 0, c);
-      face_id = FACE_FOR_CHAR (f, face, c);
-      face = FACE_FROM_ID (f, face_id);
-    }
-  else if (c < 128)
-    {
-      /* Case of ASCII in a face known to fit ASCII.  */
-      STORE_XCHAR2B (char2b, 0, c);
-    }
-  else
-    {
-      int c1, c2, charset;
-
-      /* Split characters into bytes.  If c2 is -1 afterwards, C is
-	 really a one-byte character so that byte1 is zero.  */
-      SPLIT_CHAR (c, charset, c1, c2);
-      if (c2 > 0)
-	STORE_XCHAR2B (char2b, c1, c2);
-      else
-	STORE_XCHAR2B (char2b, 0, c1);
-
-      /* Maybe encode the character in *CHAR2B.  */
-      if (face->font != NULL)
-	{
-	  struct font_info *font_info
-	    = FONT_INFO_FROM_ID (f, face->font_info_id);
-	  if (font_info)
-	    FRAME_RIF (f)->encode_char (c, char2b, font_info, 0);
-	}
-    }
-
-  /* Make sure X resources of the face are allocated.  */
-#ifdef HAVE_X_WINDOWS
-  if (display_p)
-#endif
-    {
-      xassert (face != NULL);
-      PREPARE_FACE_FOR_DISPLAY (f, face);
-    }
-
-  return face;
-}
-
-
 /* Set background width of glyph string S.  START is the index of the
    first glyph following S.  LAST_X is the right-most x-position + 1
    in the drawing area.  */
--- orig/src/xfaces.c
+++ mod/src/xfaces.c
@@ -5572,11 +5572,11 @@
 	    free_face_fontset (f, face);
 	  if (face->gc)
 	    {
+	      BLOCK_INPUT;
 #ifdef USE_FONT_BACKEND
 	      if (enable_font_backend && face->font_info)
 		font_done_for_face (f, face);
 #endif	/* USE_FONT_BACKEND */
-	      BLOCK_INPUT;
 	      x_free_gc (f, face->gc);
 	      face->gc = 0;
 	      UNBLOCK_INPUT;
@@ -5747,11 +5747,11 @@
 	  struct face *face = c->faces_by_id[i];
 	  if (face && face->gc)
 	    {
+	      BLOCK_INPUT;
 #ifdef USE_FONT_BACKEND
 	      if (enable_font_backend && face->font_info)
 		font_done_for_face (c->f, face);
 #endif	/* USE_FONT_BACKEND */
-	      BLOCK_INPUT;
 	      x_free_gc (c->f, face->gc);
 	      face->gc = 0;
 	      UNBLOCK_INPUT;


--- orig/src/xterm.c
+++ mod/src/xterm.c
@@ -6777,17 +6777,6 @@
 		copy_bufptr = coding.destination;
 	      }
 
-		require = decoding_buffer_size (&coding, nbytes);
-		p = (unsigned char *) alloca (require);
-		coding.mode |= CODING_MODE_LAST_BLOCK;
-		/* We explicitly disable composition handling because
-		   key data should not contain any composition sequence.  */
-		coding.composing = COMPOSITION_DISABLED;
-		decode_coding (&coding, copy_bufptr, p, nbytes, require);
-		nbytes = coding.produced;
-		nchars = coding.produced_char;
-		copy_bufptr = p;
-
 		/* Convert the input data to a sequence of
 		   character events.  */
 		for (i = 0; i < nbytes; i += len)
@@ -6803,6 +6792,5 @@
 		    inev.ie.code = c;
 		    kbd_buffer_store_event_hold (&inev.ie, hold_quit);
 		  }
-	      }
 
 	    /* Previous code updated count by nchars rather than nbytes,



* added files

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures  2007-10-12
  2007-10-12  4:05     ` Stefan Monnier
@ 2007-10-12 17:43       ` Stefan Monnier
  2007-10-12 21:30         ` Dan Nicolaescu
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2007-10-12 17:43 UTC (permalink / raw)
  To: Jason Rumney; +Cc: emacs-unicode, emacs-devel, Miles Bader

> I believe the patch below makes it work (*very* lightly tested).
> Can people take a look at it and tell me if it makes sense?

Installed,


        Stefan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures  2007-10-12
  2007-10-12 17:43       ` Stefan Monnier
@ 2007-10-12 21:30         ` Dan Nicolaescu
  2007-10-12 21:51           ` Miles Bader
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Nicolaescu @ 2007-10-12 21:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Miles Bader, emacs-unicode, emacs-devel, Jason Rumney

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > > I believe the patch below makes it work (*very* lightly tested).
  > > Can people take a look at it and tell me if it makes sense?
  > 
  > Installed,

It's not in CVS, did you install it somewhere else?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures 2007-10-12
  2007-10-12 21:30         ` Dan Nicolaescu
@ 2007-10-12 21:51           ` Miles Bader
  2007-10-12 22:12             ` Dan Nicolaescu
  0 siblings, 1 reply; 11+ messages in thread
From: Miles Bader @ 2007-10-12 21:51 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-unicode, emacs-devel, Stefan Monnier, Jason Rumney

On 10/13/07, Dan Nicolaescu <dann@ics.uci.edu> wrote:
>   > > I believe the patch below makes it work (*very* lightly tested).
>   > > Can people take a look at it and tell me if it makes sense?
>   >
>   > Installed,
>
> It's not in CVS, did you install it somewhere else?

It should be now.

-Miles

-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures 2007-10-12
  2007-10-12 21:51           ` Miles Bader
@ 2007-10-12 22:12             ` Dan Nicolaescu
  2007-10-16 23:04               ` James Cloos
                                 ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Dan Nicolaescu @ 2007-10-12 22:12 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-unicode, emacs-devel, Stefan Monnier, Jason Rumney

"Miles Bader" <miles@gnu.org> writes:

  > On 10/13/07, Dan Nicolaescu <dann@ics.uci.edu> wrote:
  > >   > > I believe the patch below makes it work (*very* lightly tested).
  > >   > > Can people take a look at it and tell me if it makes sense?
  > >   >
  > >   > Installed,
  > >
  > > It's not in CVS, did you install it somewhere else?
  > 
  > It should be now.

Thanks. 

Does anyone else see a too big data segment size for the unicode-2
binary:

size -f objs-HEAD/src/emacs objs-unicode-2/src/emacs
   text    data     bss     dec     hex filename
1534480 4031660       0 5566140  54eebc objs-HEAD/src/emacs
1656770 11663100      0 13319870 cb3ebe objs-unicode-2/src/emacs

The first one is from CVS HEAD, the second is from unicode-2

temacs is fine:

size -f objs-HEAD/src/temacs objs-unicode-2/src/temacs
text    data     bss     dec     hex filename
1534480 1212620  257992 3005092  2ddaa4 objs-HEAD/src/temacs
1656770 1209148  261768 3127686  2fb986 objs-unicode-2/src/temacs

This is on an FC5 machine.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures 2007-10-12
  2007-10-12 22:12             ` Dan Nicolaescu
@ 2007-10-16 23:04               ` James Cloos
  2007-10-17  0:04               ` Andreas Schwab
  2007-10-17  1:04               ` Kenichi Handa
  2 siblings, 0 replies; 11+ messages in thread
From: James Cloos @ 2007-10-16 23:04 UTC (permalink / raw)
  To: Dan Nicolaescu
  Cc: emacs-unicode, emacs-devel, Jason Rumney, Stefan Monnier,
	Miles Bader

>>>>> "Dan" == Dan Nicolaescu <dann@ics.uci.edu> writes:

(My mx is pathetically behind in spam filtering, so I just saw this,
and have not yet seen any replies which may have been sent....)

Dan> Does anyone else see a too big data segment size for the unicode-2
Dan> binary:

Dan> size -f objs-HEAD/src/emacs objs-unicode-2/src/emacs
Dan>    text    data     bss     dec     hex filename
Dan> 1534480 4031660       0 5566140  54eebc objs-HEAD/src/emacs
Dan> 1656770 11663100      0 13319870 cb3ebe objs-unicode-2/src/emacs

I don't have the compile trees for these two versions around, but on my
(Gentoo) laptop I get:

,----< :; size /usr/bin/emacs-23-unicode >
|    text      data  bss       dec     hex  filename
| 1645849  11526540    0  13172389  c8fea5  /usr/bin/emacs-23-unicode
`----

and on my (Debian) server I get:

,----< :; size /usr/bin/emacs-snapshot-nox >
|    text     data  bss      dec     hex  filename
| 1154944  4054840    0  5209784  4f7eb8  /usr/bin/emacs-snapshot-nox
`----

They are not exactly comparable, since the latter lacks GUI support,
but are about the same as you saw.

My laptop's emacs is compiled --with-x-toolkit=athena --without-gtk,
and was last compiled on September 20, so the data size difference is
not new.

It may be the result of the font backend work.  Does HEAD use 32 bit
ints for all characters in the buffers?  Might strings take up more
space now that they are stored in (modified) UTF-32?  (Just guesses.)

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures 2007-10-12
  2007-10-12 22:12             ` Dan Nicolaescu
  2007-10-16 23:04               ` James Cloos
@ 2007-10-17  0:04               ` Andreas Schwab
  2007-10-17  1:04               ` Kenichi Handa
  2 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2007-10-17  0:04 UTC (permalink / raw)
  To: Dan Nicolaescu
  Cc: emacs-unicode, emacs-devel, Jason Rumney, Stefan Monnier,
	Miles Bader

Dan Nicolaescu <dann@ics.uci.edu> writes:

> Does anyone else see a too big data segment size for the unicode-2
> binary:
>
> size -f objs-HEAD/src/emacs objs-unicode-2/src/emacs
>    text    data     bss     dec     hex filename
> 1534480 4031660       0 5566140  54eebc objs-HEAD/src/emacs
> 1656770 11663100      0 13319870 cb3ebe objs-unicode-2/src/emacs
>
> The first one is from CVS HEAD, the second is from unicode-2

Most of the increase can be attributed to heap usage (nearly fourfold),
whereas the size of pure space even decreased slightly.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: unicode merge failures 2007-10-12
  2007-10-12 22:12             ` Dan Nicolaescu
  2007-10-16 23:04               ` James Cloos
  2007-10-17  0:04               ` Andreas Schwab
@ 2007-10-17  1:04               ` Kenichi Handa
  2 siblings, 0 replies; 11+ messages in thread
From: Kenichi Handa @ 2007-10-17  1:04 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-unicode, jasonr, emacs-devel, monnier, miles

In article <200710122212.l9CMCD3r024677@oogie-boogie.ics.uci.edu>, Dan Nicolaescu <dann@ics.uci.edu> writes:

> "Miles Bader" <miles@gnu.org> writes:
> On 10/13/07, Dan Nicolaescu <dann@ics.uci.edu> wrote:
> >   > > I believe the patch below makes it work (*very* lightly tested).
> >   > > Can people take a look at it and tell me if it makes sense?
> >   >
> >   > Installed,
> >
> > It's not in CVS, did you install it somewhere else?
> 
> It should be now.

> Thanks. 

> Does anyone else see a too big data segment size for the unicode-2
> binary:

> size -f objs-HEAD/src/emacs objs-unicode-2/src/emacs
>    text    data     bss     dec     hex filename
> 1534480 4031660       0 5566140  54eebc objs-HEAD/src/emacs
> 1656770 11663100      0 13319870 cb3ebe objs-unicode-2/src/emacs

> The first one is from CVS HEAD, the second is from unicode-2

> temacs is fine:

> size -f objs-HEAD/src/temacs objs-unicode-2/src/temacs
> text    data     bss     dec     hex filename
> 1534480 1212620  257992 3005092  2ddaa4 objs-HEAD/src/temacs
> 1656770 1209148  261768 3127686  2fb986 objs-unicode-2/src/temacs

> This is on an FC5 machine.

One possibility is that the difference is because of big CJK
charset maps loaded while creating emacs from temacs.  Just
before dumping, loadup.el calls `clear-charset-maps' which
sets internal vectors and char-tables for charsets to nil,
but the following call of `garbage-collect' doesn't return
those free memory.

I'll try to convert all encodings of language/*.el files to
utf-8 so that Emacs doesn't have to load charset maps in
loadup.el.

---
Kenichi Handa
handa@m17n.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-10-17  1:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11 16:13 unicode merge failures 2007-10-12 Miles Bader
2007-10-11 22:35 ` Jason Rumney
2007-10-12  1:04   ` Stefan Monnier
2007-10-12  4:05     ` Stefan Monnier
2007-10-12 17:43       ` Stefan Monnier
2007-10-12 21:30         ` Dan Nicolaescu
2007-10-12 21:51           ` Miles Bader
2007-10-12 22:12             ` Dan Nicolaescu
2007-10-16 23:04               ` James Cloos
2007-10-17  0:04               ` Andreas Schwab
2007-10-17  1:04               ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).