snippets icon indicating copy to clipboard operation
snippets copied to clipboard

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

Open afidegnum opened this issue 2 years ago • 0 comments
trafficstars

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

afidegnum avatar Nov 20 '23 12:11 afidegnum