Start a new topic

Convert selection into org-id link?

Thanks for making Beorg, I love it! Here's something I'd like to do when editing a file: - type something like "I like coffee" - select the word "coffee" - press a button - "coffee" is changed into "[[id:coffee][coffee]]" I'm getting stuck at concatenating strings... I've been trying to do something like this: #+begin_src scheme ;; make a function to encapsulate something with brackets (define (linkify x) (cons (cons "[[" x) "]]"))) ;; then add a button for it (set! editor-toolbar-items '(("back" (backward-char)) ;; more buttons here ("linkify" (region-text-set (linkify (region)) )) )) #+end_src ...but nothing I do seems to work. I can do this to replace the region text: #+BEGIN_SRC scheme ("replace" (region-text-set "replacement")) #+END_SRC but concatenation doesn't seem to work #+BEGIN_SRC scheme ("prepend" (region-text-set (cons "hello" (region)))) #+END_SRC I'd expect that last one to turn selected text like "world" into "hello world" but nothing happens when I press the "prepend" button. any ideas? thanks in advance!

awesome, thanks so much! I super appreciate it

I've answered this in a reply to the support ticket.


If anyone else is interested in how this can be done see https://paste.lol/mken/init.org for a minimal init.org. The key is to use the function string-append - e.g. (string-append "a" "b" "c") => "abc"

Login or Signup to post a comment