Io chiamo git ottenere la directory principale (secondo Is there a way to get the git root directory in one command? ).Come si elimina la nuova riga da un'uscita di processo?
(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))))
Ma c'è una riga finale finale nella stringa restituita. Non sono sicuro di come sbarazzarmene.
Ciò non rimuove solo i newline alla fine dell'output. Ho aggiunto una risposta alternativa. –