Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

orgmode - disable elisp code execute confirmation dialog

Tags:

elisp

org-mode

I have below code to call elisp function "myfun" when user click the link:

#+BEGIN_SRC elisp :results output raw
  (defun myfun(filepath lineno)
    (if (not (get-buffer bufname))
        (get-buffer-create bufname)
      )
    (switch-to-buffer-other-window bufname)
    (global-linum-mode)
    (erase-buffer)
    (insert-file-contents (format "%s" filepath))
    (goto-char (point-min))
    (forward-line lineno)
    (setq start (point))
    (forward-line -1)
    (setq end (point))
    (let ((x (make-overlay start end)))
      (overlay-put x 'face '(:background "#fef0f1")))
    )

  (defun createSampleFile(file-name count)
    (let ((c 0))
      (with-temp-buffer
        (while (< c (* 2 count))
          (setq c (1+ c))
          (insert (format "line %d\n" c))
          (write-file filename)
          ))))

  (let ((c 0)(filename nil))
    (while (< c 4)
      (setq c (1+ c))
      (setq filename (format "./test%d.txt" c))
      (createSampleFile filename c)
      (princ (format "[[elisp:(myfun '%s' %d)][%s]]\n" filename c filename))
      ))
#+END_SRC

#+RESULTS:
[[elisp:(myfun './test1.txt' 1)][./test1.txt]]
[[elisp:(myfun './test2.txt' 2)][./test2.txt]]
[[elisp:(myfun './test3.txt' 3)][./test3.txt]]
[[elisp:(myfun './test4.txt' 4)][./test4.txt]]

But when click the link, I got below prompt warning dialog always: enter image description here

Can we disable that dialog?

like image 416
beetlej Avatar asked Jan 29 '23 21:01

beetlej


1 Answers

Add below line to init.el:

(setq org-confirm-elisp-link-function nil)
like image 194
lucky1928 Avatar answered Mar 06 '23 08:03

lucky1928