diff --git a/.travis.yml b/.travis.yml index bda4b1a1c..9ca8a9f32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/cider-browse-spec.el b/cider-browse-spec.el index 30e57b165..858fbf982 100644 --- a/cider-browse-spec.el +++ b/cider-browse-spec.el @@ -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) diff --git a/cider-client.el b/cider-client.el index 6f9eeb014..368a3fa7b 100644 --- a/cider-client.el +++ b/cider-client.el @@ -976,7 +976,10 @@ 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) @@ -984,14 +987,14 @@ CONTEXT represents a completion context for compliment." (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) diff --git a/cider-compat.el b/cider-compat.el index 4f6e9d8aa..7387f8333 100644 --- a/cider-compat.el +++ b/cider-compat.el @@ -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 diff --git a/cider-debug.el b/cider-debug.el index 6b31bb8e6..3bb9f784e 100644 --- a/cider-debug.el +++ b/cider-debug.el @@ -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))))) diff --git a/cider-interaction.el b/cider-interaction.el index 03625564a..9fe48f48d 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -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) @@ -1366,7 +1366,7 @@ 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)) @@ -1374,15 +1374,14 @@ See `cider-mode'." (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))) diff --git a/cider-mode.el b/cider-mode.el index 68dd05387..5d0c6115c 100644 --- a/cider-mode.el +++ b/cider-mode.el @@ -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. diff --git a/cider-repl-history.el b/cider-repl-history.el index e72436cc1..6a9cdfec0 100644 --- a/cider-repl-history.el +++ b/cider-repl-history.el @@ -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 () diff --git a/cider-stacktrace.el b/cider-stacktrace.el index db74b8bda..e1c45b2c9 100644 --- a/cider-stacktrace.el +++ b/cider-stacktrace.el @@ -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 @@ -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 @@ -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) @@ -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) @@ -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")))) diff --git a/cider-util.el b/cider-util.el index 497f863fe..1b4872524 100644 --- a/cider-util.el +++ b/cider-util.el @@ -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))))) @@ -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)) @@ -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) diff --git a/nrepl-client.el b/nrepl-client.el index 9f91777b3..706e4719a 100644 --- a/nrepl-client.el +++ b/nrepl-client.el @@ -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 diff --git a/test/cider-checks.el b/test/cider-checks.el index 06ca70ea3..6db9ba8e0 100644 --- a/test/cider-checks.el +++ b/test/cider-checks.el @@ -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)))