Skip to content

Commit 94258bc

Browse files
authored
Merge pull request #104 from bwolf/emacs-compat
Fix byte compiler errors and Emacs compatibility
2 parents 2a22b3f + af35486 commit 94258bc

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lsp-java.el

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
;; You should have received a copy of the GNU General Public License
1919
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
2020

21-
;;; Commentary: Java specific adapter for LSP mode
21+
;;; Commentary:
22+
23+
;; Java specific adapter for LSP mode
2224

2325
;;; Code:
2426
(require 'cc-mode)
@@ -29,6 +31,7 @@
2931
(require 'f)
3032
(require 'tree-widget)
3133
(require 'request)
34+
(require 'cl-lib)
3235

3336
(defgroup lsp-java nil
3437
"JDT emacs frontend."
@@ -560,10 +563,10 @@ NOT-FOUND-MESSAGE will be used if there is no matching action."
560563
(let ((actions (cl-remove-if-not
561564
(lambda (item) (string-match regexp (gethash "title" item)))
562565
(lsp-get-or-calculate-code-actions))))
563-
(case (length actions)
566+
(pcase (length actions)
564567
(0 (error (or not-found-message "Unable to find action")))
565568
(1 (lsp-execute-code-action (car actions)))
566-
(t (lsp-execute-code-action (lsp--select-action actions))))))
569+
(_ (lsp-execute-code-action (lsp--select-action actions))))))
567570

568571
(defun lsp-java-extract-to-local-variable (arg)
569572
"Extract local variable refactoring.
@@ -844,13 +847,13 @@ PROJECT-URI uri of the item."
844847

845848
(cl-defmethod lsp-execute-command
846849
((_server (eql jdtls)) (command (eql java.show.references)) params)
847-
(if-let (refs (third params))
850+
(if-let (refs (cl-third params))
848851
(xref--show-xrefs (lsp--locations-to-xref-items refs) nil)
849852
(user-error "No references")))
850853

851854
(cl-defmethod lsp-execute-command
852855
((_server (eql jdtls)) (command (eql java.show.implementations)) params)
853-
(if-let (refs (third params))
856+
(if-let (refs (cl-third params))
854857
(xref--show-xrefs (lsp--locations-to-xref-items refs) nil)
855858
(user-error "No implementations")))
856859

@@ -897,10 +900,10 @@ PROJECT-URI uri of the item."
897900
:headers '(("Accept" . "application/vnd.initializr.v2.1+json"))
898901
:success (cl-function
899902
(lambda (&key data &allow-other-keys)
900-
(flet ((ask (message key) (alist-get 'id
901-
(lsp--completing-read message
902-
(alist-get 'values (alist-get key data))
903-
(-partial 'alist-get 'name)))))
903+
(cl-flet ((ask (message key) (alist-get 'id
904+
(lsp--completing-read message
905+
(alist-get 'values (alist-get key data))
906+
(-partial 'alist-get 'name)))))
904907
(condition-case _err
905908
(-let* ((group-id (read-string "Enter group name: " "com.example"))
906909
(artifact-id (read-string "Enter artifactId: " "demo"))
@@ -934,7 +937,7 @@ PROJECT-URI uri of the item."
934937
rest))
935938
(if (-contains? deps dep)
936939
(setq deps (remove dep deps))
937-
(pushnew dep deps)))
940+
(cl-pushnew dep deps)))
938941
(let ((download-url (format "%sstarter.zip?type=%s&language=%s&groupId=%s&artifactId=%s&packaging=%s&bootVersion=%s&baseDir=%s&dependencies=%s"
939942
base-url type language group-id artifact-id packaging boot-version artifact-id (s-join "," deps))))
940943
(message "Downloading template from %s" download-url)

0 commit comments

Comments
 (0)