Skip to content

snippets always append a new line even though I require-final-newline to nil #102

Open
@afidegnum

Description

@afidegnum

What were you expecting?

I'm trying adding an attribute snippet which should behave like this: <div new-snippet="here"></div>

What actually happened?

I instead got this:

<div new-snippet="here"
></div>

Steps to reproduce

This is my snippet (I made sure it does not contain a any line break/newline):

# -*- mode: snippet -*-
# name: d-tb
# key: d-tb
# --
data-table="$1" d-field="$2" d-type="$3" $0

To enforce that, I also applied this configuration using a heuristic approach since I don't know which works and none of them didn't yield any positive result:

(defun disable-final-newline ()
  "Disable the adding of final newlines in the current buffer."
  (interactive)
  (set (make-local-variable 'require-final-newline) nil))

(add-hook 'snippet-mode 'disable-final-newline)
(add-hook 'web-mode 'disable-final-newline)
(add-hook 'web-mode-hook 'disable-final-newline)
(add-hook 'web-mode-hook (lambda () (setq-local require-final-newline nil)))
(add-hook 'html-mode-hook (lambda () (setq-local require-final-newline nil)))
(customize-set-variable 'require-final-newline nil)

Operating system

Debian Bookworm

Emacs version

GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2022-10-26

Installed commit of doom-snippets

90b1b221f

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugSomething isn't working as intendedneeds-triageIssue hasn't been assessed yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions