Update FSF's address.
[bpt/emacs.git] / src / macselect.c
index 49246f7..b519950 100644 (file)
@@ -15,8 +15,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
 
@@ -98,8 +98,10 @@ static Lisp_Object Vselection_converter_alist;
    selection type with a scrap flavor type via `mac-ostype'.  */
 static Lisp_Object Qmac_scrap_name, Qmac_ostype;
 
+#ifdef MAC_OSX
 /* Selection name for communication via Services menu.  */
 static Lisp_Object Vmac_services_selection;
+#endif
 \f
 /* Get a reference to the scrap corresponding to the symbol SYM.  The
    reference is set to *SCRAP, and it becomes NULL if there's no
@@ -455,9 +457,11 @@ x_own_selection (selection_name, selection_value)
            value = call3 (handler_fn, selection_name,
                           type, selection_value);
 
-         if (CONSP (value)
-             && EQ (XCAR (value), type)
-             && STRINGP (XCDR (value)))
+         if (STRINGP (value))
+           err = put_scrap_string (scrap, type, value);
+         else if (CONSP (value)
+                  && EQ (XCAR (value), type)
+                  && STRINGP (XCDR (value)))
            err = put_scrap_string (scrap, type, XCDR (value));
        }
 
@@ -622,7 +626,8 @@ x_clear_frame_selections (f)
       hooks = Vx_lost_selection_functions;
       selection_symbol = Fcar (Fcar (Vselection_alist));
 
-      if (!EQ (hooks, Qunbound))
+      if (!EQ (hooks, Qunbound)
+         && !NILP (Fx_selection_owner_p (selection_symbol)))
        {
          for (; CONSP (hooks); hooks = Fcdr (hooks))
            call1 (Fcar (hooks), selection_symbol);
@@ -646,7 +651,8 @@ x_clear_frame_selections (f)
        hooks = Vx_lost_selection_functions;
        selection_symbol = Fcar (Fcar (XCDR (rest)));
 
-       if (!EQ (hooks, Qunbound))
+       if (!EQ (hooks, Qunbound)
+         && !NILP (Fx_selection_owner_p (selection_symbol)))
          {
            for (; CONSP (hooks); hooks = Fcdr (hooks))
              call1 (Fcar (hooks), selection_symbol);
@@ -1098,9 +1104,11 @@ next communication only.  After the communication, this variable is
 set to nil.  */);
   Vnext_selection_coding_system = Qnil;
 
+#ifdef MAC_OSX
   DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection,
               doc: /* Selection name for communication via Services menu.  */);
-  Vmac_services_selection = intern ("CLIPBOARD");
+  Vmac_services_selection = intern ("PRIMARY");
+#endif
 
   QPRIMARY   = intern ("PRIMARY");     staticpro (&QPRIMARY);
   QSECONDARY = intern ("SECONDARY");   staticpro (&QSECONDARY);