yasnippet-snippets icon indicating copy to clipboard operation
yasnippet-snippets copied to clipboard

commentblock in emacs-lisp mode is strange

Open quazgar opened this issue 5 years ago • 2 comments
trafficstars

Observed behaviour

For me, using the cob (commentblock, from the prog-mode section) snippet in elisp mode produces this result:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                                        ;             Some comment            ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

What seems wrong to me

There are lots of whitespaces before the first ; and it's only a single ;, not as I expected ;;. Opposed to this behaviour, comment-region prepends double semicolons.

What the snippet should do

  • All three lines should start with ;; at the beginning of the line.

Discussion

If the current behaviour is as intended, that's fine for me and the issue could be closed.

quazgar avatar Jun 17 '20 09:06 quazgar

On further investigation, this seems to be a general problem with yasnippet in lisp-mode: If the return value of a ${1:$( ... )} expression starts with a single semicolon, that line will be indented to column 40, which makes no sense for comment blocks.

So as a workaround I propose to put a double semicolon in front. I will post a pull request soon.

quazgar avatar Dec 11 '22 23:12 quazgar

See PR #454

quazgar avatar Dec 11 '22 23:12 quazgar