4
我需要獲取當前緩衝區的範圍(或整個範圍),運行程序將範圍處理爲輸入,獲取結果並將字符串放在當前緩衝區的末尾。如何實現'shell-command-on-region-to-string'emacs/elisp函數?
我瞭解到shell-command-on-region可以處理一個區域。
我瞭解到shell-command-to-string可以將程序的結果存儲到字符串中。
然後,我該如何實現'shell-command-on-region-to-string'?
(defun shell-command-on-region-to-string (process &optional b e)
(interactive)
(let ((b (if mark-active (min (point) (mark)) (point-min)))
(e (if mark-active (max (point) (mark)) (point-max))))
?? (shell-command-on-region b e process (current-buffer) t)
?? how to store the return of a process to a string
?? how to insert the result at the end of current buffer
))