arduino-mode
arduino-mode copied to clipboard
Emacs freeze after typing #define
define LedOn digitalWrite
then it freeze at spacebar hit time
I see the same issue and the trigger seems to be when you enter "(" #define foo bla/( when I enter ( it just hangs, cpu goes to 100% and only way out is ^g or to kill it Even more to it, create a .ino file with that content and it hangs the same way when opening the file.
This is a bit of a killer for anybody who wants to: #define CBI(port, bit) //etc.
That's a bummer (as is my delay in responding here). I've never been able to reproduce this, so if anyone is still seeing this issue it would be much appreciated to add some details about which version of emacs you're using and any extra modes that are active.
This is probably related to #5.
I set [M-x toggle-debug-on-quit]
.
Get a little info:
company-call-backend-raw: Company: backend (company-capf :with company-yasnippet) error "Wrong type argument: stringp, nil" with args (post-completion define)Error during redisplay: (jit-lock-function 2) signaled (wrong-type-argument stringp nil)
And:
Debugger entered--Lisp error: (quit)
put-text-property(10 11 syntax-table (1))
c-neutralize-CPP-line(1 18)
c-neutralize-syntax-in-CPP(18 18 1)
#f(compiled-function (fn) #<bytecode 0x19215a9>)(c-neutralize-syntax-in-CPP)
mapc(#f(compiled-function (fn) #<bytecode 0x19215a9>) (c-depropertize-new-text c-parse-quotes-after-change c-extend-font-lock-region-for-macros c-neutralize-syntax-in-CPP c-change-expand-fl-region))
c-after-change(18 18 1)
#f(compiled-function (reg) #<bytecode 0x249c971>)((18 . 19))
mapc(#f(compiled-function (reg) #<bytecode 0x249c971>) ((19 . #<marker at 18 in test.ino>) (18 . 19) (9 . 13)))
yas--delete-regions(((19 . #<marker at 18 in test.ino>) (18 . 19) (9 . 13)))
yas--snippet-parse-create(#s(yas--snippet :expand-env nil :fields (#s(yas--field :number 1 :start #<marker at 13 in test.ino> :end #<marker at 18 in test.ino> :parent-field nil :mirrors nil :transform nil :modified-p nil :next #1=#s(yas--exit :marker #<marker at 18 in test.ino> :next nil))) :exit #1# :id 37 :control-overlay nil :active-field nil :previous-active-field nil :force-exit nil))
#f(compiled-function () #<bytecode 0x25551c1>)()
funcall(#f(compiled-function () #<bytecode 0x25551c1>))
(let nil (funcall '#f(compiled-function () #<bytecode 0x25551c1>)))
eval((let nil (funcall '#f(compiled-function () #<bytecode 0x25551c1>))))
yas--snippet-create(nil 8 21)
yas-expand-snippet(" ${1:macro}$0")
irony-snippet--expand-yas-3(" ${1:macro}$0" nil)
irony-snippet-expand(" ${1:macro}$0")
irony-completion-post-complete(("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available))
irony-completion--capf-exit-function((("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) ("define" 40 #1# #1# "define macro(args)" 6 (" macro(args)" 1 6 7 11) available)) #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)) finished)
#f(compiled-function (str status) #<bytecode 0x2a81885>)(#("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)) finished)
company-capf(post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
apply(company-capf post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
company--multi-backend-adapter((company-capf :with company-yasnippet) post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
apply(company--multi-backend-adapter (company-capf :with company-yasnippet) (post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#))))
company-call-backend-raw(post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
apply(company-call-backend-raw (post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#))))
company--force-sync(company-call-backend-raw (post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#))) (company-capf :with company-yasnippet))
company-call-backend(post-completion #("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
company-cancel(#("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
company-finish(#("define" 0 3 (irony-capf #2=("define" 40 #1="" #1# "define macro" 6 (" macro" 1 6) available) face (completions-common-part)) 3 4 (irony-capf #2# face (completions-first-difference)) 4 6 (irony-capf #2#)))
company-complete-selection()
funcall-interactively(company-complete-selection)
call-interactively(company-complete-selection nil nil)
#f(compiled-function (cmd &optional record-flag keys special) "Execute CMD as an editor command.\nCMD must be a symbol that satisfies the `commandp' predicate.\nOptional second arg RECORD-FLAG non-nil\nmeans unconditionally put this command in the variable `command-history'.\nOtherwise, that is done only if an arg is read using the minibuffer.\nThe argument KEYS specifies the value to use instead of (this-command-keys)\nwhen reading the arguments; if it is nil, (this-command-keys) is used.\nThe argument SPECIAL, if non-nil, means that this command is executing\na special event, so ignore the prefix argument and don't clear it." #<bytecode 0x24dfef>)(company-complete-selection nil nil nil)
ad-Advice-command-execute(#f(compiled-function (cmd &optional record-flag keys special) "Execute CMD as an editor command.\nCMD must be a symbol that satisfies the `commandp' predicate.\nOptional second arg RECORD-FLAG non-nil\nmeans unconditionally put this command in the variable `command-history'.\nOtherwise, that is done only if an arg is read using the minibuffer.\nThe argument KEYS specifies the value to use instead of (this-command-keys)\nwhen reading the arguments; if it is nil, (this-command-keys) is used.\nThe argument SPECIAL, if non-nil, means that this command is executing\na special event, so ignore the prefix argument and don't clear it." #<bytecode 0x24dfef>) company-complete-selection)
apply(ad-Advice-command-execute #f(compiled-function (cmd &optional record-flag keys special) "Execute CMD as an editor command.\nCMD must be a symbol that satisfies the `commandp' predicate.\nOptional second arg RECORD-FLAG non-nil\nmeans unconditionally put this command in the variable `command-history'.\nOtherwise, that is done only if an arg is read using the minibuffer.\nThe argument KEYS specifies the value to use instead of (this-command-keys)\nwhen reading the arguments; if it is nil, (this-command-keys) is used.\nThe argument SPECIAL, if non-nil, means that this command is executing\na special event, so ignore the prefix argument and don't clear it." #<bytecode 0x24dfef>) company-complete-selection)
command-execute(company-complete-selection)
Here's a simpler backtrace. The following is from opening a fresh arduino-mode
buffer, and typing #define foo
C-q (:
Debugger entered--Lisp error: (quit)
put-text-property(12 13 syntax-table (1))
c-neutralize-CPP-line(1 13)
c-neutralize-syntax-in-and-mark-CPP(12 13 0)
#f(compiled-function (fn) #<bytecode 0xea659d>)(c-neutralize-syntax-in-and-mark-CPP)
mapc(#f(compiled-function (fn) #<bytecode 0xea659d>) (c-depropertize-new-text c-parse-quotes-after-change c-extend-font-lock-region-for-macros c-neutralize-syntax-in-and-mark-CPP c-change-expand-fl-region))
c-after-change(12 13 0)
insert-and-inherit(40)
quoted-insert(1)
funcall-interactively(quoted-insert 1)
call-interactively(quoted-insert nil nil)
command-execute(quoted-insert)
(I used C-q ( to rule out electric insertion as a problem.)