Move clipboard-manager functionality out of hooks.
[bpt/emacs.git] / src / emacs.c
index 8c4490b..090fdda 100644 (file)
@@ -1959,6 +1959,11 @@ sort_args (int argc, char **argv)
   xfree (priority);
 }
 \f
+#ifdef HAVE_X_WINDOWS
+/* Defined in xselect.c.  */
+extern void x_clipboard_manager_save_all (void);
+#endif
+
 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
        doc: /* Exit the Emacs job and kill it.
 If ARG is an integer, return ARG as the exit program code.
@@ -1985,6 +1990,11 @@ all of which are called before Emacs is actually killed.  */)
 
   UNGCPRO;
 
+#ifdef HAVE_X_WINDOWS
+  /* Transfer any clipboards we own to the clipboard manager.  */
+  x_clipboard_manager_save_all ();
+#endif
+
   shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
 
   /* If we have an auto-save list file,