Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elpy-snippet-init-assignments - "Symbol’s value as variable is void: start-point" #1187

Open
lu-pl opened this issue Jan 28, 2024 · 1 comment

Comments

@lu-pl
Copy link

lu-pl commented Jan 28, 2024

Emacs version: 29.2
yasnippet version: 20240124.258 (Melpa)

Snippets using elpy-snippet-init-assignments expand to error output "Symbol’s value as variable is void: start-point".

E.g.

# -*- mode: snippet -*-
# name: init
# key: init
# group : definitions
# --

def __init__(self${1:, args}):
    ${1:$(my/elpy-snippet-init-assignments yas/text)}

expands to

def __init__(self, args):
    Symbol’s value as variable is void: start-point

As a quick fix replacing start-point with (point) appears to work:

(defun fix/elpy-snippet-init-assignments (arg-string)
  "Return the typical __init__ assignments for arguments in ARG-STRING."
  (let ((indentation
	 (make-string
	  (save-excursion
	    (goto-char (point))
	    (current-indentation))
	  ?\s)))
    (mapconcat
     (lambda (arg)
       (if (string-match "^\\*" arg)
	   ""
	 (format "self.%s = %s\n%s" arg arg indentation)))
     (elpy-snippet-split-args arg-string) "")))
@monnier
Copy link
Collaborator

monnier commented Feb 13, 2024

What/where is my/elpy-snippet-init-assignments?
It sounds like the error is coming from that function, which is not part of YASnippet, AFAICT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants