[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6] ol.el: add description format parameter to org-link-param

From: Max Nikulin
Subject: Re: [PATCH v6] ol.el: add description format parameter to org-link-parameters
Date: Mon, 18 Jul 2022 17:55:51 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0


I am sorry if I am wrong, but I do not see you among known Org contributors. You patch is likely greater than it is allowed for TINYCHANGE, so before you patch can be committed, copyright assignment should be signed, see https://orgmode.org/worg/org-contribute.html#copyright for details.

On 18/07/2022 03:59, Hugo Heagren wrote:
 From fbe030ad3a2aafd09d491aefb9c56242b7ec669b Mon Sep 17 00:00:00 2001
From: Hugo Heagren<hugo@heagren.com>
Date: Sat, 16 Jul 2022 19:50:15 +0100
Subject: [PATCH] test-ol: tests for insert-description param when inserting

make test-dirty BTEST_RE=test-ol/insert-link-insert-description

selected tests: test-ol/insert-link-insert-description
Running 1 tests (2022-07-18 12:21:46+0200)
Test test-ol/insert-link-insert-description backtrace:
  signal(wrong-type-argument (listp :insert-description))
  apply(signal (wrong-type-argument (listp :insert-description)))
  (setq value-7565 (apply fn-7563 args-7564))
  (unwind-protect (setq value-7565 (apply fn-7563 args-7564)) (setq fo
  (if (unwind-protect (setq value-7565 (apply fn-7563 args-7564)) (set
  (let (form-description-7567) (if (unwind-protect (setq value-7565 (a
  (let ((value-7565 (quote ert-form-evaluation-aborted-7566))) (let (f
  (let* ((fn-7563 (function signal)) (args-7564 (condition-case err (l
  (closure (t) nil (let* ((fn-7563 (function signal)) (args-7564 (cond
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name test-ol/insert-link-insert-descriptio
  ert-run-or-rerun-test(#s(ert--stats :selector "test-ol/insert-link-i
  ert-run-tests("test-ol/insert-link-insert-description" #f(compiled-f
  (let ((org-id-track-globally t) (org-test-selector (if org-test-sele
  eval((org-test-run-batch-tests org-test-select-re))
  command-line-1(("--eval" "(setq vc-handled-backends nil org-startup-
Test test-ol/insert-link-insert-description condition:
    (wrong-type-argument listp :insert-description)
   FAILED  1/1  test-ol/insert-link-insert-description

+(ert-deftest test-ol/insert-link-insert-description ()
+  "Test `:insert-description' parameter handling."
+  ;; String case.

The cases might be improved by using different values, so when particular `should' form fail it is easier to find it in the code

+  (should
+   (string=
+    "foobar"
+    (test-ol-with-link-parameters-as
+        "id" (:insert-description "foobar")

E.g. "foobar-string"

+      (test-ol-insert-link-get-desc "id:foo-bar"))))
+  ;; Lambda case.
+  (should
+   (string=
+    "foobar"
+    (test-ol-with-link-parameters-as
+        "id" (:insert-description (lambda (_link-test _desc) "foobar"))
+      (test-ol-insert-link-get-desc "id:foo-bar"))))


Further "foobar-desc-arg", etc.

+  String or function used as a default when prompting users for a
+  link's description.  A string is used as-is, a function is
+  called with two arguments: the full link text, and the

"link text" might be a bit ambiguous here. I would consider "link location", "string containing link type and target", or something else.

+  description generated by `org-insert-link'.  It should return
+  the description to use (this reflects the behaviour of
+  `org-link-make-description-function').  If it returns nil, no
+  default description is used, but no error is thrown (from the
+  user's perspective, this is equivalent to a default description
+  of \"\").

reply via email to

[Prev in Thread] Current Thread [Next in Thread]