0

I stumbled this thread and at first, it seems glorious, but I simply cannot get it to work. So when I try it on any program e.g.:

#include <iostream>

bool helloWorld(int a,int b){
    dox<tab>
    std::cout << a << b << std::endl;
    return true
}

int main(){
std::cout << helloWorld(123, 321) std::endl;
return 0;
}

even though I have semantic-, doxy- and yas-mode enabled, it returns:

function: main (start)
[yas] Error running #[128 \302\300\303\301""\207 [eval ((progn (unless 
    (and (fboundp (quote semantic-current-tag)) semantic-mode) 
    (error Semantic required to use dox snippet)) (let ((tag 
    (senator-next-tag))) (while (or (null tag) (not (semantic-tag-of-class-p 
    tag (quote function)))) (setq tag (senator-next-tag))) (let* ((name 
    (semantic-tag-name tag)) (attrs (semantic-tag-attributes tag)) 
    (args (plist-get attrs :arguments)) (return-name (plist-get attrs :type)) 
    (idx 1)) (if (listp return-name) (setq return-name (car return-name))) 
    (yas/expand-snippet (format /**
* @brief ${1:%s}
*
%s
%s*/
name (mapconcat (lambda (x) (format * @param %s ${%d:Description of %s} (car x) 
    (incf idx) (car x))) args 
) (if (and return-name (not (string-equal void return-name))) 
    (format  * @return ${%d:%s}
(incf idx) return-name) ))))))) apply append] 6 

(fn &rest ARGS2)]: Symbol’s function definition is void: incf

I'm currently running ubuntu 16.04 and emacs25

  • Please format your error message. – Dan Apr 9 '18 at 8:41
  • Hope this is the format you're looking for ^_^ – Jakob Guldberg Aaes Apr 9 '18 at 12:06
  • Nope, currently unreadable. – Dan Apr 9 '18 at 12:12
  • Would you care to elaborate? – Jakob Guldberg Aaes Apr 9 '18 at 12:13
  • Second line stretches way, way, way to the right. Please try to format it so that it can be read like code (ie, vertically). – Dan Apr 9 '18 at 12:19
1
Symbol’s function definition is void: incf

You can replace the incf calls in the snippet with cl-incf, or M-x load-library RET cl RET.

incf is an alias for ‘cl-incf’ in ‘cl.el’.

By the way, I think the dox is supposed to be expanded from above the function, not inside it.

  • Figured it out just as you posted, thanks for the answer though. I like it better in there instead of having to load even more packages on startup, AND you are right about where to use it. Thanks for a pleasant experience for my first post in here :) – Jakob Guldberg Aaes Apr 9 '18 at 13:01
0

So investigated a little and found the answer here which is to include the Common Lisp functions with

(require 'cl)

in the .emacs file, or init.el if you are into that one insead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.