From 805e288178ce2b96dd4a0277b49904131853e8fe Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 27 May 2026 15:44:21 -0500 Subject: feat(commands): add pearl-copy-issue-url, bound at u c I added pearl-copy-issue-url. It copies the Linear URL of the issue at point to the kill ring and the system clipboard, reading the stored LINEAR-URL drawer property so there's no network call, and works from anywhere inside the issue subtree. kill-new carries it to the clipboard through interprogram-cut-function, so nothing shells out to a clipboard tool. Bound at u c in the url group, beside u o (open in browser). --- tests/test-pearl-open.el | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests/test-pearl-open.el') diff --git a/tests/test-pearl-open.el b/tests/test-pearl-open.el index 1be6114..f01ecd3 100644 --- a/tests/test-pearl-open.el +++ b/tests/test-pearl-open.el @@ -62,5 +62,29 @@ (test-pearl--in-org "plain text, no heading\n" (should-error (pearl-open-current-issue) :type 'user-error))) +;;; pearl-copy-issue-url + +(ert-deftest test-pearl-copy-issue-url-copies-to-kill-ring () + "The command copies the heading's LINEAR-URL to the kill ring." + (let ((kill-ring nil)) + (test-pearl--in-org + "*** TODO Title\n:PROPERTIES:\n:LINEAR-ID: a\n:LINEAR-URL: https://linear.app/x/ENG-1\n:END:\nbody\n" + (goto-char (point-max)) + (pearl-copy-issue-url) + (should (string= "https://linear.app/x/ENG-1" (car kill-ring)))))) + +(ert-deftest test-pearl-copy-issue-url-no-url-errors () + "An issue heading without a LINEAR-URL signals a user error, nothing copied." + (let ((kill-ring nil)) + (test-pearl--in-org + "*** TODO Title\n:PROPERTIES:\n:LINEAR-ID: a\n:END:\n" + (should-error (pearl-copy-issue-url) :type 'user-error) + (should-not kill-ring)))) + +(ert-deftest test-pearl-copy-issue-url-not-on-issue-errors () + "Running outside a heading signals a user error." + (test-pearl--in-org "plain text, no heading\n" + (should-error (pearl-copy-issue-url) :type 'user-error))) + (provide 'test-pearl-open) ;;; test-pearl-open.el ends here -- cgit v1.2.3