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

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).