summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-08-25 01:01:37 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-08-25 01:36:15 +0100
commit62d54d64c1508cba0aa16e33a8f7cf793e3af9d7 (patch)
treed25113355ec25d6c9dd11d347d31521c650f0508
parent4f8a9bbe43a3ad96c5ba7ef1c221aec1e879a0a8 (diff)
Fix many compile warnings
Most of the remaining warnings would be fixed if we cleaned up cider-interaction a little bit. In the very least, there are many repl-related functions in there which should cleanly fit into cider-repl.
-rw-r--r--cider-client.el13
-rw-r--r--cider-debug.el9
-rw-r--r--cider-doc.el2
-rw-r--r--cider-inspector.el4
-rw-r--r--cider-interaction.el20
-rw-r--r--cider-macroexpansion.el2
-rw-r--r--cider-mode.el1
-rw-r--r--cider-repl.el3
-rw-r--r--cider-stacktrace.el1
-rw-r--r--cider-util.el13
-rw-r--r--nrepl-client.el1
11 files changed, 48 insertions, 21 deletions
diff --git a/cider-client.el b/cider-client.el
index 26a3ab95..31321ea2 100644
--- a/cider-client.el
+++ b/cider-client.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'nrepl-client)
+(require 'cider-util)
;;; Connection Buffer Management
@@ -70,6 +71,7 @@ Moves CONNECTION-BUFFER to the front of `cider-connections'."
(cider--connections-refresh))
(user-error "Not in a REPL buffer")))
+(declare-function cider--close-buffer "cider-interaction")
(defun cider--close-connection-buffer (conn-buffer)
"Close CONN-BUFFER, removing it from `cider-connections'.
Also close associated REPL and server buffers."
@@ -94,6 +96,7 @@ Also close associated REPL and server buffers."
(define-key map (kbd "RET") #'cider-connections-goto-connection)
map))
+(declare-function cider-popup-buffer-mode "cider-interaction")
(define-derived-mode cider-connections-buffer-mode cider-popup-buffer-mode
"CIDER Connections"
"CIDER Connections Buffer Mode.
@@ -143,6 +146,9 @@ The connections buffer is determined by
(cider-connections-buffer-mode)
(display-buffer (current-buffer)))))
+(defvar-local cider-repl-type nil
+ "The type of this REPL buffer, usually either \"clj\" or \"cljs\".")
+
(defun cider--connection-pp (connection)
"Print an nREPL CONNECTION to the current buffer."
(let* ((buffer-read-only nil)
@@ -158,7 +164,7 @@ The connections buffer is determined by
"")
(with-current-buffer buffer
(if nrepl-sibling-buffer-alist
- (concat " " nrepl-repl-type)
+ (concat " " cider-repl-type)
""))))))
(defun cider--update-connections-display (ewoc connections)
@@ -287,6 +293,7 @@ NS specifies the namespace in which to evaluate the request."
;; namespace forms are always evaluated in the "user" namespace
(nrepl-request:eval input callback ns (cider-current-tooling-session)))
+(declare-function cider-find-relevant-connection "cider-interaction")
(defun cider-current-repl-buffer ()
"The current REPL buffer.
Return the REPL buffer given by using `cider-find-relevant-connection' and
@@ -309,6 +316,7 @@ on where they come from."
;; REPL buffer (which is probably just `repl-buf').
nrepl-repl-buffer)))))
+(declare-function cider-interrupt-handler "cider-interaction")
(defun cider-interrupt ()
"Interrupt any pending evaluations."
(interactive)
@@ -360,6 +368,7 @@ unless ALL is truthy."
;;; Requests
+(declare-function cider-load-file-handler "cider-interaction")
(defun cider-request:load-file (file-contents file-path file-name &optional callback)
"Perform the nREPL \"load-file\" op.
FILE-CONTENTS, FILE-PATH and FILE-NAME are details of the file to be
@@ -374,6 +383,7 @@ loaded. If CALLBACK is nil, use `cider-load-file-handler'."
;;; Sync Requests
+(declare-function cider-current-ns "cider-interaction")
(defun cider-sync-request:apropos (query &optional search-ns docs-p privates-p case-sensitive-p)
"Send \"apropos\" op with args SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P."
(-> `("op" "apropos"
@@ -386,6 +396,7 @@ loaded. If CALLBACK is nil, use `cider-load-file-handler'."
(nrepl-send-sync-request)
(nrepl-dict-get "apropos-matches")))
+(declare-function cider-ensure-op-supported "cider-interaction")
(defun cider-sync-request:classpath ()
"Return a list of classpath entries."
(cider-ensure-op-supported "classpath")
diff --git a/cider-debug.el b/cider-debug.el
index 4c7310b5..ee98cd8f 100644
--- a/cider-debug.el
+++ b/cider-debug.el
@@ -27,9 +27,12 @@
(require 'nrepl-client)
(require 'cider-interaction)
+(require 'cider-client)
(require 'cider-inspector)
(require 'cider-browse-ns)
+(require 'cider-util)
(require 'dash)
+(require 'spinner)
;;; Customization
@@ -424,7 +427,7 @@ ID is the id of the message that instrumented CODE."
(erase-buffer)
(insert
(format "%s" (cider--debug-trim-code code)))
- (font-lock-fontify-buffer)
+ (cider--font-lock-ensure)
(set-buffer-modified-p nil))))
(switch-to-buffer buffer-name)
(goto-char (point-min))))
@@ -445,7 +448,7 @@ sexp."
(while coordinates
(down-list)
;; Are we entering a syntax-quote?
- (when (looking-back "`\\(#{\\|[{[(]\\)")
+ (when (looking-back "`\\(#{\\|[{[(]\\)" (line-beginning-position))
;; If we are, this affects all nested structures until the next `~',
;; so we set this variable for all following steps in the loop.
(setq in-syntax-quote t))
@@ -458,7 +461,7 @@ sexp."
(unless (eq ?\( (char-before))
(pop coordinates)))
;; #(...) is read as (fn* ([] ...)), so we patch that here.
- (when (looking-back "#(")
+ (when (looking-back "#(" (line-beginning-position))
(pop coordinates))
(if coordinates
(let ((next (pop coordinates)))
diff --git a/cider-doc.el b/cider-doc.el
index dff73104..3a2a53d2 100644
--- a/cider-doc.el
+++ b/cider-doc.el
@@ -186,6 +186,8 @@
"Can't find the source because it wasn't defined with `cider-eval-buffer'")))
(error "No source location for %s" cider-docview-symbol)))
+(defvar cider-buffer-ns)
+
(defun cider-docview-grimoire ()
(interactive)
(if cider-buffer-ns
diff --git a/cider-inspector.el b/cider-inspector.el
index bed8ec41..40cdfc62 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -194,7 +194,7 @@ Current page will be reset to zero."
((and (consp el) (eq (car el) :newline))
(newline))
((and (consp el) (eq (car el) :value))
- (cider-irender-value (cadr el) (caddr el)))
+ (cider-irender-value (cadr el) (cl-caddr el)))
(t (message "Unrecognized inspector object: %s" el))))
(defun cider-irender-value (value idx)
@@ -216,7 +216,7 @@ LIMIT is the maximum or minimum position in the current buffer.
Return a list of two values: If an object could be found, the
starting position of the found object and T is returned;
otherwise LIMIT and NIL is returned."
- (let ((finder (ecase direction
+ (let ((finder (cl-ecase direction
(next 'next-single-property-change)
(prev 'previous-single-property-change))))
(let ((prop nil) (curpos (point)))
diff --git a/cider-interaction.el b/cider-interaction.el
index 5fdddda6..3d0f5676 100644
--- a/cider-interaction.el
+++ b/cider-interaction.el
@@ -46,8 +46,8 @@
(require 'cl-lib)
(require 'compile)
(require 'tramp)
+(require 'spinner)
-(defconst cider-error-buffer "*cider-error*")
(defconst cider-read-eval-buffer "*cider-read-eval*")
(defconst cider-doc-buffer "*cider-doc*")
(defconst cider-result-buffer "*cider-result*")
@@ -282,15 +282,13 @@ keep track of a namespace.
This should never be set in Clojure buffers, as there the namespace
should be extracted from the buffer's ns form.")
-(defvar-local cider-repl-type nil
- "The type of this REPL buffer, usually either \"clj\" or \"cljs\".")
-
(defvar-local cider-buffer-connection nil
"A connection associated with a specific buffer.
If this is set to a non-nil value it will take precedence over both
the project associated with a connection and the default connection.")
+(defvar cider-version)
(defun cider-ensure-op-supported (op)
"Check for support of middleware op OP.
Signal an error if it is not supported."
@@ -404,7 +402,8 @@ default connection."
(setq cider-connections
(append (cdr cider-connections)
(list (car cider-connections))))
- (message "Default nREPL connection:" (cider--connection-info (car cider-connections))))
+ (message "Default nREPL connection: %s"
+ (cider--connection-info (car cider-connections))))
(define-obsolete-function-alias 'cider-rotate-connection 'cider-rotate-default-connection "0.10")
@@ -882,7 +881,8 @@ If a cons, it specifies the position as (LINE . COLUMN). COLUMN can be nil.
If a symbol, `cider-jump-to' searches for something that looks like the
symbol's definition in the file.
If OTHER-WINDOW is non-nil don't reuse current window."
- (ring-insert find-tag-marker-ring (point-marker))
+ (with-no-warnings
+ (ring-insert find-tag-marker-ring (point-marker)))
(if other-window
(pop-to-buffer buffer)
;; like switch-to-buffer, but reuse existing window if BUFFER is visible
@@ -1108,7 +1108,7 @@ the results to be displayed in a different window."
(defun cider-completion-symbol-start-pos ()
"Find the starting position of the symbol at point, unless inside a string."
(let ((sap (symbol-at-point)))
- (when (and sap (not (in-string-p)))
+ (when (and sap (not (nth 3 (syntax-ppss))))
(car (bounds-of-thing-at-point 'symbol)))))
(defun cider-completion-get-context-at-point ()
@@ -1197,7 +1197,7 @@ The formatting is performed by `cider-annotate-completion-function'."
(defun cider-complete-at-point ()
"Complete the symbol at point."
(let ((sap (symbol-at-point)))
- (when (and sap (not (in-string-p)) (cider-connected-p))
+ (when (and sap (not (nth 3 (syntax-ppss))) (cider-connected-p))
(let ((bounds (bounds-of-thing-at-point 'symbol)))
(list (car bounds) (cdr bounds)
(completion-table-dynamic #'cider-complete)
@@ -1526,7 +1526,7 @@ See `compilation-error-regexp-alist' for help on their format.")
We do so by starting and the current position and proceeding backwards
until we find a delimiters that's not inside a string."
- (if (and (looking-back "[])}]")
+ (if (and (looking-back "[])}]" (line-beginning-position))
(null (nth 3 (syntax-ppss))))
(backward-sexp)
(while (or (not (looking-at-p "[({[]"))
@@ -2136,7 +2136,7 @@ opposite of what that option dictates."
(log message face)
(unless cider-refresh-show-log-buffer
(let ((message-truncate-lines t))
- (message "cider-refresh: %s" (s-trim message))))))
+ (message "cider-refresh: %s" message)))))
(cond (out
(log out))
diff --git a/cider-macroexpansion.el b/cider-macroexpansion.el
index 47c9151e..4349b0a9 100644
--- a/cider-macroexpansion.el
+++ b/cider-macroexpansion.el
@@ -143,7 +143,7 @@ If invoked with a PREFIX argument, use 'macroexpand' instead of
(erase-buffer)
(insert (format "%s" expansion))
(goto-char (point-max))
- (font-lock-fontify-buffer)))
+ (cider--font-lock-ensure)))
(defun cider-redraw-macroexpansion-buffer (expansion buffer start end)
"Redraw the macroexpansion with new EXPANSION.
diff --git a/cider-mode.el b/cider-mode.el
index 1f049f5c..c1377c7b 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -32,6 +32,7 @@
(require 'cider-interaction)
(require 'cider-eldoc)
+(require 'cider-repl)
(defcustom cider-mode-line-show-connection t
"If the mode-line lighter should detail the connection."
diff --git a/cider-repl.el b/cider-repl.el
index 422d89cb..1942896c 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -38,6 +38,7 @@
(require 'clojure-mode)
(require 'easymenu)
+(require 'cl-lib)
(eval-when-compile
(defvar paredit-version)
@@ -638,7 +639,7 @@ are not balanced."
If REPLACE is non-nil the current input is replaced with the old
input; otherwise the new input is appended. The old input has the
text property `cider-old-input'."
- (multiple-value-bind (beg end) (cider-property-bounds 'cider-old-input)
+ (cl-multiple-value-bind (beg end) (cider-property-bounds 'cider-old-input)
(let ((old-input (buffer-substring beg end)) ;;preserve
;;properties, they will be removed later
(offset (- (point) beg)))
diff --git a/cider-stacktrace.el b/cider-stacktrace.el
index 60263ed1..882a06f8 100644
--- a/cider-stacktrace.el
+++ b/cider-stacktrace.el
@@ -87,6 +87,7 @@ cyclical data structures."
(defvar-local cider-stacktrace-prior-filters nil)
(defvar-local cider-stacktrace-cause-visibility nil)
+(defconst cider-error-buffer "*cider-error*")
;; Faces
diff --git a/cider-util.el b/cider-util.el
index 3935d818..1d6ace15 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -95,6 +95,13 @@ PROP is the name of a text property."
;;; Font lock
+(defun cider--font-lock-ensure ()
+ "Call `font-lock-ensure' or `font-lock-fontify-buffer', as appropriate."
+ (if (fboundp 'font-lock-ensure)
+ (font-lock-ensure)
+ (with-no-warnings
+ (font-lock-fontify-buffer))))
+
(defun cider-font-lock-as (mode string)
"Use MODE to font-lock the STRING."
(if (or (null cider-font-lock-max-length)
@@ -106,9 +113,7 @@ PROP is the name of a text property."
(setq-local delay-mode-hooks t)
(setq delayed-mode-hooks nil)
(funcall mode)
- (if (fboundp 'font-lock-ensure)
- (font-lock-ensure)
- (font-lock-fontify-buffer))
+ (cider--font-lock-ensure)
(buffer-string))
string))
@@ -144,6 +149,8 @@ Unless you specify a BUFFER it will default to the current one."
(autoload 'pkg-info-version-info "pkg-info.el")
+(defvar cider-version)
+
(defun cider--version ()
"Retrieve CIDER's version."
(condition-case nil
diff --git a/nrepl-client.el b/nrepl-client.el
index 8d3883d4..da8bb7a8 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -851,6 +851,7 @@ values of *1, *2, etc."
(cider-default-err-handler session))
"Evaluation error handler.")
+(defvar cider-buffer-ns)
(defun nrepl-make-response-handler (buffer value-handler stdout-handler
stderr-handler done-handler
&optional eval-error-handler)