[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16634: 24.3.50; extra newline in skeleton {} in sh-mode
From: |
npostavs |
Subject: |
bug#16634: 24.3.50; extra newline in skeleton {} in sh-mode |
Date: |
Mon, 19 Dec 2016 20:39:21 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
tags 16634 patch
quit
Sam Steingold <sds@gnu.org> writes:
>
> emacs -Q
>
> Eval these:
>
> (define-key global-map "{" 'skeleton-pair-insert-maybe)
> (setq skeleton-pair t)
>
> M-x sh-mode RET
> insert:
>
> foo bar
>
> put the point between "foo" and " bar" (i.e., before SPC)
>
> hit "{"
>
> result: "{}\n" is inserted, the point is placed between the braces.
> expected: "{}" is inserted, the point is placed between the braces.
The problem is that sh-mode sets skeleton-end-hook to a function that
doesn't respect skeleton-end-newline:
(setq-local skeleton-end-hook
(lambda () (or (eolp) (newline) (indent-relative))))
Since skeleton-insert already does
(or (eolp) (not skeleton-end-newline) (newline-and-indent))
I think the fix is simply to remove sh-mode's custom skeleton-end-hook.
>From b8810e40da2d68555b294b4d809346db6226b144 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 19 Dec 2016 20:16:50 -0500
Subject: [PATCH v1] Remove sh-mode's skeleton-end-hook
* lisp/progmodes/sh-script.el (sh-mode): Remove local setting of
`skeleton-end-hook', `skeleton-insert' already does `newline-and-indent'
and also respects `skeleton-end-newline' (Bug#16634).
---
lisp/progmodes/sh-script.el | 2 --
1 file changed, 2 deletions(-)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 5d362e4..f34b5e6 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1629,8 +1629,6 @@ sh-mode
(setq-local skeleton-pair-default-alist
sh-skeleton-pair-default-alist)
- (setq-local skeleton-end-hook
- (lambda () (or (eolp) (newline) (indent-relative))))
(setq-local paragraph-start (concat page-delimiter "\\|$"))
(setq-local paragraph-separate (concat paragraph-start "\\|#!/"))
--
2.9.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#16634: 24.3.50; extra newline in skeleton {} in sh-mode,
npostavs <=