Merge pull request #352 from stepnem/fix-hook-functions

Don't add anonymous functions to hooks, use named functions instead
This commit is contained in:
Andrea Crotti 2019-11-08 09:17:19 +00:00 committed by GitHub
commit 43624cad75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

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

View File

@ -35,5 +35,4 @@
"\n"))))
(add-hook 'python-mode-hook
'(lambda () (set (make-local-variable 'yas-indent-line) 'fixed)))
(add-hook 'python-mode-hook #'yasnippet-snippets--fixed-indent)

View File

@ -58,6 +58,14 @@ customizable variable used for a snippet expansion.
See Info node `(elisp)Customization Types'."
:group 'yasnippet)
(defun yasnippet-snippets--fixed-indent ()
"Set `yas-indent-line' to `fixed'."
(set (make-local-variable 'yas-indent-line) 'fixed))
(defun yasnippet-snippets--no-indent ()
"Set `yas-indent-line' to nil."
(set (make-local-variable 'yas-indent-line) nil))
;;;###autoload
(eval-after-load 'yasnippet
'(yasnippet-snippets-initialize))