From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode Date: Wed, 03 Jun 2015 18:29:06 +0300 Message-ID: <83twuoret9.fsf@gnu.org> References: <556B72BB.4080508@live.com> <874mmq583h.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1433345503 15685 80.91.229.3 (3 Jun 2015 15:31:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Jun 2015 15:31:43 +0000 (UTC) Cc: clement.pitclaudel@live.com, 20705@debbugs.gnu.org To: Johan =?UTF-8?Q?Bockg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 03 17:31:33 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z0AdT-0002L0-Sv for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 17:31:20 +0200 Original-Received: from localhost ([::1]:36232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AdO-0007ZP-9m for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jun 2015 11:31:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AdG-0007YL-PJ for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 11:31:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0AdD-0002As-Gk for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 11:31:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AdD-0002Ak-6J for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 11:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z0AdC-0005hW-Pu for bug-gnu-emacs@gnu.org; Wed, 03 Jun 2015 11:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jun 2015 15:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20705 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20705-submit@debbugs.gnu.org id=B20705.143334542821868 (code B ref 20705); Wed, 03 Jun 2015 15:31:02 +0000 Original-Received: (at 20705) by debbugs.gnu.org; 3 Jun 2015 15:30:28 +0000 Original-Received: from localhost ([127.0.0.1]:39177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z0Acd-0005gd-5N for submit@debbugs.gnu.org; Wed, 03 Jun 2015 11:30:27 -0400 Original-Received: from mtaout26.012.net.il ([80.179.55.182]:50658) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z0AcZ-0005fb-1J for 20705@debbugs.gnu.org; Wed, 03 Jun 2015 11:30:24 -0400 Original-Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NPD00H00KG3UT00@mtaout26.012.net.il> for 20705@debbugs.gnu.org; Wed, 03 Jun 2015 18:31:17 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NPD00647KG3B370@mtaout26.012.net.il>; Wed, 03 Jun 2015 18:31:16 +0300 (IDT) In-reply-to: <874mmq583h.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103541 Archived-At: > From: Johan Bockgård > Cc: 20705@debbugs.gnu.org, Eli Zaretskii > 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 */