core-defuns: remove cl-lib dependency

This commit is contained in:
Henrik Lissner 2016-05-12 02:36:11 -04:00
parent ebf283e5a8
commit ef4b8c5b65

View file

@ -1,5 +1,3 @@
(eval-when-compile (require 'cl-lib))
;; Backwards compatible `with-eval-after-load'
(unless (fboundp 'with-eval-after-load)
(defmacro with-eval-after-load (file &rest body)
@ -68,13 +66,13 @@ Examples:
(if (listp hook) hook (list hook))))) funcs)
`(progn ,@forms)))
(cl-defmacro associate! (mode &key minor
&key in
&key match
&key files
&allow-other-keys)
(defmacro associate! (mode &rest rest)
"Associate a major or minor mode to certain patterns and project files."
(declare (indent 1))
(let ((minor (plist-get rest :minor))
(in (plist-get rest :in))
(match (plist-get rest :match))
(files (plist-get rest :files)))
`(progn
(,@(cond ((or files in)
(when (and files (not (or (listp files) (stringp files))))
@ -96,7 +94,7 @@ Examples:
`(add-to-list ',(if minor 'narf-auto-minor-mode-alist 'auto-mode-alist)
(cons ,match ',mode)))
(t (user-error "associate! invalid rules for mode [%s] (in %s) (match %s) (files %s)"
mode in match files))))))
mode in match files)))))))
(defmacro def-project-type! (name lighter &rest body)
"Define a minor mode for a specific framework, library or project type."
@ -230,7 +228,7 @@ Examples:
(t (user-error "Invalid key %s" key)))
forms)
(cl-incf i))
(setq i (1+ i)))
`(progn ,@(apply #'nconc (delete nil (delete (list nil) (reverse forms))))))))