From b585a2040148fb5d7f21ba8e51c731c594c64ef2 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 11 Dec 2017 21:17:55 -0500 Subject: [PATCH] * lisp/mail/emacsbug.el (report-emacs-bug): Try "sw_vers" on Darwin. --- lisp/mail/emacsbug.el | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 92f39659360..667b6f39abe 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -232,13 +232,32 @@ usually do not have translators for other languages.\n\n"))) "', version " (mapconcat 'number-to-string (x-server-version) ".") "\n") (error t))) - (let ((lsb (with-temp-buffer - (if (eq 0 (ignore-errors - (call-process "lsb_release" nil '(t nil) - nil "-d"))) - (buffer-string))))) - (if (stringp lsb) - (insert "System " lsb "\n"))) + (let (os) + ;; Maybe this should be factored out in a standalone function, + ;; eg emacs-os-description. + (cond ((eq system-type 'darwin) + (with-temp-buffer + (when (eq 0 (ignore-errors + (call-process "sw_vers" nil '(t nil) nil))) + (dolist (s '("ProductName" "ProductVersion")) + (goto-char (point-min)) + (if (re-search-forward (format "^%s\\s-*:\\s-+\\(.*\\)$" s) + nil t) + (setq os (concat os " " (match-string 1)))))))) + ;; TODO include other branches here. + ;; MS Windows: systeminfo ? + ;; Cygwin, *BSD, etc: ? + (t + (with-temp-buffer + (when (eq 0 (ignore-errors + (call-process "lsb_release" nil '(t nil) + nil "-d"))) + (goto-char (point-min)) + (if (looking-at "^\\sw+:\\s-+") + (goto-char (match-end 0))) + (setq os (buffer-substring (point) (line-end-position))))))) + (if (stringp os) + (insert "System Description: " os "\n\n"))) (let ((message-buf (get-buffer "*Messages*"))) (if message-buf (let (beg-pos -- 2.39.5