lisp/ol.el: Make `org-link-get-parameter' a valid PLACE for `setf'

* lisp/ol.el (org-link-get-parameter): Define setter.  This allows
modifying link parameters with `setf' and altering them via
`add-function'.

Link: https://orgmode.org/list/a123389c-8f86-4836-a4fe-1e3f4281d33b@app.fastmail.com
This commit is contained in:
Ihor Radchenko 2024-03-17 13:06:11 +03:00
parent ae50b94e0e
commit d545ad6068
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 0 deletions

View File

@ -923,6 +923,13 @@ PARAMETERS should be keyword value pairs. See
(org-link-make-regexps)
(when (featurep 'org-element) (org-element-update-syntax)))))
;; This way, one can add multiple functions as, say, :follow parameter.
;; For example,
;; (add-function :before-until (org-link-get-parameter "id" :follow) #'my-function)
;; See https://orgmode.org/list/a123389c-8f86-4836-a4fe-1e3f4281d33b@app.fastmail.com
(gv-define-setter org-link-get-parameter (value type key)
`(org-link-set-parameters ,type ,key ,value))
(defun org-link-make-regexps ()
"Update the link regular expressions.
This should be called after the variable `org-link-parameters' has changed."