我需要获取当前缓冲区的范围(或整个范围),运行处理该范围作为输入的程序,获取结果并将字符串放置在当前缓冲区的末尾。
我了解到 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
))