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

From: Johan Bockgård <[email-masked]>
Date: Tue, 02 Jun 2015 19:32:50 +0200

Clément Pit--Claudel <[email-masked]> writes:

> Lisp Backtrace:
> "key-binding" (0xffffaef0)
> "yas--keybinding-beyond-yasnippet" (0xffffb0d0)
> "yas--expand-from-trigger-key-doc" (0xffffb200)
> "documentation" (0xffffb500)
> "elisp-get-fnsym-args-string" (0xffffb6e8)
> "apply" (0xffffb840)
> "elisp-eldoc-documentation-function" (0xffffbb30)
> "apply" (0xffffbb28)
> 0x1e1ba50 PVEC_COMPILED
> "eldoc-print-current-symbol-info" (0xffffbee0)
> 0x9e4270 PVEC_COMPILED
> "apply" (0xffffc1c0)
> "timer-event-handler" (0xffffc3a8)

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.