Interactive methods use '-', private methods uses `/` as separator after
library prefix.
--- a/maven-central.el Wed Mar 29 22:56:36 2017 +0300
+++ b/maven-central.el Wed Mar 29 23:55:10 2017 +0300
@@ -9,71 +9,71 @@
;;; Code:
-(defvar maven-central.buffer-name "*Maven Central*")
+(defvar maven-central/buffer-name "*Maven Central*")
-(defconst maven-central.search-url "http://search.maven.org/solrsearch/select?wt=json&rows=20")
+(defconst maven-central/search-url "http://search.maven.org/solrsearch/select?wt=json&rows=20")
-(defun maven-central.versions-url (groupId artifactId)
- (concat maven-central.search-url "&core=gav&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
-;; (maven-central.versions-url "junit" "junit")
+(defun maven-central/versions-url (groupId artifactId)
+ (concat maven-central/search-url "&core=gav&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
+;; (maven-central/versions-url "junit" "junit")
-(defun maven-central.versions-callback (status)
+(defun maven-central/versions-callback (status)
(let ( (buffer (current-buffer)) json )
(with-temp-buffer
(url-insert buffer)
(goto-char (point-min))
(setq json (json-read))
- ;; (switch-to-buffer maven-central.buffer-name)
+ ;; (switch-to-buffer maven-central/buffer-name)
;; (pp json)
(message "Available versions: %s" (mapconcat (lambda (json) (cdr (assq 'v json))) (cdr (assq 'docs (cdr (assoc 'response json)))) ", "))
)))
-(defun maven-central.versions (groupId artifactId)
+(defun maven-central/versions (groupId artifactId)
"Retrieve available versions."
- (url-retrieve (maven-central.versions-url groupId artifactId) #'maven-central.versions-callback))
+ (url-retrieve (maven-central/versions-url groupId artifactId) #'maven-central/versions-callback))
-(defun maven-central.last-version-url (groupId artifactId)
- (concat maven-central.search-url "&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
-;; (maven-central.versions-url "junit" "junit")
+(defun maven-central/last-version-url (groupId artifactId)
+ (concat maven-central/search-url "&q=g:" (url-hexify-string groupId) (url-hexify-string " AND ") "a:" (url-hexify-string artifactId)))
+;; (maven-central/versions-url "junit" "junit")
-(defun maven-central.last-version-callback (status)
+(defun maven-central/last-version-callback (status)
(let ( (buffer (current-buffer)) json )
(with-temp-buffer
(url-insert buffer)
(goto-char (point-min))
(setq json (json-read))
- ;; (switch-to-buffer maven-central.buffer-name)
+ ;; (switch-to-buffer maven-central/buffer-name)
;; (pp json)
(message "Latest version: %s" (cdr (assq 'latestVersion (elt (cdr (assq 'docs (cdr (assoc 'response json)))) 0))))
)))
-(defun maven-central.last-version (groupId artifactId)
+(defun maven-central/last-version (groupId artifactId)
"Retrieve last package version."
- (url-retrieve (maven-central.last-version-url groupId artifactId) #'maven-central.last-version-callback))
+ (url-retrieve (maven-central/last-version-url groupId artifactId) #'maven-central/last-version-callback))
;;;###autoload
-(defun maven-central.last-version-from-pom ()
+(defun maven-central-last-version-from-pom ()
(interactive)
(let (dependency groupId artifactId)
- (setq dependency (maven.parse-pom-dependency))
+ (setq dependency (maven/parse-pom-dependency))
(setq groupId (elt dependency 0))
(setq artifactId (elt dependency 1))
(when (and groupId artifactId)
- (maven-central.last-version groupId artifactId))
+ (maven-central/last-version groupId artifactId))
))
;;;###autoload
-(defun maven-central.versions-from-pom ()
+(defun maven-central-versions-from-pom ()
(interactive)
(let (dependency groupId artifactId)
- (setq dependency (maven.parse-pom-dependency))
+ (setq dependency (maven/parse-pom-dependency))
(setq groupId (elt dependency 0))
(setq artifactId (elt dependency 1))
(when (and groupId artifactId)
- (maven-central.versions groupId artifactId))
+ (maven-central/versions groupId artifactId))
))
-(defun ivy.parse-dependency ()
+(defun ivy/parse-dependency ()
(let ( end groupId artifactId )
(save-excursion
(if (looking-at "[^>]*<dependency ")
@@ -94,28 +94,28 @@
(list groupId artifactId)))
;;;###autoload
-(defun maven-central.last-version-from-ivy ()
+(defun maven-central-last-version-from-ivy ()
(interactive)
(let (dependency groupId artifactId)
- (setq dependency (ivy.parse-dependency))
+ (setq dependency (ivy/parse-dependency))
(setq groupId (elt dependency 0))
(setq artifactId (elt dependency 1))
(when (and groupId artifactId)
- (maven-central.last-version groupId artifactId))
+ (maven-central/last-version groupId artifactId))
))
;;;###autoload
-(defun maven-central.versions-from-ivy ()
+(defun maven-central-versions-from-ivy ()
(interactive)
(let (dependency groupId artifactId)
- (setq dependency (ivy.parse-dependency))
+ (setq dependency (ivy/parse-dependency))
(setq groupId (elt dependency 0))
(setq artifactId (elt dependency 1))
(when (and groupId artifactId)
- (maven-central.versions groupId artifactId))
+ (maven-central/versions groupId artifactId))
))
-;; (maven-central.last-version "junit" "junit")
+;; (maven-central/last-version "junit" "junit")
(provide 'maven-central)
--- a/maven.el Wed Mar 29 22:56:36 2017 +0300
+++ b/maven.el Wed Mar 29 23:55:10 2017 +0300
@@ -5,11 +5,11 @@
;;; Code:
-(defvar maven.command "mvn")
+(defvar maven-command "mvn")
-(defvar maven.help-buffer-name "*Maven Help*")
+(defvar maven/help-buffer-name "*Maven Help*")
-(defun maven.parse-pom-dependency-in-region (start end)
+(defun maven/parse-pom-dependency-in-region (start end)
(let (groupId artifactId version)
(save-restriction
(narrow-to-region start end)
@@ -25,7 +25,7 @@
(list groupId artifactId version)
)))
-(defun maven.parse-pom-dependency (&optional point)
+(defun maven/parse-pom-dependency (&optional point)
(let (start end pos groupId artifactId version fs-o bs-o fs-c bs-c)
(save-excursion
(if (looking-at "[^>]*<[^!]")
@@ -43,58 +43,58 @@
(setq bs-c (re-search-forward ">" nil t)))
(cond
((and fs-o (= fs-o point) fs-c)
- (maven.parse-pom-dependency-in-region fs-o fs-c))
+ (maven/parse-pom-dependency-in-region fs-o fs-c))
((and bs-o (<= bs-o point) fs-c (<= point fs-c))
- (maven.parse-pom-dependency-in-region bs-o fs-c))
+ (maven/parse-pom-dependency-in-region bs-o fs-c))
((and fs-o fs-c)
- (maven.parse-pom-dependency-in-region fs-o fs-c))
+ (maven/parse-pom-dependency-in-region fs-o fs-c))
((and bs-o bs-c)
- (maven.parse-pom-dependency-in-region bs-o bs-c))
+ (maven/parse-pom-dependency-in-region bs-o bs-c))
(t
(list nil nil nil)))
)))
-;; (pp (maven.parse-pom-dependency))
+;; (pp (maven/parse-pom-dependency))
;;;###autoload
-(defun maven.help ()
+(defun maven-help ()
"Run help:describe for plugin at point."
(interactive)
(let (dependency groupId artifactId)
- (setq dependency (maven.parse-pom-dependency))
+ (setq dependency (maven/parse-pom-dependency))
(setq groupId (elt dependency 0))
(setq artifactId (elt dependency 1))
(if (not (and groupId artifactId))
(message "Can't find `groupId' or `artifactId'")
(shell-command
- (format "%s help:describe -Ddetail -DgroupId=%s -DartifactId=%s" maven.command groupId artifactId)
- (switch-to-buffer maven.help-buffer-name)) )
+ (format "%s help:describe -Ddetail -DgroupId=%s -DartifactId=%s" maven-command groupId artifactId)
+ (switch-to-buffer maven/help-buffer-name)) )
))
;;;###autoload
-(defun maven.effective-pom ()
+(defun maven-effective-pom ()
"Run help:effective-pom for plugin at point."
(interactive)
(shell-command
- (format "%s help:effective-pom" maven.command)
- (switch-to-buffer maven.help-buffer-name)) )
+ (format "%s help:effective-pom" maven-command)
+ (switch-to-buffer maven/help-buffer-name)) )
;;;###autoload
-(defun maven.effective-settings ()
+(defun maven-effective-settings ()
"Run help:effective-settings for plugin at point."
(interactive)
(shell-command
- (format "%s help:effective-settings" maven.command)
- (switch-to-buffer maven.help-buffer-name)) )
+ (format "%s help:effective-settings" maven-command)
+ (switch-to-buffer maven/help-buffer-name)) )
;;;###autoload
-(defun maven.dependency-tree ()
+(defun maven-dependency-tree ()
"Run dependency:tree for plugin at point."
(interactive)
(shell-command
- (format "%s dependency:tree" maven.command)
- (switch-to-buffer maven.help-buffer-name)) )
+ (format "%s dependency:tree" maven-command)
+ (switch-to-buffer maven/help-buffer-name)) )
-(defun maven.project-root ()
+(defun maven/project-root ()
"Root of project."
(let ( (dir default-directory) (found nil) )
(while (and (not found) (> (length dir) 5))
@@ -103,7 +103,7 @@
(setq dir (expand-file-name (concat dir "/.."))))
found))
-(defun maven.file-package ()
+(defun maven/file-package ()
"Return file package."
(save-excursion
(goto-char (point-min))
@@ -116,24 +116,24 @@
(concat pkg "." cls))) ))
;;;###autoload
-(defun maven.run-file ()
+(defun maven-run-file ()
"Run exec:java for current file."
(interactive)
- (let* ( (default-directory (concat (maven.project-root) "/")) )
+ (let* ( (default-directory (concat (maven/project-root) "/")) )
(if (not default-directory)
(message "Can't find maven project root")
(compilation-start
- (format "%s exec:java -Dexec.mainClass=%s" maven.command (maven.file-package))))))
+ (format "%s exec:java -Dexec.mainClass=%s" maven-command (maven/file-package))))))
;;;###autoload
-(defun maven.run-test ()
+(defun maven-run-test ()
"Run test -Dtest=... for current file."
(interactive)
- (let* ( (default-directory (concat (maven.project-root) "/")) )
+ (let* ( (default-directory (concat (maven/project-root) "/")) )
(if (not default-directory)
(message "Can't find maven project root")
(compilation-start
- (format "%s test -Dtest=%s" maven.command (maven.file-package))))))
+ (format "%s test -Dtest=%s" maven-command (maven/file-package))))))
(provide 'maven)