Skip to content

Commit 05a2c6a

Browse files
committed
Replace dash functions and fix byte-compile warnings
1 parent 405239c commit 05a2c6a

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

fsharp-mode-util.el

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; fsharp-mode-util.el --- utility functions
1+
;;; fsharp-mode-util.el --- utility functions -*- lexical-binding: t -*-
22

33
;; Copyright (C) 2015 Robin Neatherway
44

@@ -23,10 +23,10 @@
2323
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2424
;; Boston, MA 02110-1301, USA.
2525

26-
(with-no-warnings (require 'cl))
26+
(require 'cl-lib)
2727

2828
(defvar fsharp-ac-using-mono
29-
(case system-type
29+
(cl-case system-type
3030
((windows-nt cygwin msdos) nil)
3131
(otherwise t))
3232
"Whether the .NET runtime in use is mono.
@@ -35,36 +35,39 @@ for all *nix.")
3535

3636
(defun fsharp-mode--program-files-x86 ()
3737
(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)")))
4241

4342
(defun fsharp-mode--vs2017-msbuild-find (exe)
4443
"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)))
5252

5353
(defun fsharp-mode--msbuild-find (exe)
5454
(if fsharp-ac-using-mono
5555
(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")))
5960
(exec-path (append searchdirs exec-path)))
6061
(or (fsharp-mode--vs2017-msbuild-find exe) (executable-find exe)))))
6162

6263
(defun fsharp-mode--executable-find (exe)
6364
(if fsharp-ac-using-mono
6465
(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")))
6871
(exec-path (append searchdirs exec-path)))
6972
(executable-find exe))))
7073

fsharp-mode.el

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
(require 'fsharp-mode-util)
3636
(require 'compile)
3737
(require 'project)
38+
(require 'subr-x)
39+
(require 'seq)
3840

3941
(defgroup fsharp nil
4042
"Support for the Fsharp programming language, <http://www.fsharp.net/>"
@@ -358,7 +360,7 @@ folders relative to DIR-OR-FILE."
358360

359361
;; Make project.el aware of fsharp projects
360362
(defun fsharp-mode-project-root (dir)
361-
(-when-let (project-file (fsharp-mode/find-sln-or-fsproj dir))
363+
(when-let (project-file (fsharp-mode/find-sln-or-fsproj dir))
362364
(cons 'fsharp (file-name-directory project-file))))
363365

364366
(cl-defmethod project-roots ((project (head fsharp)))

0 commit comments

Comments
 (0)