emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xselect.c [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/xselect.c [lexbind]
Date: Tue, 14 Oct 2003 19:23:34 -0400

Index: emacs/src/xselect.c
diff -c emacs/src/xselect.c:1.119.2.1 emacs/src/xselect.c:1.119.2.2
*** emacs/src/xselect.c:1.119.2.1       Fri Apr  4 01:21:09 2003
--- emacs/src/xselect.c Tue Oct 14 19:22:51 2003
***************
*** 29,38 ****
  #include "frame.h"    /* Need this to get the X window of selected_frame */
  #include "blockinput.h"
  #include "buffer.h"
- #include "charset.h"
- #include "coding.h"
  #include "process.h"
- #include "composite.h"
  
  struct prop_location;
  
--- 29,35 ----
***************
*** 114,119 ****
--- 111,118 ----
  /* Coding system for the next communicating with other X clients.  */
  static Lisp_Object Vnext_selection_coding_system;
  
+ static Lisp_Object Qforeign_selection;
+ 
  /* If this is a smaller number than the max-request-size of the display,
     emacs will use INCR selection transfer when the selection is larger
     than this.  The max-request-size is usually around 64k, so if you want
***************
*** 425,430 ****
--- 424,432 ----
  
        CHECK_SYMBOL (target_type);
        handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
+       /* gcpro is not needed here since nothing but HANDLER_FN
+        is live, and that ought to be a symbol.  */
+ 
        if (!NILP (handler_fn))
        value = call3 (handler_fn,
                       selection_symbol, (local_request ? Qnil : target_type),
***************
*** 837,844 ****
  
   DONE:
  
-   UNGCPRO;
- 
    /* Let random lisp code notice that the selection has been asked for.  */
    {
      Lisp_Object rest;
--- 839,844 ----
***************
*** 847,852 ****
--- 847,854 ----
        for (; CONSP (rest); rest = Fcdr (rest))
        call3 (Fcar (rest), selection_symbol, target_symbol, successful_p);
    }
+ 
+   UNGCPRO;
  }
  
  /* Handle a SelectionClear event EVENT, which indicates that some
***************
*** 1602,1675 ****
    /* Convert any 8-bit data to a string, for compactness.  */
    else if (format == 8)
      {
!       Lisp_Object str;
!       int require_encoding = 0;
  
!       if (
! #if 1
!         1
! #else
!         ! NILP (buffer_defaults.enable_multibyte_characters)
! #endif
!         )
!       {
!         /* If TYPE is `TEXT' or `COMPOUND_TEXT', we should decode
!            DATA to Emacs internal format because DATA may be encoded
!            in compound text format.  In addtion, if TYPE is `STRING'
!            and DATA contains any 8-bit Latin-1 code, we should also
!            decode it.  */
!         if (type == dpyinfo->Xatom_TEXT
!             || type == dpyinfo->Xatom_COMPOUND_TEXT)
!           require_encoding = 1;
!         else if (type == XA_STRING)
!           {
!             int i;
!             for (i = 0; i < size; i++)
!               {
!                 if (data[i] >= 0x80)
!                   {
!                     require_encoding = 1;
!                     break;
!                   }
!               }
!           }
!       }
!       if (!require_encoding)
!       {
!         str = make_unibyte_string ((char *) data, size);
!         Vlast_coding_system_used = Qraw_text;
!       }
        else
!       {
!         int bufsize;
!         unsigned char *buf;
!         struct coding_system coding;
! 
!         if (NILP (Vnext_selection_coding_system))
!           Vnext_selection_coding_system = Vselection_coding_system;
!         setup_coding_system
!           (Fcheck_coding_system(Vnext_selection_coding_system), &coding);
!         coding.src_multibyte = 0;
!         coding.dst_multibyte = 1;
!         Vnext_selection_coding_system = Qnil;
!           coding.mode |= CODING_MODE_LAST_BLOCK;
!         /* We explicitely disable composition handling because
!            selection data should not contain any composition
!            sequence.  */
!         coding.composing = COMPOSITION_DISABLED;
!         bufsize = decoding_buffer_size (&coding, size);
!         buf = (unsigned char *) xmalloc (bufsize);
!         decode_coding (&coding, data, buf, size, bufsize);
!         str = make_string_from_bytes ((char *) buf,
!                                       coding.produced_char, coding.produced);
!         xfree (buf);
! 
!         if (SYMBOLP (coding.post_read_conversion)
!             && !NILP (Ffboundp (coding.post_read_conversion)))
!           str = run_pre_post_conversion_on_str (str, &coding, 0);
!         Vlast_coding_system_used = coding.symbol;
!       }
!       compose_chars_in_text (0, SCHARS (str), str);
        return str;
      }
    /* Convert a single atom to a Lisp_Symbol.  Convert a set of atoms to
--- 1604,1624 ----
    /* Convert any 8-bit data to a string, for compactness.  */
    else if (format == 8)
      {
!       Lisp_Object str, lispy_type;
  
!       str = make_unibyte_string ((char *) data, size);
!       /* Indicate that this string is from foreign selection by a text
!        property `foreign-selection' so that the caller of
!        x-get-selection-internal (usually x-get-selection) can know
!        that the string must be decode.  */
!       if (type == dpyinfo->Xatom_COMPOUND_TEXT)
!       lispy_type = QCOMPOUND_TEXT;
!       else if (type == dpyinfo->Xatom_UTF8_STRING)
!       lispy_type = QUTF8_STRING;
        else
!       lispy_type = QSTRING;
!       Fput_text_property (make_number (0), make_number (size),
!                         Qforeign_selection, lispy_type, str);
        return str;
      }
    /* Convert a single atom to a Lisp_Symbol.  Convert a set of atoms to
***************
*** 2448,2451 ****
--- 2397,2405 ----
    QCUT_BUFFER7 = intern ("CUT_BUFFER7"); staticpro (&QCUT_BUFFER7);
  #endif
  
+   Qforeign_selection = intern ("foreign-selection");
+   staticpro (&Qforeign_selection);
  }
+ 
+ /* arch-tag: 7c293b0f-9918-4f69-8ac7-03e142307236
+    (do not change this comment) */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]