gpt4 book ai didi

elisp - orgmode - 禁用 elisp 代码执行确认对话框

转载 作者:行者123 更新时间:2023-12-05 00:50:49 25 4
gpt4 key购买 nike

当用户单击链接时,我有以下代码来调用 elisp 函数“myfun”:

#+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]]

但是当点击链接时,我总是在提示警告对话框下面:
enter image description here

我们可以禁用那个对话框吗?

最佳答案

将以下行添加到 init.el:

(setq org-confirm-elisp-link-function nil)

关于elisp - orgmode - 禁用 elisp 代码执行确认对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45379426/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com