【发布时间】:2012-12-28 19:47:47
【问题描述】:
我调用 git 获取顶层目录(根据 Is there a way to get the git root directory in one command? )。
(let ((tmpbuffer (get-buffer-create (make-temp-name "git"))))
(call-process "git" nil tmpbuffer nil "rev-parse" "--show-toplevel")
(with-current-buffer tmpbuffer
(with-output-to-string
(princ (buffer-string))
(kill-buffer))))
但是返回的字符串中有一个尾随换行符。我不知道如何摆脱它。
【问题讨论】:
标签: elisp