[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104418: Move clipboard-manager funct
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104418: Move clipboard-manager functionality out of hooks. |
Date: |
Sat, 28 May 2011 20:45:00 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104418
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2011-05-28 20:45:00 -0400
message:
Move clipboard-manager functionality out of hooks.
* lisp/select.el: Don't perform clipboard-manager saving in hooks;
leave the hooks empty.
* src/emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
* src/frame.c (delete_frame): Call x_clipboard_manager_save_frame.
* src/xselect.c (x_clipboard_manager_save_frame)
(x_clipboard_manager_save_all): New functions.
(Fx_clipboard_manager_save): Lisp function deleted.
* src/xterm.h: Update prototype.
modified:
etc/NEWS
lisp/ChangeLog
lisp/select.el
src/ChangeLog
src/emacs.c
src/frame.c
src/xselect.c
src/xterm.h
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2011-05-28 22:56:14 +0000
+++ b/etc/NEWS 2011-05-29 00:45:00 +0000
@@ -177,6 +177,8 @@
Emacs.pane.menubar.font: Courier-12
** On graphical displays, the mode-line no longer ends in dashes.
+Also, the first dash (which does not indicate anything) is just
+displayed as a space.
** On Nextstep/OSX, the menu bar can be hidden by customizing
ns-auto-hide-menu-bar.
@@ -386,6 +388,8 @@
*** Support for X cut buffers has been removed.
+*** Support for X clipboard managers has been added.
+
** New command `rectangle-number-lines', bound to `C-x r N', numbers
the lines in the current rectangle. With an prefix argument, this
prompts for a number to count from and for a format string.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-05-28 23:43:11 +0000
+++ b/lisp/ChangeLog 2011-05-29 00:45:00 +0000
@@ -1,3 +1,8 @@
+2011-05-29 Chong Yidong <address@hidden>
+
+ * select.el: Don't perform clipboard-manager saving in hooks;
+ leave the hooks empty.
+
2011-05-28 Leo Liu <address@hidden>
* replace.el (occur-menu-map, occur-edit-mode-map): New vars.
=== modified file 'lisp/select.el'
--- a/lisp/select.el 2011-05-27 16:17:59 +0000
+++ b/lisp/select.el 2011-05-29 00:45:00 +0000
@@ -395,10 +395,6 @@
(SAVE_TARGETS . xselect-convert-to-save-targets)
(_EMACS_INTERNAL . xselect-convert-to-identity)))
-(when (fboundp 'x-clipboard-manager-save)
- (add-hook 'delete-frame-functions 'x-clipboard-manager-save)
- (add-hook 'kill-emacs-hook 'x-clipboard-manager-save))
-
(provide 'select)
;;; select.el ends here
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-05-28 16:56:53 +0000
+++ b/src/ChangeLog 2011-05-29 00:45:00 +0000
@@ -1,3 +1,14 @@
+2011-05-29 Chong Yidong <address@hidden>
+
+ * xselect.c (x_clipboard_manager_save_frame)
+ (x_clipboard_manager_save_all): New functions.
+ (Fx_clipboard_manager_save): Lisp function deleted.
+
+ * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
+ * frame.c (delete_frame): Call x_clipboard_manager_save_frame.
+
+ * xterm.h: Update prototype.
+
2011-05-28 William Xu <address@hidden>
* nsterm.m (ns_term_shutdown): Synchronize user defaults before
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2011-05-04 14:03:16 +0000
+++ b/src/emacs.c 2011-05-29 00:45:00 +0000
@@ -1959,6 +1959,11 @@
xfree (priority);
}
+#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 @@
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,
=== modified file 'src/frame.c'
--- a/src/frame.c 2011-05-12 20:23:33 +0000
+++ b/src/frame.c 2011-05-29 00:45:00 +0000
@@ -1347,7 +1347,14 @@
= Fcons (list3 (Qrun_hook_with_args, Qdelete_frame_functions, frame),
pending_funcalls);
else
- safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
+ {
+#ifdef HAVE_X_WINDOWS
+ /* Also, save clipboard to the the clipboard manager. */
+ x_clipboard_manager_save_frame (frame);
+#endif
+
+ safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
+ }
/* The hook may sometimes (indirectly) cause the frame to be deleted. */
if (! FRAME_LIVE_P (f))
=== modified file 'src/xselect.c'
--- a/src/xselect.c 2011-05-27 19:39:18 +0000
+++ b/src/xselect.c 2011-05-29 00:45:00 +0000
@@ -2107,6 +2107,7 @@
return (owner ? Qt : Qnil);
}
+
/* Send the clipboard manager a SAVE_TARGETS request with a
UTF8_STRING property, as described by
http://www.freedesktop.org/wiki/ClipboardManager */
@@ -2126,54 +2127,53 @@
Qnil, frame);
}
-DEFUN ("x-clipboard-manager-save", Fx_clipboard_manager_save,
- Sx_clipboard_manager_save, 0, 1, 0,
- doc: /* Save the clipboard contents to the clipboard manager.
-This function is intended to run from `delete-frame-functions' and
-`kill-emacs-hook', to transfer clipboard data owned by Emacs to a
-clipboard manager prior to deleting a frame or killing Emacs.
-
-FRAME specifies a frame owning a clipboard; do nothing if FRAME does
-not own the clipboard, or if no clipboard manager is present. If
-FRAME is nil, save all clipboard contents owned by Emacs. */)
- (Lisp_Object frame)
-{
- if (FRAMEP (frame))
- {
- struct frame *f = XFRAME (frame);
- if (FRAME_LIVE_P (f) && FRAME_X_P (f))
- {
- struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- Lisp_Object local_selection
- = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
-
- if (!NILP (local_selection)
- && EQ (frame, XCAR (XCDR (XCDR (XCDR (local_selection)))))
- && XGetSelectionOwner (dpyinfo->display,
- dpyinfo->Xatom_CLIPBOARD_MANAGER))
- x_clipboard_manager_save (dpyinfo, frame);
- }
- }
- else if (NILP (frame))
- {
- /* Loop through all X displays, saving owned clipboards. */
- struct x_display_info *dpyinfo;
- Lisp_Object local_selection, local_frame;
- for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
- {
- local_selection = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
- if (NILP (local_selection)
- || !XGetSelectionOwner (dpyinfo->display,
- dpyinfo->Xatom_CLIPBOARD_MANAGER))
- continue;
-
- local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
- if (FRAME_LIVE_P (XFRAME (local_frame)))
- x_clipboard_manager_save (dpyinfo, local_frame);
- }
- }
-
- return Qnil;
+/* Called from delete_frame: save any clipboard owned by FRAME to the
+ clipboard manager. Do nothing if FRAME does not own the clipboard,
+ or if no clipboard manager is present. */
+
+void
+x_clipboard_manager_save_frame (Lisp_Object frame)
+{
+ struct frame *f;
+
+ if (FRAMEP (frame)
+ && (f = XFRAME (frame), FRAME_X_P (f))
+ && FRAME_LIVE_P (f))
+ {
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Lisp_Object local_selection
+ = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
+
+ if (!NILP (local_selection)
+ && EQ (frame, XCAR (XCDR (XCDR (XCDR (local_selection)))))
+ && XGetSelectionOwner (dpyinfo->display,
+ dpyinfo->Xatom_CLIPBOARD_MANAGER))
+ x_clipboard_manager_save (dpyinfo, frame);
+ }
+}
+
+/* Called from Fkill_emacs: save any clipboard owned by FRAME to the
+ clipboard manager. Do nothing if FRAME does not own the clipboard,
+ or if no clipboard manager is present. */
+
+void
+x_clipboard_manager_save_all (void)
+{
+ /* Loop through all X displays, saving owned clipboards. */
+ struct x_display_info *dpyinfo;
+ Lisp_Object local_selection, local_frame;
+ for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+ {
+ local_selection = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
+ if (NILP (local_selection)
+ || !XGetSelectionOwner (dpyinfo->display,
+ dpyinfo->Xatom_CLIPBOARD_MANAGER))
+ continue;
+
+ local_frame = XCAR (XCDR (XCDR (XCDR (local_selection))));
+ if (FRAME_LIVE_P (XFRAME (local_frame)))
+ x_clipboard_manager_save (dpyinfo, local_frame);
+ }
}
@@ -2586,7 +2586,6 @@
defsubr (&Sx_disown_selection_internal);
defsubr (&Sx_selection_owner_p);
defsubr (&Sx_selection_exists_p);
- defsubr (&Sx_clipboard_manager_save);
defsubr (&Sx_get_atom_name);
defsubr (&Sx_send_client_message);
=== modified file 'src/xterm.h'
--- a/src/xterm.h 2011-05-27 16:17:59 +0000
+++ b/src/xterm.h 2011-05-29 00:45:00 +0000
@@ -1024,6 +1024,7 @@
Atom,
int,
unsigned long);
+extern void x_clipboard_manager_save_frame (Lisp_Object);
/* Defined in xfns.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104418: Move clipboard-manager functionality out of hooks.,
Chong Yidong <=