doomemacs / doomemacs/snippets

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

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
YASnippet
Stars
313
Forks
98
PR merge metrics
No merged PRs in 30d

Description

### What were you expecting?

I'm trying adding an attribute snippet which should behave like this: `

`

### What actually happened?

I instead got this:
```html


```

### Steps to reproduce

This is my snippet (I made sure it does not contain a any line break/newline):
```html
# -*- 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:
```lisp
(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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the d-tb snippet on GNU Emacs 28.2 using the configuration and HTML example from the issue, then inspect the snippet insertion behavior around the generated attribute. Done means a snippet with no newline does not gain one when require-final-newline is nil, while expected newline behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.