branch: externals/gpastel commit 184539c5345135d2c3c23b0db3f78175bf163b4b Merge: 6241ad0 c32e57f Author: Damien Cassou <dam...@cassou.me> Commit: GitHub <nore...@github.com>
Merge pull request #3 from clemera/master Add `gpastel-update-hook` --- gpastel.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gpastel.el b/gpastel.el index 97efd58..a2afb0a 100644 --- a/gpastel.el +++ b/gpastel.el @@ -57,6 +57,14 @@ :type 'string :group 'gpastel) +(defcustom gpastel-update-hook nil + "Hook which runs after gpastel added an element to `kill-ring'. + +Hook functions can retrieve the latest entry by accessing the +`car' of `kill-ring'." + :type 'hook + :group 'gpastel) + (defvar gpastel--dbus-object nil "D-Bus object remembering the return value of `dbus-register-signal'. This can be used to unregister from the signal.") @@ -105,7 +113,8 @@ all text in the GPaste clipboard." ;; system clipboard with `interprogram-cut-function' to be ;; saved again to the `kill-ring': (unless (string= copied-text (car kill-ring)) - (kill-new copied-text))))) + (kill-new copied-text) + (run-hooks 'gpastel-update-hook))))) (defun gpastel--start-gpaste-daemon () "(Re)Start GPaste daemon and return non-nil upon success."