Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors when indenting codes in php closure #42

Closed
guweigang opened this issue Dec 13, 2012 · 5 comments
Closed

errors when indenting codes in php closure #42

guweigang opened this issue Dec 13, 2012 · 5 comments
Labels

Comments

@guweigang
Copy link
Contributor

debug trace:

Debugger entered--Lisp error: (void-function cl-count)                                       
  (cl-count (quote arglist-cont-nonempty) syntax)                                            
  (* (cl-count (quote arglist-cont-nonempty) syntax) c-basic-offset)                         
  (delete-char (* (cl-count ... syntax) c-basic-offset))                                     
  (let ((count-func ...)) (beginning-of-line) (delete-char (* ... c-basic-offset)))          
  (save-excursion (let (...) (beginning-of-line) (delete-char ...)))                         
  (if (and (member ... syntax) (or ... ... ... ...)) (save-excursion (let ... ... ...)))     
  (let ((syntax ...)) (if (and ... ...) (save-excursion ...)))                               
  php-unindent-closure()                                                                     
  run-hooks(c-special-indent-hook)                                                           
  c-indent-line(((arglist-cont-nonempty 456 464) (statement-block-intro 456)) t t)           
  c-indent-region(1 2284 nil)                                                                
  funcall(c-indent-region 1 2284 nil)                                                        
  (if (or (not php-mode-warn-if-mumamo-off) php-warned-bad-indent                            
(php-check-html-for-indentation)) (funcall (quote c-indent-region) start end quiet))         
  php-cautious-indent-region(1 2284)                                                         
  indent-region(1 2284)                                                                      
  indent-for-tab-command(nil)                                                                
  call-interactively(indent-for-tab-command)                                                 
  (progn (setq this-command command) (call-interactively command))                           
  (if (and (commandp command) (not ...)) (progn (setq this-command command)                  
(call-interactively command)))                                                               
  (when (and (commandp command) (not ...)) (setq this-command command) (call-interactively   
command))                                                                                    
  (let* ((yas/minor-mode nil) (keys-1 ...) (keys-2 ...) (command-1 ...) (command-2 ...)      
(command ...)) (when (and ... ...) (setq this-command command) (call-interactively command)))
  (cond ((eq yas/fallback-behavior ...) nil) ((eq yas/fallback-behavior ...) (let* ... ...)) 
((and ... ... ...) (if ... ... ...)) (t nil))                                                
  (if templates (let (...) (when template ...)) (cond (... nil) (... ...) (... ...) (t nil)))
  (let* ((--cl-var-- ...) (templates ...) (start ...) (end ...)) (if templates (let ... ...) 
(cond ... ... ... ...)))                                                                     
  (multiple-value-bind (templates start end) (if field (save-restriction ... ...)            
(yas/current-key)) (if templates (let ... ...) (cond ... ... ... ...)))                      
  yas/expand-1()                                                                             
  yas/expand()                                                                               
  call-interactively(yas/expand nil nil)                                                     
@ejmr
Copy link
Collaborator

ejmr commented Dec 14, 2012

Eeesh, that looks nasty...

@cnwggu Could you please post an example of some PHP code that triggers this bug? That will help a lot. Thank you in advanced.

@guweigang
Copy link
Contributor Author

OK, no problem

$di->set('config', function () use ($config) {                                
        return $config;                                                       
    });                                                                       

$di->set('logger', function() use ($config) {                                 
        $filename = date('Ymd');                                              
        $logger = new \Logger($config->application->logger->dir . $filename); 
        $logger->setFormat($config->application->logger->format);             
        return $logger;                                                       
    });                                                                       

@ejmr
Copy link
Collaborator

ejmr commented Dec 14, 2012

Thanks for posting the example. Would you please try fetching the latest updates and checking out commit 8fc806e to see if that fixes the problem for you? I could not exactly reproduce the issue, but based on the example and the error output you gave I think it may be related.

@guweigang
Copy link
Contributor Author

thx so much, it worked just fine

@ejmr
Copy link
Collaborator

ejmr commented Dec 15, 2012

Great to hear :)

Hope you don't mind but I added the code you posted as a test case (giving you authorship credit of course) so that in the future we'll have this code to test php-unindent-closure and related code.

@ejmr ejmr closed this as completed Dec 15, 2012
haxney added a commit to haxney/php-mode that referenced this issue Feb 8, 2013
ejmr pushed a commit that referenced this issue Feb 8, 2013
This massively cuts back on the elisp code needed.

Signed-off-by: Eric James Michael Ritz <lobbyjones@gmail.com>
ejmr pushed a commit that referenced this issue Feb 8, 2013
* haxney/tests-with-magic-comments:
  Use magic for tests of issues #14, #19, #27, #29, #42
  Use "magic" comments in PHP files to simplify indentation testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants