jimeh / .emacs.d

My personal Emacs config with any quirks, oddities, bugs, and man-eating errors I live with on a daily basis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yaml/ansible syntax

sandikata opened this issue · comments

I'm facing weird behavior in yaml mode if I copy paste a formated playbook.
emacs just makes it with multiple tabs in any new line, and it's absolutely unreadable and broken code at all.
Do you have any ideas ?

This behavior is what I'd expect if auto-indenting was firing for yaml-mode. But it's disabled for YAML and various other indentation-sensitive major modes by default. However if you've customized the siren-indent-sensitive-modes variable, make sure yaml-mode is still listed there.

Yep it's still there. Well, if you found some fix i'll be happy :)

I'm afraid I can't re-produce the issue myself. Are you sure you're using yaml-mode major mode for the files in question, and not some other ansible specific major mode?

To check if it's the auto-indent on paste code causing the issue, try commenting out these lines locally and restart emacs:

(advise-commands "indent" (yank yank-pop) after
"If current mode is one of `siren-yank-indent-modes',
indent yanked text (with prefix arg don't indent)."
(if (and (not (ad-get-arg 0))
(not (member major-mode siren-indent-sensitive-modes))
(or (derived-mode-p 'prog-mode)
(member major-mode siren-yank-indent-modes)))
(let ((transient-mark-mode nil))
(yank-advised-indent-function (region-beginning) (region-end)))))