Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ sudo: false
language: emacs-lisp
env:
- EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test
- EMACS_BINARY=emacs-24.4-travis MAKE_TEST=test-bytecomp
- EMACS_BINARY=emacs-24.5-travis MAKE_TEST=test
- EMACS_BINARY=emacs-24.5-travis MAKE_TEST=test-bytecomp
- EMACS_BINARY=emacs-25.1-travis MAKE_TEST=test
- EMACS_BINARY=emacs-25.1-travis MAKE_TEST=test-bytecomp
- EMACS_BINARY=emacs-25.2-travis MAKE_TEST=test
- EMACS_BINARY=emacs-25.2-travis MAKE_TEST=test-bytecomp
- EMACS_BINARY=emacs-25.2-travis MAKE_TEST=test-checks
- EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test
- MAKE_TEST=test-bytecomp EMACS_BINARY=emacs-25.1-travis
- MAKE_TEST=test-checks EMACS_BINARY=emacs-25.1-travis
- EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test-bytecomp
- EMACS_BINARY=emacs-git-snapshot-travis MAKE_TEST=test-checks

before_script:
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
Expand Down
4 changes: 2 additions & 2 deletions cider-browse-spec.el
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ Display TITLE at the top and SPECS are indented underneath."
;; prettier fns #()
((string-equal form-tag "clojure.core/fn")
(if (equal (cl-second form) '("%"))
(format "#%s" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form))))))
(format "(fn [%%] %s)" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form))))))
(format "#%s" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form)))))
(format "(fn [%%] %s)" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form)))))))
;; prettier (s/and )
((cider--spec-fn-p form-tag "and")
(format "(s/and\n%s)" (string-join (thread-last (cl-rest form)
Expand Down
9 changes: 6 additions & 3 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -976,22 +976,25 @@ CONTEXT represents a completion context for compliment."
eldoc)))

(defun cider-sync-request:spec-list (&optional filter-regex)
"Get a list of the available specs in the registry."
"Get a list of the available specs in the registry.

Optional argument FILTER-REGEX filters specs. By default, all specs are
returned."
(setq filter-regex (or filter-regex ""))
(thread-first `("op" "spec-list"
"filter-regex" ,filter-regex)
(cider-nrepl-send-sync-request)
(nrepl-dict-get "spec-list")))

(defun cider-sync-request:spec-form (spec)
"Get spec form from registry"
"Get SPEC's form from registry."
(thread-first `("op" "spec-form"
"spec-name" ,spec)
(cider-nrepl-send-sync-request)
(nrepl-dict-get "spec-form")))

(defun cider-sync-request:spec-example (spec)
"Get a spec example"
"Get an example for SPEC."
(thread-first `("op" "spec-example"
"spec-name" ,spec)
(cider-nrepl-send-sync-request)
Expand Down
34 changes: 34 additions & 0 deletions cider-compat.el
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,39 @@ to bind a single value, BINDINGS can just be a plain tuple."
(declare (indent 1) (debug if-let))
`(if-let ,bindings ,(macroexp-progn body)))))

(eval-and-compile

(with-no-warnings
(unless (fboundp 'directory-files-recursively)
(defun directory-files-recursively (dir regexp &optional include-directories)
"Return list of all files under DIR that have file names matching REGEXP.
This function works recursively. Files are returned in \"depth first\"
order, and files from each directory are sorted in alphabetical order.
Each file name appears in the returned list in its absolute form.
Optional argument INCLUDE-DIRECTORIES non-nil means also include in the
output directories whose names match REGEXP."
(let ((result nil)
(files nil)
;; When DIR is "/", remote file names like "/method:" could
;; also be offered. We shall suppress them.
(tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir)))))
(dolist (file (sort (file-name-all-completions "" dir)
'string<))
(unless (member file '("./" "../"))
(if (directory-name-p file)
(let* ((leaf (substring file 0 (1- (length file))))
(full-file (expand-file-name leaf dir)))
;; Don't follow symlinks to other directories.
(unless (file-symlink-p full-file)
(setq result
(nconc result (directory-files-recursively
full-file regexp include-directories))))
(when (and include-directories
(string-match regexp leaf))
(setq result (nconc result (list full-file)))))
(when (string-match regexp file)
(push (expand-file-name file dir) files)))))
(nconc result (nreverse files)))))))

(provide 'cider-compat)
;;; cider-compat.el ends here
2 changes: 1 addition & 1 deletion cider-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ In order to work properly, this mode must be activated by
["Customize" (customize-group 'cider-debug)]))

(defun cider--uppercase-command-p ()
"Return true if the last command was uppercase letter."
"Return non-nil if the last command was uppercase letter."
(ignore-errors
(let ((case-fold-search nil))
(string-match "[[:upper:]]" (string last-command-event)))))
Expand Down
11 changes: 5 additions & 6 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -1068,8 +1068,8 @@ evaluation command. Honor `cider-auto-jump-to-error'."
(defun cider--prep-interactive-eval (form connection)
"Prepare the environment for an interactive eval of FORM in CONNECTION.
Ensure the current ns declaration has been evaluated (so that the ns
containing FORM exists). Cache ns-form in the current buffer unless FORM is
ns declaration itself. Clear any compilation highlights and kill the error
containing FORM exists). Cache ns-form in the current buffer unless FORM is
ns declaration itself. Clear any compilation highlights and kill the error
window."
(cider--clear-compilation-highlights)
(cider--quit-error-window)
Expand Down Expand Up @@ -1366,23 +1366,22 @@ If invoked with a prefix ARG eval the expression after inserting it."

(defun cider-enable-on-existing-clojure-buffers ()
"Enable CIDER's minor mode on existing Clojure buffers.
See `cider-mode'."
See command `cider-mode'."
(interactive)
(add-hook 'clojure-mode-hook #'cider-mode)
(dolist (buffer (cider-util--clojure-buffers))
(with-current-buffer buffer
(cider-mode +1))))

(defun cider-disable-on-existing-clojure-buffers ()
"Disable `cider-mode' on existing Clojure buffers.
See `cider-mode'."
"Disable command `cider-mode' on existing Clojure buffers."
(interactive)
(dolist (buffer (cider-util--clojure-buffers))
(with-current-buffer buffer
(cider-mode -1))))

(defun cider-possibly-disable-on-existing-clojure-buffers ()
"If not connected, disable `cider-mode' on existing Clojure buffers."
"If not connected, disable command `cider-mode' on existing Clojure buffers."
(unless (cider-connected-p)
(cider-disable-on-existing-clojure-buffers)))

Expand Down
2 changes: 1 addition & 1 deletion cider-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ that of the namespace in the Clojure source buffer."

(defun cider-switch-to-repl-buffer (&optional set-namespace)
"Select the REPL buffer, when possible in an existing window.
The buffer chosen is based on the file open in the current buffer. If
The buffer chosen is based on the file open in the current buffer. If
multiple REPL buffers are associated with current connection the most
recent is used.

Expand Down
2 changes: 1 addition & 1 deletion cider-repl-history.el
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ text is still inserted at the end."
"Clear the highlighted entry, when one exists."
(when cider-repl-history-previous-overlay
(cl-assert (overlayp cider-repl-history-previous-overlay)
t "not an overlay")
nil "not an overlay")
(overlay-put cider-repl-history-previous-overlay 'face nil)))

(defun cider-repl-history-update-highlighed-entry ()
Expand Down
22 changes: 15 additions & 7 deletions cider-stacktrace.el
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,19 @@ The error types are represented as strings."

(defvar cider-stacktrace--all-negative-filters
'(clj tooling dup java repl)
"Filters that remove stackframes")
"Filters that remove stackframes.")

(defvar cider-stacktrace--all-positive-filters
'(project)
"Filters that ensure stackframes are shown")
"Filters that ensure stackframes are shown.")

(defun cider-stacktrace--face-for-filter (filter neg-filters pos-filters)
"Return whether we should mark the filter is active or not."
"Return whether we should mark the FILTER is active or not.

NEG-FILTERS and POS-FILTERS are lists of filters to check FILTER's type.

NEG-FILTERS dictate which frames should be hidden while POS-FILTERS can
override this and ensure that those frames are shown."
(cond ((member filter cider-stacktrace--all-negative-filters)
(if (member filter neg-filters)
'cider-stacktrace-filter-active-face
Expand All @@ -273,7 +278,7 @@ The error types are represented as strings."
Find buttons with a 'filter property; if filter is a member of FILTERS, or
if filter is nil ('show all') and the argument list is non-nil, fontify the
button as disabled. Upon finding text with a 'hidden-count property, stop
searching and update the hidden count text. POS-FILTERS is the list of
searching and update the hidden count text. POS-FILTERS is the list of
positive filters to always include."
(with-current-buffer cider-error-buffer
(save-excursion
Expand Down Expand Up @@ -538,7 +543,7 @@ with the button."
(cider-stacktrace-toggle flag))
((member flag cider-stacktrace--all-positive-filters)
(cider-stacktrace-show-only-project))
(t cider-stacktrace-toggle-all)))
(t (cider-stacktrace-toggle-all))))
(sit-for 5)))

(defun cider-stacktrace-toggle-suppression (button)
Expand Down Expand Up @@ -606,7 +611,10 @@ prompt and whether to use a new window. Similar to `cider-find-var'."
(fill-region beg (point)))))

(defun cider-stacktrace-render-filters (buffer special-filters filters)
"Emit into BUFFER toggle buttons for each of the FILTERS."
"Emit into BUFFER toggle buttons for each of the FILTERS.

SPECIAL-FILTERS are filters that show stack certain stack frames, hiding
others."
(with-current-buffer buffer
(insert " Show: ")
(dolist (filter special-filters)
Expand All @@ -627,7 +635,7 @@ prompt and whether to use a new window. Similar to `cider-find-var'."
'help-echo (format "Toggle %s stack frames"
(car filter)))
(insert " "))

(let ((hidden "(0 frames hidden)"))
(put-text-property 0 (length hidden) 'hidden-count t hidden)
(insert " " hidden "\n"))))
Expand Down
11 changes: 7 additions & 4 deletions cider-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ Setting this to nil removes the fontification restriction."
default-directory))

(defun cider-in-string-p ()
"Return true if point is in a string."
"Return non-nil if point is in a string."
(let ((beg (save-excursion (beginning-of-defun) (point))))
(nth 3 (parse-partial-sexp beg (point)))))

(defun cider-in-comment-p ()
"Return true if point is in a comment."
"Return non-nil if point is in a comment."
(let ((beg (save-excursion (beginning-of-defun) (point))))
(nth 4 (parse-partial-sexp beg (point)))))

Expand All @@ -84,7 +84,7 @@ which nREPL uses for temporary evaluation file names."
(string-match-p "^form-init" fname)))

(defun cider--cljc-or-cljx-buffer-p (&optional buffer)
"Return true if the current buffer is visiting a cljc or cljx file.
"Return non-nil if the current buffer is visiting a cljc or cljx file.

If BUFFER is provided act on that buffer instead."
(with-current-buffer (or buffer (current-buffer))
Expand Down Expand Up @@ -475,7 +475,10 @@ the buffer."

;; Taken from: https://github.com/emacs-mirror/emacs/blob/65c8c7cb96c14f9c6accd03cc8851b5a3459049e/lisp/help-mode.el#L551-L565
(defun cider--make-back-forward-xrefs (&optional buffer)
"Insert special references `back' and `forward', as in `help-make-xrefs'"
"Insert special references `back' and `forward', as in `help-make-xrefs'.

Optional argument BUFFER is the buffer in which to insert references.
Default is current buffer."
(with-current-buffer (or buffer (current-buffer))
(insert "\n")
(when (or help-xref-stack help-xref-forward-stack)
Expand Down
2 changes: 1 addition & 1 deletion nrepl-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ MSG is a string to be displayed. TYPE is the type of the message. All
notifications are currently displayed with `message' function and emitted
to the REPL."
(let* ((face (pcase type
((or "message" 'nil) 'font-lock-builtin-face)
((or "message" `nil) 'font-lock-builtin-face)
("warning" 'warning)
("error" 'error)))
(msg (if face
Expand Down
11 changes: 9 additions & 2 deletions test/cider-checks.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@

(let ((files (directory-files default-directory t
"\\`[^.].*\\.el\\'" t)))
(dolist (file files)
(checkdoc-file file))

;; `checkdoc-file' was introduced in Emacs 25
(when (fboundp 'checkdoc-file)
(dolist (file files)
(checkdoc-file file))
(when (get-buffer "*Warnings*")
(message "Failing due to checkdoc warnings...")
(kill-emacs 1)))

(when (apply #'check-declare-files files)
(kill-emacs 1)))