1
- ; ;; fsharp-mode-util.el --- utility functions
1
+ ; ;; fsharp-mode-util.el --- utility functions -*- lexical-binding : t -*-
2
2
3
3
; ; Copyright (C) 2015 Robin Neatherway
4
4
23
23
; ; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24
24
; ; Boston, MA 02110-1301, USA.
25
25
26
- (with-no-warnings ( require 'cl ) )
26
+ (require 'cl-lib )
27
27
28
28
(defvar fsharp-ac-using-mono
29
- (case system-type
29
+ (cl- case system-type
30
30
((windows-nt cygwin msdos) nil )
31
31
(otherwise t ))
32
32
" Whether the .NET runtime in use is mono.
@@ -35,36 +35,39 @@ for all *nix.")
35
35
36
36
(defun fsharp-mode--program-files-x86 ()
37
37
(file-name-as-directory
38
- (car (-drop-while 'not
39
- (list (getenv " ProgramFiles(x86)" )
40
- (getenv " ProgramFiles" )
41
- " C:\\ Program Files (x86)" )))))
38
+ (or (getenv " ProgramFiles(x86)" )
39
+ (getenv " ProgramFiles" )
40
+ " C:\\ Program Files (x86)" )))
42
41
43
42
(defun fsharp-mode--vs2017-msbuild-find (exe )
44
43
" Return EXE absolute path for Visual Studio 2017, if existent, else nil."
45
- (->> (--map (concat (fsharp-mode--program-files-x86)
46
- " Microsoft Visual Studio/2017/"
47
- it
48
- " msbuild/15.0/bin/"
49
- exe)
50
- '(" Enterprise/" " Professional/" " Community/" " BuildTools/" ))
51
- (--first (file-executable-p it))))
44
+ (let ((candidates (mapcar (lambda (edition )
45
+ (concat (fsharp-mode--program-files-x86)
46
+ edition
47
+ " msbuild/15.0/bin/"
48
+ exe))
49
+ '(" Enterprise/" " Professional/"
50
+ " Community/" " BuildTools/" ))))
51
+ (cl-find-if (lambda (exe ) (file-executable-p exe)) candidates)))
52
52
53
53
(defun fsharp-mode--msbuild-find (exe )
54
54
(if fsharp-ac-using-mono
55
55
(executable-find exe)
56
- (let* ((searchdirs (--map (concat (fsharp-mode--program-files-x86)
57
- " MSBuild/" it " /Bin" )
58
- '(" 14.0" " 13.0" " 12.0" )))
56
+ (let* ((searchdirs (mapcar (lambda (ver )
57
+ (concat (fsharp-mode--program-files-x86)
58
+ " MSBuild/" ver " /Bin" ))
59
+ '(" 14.0" " 13.0" " 12.0" )))
59
60
(exec-path (append searchdirs exec-path)))
60
61
(or (fsharp-mode--vs2017-msbuild-find exe) (executable-find exe)))))
61
62
62
63
(defun fsharp-mode--executable-find (exe )
63
64
(if fsharp-ac-using-mono
64
65
(executable-find exe)
65
- (let* ((searchdirs (--map (concat (fsharp-mode--program-files-x86)
66
- " Microsoft SDKs/F#/" it " /Framework/v4.0" )
67
- '(" 10.1" " 4.0" " 3.1" " 3.0" )))
66
+ (let* ((searchdirs (mapcar (lambda (ver )
67
+ (concat (fsharp-mode--program-files-x86)
68
+ " Microsoft SDKs/F#/"
69
+ ver " /Framework/v4.0" ))
70
+ '(" 10.1" " 4.0" " 3.1" " 3.0" )))
68
71
(exec-path (append searchdirs exec-path)))
69
72
(executable-find exe))))
70
73
0 commit comments