Closed k-okada closed 9 years ago
Kei,
thanks a lot for the pull request. Does this work for you in elisp?
However, in the default SBCL implementation, I couldn't find the cl-flet
call:
CL-USER> (cl-flet ((fnc ())))
; in: CL-FLET ((FNC NIL))
; ((FNC NIL))
;
; caught ERROR:
; illegal function call
; in: CL-FLET ((FNC NIL))
; (CL-FLET ((FNC NIL)))
;
; caught STYLE-WARNING:
; undefined function: CL-FLET
;
; compilation unit finished
; Undefined function:
; CL-FLET
; caught 1 ERROR condition
; caught 1 STYLE-WARNING condition
; Evaluation aborted on #<SB-INT:COMPILED-PROGRAM-ERROR {1010E6B583}>.
flet
seems indeed to be deprecated though: http://stackoverflow.com/questions/18895605/should-flet-be-replaced-with-cl-flet-or-cl-letf
@gaya-, do you have an idea whether this exists in SBCL as well? Its this function: http://www.gnu.org/software/emacs/manual/html_node/cl/Function-Bindings.html
Please be careful about using cl-flet
, because cl-flet
does not exist on emacs 23 (precise default).
Thanks, true. I'm on GNU Emacs 24.3.1 (Ubuntu 14.04, using ROS Indigo) and it seems to not be present here either. Which Emacs are you using exactly? Is it the default one for Ubuntu (e.g. 24.3)?
I'm using emacs 24.3.1 and I can use cl-flet
after (require 'cl-lib)
.
According to you code above, you are using sbcl and you don't test it on emacs lisp.
(require 'cl-lib)
(cl-flet ((foo ()))
(print 'foo))
Humm, on emacs24 (trusty default), flet does not exist, we have to use cl-flet.
◉ Kei Okada
On Fri, Jan 2, 2015 at 5:50 PM, Ryohei Ueda notifications@github.com wrote:
Please be careful about using cl-flet, because cl-flet does not exist on emacs 23 (precise default).
— Reply to this email directly or view it on GitHub https://github.com/code-iai/ros_emacs_utils/pull/9#issuecomment-68514167 .
emacs provides a good variable emacs-major-version
.
Yes, I've used that variable in this stack before and am planning to use it for this pull request. I'll merge it in and add necessary tweaks once I'm back home from vacation tomorrow if that's fine. @fairlight1337 You're testing it in common lisp, it's written in emacs lisp though.
You're right, @garaemon. I was testing it in SBCL and not Elisp, which didn't make any sense. So
(progn
(require 'cl-lib)
(cl-flet ((fnc ()
(print "Test")))
(fnc)))
works fine for me. Does this work on older Emacs versions as well? We still have some people around that use emacs23 (and hopefully nothing older).
Otherwise, I'll just pull it in. @airballking, @gaya-, any objections?
@gaya-, just saw it, thanks ;). Okay, I'll leave that to you.
unfortunately emacs23 does not support cl-flet.
Does this work on older Emacs versions as well? We still have some people around that use emacs23 (and hopefully nothing older).
Sorry it took forever to process this pull request.
A couple of notes:
flet
is declared obsolete but is still a valid function. The default behavior of Emacs is to continue execution on warnings.cl-flet
is not exactly equivalent to flet
, so in this particular case substitution will not achieve the expected behavior. Interestingly, I googled around and stumbled over the exact same issue on the original rosemacs repo: https://github.com/moesenle/rosemacs-debs/issues/2. Pity that, although the issue was solved, there was never a pull request, I guess the guys couldn't be bothered dealing with compatibility issues.cl.el
in general is an outdated version of cl-lib.el
, I ported all the code to the new cl-lib.el
, and because the change is so big, I decided to stop worrying about compatibility and created an extra branch for Emacs versions lower than 24.3 and only support modern emacsen on the master branch.Thanks a lot to everyone for your contribution!
on indigo(14.04) it fails on loading as follows: