diff options
| author | Noam Postavsky | 2017-08-30 19:42:47 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-09-25 19:39:19 -0400 |
| commit | f5e72b04d930215f6e770e2fe9e02ad6debf03ad (patch) | |
| tree | a4fb715f241624068466bda6f883c23141073f90 /lisp | |
| parent | a58d0c590a777be98e58cd8c92ee1381e07e9b2d (diff) | |
| download | emacs-f5e72b04d930215f6e770e2fe9e02ad6debf03ad.tar.gz emacs-f5e72b04d930215f6e770e2fe9e02ad6debf03ad.zip | |
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'.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/sh-script.el | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index f2027e37345..14598bcafb9 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -593,11 +593,7 @@ sign. See `sh-feature'." | |||
| 593 | (sexp :format "Evaluate: %v")))) | 593 | (sexp :format "Evaluate: %v")))) |
| 594 | :group 'sh-script) | 594 | :group 'sh-script) |
| 595 | 595 | ||
| 596 | 596 | (define-obsolete-variable-alias 'sh-indentation 'sh-basic-offset "26.1") | |
| 597 | (defcustom sh-indentation 4 | ||
| 598 | "The width for further indentation in Shell-Script mode." | ||
| 599 | :type 'integer | ||
| 600 | :group 'sh-script) | ||
| 601 | (put 'sh-indentation 'safe-local-variable 'integerp) | 597 | (put 'sh-indentation 'safe-local-variable 'integerp) |
| 602 | 598 | ||
| 603 | (defcustom sh-remember-variable-min 3 | 599 | (defcustom sh-remember-variable-min 3 |
| @@ -1617,7 +1613,7 @@ with your script for an edit-interpret-debug cycle." | |||
| 1617 | (setq-local skeleton-pair-alist '((?` _ ?`))) | 1613 | (setq-local skeleton-pair-alist '((?` _ ?`))) |
| 1618 | (setq-local skeleton-pair-filter-function 'sh-quoted-p) | 1614 | (setq-local skeleton-pair-filter-function 'sh-quoted-p) |
| 1619 | (setq-local skeleton-further-elements | 1615 | (setq-local skeleton-further-elements |
| 1620 | '((< '(- (min sh-indentation (current-column)))))) | 1616 | '((< '(- (min sh-basic-offset (current-column)))))) |
| 1621 | (setq-local skeleton-filter-function 'sh-feature) | 1617 | (setq-local skeleton-filter-function 'sh-feature) |
| 1622 | (setq-local skeleton-newline-indent-rigidly t) | 1618 | (setq-local skeleton-newline-indent-rigidly t) |
| 1623 | (setq-local defun-prompt-regexp | 1619 | (setq-local defun-prompt-regexp |
| @@ -2012,7 +2008,7 @@ May return nil if the line should not be treated as continued." | |||
| 2012 | (forward-line -1) | 2008 | (forward-line -1) |
| 2013 | (if (sh-smie--looking-back-at-continuation-p) | 2009 | (if (sh-smie--looking-back-at-continuation-p) |
| 2014 | (current-indentation) | 2010 | (current-indentation) |
| 2015 | (+ (current-indentation) sh-indentation)))) | 2011 | (+ (current-indentation) sh-basic-offset)))) |
| 2016 | (t | 2012 | (t |
| 2017 | ;; Just make sure a line-continuation is indented deeper. | 2013 | ;; Just make sure a line-continuation is indented deeper. |
| 2018 | (save-excursion | 2014 | (save-excursion |
| @@ -2033,13 +2029,13 @@ May return nil if the line should not be treated as continued." | |||
| 2033 | ;; check the line before that one. | 2029 | ;; check the line before that one. |
| 2034 | (> ci indent)) | 2030 | (> ci indent)) |
| 2035 | (t ;Previous line is the beginning of the continued line. | 2031 | (t ;Previous line is the beginning of the continued line. |
| 2036 | (setq indent (min (+ ci sh-indentation) max)) | 2032 | (setq indent (min (+ ci sh-basic-offset) max)) |
| 2037 | nil))))) | 2033 | nil))))) |
| 2038 | indent)))))) | 2034 | indent)))))) |
| 2039 | 2035 | ||
| 2040 | (defun sh-smie-sh-rules (kind token) | 2036 | (defun sh-smie-sh-rules (kind token) |
| 2041 | (pcase (cons kind token) | 2037 | (pcase (cons kind token) |
| 2042 | (`(:elem . basic) sh-indentation) | 2038 | (`(:elem . basic) sh-basic-offset) |
| 2043 | (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) | 2039 | (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt) |
| 2044 | (sh-var-value 'sh-indent-for-case-label))) | 2040 | (sh-var-value 'sh-indent-for-case-label))) |
| 2045 | (`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case")) | 2041 | (`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case")) |
| @@ -2248,8 +2244,8 @@ Point should be before the newline." | |||
| 2248 | 2244 | ||
| 2249 | (defun sh-smie-rc-rules (kind token) | 2245 | (defun sh-smie-rc-rules (kind token) |
| 2250 | (pcase (cons kind token) | 2246 | (pcase (cons kind token) |
| 2251 | (`(:elem . basic) sh-indentation) | 2247 | (`(:elem . basic) sh-basic-offset) |
| 2252 | ;; (`(:after . "case") (or sh-indentation smie-indent-basic)) | 2248 | ;; (`(:after . "case") (or sh-basic-offset smie-indent-basic)) |
| 2253 | (`(:after . ";") | 2249 | (`(:after . ";") |
| 2254 | (if (smie-rule-parent-p "case") | 2250 | (if (smie-rule-parent-p "case") |
| 2255 | (smie-rule-parent (sh-var-value 'sh-indent-after-case)))) | 2251 | (smie-rule-parent (sh-var-value 'sh-indent-after-case)))) |
| @@ -2490,7 +2486,7 @@ the value thus obtained, and the result is used instead." | |||
| 2490 | 2486 | ||
| 2491 | (defun sh-basic-indent-line () | 2487 | (defun sh-basic-indent-line () |
| 2492 | "Indent a line for Sh mode (shell script mode). | 2488 | "Indent a line for Sh mode (shell script mode). |
| 2493 | Indent as far as preceding non-empty line, then by steps of `sh-indentation'. | 2489 | Indent as far as preceding non-empty line, then by steps of `sh-basic-offset'. |
| 2494 | Lines containing only comments are considered empty." | 2490 | Lines containing only comments are considered empty." |
| 2495 | (interactive) | 2491 | (interactive) |
| 2496 | (let ((previous (save-excursion | 2492 | (let ((previous (save-excursion |
| @@ -2514,9 +2510,9 @@ Lines containing only comments are considered empty." | |||
| 2514 | (delete-region (point) | 2510 | (delete-region (point) |
| 2515 | (progn (beginning-of-line) (point))) | 2511 | (progn (beginning-of-line) (point))) |
| 2516 | (if (eolp) | 2512 | (if (eolp) |
| 2517 | (max previous (* (1+ (/ current sh-indentation)) | 2513 | (max previous (* (1+ (/ current sh-basic-offset)) |
| 2518 | sh-indentation)) | 2514 | sh-basic-offset)) |
| 2519 | (* (1+ (/ current sh-indentation)) sh-indentation)))))) | 2515 | (* (1+ (/ current sh-basic-offset)) sh-basic-offset)))))) |
| 2520 | (if (< (current-column) (current-indentation)) | 2516 | (if (< (current-column) (current-indentation)) |
| 2521 | (skip-chars-forward " \t")))) | 2517 | (skip-chars-forward " \t")))) |
| 2522 | 2518 | ||