Here's a clearer way to see the results in each row when entering them on one line.
Take the latest copy of yasnippet from http://github.com/capitaomorte/yasnippet and add to your.emacs
(require 'yasnippet)
(defun yas/add-to-end-of-lines-snippet ()
(interactive)
(when (region-active-p)
(let ((snippet (replace-regexp-in-string "$" "$1" (buffer-substring (region-beginning) (region-end)))))
(delete-region (region-beginning) (region-end))
(yas/expand-snippet snippet))))
Now select a region and enter M-x add-to-end-of-lines-snippet.
source
share