X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-parser.el;h=dc9fbe2f33911ec48294804de1098269a0f03426;hb=87d462a20423a25eaf4b54a90bfd538dd93da675;hp=d59c0e1cc22727d60454ac0a79a04f63a99cf21d;hpb=b89ffba3012603d3eb9b1e144bf0a81480588ea3;p=notmuch
diff --git a/emacs/notmuch-parser.el b/emacs/notmuch-parser.el
index d59c0e1c..dc9fbe2f 100644
--- a/emacs/notmuch-parser.el
+++ b/emacs/notmuch-parser.el
@@ -1,4 +1,4 @@
-;; notmuch-parser.el --- streaming S-expression parser
+;;; notmuch-parser.el --- streaming S-expression parser
;;
;; Copyright © Austin Clements
;;
@@ -15,11 +15,13 @@
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
-;; along with Notmuch. If not, see .
+;; along with Notmuch. If not, see .
;;
;; Authors: Austin Clements
-(require 'cl)
+;;; Code:
+
+(eval-when-compile (require 'cl-lib))
(defun notmuch-sexp-create-parser ()
"Return a new streaming S-expression parser.
@@ -68,7 +70,7 @@ returns the value."
;; error to be consistent with all other code paths.
(read (current-buffer))
;; Go up a level and return an end token
- (decf (notmuch-sexp--depth sp))
+ (cl-decf (notmuch-sexp--depth sp))
(forward-char)
'end))
((= (char-after) ?\()
@@ -92,8 +94,8 @@ returns the value."
(notmuch-sexp--partial-state sp)))
;; A complete value is available if we've
;; reached depth 0.
- (depth (first new-state)))
- (assert (>= depth 0))
+ (depth (car new-state)))
+ (cl-assert (>= depth 0))
(if (= depth 0)
;; Reset partial parse state
(setf (notmuch-sexp--partial-state sp) nil
@@ -137,7 +139,7 @@ beginning of a list, throw invalid-read-syntax."
(cond ((eobp) 'retry)
((= (char-after) ?\()
(forward-char)
- (incf (notmuch-sexp--depth sp))
+ (cl-incf (notmuch-sexp--depth sp))
t)
(t
;; Skip over the bad character like `read' does
@@ -179,7 +181,7 @@ move point in the input buffer."
(set (make-local-variable 'notmuch-sexp--state) 'begin))
(let (done)
(while (not done)
- (case notmuch-sexp--state
+ (cl-case notmuch-sexp--state
(begin
;; Enter the list
(if (eq (notmuch-sexp-begin-list notmuch-sexp--parser) 'retry)
@@ -188,7 +190,7 @@ move point in the input buffer."
(result
;; Parse a result
(let ((result (notmuch-sexp-read notmuch-sexp--parser)))
- (case result
+ (cl-case result
(retry (setq done t))
(end (setq notmuch-sexp--state 'end))
(t (with-current-buffer result-buffer
@@ -202,6 +204,4 @@ move point in the input buffer."
(provide 'notmuch-parser)
-;; Local Variables:
-;; byte-compile-warnings: (not cl-functions)
-;; End:
+;;; notmuch-parser.el ends here