Skip to content

Commit 43624ca

Browse files
authored
Merge pull request #352 from stepnem/fix-hook-functions
Don't add anonymous functions to hooks, use named functions instead
2 parents b36dc30 + 27f4d48 commit 43624ca

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

snippets/bibtex-mode/.yas-setup.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
(require 'yasnippet)
22

3-
(add-hook 'bibtex-mode-hook
4-
'(lambda () (set (make-local-variable 'yas-indent-line) nil)))
3+
(add-hook 'bibtex-mode-hook #'yasnippet-snippets--no-indent)

snippets/python-mode/.yas-setup.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@
3535
"\n"))))
3636

3737

38-
(add-hook 'python-mode-hook
39-
'(lambda () (set (make-local-variable 'yas-indent-line) 'fixed)))
38+
(add-hook 'python-mode-hook #'yasnippet-snippets--fixed-indent)

yasnippet-snippets.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ customizable variable used for a snippet expansion.
5858
See Info node `(elisp)Customization Types'."
5959
:group 'yasnippet)
6060

61+
(defun yasnippet-snippets--fixed-indent ()
62+
"Set `yas-indent-line' to `fixed'."
63+
(set (make-local-variable 'yas-indent-line) 'fixed))
64+
65+
(defun yasnippet-snippets--no-indent ()
66+
"Set `yas-indent-line' to nil."
67+
(set (make-local-variable 'yas-indent-line) nil))
68+
6169
;;;###autoload
6270
(eval-after-load 'yasnippet
6371
'(yasnippet-snippets-initialize))

0 commit comments

Comments
 (0)