From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: unicode merge failures 2007-10-12 Date: Thu, 11 Oct 2007 12:13:52 -0400 Message-ID: <61d4vlaatb.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1192119297 3905 80.91.229.12 (11 Oct 2007 16:14:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 11 Oct 2007 16:14:57 +0000 (UTC) Cc: emacs-devel@gnu.org To: emacs-unicode@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 11 18:14:55 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ig0g5-0004rX-RJ for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 18:14:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ig0fz-0001Am-Cx for ged-emacs-devel@m.gmane.org; Thu, 11 Oct 2007 12:14:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ig0fv-0001AF-C9 for emacs-devel@gnu.org; Thu, 11 Oct 2007 12:14:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ig0fr-00019s-P2 for emacs-devel@gnu.org; Thu, 11 Oct 2007 12:14:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ig0fr-00019p-LW for emacs-devel@gnu.org; Thu, 11 Oct 2007 12:14:11 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ig0fr-0000zA-9B; Thu, 11 Oct 2007 12:14:11 -0400 Original-Received: from miles by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1Ig0fZ-0000ux-22; Thu, 11 Oct 2007 12:13:53 -0400 System-Type: x86_64-unknown-linux-gnu Blat: Foop X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80629 Archived-At: 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; } @@ -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))))) -;;; 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) + + +;;;; 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)