特性:代码块展开
实现
#+name: 2025-07-26-10-50
#+begin_src emacs-lisp :eval no
(lambda (ele conf)
(setq info (org-babel-get-src-block-info))
(cond
;; 如果代码块参数 `:expand' 的 sexp 求值
;; 为 nil 或 "no",
((and
(assq :expand (nth 2 info))
(member
(alist-get :expand (nth 2 info))
'(nil "no")))
;; 表明该代码块在当前环境下拒绝展开。
(plist-put conf :failed t)
(plist-put
conf :err-msg
(format-message "ignore %s." link))
"")
(t
(plist-put conf :lang (nth 0 info))
(org-babel-expand-noweb-references info))))
#+end_src
注册到整体结构中的文本片段:
#+name: 2025-07-26-10-48
#+begin_src emacs-lisp :eval no
;;; src-block Expander
(!let ((expand (make-symbol "src-block-expand")))
(!def expand
<<@([[id:org-noweb-expand-link::expand-src-block]])>>)
(entry 'set-expander
'src-block expand 'src-block-expand))
#+end_src