[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shell-script[bash] indention broken (or fixed?)
From: |
Stefan Monnier |
Subject: |
Re: Shell-script[bash] indention broken (or fixed?) |
Date: |
Mon, 11 Jul 2005 17:25:39 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
>> This might make it safe most of the time, but I think there will still
>> be cases of strings where it gets fooled.
> The idea is not to use a heuristic to figure out what the user wants, but
> to
> setup a convention that the user can follow.
> It might work. The paren-after-newline convention for starting a
> function works well, and I guess people would adapt to this one too.
> Want to try it?
How 'bout the patch below?
Stefan
--- sh-script.el 04 jui 2005 14:42:24 -0400 1.160
+++ sh-script.el 11 jui 2005 17:24:12 -0400
@@ -2033,11 +2033,20 @@
;; Continuation lines are handled specially
(if (sh-this-is-a-continuation)
(progn
+ (setq result
+ (if (save-excursion
+ (beginning-of-line)
+ (not (memq (char-before (- (point) 2)) '(?\s ?\t))))
+ ;; By convention, if the continuation \ is not
+ ;; preceded by a SPC or a TAB it means that the line
+ ;; is cut at a place where spaces cannot be freely
+ ;; added/removed. I.e. do not indent the line.
+ (list '(= nil))
;; We assume the line being continued is already
;; properly indented...
;; (setq prev-line-end (sh-prev-line))
(setq align-point (sh-prev-line nil))
- (setq result (list '(+ sh-indent-for-continuation)))
+ (list '(+ sh-indent-for-continuation))))
(setq have-result t))
(beginning-of-line)
(skip-chars-forward " \t")
- Re: Shell-script[bash] indention broken (or fixed?),
Stefan Monnier <=