bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-mi


From: Clément Pit--Claudel
Subject: bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode
Date: Sat, 06 Jun 2015 17:35:20 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Yes! Brilliant debugging as always :) This patch seems to fix the problem.

Thanks Johan and Eli,
Clément.

On 06/06/2015 06:34 AM, Eli Zaretskii wrote:
> Ping!  Clément, any word on this?
> 
>> Date: Wed, 03 Jun 2015 18:29:06 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: clement.pitclaudel@live.com, 20705@debbugs.gnu.org
>>
>>> From: Johan Bockgård <bojohan@gnu.org>
>>> Cc: 20705@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
>>> Date: Tue, 02 Jun 2015 19:32:50 +0200
>>>
>>> The code looks like this:
>>>
>>>     (defun yas--keybinding-beyond-yasnippet ()
>>>       "Get current keys's binding as if YASsnippet didn't exist."
>>>       (let* ((yas-minor-mode nil)
>>>              (yas--direct-keymaps nil)
>>>              (keys (this-single-command-keys)))
>>>         (or (key-binding keys t)
>>>             (key-binding (yas--fallback-translate-input keys) t))))
>>>
>>> Apparently this-single-command-keys returns [] (empty vector) when run
>>> from a timer. This in turn makes key-binding crash.
>>
>> Thanks for the analysis.
>>
>> Clément, can you try the patch below?
>>
>> diff --git a/src/keymap.c b/src/keymap.c
>> index 8f4ac0d..b69b409 100644
>> --- a/src/keymap.c
>> +++ b/src/keymap.c
>> @@ -1652,10 +1652,14 @@ Returns nil if COMMAND is not remapped (or not a 
>> symbol).
>>  
>>    if (NILP (position) && VECTORP (key))
>>      {
>> -      Lisp_Object event
>> -    /* mouse events may have a symbolic prefix indicating the
>> -       scrollbar or mode line */
>> -    = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
>> +      Lisp_Object event;
>> +
>> +      if (ASIZE (key) == 0)
>> +    return Qnil;
>> +
>> +      /* mouse events may have a symbolic prefix indicating the
>> +     scrollbar or mode line */
>> +      event = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 
>> 0);
>>  
>>        /* We are not interested in locations without event data */
>>  
>>
>>
>>
>>
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]