diff options
author | Glenn Morris <rgm@gnu.org> | 2018-08-28 20:35:09 -0400 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-08-28 20:35:09 -0400 |
commit | d0fc4f3f578ac33b4e11adea4a2281d2b849840e (patch) | |
tree | 3eccc4362f001adaf2976fea29885c839d4ba2e0 /lisp/mail/emacsbug.el | |
parent | d4586b7a9cea6aac7d710d59fd29ce1b9a705449 (diff) | |
download | emacs-d0fc4f3f578ac33b4e11adea4a2281d2b849840e.tar.gz emacs-d0fc4f3f578ac33b4e11adea4a2281d2b849840e.tar.bz2 emacs-d0fc4f3f578ac33b4e11adea4a2281d2b849840e.zip |
* lisp/mail/emacsbug.el (report-emacs-bug--os-description):
Add MS Windows.
Diffstat (limited to 'lisp/mail/emacsbug.el')
-rw-r--r-- | lisp/mail/emacsbug.el | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index d4caeed7888..43ecddf265c 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -116,6 +116,9 @@ This requires either the macOS \"open\" command, or the freedesktop (concat "mailto:" to))) (error "Subject, To or body not found"))))) +(defvar report-emacs-bug--os-description nil + "Cached value of operating system description.") + (defun report-emacs-bug--os-description () "Return a string describing the operating system, or nil." (cond ((eq system-type 'darwin) @@ -129,8 +132,25 @@ This requires either the macOS \"open\" command, or the freedesktop nil t) (setq os (concat os " " (match-string 1))))))) os)) + ((eq system-type 'windows-nt) + (or report-emacs-bug--os-description + (setq + report-emacs-bug--os-description + (let (os) + (with-temp-buffer + ;; Seems like this command can be slow, because it + ;; unconditionally queries a bunch of other stuff + ;; we don't care about. + (when (eq 0 (ignore-errors + (call-process "systeminfo" nil '(t nil) nil))) + (dolist (s '("OS Name" "OS Version")) + (goto-char (point-min)) + (if (re-search-forward + (format "^%s\\s-*:\\s-+\\(.*\\)$" s) + nil t) + (setq os (concat os " " (match-string 1))))))) + os)))) ;; TODO include other branches here. - ;; MS Windows: systeminfo ? ;; Cygwin, *BSD, etc: ? (t (or (let ((file "/etc/os-release")) |