From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#16634: 24.3.50; extra newline in skeleton {} in sh-mode Date: Mon, 19 Dec 2016 20:39:21 -0500 Message-ID: <87k2avbcqe.fsf@users.sourceforge.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1482197956 24325 195.159.176.226 (20 Dec 2016 01:39:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Dec 2016 01:39:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 16634@debbugs.gnu.org To: Sam Steingold Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 20 02:39:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJ9OX-0005CE-4F for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Dec 2016 02:39:09 +0100 Original-Received: from localhost ([::1]:48584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ9Ob-0008QA-NL for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Dec 2016 20:39:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ9OV-0008P8-2H for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2016 20:39:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJ9OQ-0004bI-PL for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2016 20:39:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60982) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cJ9OQ-0004b2-Ll for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2016 20:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cJ9OQ-0000wl-Ag for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2016 20:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Dec 2016 01:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16634 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16634-submit@debbugs.gnu.org id=B16634.14821979063592 (code B ref 16634); Tue, 20 Dec 2016 01:39:02 +0000 Original-Received: (at 16634) by debbugs.gnu.org; 20 Dec 2016 01:38:26 +0000 Original-Received: from localhost ([127.0.0.1]:48148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJ9Nq-0000vn-0M for submit@debbugs.gnu.org; Mon, 19 Dec 2016 20:38:26 -0500 Original-Received: from mail-it0-f50.google.com ([209.85.214.50]:36092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cJ9No-0000vT-ET; Mon, 19 Dec 2016 20:38:24 -0500 Original-Received: by mail-it0-f50.google.com with SMTP id 75so48828104ite.1; Mon, 19 Dec 2016 17:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AkrG7Z1aPcnRChWwGrP/jtLJL0j66GaIRtgiuZEy04A=; b=ryLHsDurQ0LEZrNJxEvDjqYElaz12i4U5IttI9eYKwiNRnFHX668T0jPmLLz3/wWSI BTOUkaTEb68x24asvWxSPSpRp7iICE2DQlB05uOho96Djg3z1TiMWsyoKZKrte1sSLcd KDNeTVxCJLtjc8VSQOWjp5ENfFHeALXDQpCZlXlclLpwKt5P1vJa+DFjcZsdXxJNeZsI +wOIkks881oVIkSBt9+p+GVn5/oxqE3joayPHSbZ8PirFUzp2fwjPpbkPeIvHhww+2u2 3XLFhNRiUD5R5Vc+DLgEHCcJw/8m1bup9xsdhYdTMhdBV8SOuPw79IUbGbEXtm2Fk4QU Cemg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=AkrG7Z1aPcnRChWwGrP/jtLJL0j66GaIRtgiuZEy04A=; b=Rvm+lzLtLricVdJ+0z4hikkkJQn9kgkaknuTWq5mEZzK3bfLKOyQnkHAGOMQ3CB0iI NeQFeREo1b3sqZDB+iBSmBjY3FhHFBZYPq2Ry3LPeb/RiAUZky80r352lo6+yVH8vzKw TC1PCT+NRegAUu1DsEG67TBCoeAMwKabdoV7GzGq/in0OWl7/njKHDSz24/vkN7Htc6c Jn7WD0CVZdALaxK+KSUTGGUEUbTr35xmW/2og0WPRZreWrTfGaaZ20dYyK7P916RCY9C sTPe/D1xu7gQj0dSdIFqYj325CV3t7Ie/h6VvxwZBIb+elgE0KFWhFUDySXTIfdBrZNe ejRQ== X-Gm-Message-State: AKaTC01ZVkfGk9BVWZHAhpeKDPQiUo2l06o4vqel+P5mRqKw8KSE234pAqNB12yyw4cg+A== X-Received: by 10.36.129.9 with SMTP id q9mr20234463itd.24.1482197898841; Mon, 19 Dec 2016 17:38:18 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 9sm9304909itv.0.2016.12.19.17.38.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Dec 2016 17:38:18 -0800 (PST) In-Reply-To: (Sam Steingold's message of "Tue, 04 Feb 2014 17:40:16 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127225 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=v1-0001-Remove-sh-mode-s-skeleton-end-hook.patch Content-Description: patch >From b8810e40da2d68555b294b4d809346db6226b144 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--