Skip to content

Symbol's function definition is void: find #95

Open
daveloyall opened this Issue Mar 26, 2013 · 8 comments

6 participants

@daveloyall

Hi.

I'm no emacs expert, so maybe this is just "user error", but here goes:

When I start a fresh emacs and issue M-x eclim-manage-projects, I get the message Symbol's function definition is void: find.

After looking around for a while, I realized that various calls like (find ...) are all over eclim.el, and indeed that function wasn't defined. But I found a defun for it here:

hobbes@metalbaby:~/src/emacs$ find . -name *.el -exec grep -H  "^(defun find (" {} +
./emacs24-24.2+1/lisp/emacs-lisp/cl-seq.el:(defun find (cl-item cl-seq &rest cl-keys)

...So, long story short, I had to (require 'cl), then eclim-manage-projects works.

So maybe emacs-eclim should call (require 'cl) on its own. Is that how that works?

Now, I have read that it's not popular to make a package depend on cl at runtime, but it's accepted to make it depend on it at compile time... And indeed I seem to recall cl being loaded during compile when I first installed emacs-eclim. Personally, I don't mind having cl loaded, so I consider my problem solved, but, I just thought that you might want to know about this.

Cheers,
--Dave

@expez
expez commented Mar 27, 2013

The cl package was deprecated in emacs 24.3. cl is now just a bunch of aliases to functions living in the replacement cl-lib. All the functions from cl are in cl-lib but they have the prefix cl-, so foo is now cl-foo.

More info can be find by doing C-h n and searching for 'cl-lib'.

@dgutov
dgutov commented Mar 27, 2013

@expez (require 'cl) still works in 24.3, and switching to cl-lib won't work as long as the project has to maintain compatibility with older Emacsen. For 24.1+, there's cl-lib in ELPA which can be used as a shim, but it will at least complicate installation with Emacs 23, if it'll work at all.

Speaking of compile-time vs. runtime, many of functions in cl can be replaced by using the loop macro.

@senny
Owner
senny commented Mar 27, 2013

Currently the README does not mention what versions we are actually targeting. I think this is a good time to set a version requirement.

@fred-o thoughts?

@root42
root42 commented Mar 27, 2013

Emacs 23 is still the current version in Debian stable. So I would recommend to at least allow for some compatibility with it.

@fred-o
Collaborator
fred-o commented Mar 27, 2013

Personally, I don't know enough about compatibility between emacs versions to be able to form an informed opinion. I just recently switched to 24, and am loving it so far, but keeping compatibility with 23 would be a good thing.

Does anyone know what the recommended way of handling the migration from cl to cl-lib is?

@dgutov
dgutov commented Mar 27, 2013

With Emacs 24, you declare dependency on cl-lib version 0.2 and stick cl- prefix everywhere. With 24.3, Emacs will notice it already has this package as built-in, and versions 24.1 and 24.2 will download and install the cl-lib shim. It's not fully compatible (check out the comments in the code), but probably compatible enough. It may even work with Emacs 23, provided it has GNU ELPA in the archives list.

Here's a package of mine that uses this approach: https://github.com/dgutov/diff-hl/blob/master/diff-hl.el

@fred-o
Collaborator
fred-o commented Oct 14, 2013

Okay, I still can't make heads or tails out of this. Had a look at cl-lib (version 0.3), but as far as I can tell it doesn't have the cl-find function anywhere.

FWIW, I'm running 24.2.2 on OSX, and it includes cl-seq.el, which at least has find.

If anybody wants to contribute a patch for this, I'd be more than willing to merge it. As it stands, I don't feel confident that I'd be doing the right thing if I tried myself.

@dgutov
dgutov commented Oct 14, 2013

it doesn't have the cl-find function anywhere

It defines a bunch of aliases, and cl-find as a alias for find. This long form does this:

(dolist (fun '(
               (get* . cl-get)
               (random* . cl-random)
               (rem* . cl-rem)
               (mod* . cl-mod)
               (round* . cl-round)
               (truncate* . cl-truncate)
               (ceiling* . cl-ceiling)
               (floor* . cl-floor)
               (rassoc* . cl-rassoc)
               (assoc* . cl-assoc)
               (member* . cl-member)
               (delete* . cl-delete)
               (remove* . cl-remove)
               (defsubst* . cl-defsubst)
               (sort* . cl-sort)
               (function* . cl-function)
               (defmacro* . cl-defmacro)
               (defun* . cl-defun)
               (mapcar* . cl-mapcar)

               remprop
               getf
               tailp
               list-length
               nreconc
               revappend
               concatenate
               subseq
               random-state-p
               make-random-state
               signum
               isqrt
               lcm
               gcd
               notevery
               notany
               every
               some
               mapcon
               mapcan
               mapl
               maplist
               map
               equalp
               coerce
               tree-equal
               nsublis
               sublis
               nsubst-if-not
               nsubst-if
               nsubst
               subst-if-not
               subst-if
               subsetp
               nset-exclusive-or
               set-exclusive-or
               nset-difference
               set-difference
               nintersection
               intersection
               nunion
               union
               rassoc-if-not
               rassoc-if
               assoc-if-not
               assoc-if
               member-if-not
               member-if
               merge
               stable-sort
               search
               mismatch
               count-if-not
               count-if
               count
               position-if-not
               position-if
               position
               find-if-not
               find-if
               find
               nsubstitute-if-not
               nsubstitute-if
               nsubstitute
               substitute-if-not
               substitute-if
               substitute
               delete-duplicates
               remove-duplicates
               delete-if-not
               delete-if
               remove-if-not
               remove-if
               replace
               fill
               reduce
               compiler-macroexpand
               define-compiler-macro
               assert
               check-type
               typep
               deftype
               defstruct
               callf2
               callf
               letf*
               letf
               rotatef
               shiftf
               remf
               psetf
               (define-setf-method . define-setf-expander)
               declare
               the
               locally
               multiple-value-setq
               multiple-value-bind
               symbol-macrolet
               macrolet
               progv
               psetq
               do-all-symbols
               do-symbols
               dotimes
               dolist
               do*
               do
               loop
               return-from
               return
               block
               etypecase
               typecase
               ecase
               case
               load-time-value
               eval-when
               destructuring-bind
               gentemp
               gensym
               pairlis
               acons
               subst
               adjoin
               copy-list
               ldiff
               list*
               cddddr
               cdddar
               cddadr
               cddaar
               cdaddr
               cdadar
               cdaadr
               cdaaar
               cadddr
               caddar
               cadadr
               cadaar
               caaddr
               caadar
               caaadr
               caaaar
               cdddr
               cddar
               cdadr
               cdaar
               caddr
               cadar
               caadr
               caaar
               tenth
               ninth
               eighth
               seventh
               sixth
               fifth
               fourth
               third
               endp
               rest
               second
               first
               svref
               copy-seq
               evenp
               oddp
               minusp
               plusp
               floatp-safe
               declaim
               proclaim
               nth-value
               multiple-value-call
               multiple-value-apply
               multiple-value-list
               values-list
               values
               pushnew
               decf
               incf

               dolist
               dotimes
               ))
  (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun)))
               (intern (format "cl-%s" fun)))))
    (unless (fboundp new) (defalias new fun))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.