]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mail/emacsbug.el (report-emacs-bug): Try "sw_vers" on Darwin.
authorGlenn Morris <rgm@gnu.org>
Tue, 12 Dec 2017 02:17:55 +0000 (21:17 -0500)
committerGlenn Morris <rgm@gnu.org>
Tue, 12 Dec 2017 02:17:55 +0000 (21:17 -0500)
lisp/mail/emacsbug.el

index 92f396593606848de4bd4c93c2c12980b105f9a0..667b6f39abeff133acca4ceaf48fd5e0519a5c19 100644 (file)
@@ -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