* src/profiler.c: Delete.
[bpt/emacs.git] / src / nsselect.m
index bb9eacd..da1b955 100644 (file)
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep / MacOSX Cocoa selection processing for emacs.
-   Copyright (C) 1993-1994, 2005-2006, 2008-2013 Free Software
+   Copyright (C) 1993-1994, 2005-2006, 2008-2014 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -182,14 +182,13 @@ ns_get_local_selection (Lisp_Object selection_name,
                        Lisp_Object target_type)
 {
   Lisp_Object local_value;
-  Lisp_Object handler_fn, value, type, check;
-  ptrdiff_t count;
+  Lisp_Object handler_fn, value, check;
 
   local_value = assq_no_quit (selection_name, Vselection_alist);
 
   if (NILP (local_value)) return Qnil;
 
-  count = specpdl_ptr - specpdl;
+  dynwind_begin ();
   specbind (Qinhibit_quit, Qt);
   CHECK_SYMBOL (target_type);
   handler_fn = Fcdr (Fassq (target_type, Vselection_converter_alist));
@@ -198,12 +197,11 @@ ns_get_local_selection (Lisp_Object selection_name,
                 XCAR (XCDR (local_value)));
   else
     value = Qnil;
-  unbind_to (count, Qnil);
+  dynwind_end ();
 
   check = value;
   if (CONSP (value) && SYMBOLP (XCAR (value)))
     {
-      type = XCAR (value);
       check = XCDR (value);
     }
 
@@ -220,9 +218,10 @@ ns_get_local_selection (Lisp_Object selection_name,
     return value;
 
   // FIXME: Why `quit' rather than `error'?
-  Fsignal (Qquit, Fcons (build_string (
-      "invalid data returned by selection-conversion function"),
-                        Fcons (handler_fn, Fcons (value, Qnil))));
+  Fsignal (Qquit,
+          list3 (build_string ("invalid data returned by"
+                               " selection-conversion function"),
+                 handler_fn, value));
   // FIXME: Beware, `quit' can return!!
   return Qnil;
 }
@@ -256,10 +255,7 @@ ns_string_from_pasteboard (id pb)
   type = [pb availableTypeFromArray: ns_return_types];
   if (type == nil)
     {
-      Fsignal (Qquit,
-              Fcons (build_string ("empty or unsupported pasteboard type"),
-                    Qnil));
-    return Qnil;
+      return Qnil;
     }
 
   /* get the string */
@@ -275,9 +271,6 @@ ns_string_from_pasteboard (id pb)
         }
       else
         {
-          Fsignal (Qquit,
-                  Fcons (build_string ("pasteboard doesn't contain valid data"),
-                        Qnil));
           return Qnil;
         }
     }
@@ -357,13 +350,13 @@ On Nextstep, FRAME is unused.  */)
   check_window_system (NULL);
   CHECK_SYMBOL (selection);
   if (NILP (value))
-      error ("selection value may not be nil.");
+    error ("Selection value may not be nil");
   pb = ns_symbol_to_pb (selection);
   if (pb == nil) return Qnil;
 
   ns_declare_pasteboard (pb);
   old_value = assq_no_quit (selection, Vselection_alist);
-  new_value = Fcons (selection, Fcons (value, Qnil));
+  new_value = list2 (selection, value);
 
   if (NILP (old_value))
     Vselection_alist = Fcons (new_value, Vselection_alist);
@@ -435,7 +428,9 @@ On Nextstep, TERMINAL is unused.  */)
   id pb;
   NSArray *types;
 
-  check_window_system (NULL);
+  if (!window_system_available (NULL))
+    return Qnil;
+
   CHECK_SYMBOL (selection);
   if (EQ (selection, Qnil)) selection = QPRIMARY;
   if (EQ (selection, Qt)) selection = QSECONDARY;
@@ -545,19 +540,13 @@ nxatoms_of_nsselect (void)
 void
 syms_of_nsselect (void)
 {
+#include "nsselect.x"
+
   QCLIPBOARD = intern_c_string ("CLIPBOARD");  staticpro (&QCLIPBOARD);
   QSECONDARY = intern_c_string ("SECONDARY");  staticpro (&QSECONDARY);
   QTEXT      = intern_c_string ("TEXT");       staticpro (&QTEXT);
   QFILE_NAME = intern_c_string ("FILE_NAME");  staticpro (&QFILE_NAME);
 
-  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);
-  defsubr (&Sns_get_selection_internal);
-  defsubr (&Sns_store_selection_internal);
-
   Vselection_alist = Qnil;
   staticpro (&Vselection_alist);