capitaomorte/yasnippet — Issue #213: TAB completion doesn't work on Windows in Emacs 24
Author: GChristensen
Created: 2012-02-19 12:09:07+00:00
State: open

For example, when I type '(def' in Emacs Lisp mode and press TAB nothing happens. But if I place point on the 'e' letter in (def and call expand trigger from menu it replaces 'd' letter with the 'defun' snippet, the bracked and 'ef' rest in place.

(defun yas/expand-from-trigger-key (&optional field)
(interactive)
(setq yas/condition-cache-timestamp (current-time))
(let (templates-and-pos)
(unless (and yas/expand-only-for-last-commands
(not (member last-command yas/expand-only-for-last-commands)))
(setq templates-and-pos (if field
(save-restriction
(narrow-to-region (yas/field-start field)
(yas/field-end field))
(yas/current-key))
(yas/current-key))))
(if (and templates-and-pos
(first templates-and-pos)) <---- the code fails here because (yas/current-key) returns something like (nil 196 196)

I haven't manage to understand the logic of yas/current-key function, it seems malformed to me.