]> code.delx.au - gnu-emacs/blobdiff - src/nsselect.m
* lisp/menu-bar.el (menu-bar-games-menu): Add landmark.
[gnu-emacs] / src / nsselect.m
index 4a7729d12d53ce7f8c63b4b1a96f37a7d5dd1022..e4f5f0c613e276423a55c5390359235bcedab960 100644 (file)
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep / MacOSX Cocoa selection processing for emacs.
-   Copyright (C) 1993, 1994, 2005, 2006, 2008
+   Copyright (C) 1993, 1994, 2005, 2006, 2008, 2009, 2010
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -25,7 +25,11 @@ MacOSX/Aqua port by Christophe de Dinechin (descubes@earthlink.net)
 GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 */
 
+/* This should be the first include, as it may set up #defines affecting
+   interpretation of even the system includes. */
 #include "config.h"
+#include <setjmp.h>
+
 #include "lisp.h"
 #include "nsterm.h"
 #include "termhooks.h"
@@ -39,11 +43,6 @@ static Lisp_Object Vns_lost_selection_hooks;
 static Lisp_Object Vselection_alist;
 static Lisp_Object Vselection_converter_alist;
 
-/* 23: new */
-/* Coding system for communicating with other programs. */
-static Lisp_Object Vselection_coding_system;
-/* Coding system for the next communicating with other programs. */
-static Lisp_Object Vnext_selection_coding_system;
 static Lisp_Object Qforeign_selection;
 
 NSString *NXSecondaryPboard;
@@ -64,7 +63,7 @@ symbol_to_nsstring (Lisp_Object sym)
   if (EQ (sym, QPRIMARY))     return NSGeneralPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
   if (EQ (sym, QTEXT))        return NSStringPboardType;
-  return [NSString stringWithUTF8String: XSTRING (XSYMBOL (sym)->xname)->data];
+  return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)];
 }
 
 
@@ -115,7 +114,7 @@ clean_local_selection_data (Lisp_Object obj)
         return clean_local_selection_data (AREF (obj, 0));
       copy = Fmake_vector (make_number (size), Qnil);
       for (i = 0; i < size; i++)
-        AREF (copy, i) = clean_local_selection_data (AREF (obj, i));
+        ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
       return copy;
     }
 
@@ -152,7 +151,7 @@ ns_string_to_pasteboard_internal (id pb, Lisp_Object str, NSString *gtype)
 
       CHECK_STRING (str);
 
-      utfStr = XSTRING (str)->data;
+      utfStr = SDATA (str);
       nsStr = [NSString stringWithUTF8String: utfStr];
 
       if (gtype == nil)
@@ -373,8 +372,12 @@ ns_string_to_pasteboard (id pb, Lisp_Object str)
    ========================================================================== */
 
 
-DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
-       Sns_own_selection_internal, 2, 2, 0, "Assert a selection.")
+DEFUN ("x-own-selection-internal", Fx_own_selection_internal,
+       Sx_own_selection_internal, 2, 2, 0,
+       doc: /* Assert a selection.
+SELECTION-NAME is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+VALUE is typically a string, or a cons of two markers, but may be
+anything that the functions on `selection-converter-alist' know about.  */)
      (selection_name, selection_value)
      Lisp_Object selection_name, selection_value;
 {
@@ -407,9 +410,9 @@ DEFUN ("ns-own-selection-internal", Fns_own_selection_internal,
 }
 
 
-DEFUN ("ns-disown-selection-internal", Fns_disown_selection_internal,
-       Sns_disown_selection_internal, 1, 2, 0,
-       "If we own the selection SELECTION, disown it.")
+DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
+       Sx_disown_selection_internal, 1, 2, 0,
+       doc: /* If we own the selection SELECTION, disown it.  */)
      (selection_name, time)
      Lisp_Object selection_name, time;
 {
@@ -424,13 +427,13 @@ DEFUN ("ns-disown-selection-internal", Fns_disown_selection_internal,
 }
 
 
-DEFUN ("ns-selection-exists-p", Fns_selection_exists_p, Sns_selection_exists_p,
-       0, 1, 0, "Whether there is an owner for the given selection.\n\
-The arg should be the name of the selection in question, typically one of\n\
-the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.\n\
-\(Those are literal upper-case symbol names.)\n\
-For convenience, the symbol nil is the same as `PRIMARY',\n\
-and t is the same as `SECONDARY'.)")
+DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
+       0, 1, 0, doc: /* Whether there is an owner for the given selection.
+The arg should be the name of the selection in question, typically one of
+the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names.)
+For convenience, the symbol nil is the same as `PRIMARY',
+and t is the same as `SECONDARY'.)  */)
      (selection)
      Lisp_Object selection;
 {
@@ -447,14 +450,14 @@ and t is the same as `SECONDARY'.)")
 }
 
 
-DEFUN ("ns-selection-owner-p", Fns_selection_owner_p, Sns_selection_owner_p,
+DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
        0, 1, 0,
-       "Whether the current Emacs process owns the given selection.\n\
-The arg should be the name of the selection in question, typically one of\n\
-the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.\n\
-\(Those are literal upper-case symbol names.)\n\
-For convenience, the symbol nil is the same as `PRIMARY',\n\
-and t is the same as `SECONDARY'.)")
+       doc: /* Whether the current Emacs process owns the given selection.
+The arg should be the name of the selection in question, typically one of
+the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names.)
+For convenience, the symbol nil is the same as `PRIMARY',
+and t is the same as `SECONDARY'.)  */)
      (selection)
      Lisp_Object selection;
 {
@@ -466,12 +469,12 @@ and t is the same as `SECONDARY'.)")
 }
 
 
-DEFUN ("ns-get-selection-internal", Fns_get_selection_internal,
-       Sns_get_selection_internal, 2, 2, 0,
-       "Return text selected from some pasteboard.\n\
-SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.\n\
-\(Those are literal upper-case symbol names.)\n\
-TYPE is the type of data desired, typically `STRING'.")
+DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
+       Sx_get_selection_internal, 2, 2, 0,
+       doc: /* Return text selected from some pasteboard.
+SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
+\(Those are literal upper-case symbol names.)
+TYPE is the type of data desired, typically `STRING'.  */)
      (selection_name, target_type)
      Lisp_Object selection_name, target_type;
 {
@@ -497,7 +500,7 @@ TYPE is the type of data desired, typically `STRING'.")
 #ifdef CUT_BUFFER_SUPPORT
 DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal,
        Sns_get_cut_buffer_internal, 1, 1, 0,
-       "Returns the value of the named cut buffer.")
+       doc: /* Returns the value of the named cut buffer.  */)
      (buffer)
      Lisp_Object buffer;
 {
@@ -510,8 +513,9 @@ DEFUN ("ns-get-cut-buffer-internal", Fns_get_cut_buffer_internal,
 
 DEFUN ("ns-rotate-cut-buffers-internal", Fns_rotate_cut_buffers_internal,
        Sns_rotate_cut_buffers_internal, 1, 1, 0,
-       "Rotate the values of the cut buffers by the given number of steps;\n\
- positive means move values forward, negative means backward. CURRENTLY NOT IMPLEMENTED UNDER NeXTstep.")
+       doc: /* Rotate the values of the cut buffers by N steps.
+Positive N means move values forward, negative means
+backward. CURRENTLY NOT IMPLEMENTED UNDER NEXTSTEP. */ )
      (n)
      Lisp_Object n;
 {
@@ -524,7 +528,7 @@ DEFUN ("ns-rotate-cut-buffers-internal", Fns_rotate_cut_buffers_internal,
 
 DEFUN ("ns-store-cut-buffer-internal", Fns_store_cut_buffer_internal,
        Sns_store_cut_buffer_internal, 2, 2, 0,
-       "Sets the value of the named cut buffer (typically CUT_BUFFER0).")
+       doc: /* Sets the value of the named cut buffer (typically CUT_BUFFER0).  */)
      (buffer, string)
      Lisp_Object buffer, string;
 {
@@ -551,11 +555,11 @@ syms_of_nsselect (void)
   QTEXT      = intern ("TEXT");        staticpro (&QTEXT);
   QFILE_NAME = intern ("FILE_NAME");   staticpro (&QFILE_NAME);
 
-  defsubr (&Sns_disown_selection_internal);
-  defsubr (&Sns_get_selection_internal);
-  defsubr (&Sns_own_selection_internal);
-  defsubr (&Sns_selection_exists_p);
-  defsubr (&Sns_selection_owner_p);
+  defsubr (&Sx_disown_selection_internal);
+  defsubr (&Sx_get_selection_internal);
+  defsubr (&Sx_own_selection_internal);
+  defsubr (&Sx_selection_exists_p);
+  defsubr (&Sx_selection_owner_p);
 #ifdef CUT_BUFFER_SUPPORT
   defsubr (&Sns_get_cut_buffer_internal);
   defsubr (&Sns_rotate_cut_buffers_internal);
@@ -602,26 +606,8 @@ The functions are called with one argument, the selection type\n\
 \(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD').");
   Vns_lost_selection_hooks = Qnil;
 
-/* 23: { */
-  DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
-              doc: /* Coding system for communicating with other programs.
-When sending or receiving text via cut_buffer, selection, and clipboard,
-the text is encoded or decoded by this coding system.
-The default value is determined by the system script code.  */);
-  Vselection_coding_system = Qnil;
-
-  DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
-              doc: /* Coding system for the next communication with other programs.
-Usually, `selection-coding-system' is used for communicating with
-other programs.  But, if this variable is set, it is used for the
-next communication only.  After the communication, this variable is
-set to nil.  */);
-  Vnext_selection_coding_system = Qnil;
-
   Qforeign_selection = intern ("foreign-selection");
   staticpro (&Qforeign_selection);
-/* } */
-
 }
 
 // arch-tag: 39d1dde7-06a6-49ff-95a7-0e7af12d2218