Add some standard places to PATH if they are not set by login script.
Rearrange the order of paths so system's are first, user's are last.
For Cygwin this helps with Cygwin's paths to be situated before
"C:/Windows" (Emacs is not started from a login shell on Windows!).
(require 'json)
(require 'js)
(defvar spring-actuator-server-history nil)
(defvar spring-actuator-last-server "http://localhost:8080")
(defvar spring-actuator-path-history nil)
(defvar spring-actuator-path-completion
'("actuator" "auditevents" "autoconfig" "beans" "configprops" "dump" "env" "features" "flyway" "health" "heapdump"
"info" "jolokia" "liquibase" "logfile" "loggers" "mappings" "metrics" "trace"))
;;;###autoload
(defun spring-actuator (server path)
(interactive (list (read-string "Server: " spring-actuator-last-server 'spring-actuator-server-history)
(completing-read "Path: " spring-actuator-path-completion nil nil "" 'spring-actuator-path-history)))
(setq spring-actuator-last-server server)
(let ( (bufname (format "actuator: %s" path)) )
(when (get-buffer bufname)
(kill-buffer bufname))
(switch-to-buffer (url-retrieve-synchronously (format "%s/%s" server path)))
(rename-buffer bufname)
(goto-char (point-min))
(re-search-forward "^$" nil 'move)
(forward-char)
(delete-region (point-min) (point))
(json-pretty-print-buffer)
(goto-char (point-min))
(if (fboundp 'json-mode)
(json-mode)
(js-mode))
(setq-local js-indent-level 2)))
(provide 'spring-actuator)