0

I am trying to make a custom function for org-roam which inserts footnote-like links in the current note.

The idea is to insert links on this way

The logistic regression [fn:20200612000001]...

* Footnotes

[fn:20200612000001] [[file:20200612000001-definition_logistic_regression.org][Logistic regression]]

and the linked file has the form

:PROPERTIES:
:ID: 20200612000001
:END:
#+TITLE: Definition Logistic Regression

I just copy-pasted the original org-roam-insert function and hacked it a little to insert the footnote. The code is here https://gist.github.com/maikol-solis/ed149c16cff16a55492d1acba8c12025.

However, after a couple of times using it, emacs crashes completely. I think that is caused by this function because this has never happened before.

I used gdb to follow the crash and this is the output:

Thread 1 "emacs-gtk" received signal SIGSEGV, Segmentation fault.
gui_produce_glyphs (it=0x7fff82fc3650) at xdisp.c:29925
29925         struct font *font = face->font;
(gdb) next
handle_sigsegv (sig=11, siginfo=0xc201f0 <sigsegv_stack+7152>, arg=0xc200c0 <sigsegv_stack+6848>) at sysdep.c:1876
1876    {
(gdb) next
1882      if (!fatal && !pthread_equal (pthread_self (), main_thread_id))
(gdb) next
1886      if (!fatal && stack_overflow (siginfo))
(gdb) next
1890      deliver_fatal_thread_signal (sig);
(gdb) next

Thread 1 "emacs-gtk" received signal SIGSEGV, Segmentation fault.
0x00007fc45ddc1170 in raise () from /lib64/libpthread.so.0
(gdb) next
Single stepping until exit from function raise,
which has no line number information.
[Thread 0x7fc44567f700 (LWP 28923) exited]
[Thread 0x7fc4477fe700 (LWP 28922) exited]
[Thread 0x7fc447fff700 (LWP 28921) exited]
[Thread 0x7fc44df97700 (LWP 28920) exited]

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

I appreciate any help to solve this issue. Best.

1 Answer 1

0

I updated the code and everything is working now. Around this line https://gist.github.com/maikol-solis/ed149c16cff16a55492d1acba8c12025#file-org-roam-insert-footnote-L47

I added this

(find-file target-file-path)
(setq target-vector-id
      (car (org-roam--extract-ids target-file-path)))
(kill-current-buffer)

I still don't know why occurred the crash, but it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.