mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
* Bring back `yas/dont-activate'
* Fix issue 74. (Thanks to martin.k...@gmail.com)
This commit is contained in:
parent
f28cc874af
commit
9541218756
23
yasnippet.el
23
yasnippet.el
@ -654,10 +654,19 @@ Key bindings:
|
||||
(define-key yas/minor-mode-map (read-kbd-macro yas/trigger-key) 'yas/expand)
|
||||
(yas/init-minor-keymap))))
|
||||
|
||||
(defvar yas/dont-activate nil
|
||||
"If non-nil don't let `yas/minor-mode-on' active yas for this buffer.
|
||||
|
||||
`yas/minor-mode-on' is usually called by `yas/global-mode' so
|
||||
this effectively lets you define exceptions to the \"global\"
|
||||
behaviour.")
|
||||
(make-variable-buffer-local 'yas/dont-activate)
|
||||
|
||||
(defun yas/minor-mode-on ()
|
||||
"Turn on YASnippet minor mode."
|
||||
(interactive)
|
||||
(yas/minor-mode 1))
|
||||
(unless yas/dont-activate
|
||||
(yas/minor-mode 1)))
|
||||
|
||||
(defun yas/minor-mode-off ()
|
||||
"Turn off YASnippet minor mode."
|
||||
@ -2936,14 +2945,10 @@ Meant to be called in a narrowed buffer, does various passes"
|
||||
(indent-according-to-mode))))
|
||||
(save-excursion
|
||||
(cond ((eq yas/indent-line 'fixed)
|
||||
(let* ((indent (if indent-tabs-mode
|
||||
(concat (make-string (/ column tab-width) ?\t)
|
||||
(make-string (% column tab-width) ?\ ))
|
||||
(make-string (current-column) ?\ ))))
|
||||
(goto-char (point-min))
|
||||
(while (and (zerop (forward-line))
|
||||
(= (current-column) 0))
|
||||
(insert indent))))
|
||||
(goto-char (point-min))
|
||||
(while (and (zerop (forward-line))
|
||||
(zerop (current-column)))
|
||||
(indent-to-column column)))
|
||||
((eq yas/indent-line 'auto)
|
||||
(let ((end (set-marker (make-marker) (point-max)))
|
||||
(indent-first-line-p yas/also-auto-indent-first-line)
|
||||
|
Loading…
x
Reference in New Issue
Block a user