From 9f0209543318c331c5a4051750ea817370d234f6 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 24 Jan 2019 19:59:26 -0500 Subject: transport: Let caller overwrite previous description The existing description may not be of interest to the caller, especially if it was automatically generated by org-store-link. --- test-org-link-edit.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'test-org-link-edit.el') diff --git a/test-org-link-edit.el b/test-org-link-edit.el index 0980aca..0f63306 100644 --- a/test-org-link-edit.el +++ b/test-org-link-edit.el @@ -578,12 +578,26 @@ website" (org-link-edit-transport-next-link nil (point-min) (point))) :type 'user-error) - ;; Fail if link already has a description. + ;; Fail if link already has a description, unless caller confirms + ;; the overwrite. + (should-error + (org-test-with-temp-text + "Here is Org's website \[\[http://orgmode.org/\]\[description\]\]" + (cl-letf (((symbol-function 'y-or-n-p) (lambda (_) nil))) + (call-interactively #'org-link-edit-transport-next-link))) + :type 'user-error) (should-error (org-test-with-temp-text "Here is Org's website \[\[http://orgmode.org/\]\[description\]\]" (org-link-edit-transport-next-link)) - :type 'user-error)) + :type 'user-error) + (should + (string= + "Here is \[\[http://orgmode.org/\]\[Org's\]\] website " + (org-test-with-temp-text + "Here is Org's website \[\[http://orgmode.org/\]\[description\]\]" + (org-link-edit-transport-next-link nil nil nil 'overwrite) + (buffer-string))))) ;;; Other -- cgit v1.2.3