Skip to content

Commit

Permalink
Explicitly return t' or nil' from es-goto-(next|previous)-request
Browse files Browse the repository at this point in the history
Relates to #24
  • Loading branch information
dakrone committed Jan 20, 2016
1 parent 4062a48 commit f412e6c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
45 changes: 28 additions & 17 deletions es-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -586,16 +586,21 @@ available. Returns true if one was found, nil otherwise."
(forward-line -1)
(es-mark-request-body)
(deactivate-mark)
(ignore-errors
(re-search-backward
(concat "}\\\|" (concat "^" (regexp-opt es-http-builtins-all) " .*$"))))
(es-mark-request-body)
(deactivate-mark)
(forward-line -1)
(beginning-of-line)
(unless (looking-at es--method-url-regexp)
(search-forward "{")
(backward-char)))
(let ((found? (ignore-errors
(re-search-backward
(concat
"}\\\|"
(concat
"^" (regexp-opt es-http-builtins-all) " .*$"))))))
(es-mark-request-body)
(deactivate-mark)
(forward-line -1)
(beginning-of-line)
(unless (looking-at es--method-url-regexp)
(ignore-errors
(search-forward "{")
(backward-char)))
(not (not found?))))

(defun es-goto-next-request ()
"Advance the point to the next parameter declaration, if
Expand All @@ -606,13 +611,19 @@ available. Returns true if one was found, nil otherwise."
(when (looking-at "{")
(forward-sexp))
(deactivate-mark)
(ignore-errors
(re-search-forward
(concat "{\\\|" (concat "^" (regexp-opt es-http-builtins-all) " .*$"))))
(beginning-of-line)
(unless (looking-at es--method-url-regexp)
(search-forward "{")
(backward-char)))
(let ((found? (ignore-errors
(re-search-forward
(concat
"{\\\|"
(concat
"^" (regexp-opt es-http-builtins-all) " .*$"))))))
(beginning-of-line)
(unless (looking-at es--method-url-regexp)
(ignore-errors
(search-forward "{")
(backward-char)))
;; Coerce to `t' or `nil'
(not (not found?))))

(defmacro es-save-everything (&rest args)
`(,(if (fboundp
Expand Down
6 changes: 6 additions & 0 deletions test/test2.es
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ GET test/doc/1

GET _cat/nodes?v
{}

{
"query": {
"match_all": {}
}
}

0 comments on commit f412e6c

Please sign in to comment.