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#21751: 24.5; Undesirable sh-mode indent Date: Wed, 30 Aug 2017 19:50:30 -0400 Message-ID: <87y3q07gzd.fsf@users.sourceforge.net> References: <87y4esm6js.fsf@hysteria.proulx.com> <874lsua5fi.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1504136964 31439 195.159.176.226 (30 Aug 2017 23:49:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Aug 2017 23:49:24 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: Phil , Oleksandr Gavenko , 21751@debbugs.gnu.org To: Bob Proulx Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 31 01:49:18 2017 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 1dnCjJ-0007HK-M6 for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Aug 2017 01:49:05 +0200 Original-Received: from localhost ([::1]:53246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnCjQ-0006oN-Ls for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Aug 2017 19:49:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnCjK-0006nE-HF for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 19:49:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnCjG-0002Ro-Io for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 19:49:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54977) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dnCjG-0002Rk-DA for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 19:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dnCjG-0005ok-66 for bug-gnu-emacs@gnu.org; Wed, 30 Aug 2017 19:49:02 -0400 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: Wed, 30 Aug 2017 23:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21751 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 21751-submit@debbugs.gnu.org id=B21751.150413693722352 (code B ref 21751); Wed, 30 Aug 2017 23:49:02 +0000 Original-Received: (at 21751) by debbugs.gnu.org; 30 Aug 2017 23:48:57 +0000 Original-Received: from localhost ([127.0.0.1]:35425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnCjB-0005oM-Au for submit@debbugs.gnu.org; Wed, 30 Aug 2017 19:48:57 -0400 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:37073) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dnCj9-0005o4-AM; Wed, 30 Aug 2017 19:48:55 -0400 Original-Received: by mail-io0-f169.google.com with SMTP id d78so11577342ioe.4; Wed, 30 Aug 2017 16:48:55 -0700 (PDT) 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=674t4lC2woNUvIdfEleUX+tZAlc+r3wvH+TIJ60yFwM=; b=Gjxz638Qv8SCAA3E74xV+A3iZDvhW5OiCdCFiDWw6r7xrABFcqAf8aJt0oXp8btbN8 naiiKiCnfrHEeWD7c8aiXVP1NLLAohXYvQV7HDFBNcubFnHdYrg/LjDEk4xzOo/ReoDM CQJvXcVtP5Dxv8izwXKoX8W9/s4Ol5+oz9aKGj6BxfGTJtdUcKg4FxcfIziB2faHsQNd Z0r2OSvfrLAhCqOEEFDbgpPju1TeDsIgy4cpkAc5//tbEb1JQlGSmhiYcKO2ynLwxByM jdNWLXLI4Ygvyt/0ALzIeuvXS042YpwMOPtXk8JZermeMgTrs9wrw52ENLD5Trq2JH5q Wbcw== 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=674t4lC2woNUvIdfEleUX+tZAlc+r3wvH+TIJ60yFwM=; b=hfrH2XShEgJNhU6Z+YthOX+rkpszob/UgGe6zoFdEgRVj0a0BKsKfp6FTdYk3XyruW 9bKk8ZGomVclAA2qWm61uKzNMRLvu+ORU9+Z+8dYsuv/qJiNcovKqdCilSSbzT4DBz6k Q78Wx+qNeJ1hY8z4MCyZyRMkMJmuz2FtSJ/JPfyJRLqASJ2lyaXbZnNoTXmmMHcInqwO 1KZfjwWBK9ivLDK0SyOFdZiPDeMm9ZqyUtVXU5l1dyXN64nJjWW3aDSaLw6sZtARY7tN tFFFbCbTJLDco9yEy8MukC+aGceXo6DhnIu5xqu5WlzqzmmiWFKgyUuQBNdvjzTkewMo lumg== X-Gm-Message-State: AHYfb5gQk415WUsY7+U/DPD2f8+AtA4UfK3vJR8wUgm/KTGvhW/297bX L3FcDCqpO/s2RSeJ X-Received: by 10.36.25.199 with SMTP id b190mr3752380itb.58.1504136929602; Wed, 30 Aug 2017 16:48:49 -0700 (PDT) Original-Received: from zony ([45.2.119.49]) by smtp.googlemail.com with ESMTPSA id y202sm1446724itc.2.2017.08.30.16.48.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Aug 2017 16:48:48 -0700 (PDT) In-Reply-To: <874lsua5fi.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sat, 26 Aug 2017 08:18:09 -0400") 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:136395 Archived-At: --=-=-= Content-Type: text/plain tags 21751 + patch quit npostavs@users.sourceforge.net writes: > I guess sh-indentation should be made into an obsolete alias for > sh-basic-offset? Here's a patch --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Make-sh-indentation-into-an-alias-for-sh-basic-of.patch Content-Description: patch >From 2205b597476083579bd3e50b20bc2ce42ca54520 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 30 Aug 2017 19:42:47 -0400 Subject: [PATCH v1] Make sh-indentation into an alias for sh-basic-offset (Bug#21751) * lisp/progmodes/sh-script.el (sh-indentation): Redefine as obsolete variable alias for `sh-basic-offset'. (sh-mode, sh-smie--indent-continuation) (sh-smie-rc-rules, sh-basic-indent-line): Replace `sh-indentation' with `sh-basic-offset'. --- lisp/progmodes/sh-script.el | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index ca31635dbc..2cf7e15540 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -593,11 +593,7 @@ sh-assignment-regexp (sexp :format "Evaluate: %v")))) :group 'sh-script) - -(defcustom sh-indentation 4 - "The width for further indentation in Shell-Script mode." - :type 'integer - :group 'sh-script) +(define-obsolete-variable-alias 'sh-indentation 'sh-basic-offset "26.1") (put 'sh-indentation 'safe-local-variable 'integerp) (defcustom sh-remember-variable-min 3 @@ -1623,7 +1619,7 @@ sh-mode (setq-local skeleton-pair-alist '((?` _ ?`))) (setq-local skeleton-pair-filter-function 'sh-quoted-p) (setq-local skeleton-further-elements - '((< '(- (min sh-indentation (current-column)))))) + '((< '(- (min sh-basic-offset (current-column)))))) (setq-local skeleton-filter-function 'sh-feature) (setq-local skeleton-newline-indent-rigidly t) (setq-local defun-prompt-regexp @@ -2018,7 +2014,7 @@ sh-smie--indent-continuation (forward-line -1) (if (sh-smie--looking-back-at-continuation-p) (current-indentation) - (+ (current-indentation) sh-indentation)))) + (+ (current-indentation) sh-basic-offset)))) (t ;; Just make sure a line-continuation is indented deeper. (save-excursion @@ -2039,13 +2035,13 @@ sh-smie--indent-continuation ;; check the line before that one. (> ci indent)) (t ;Previous line is the beginning of the continued line. - (setq indent (min (+ ci sh-indentation) max)) + (setq indent (min (+ ci sh-basic-offset) max)) nil))))) indent)))))) (defun sh-smie-sh-rules (kind token) (pcase (cons kind token) - (`(:elem . basic) sh-indentation) + (`(:elem . basic) sh-basic-offset) (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) (sh-var-value 'sh-indent-for-case-label))) (`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case")) @@ -2254,8 +2250,8 @@ sh-smie-rc-backward-token (defun sh-smie-rc-rules (kind token) (pcase (cons kind token) - (`(:elem . basic) sh-indentation) - ;; (`(:after . "case") (or sh-indentation smie-indent-basic)) + (`(:elem . basic) sh-basic-offset) + ;; (`(:after . "case") (or sh-basic-offset smie-indent-basic)) (`(:after . ";") (if (smie-rule-parent-p "case") (smie-rule-parent (sh-var-value 'sh-indent-after-case)))) @@ -2496,7 +2492,7 @@ sh-modify (defun sh-basic-indent-line () "Indent a line for Sh mode (shell script mode). -Indent as far as preceding non-empty line, then by steps of `sh-indentation'. +Indent as far as preceding non-empty line, then by steps of `sh-basic-offset'. Lines containing only comments are considered empty." (interactive) (let ((previous (save-excursion @@ -2520,9 +2516,9 @@ sh-basic-indent-line (delete-region (point) (progn (beginning-of-line) (point))) (if (eolp) - (max previous (* (1+ (/ current sh-indentation)) - sh-indentation)) - (* (1+ (/ current sh-indentation)) sh-indentation)))))) + (max previous (* (1+ (/ current sh-basic-offset)) + sh-basic-offset)) + (* (1+ (/ current sh-basic-offset)) sh-basic-offset)))))) (if (< (current-column) (current-indentation)) (skip-chars-forward " \t")))) -- 2.14.1 --=-=-=--