all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Johan Bockgård" <bojohan@gnu.org>
Cc: clement.pitclaudel@live.com, 20705@debbugs.gnu.org
Subject: bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode
Date: Wed, 03 Jun 2015 18:29:06 +0300	[thread overview]
Message-ID: <83twuoret9.fsf@gnu.org> (raw)
In-Reply-To: <874mmq583h.fsf@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	other threads:[~2015-06-03 15:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31 20:44 bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode Clément Pit--Claudel
     [not found] ` <handler.20705.B.143310511331135.ack@debbugs.gnu.org>
2015-05-31 21:21   ` bug#20705: Acknowledgement (Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode) Clément Pit--Claudel
2015-06-01 14:52     ` Eli Zaretskii
2015-06-02  9:17       ` Clément Pit--Claudel
2015-06-02 15:21         ` Eli Zaretskii
2015-06-02 17:32 ` bug#20705: Emacs segfaults when typing "(yas-expand" after M-: in yas-minor-mode Johan Bockgård
2015-06-03 15:29   ` Eli Zaretskii [this message]
2015-06-06 13:34     ` Eli Zaretskii
2015-06-07  0:35       ` Clément Pit--Claudel
2015-06-08 14:40         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83twuoret9.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=20705@debbugs.gnu.org \
    --cc=bojohan@gnu.org \
    --cc=clement.pitclaudel@live.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.