tags 16634 patch quit Sam Steingold 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.