--- Begin Message ---
Subject: |
24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method |
Date: |
Sat, 18 Aug 2012 21:12:23 +0800 |
Looks like defaulting skeleton-untabify to t is no longer a good idea.
There is no way in a skeleton to figure out how many chars are to be
deleted for the skeleton element -num.
So for example, skeletons in sh-scripts can behave abnormally if (setq
backward-delete-char-untabify-method 'hungry).
1. Emacs -q
2. (setq backward-delete-char-untabify-method 'hungry)
3. C-x C-f x.bash
4. C-c : and choose bash
5. C-c (
You should see the function template expanded incorrectly.
I think defaulting skeleton-untabify to nil is the right fix. Otherwise,
the idea that customising backward-delete-char-untabify-method can
implicitly change how skeleton does its work is scary.
A fix local to sh-script.el can be done too:
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index f0dec93f..509b645d 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1512,6 +1512,7 @@ (define-derived-mode sh-mode prog-mode "Shell-script"
(set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p)
(set (make-local-variable 'skeleton-further-elements)
'((< '(- (min sh-indentation (current-column))))))
+ (set (make-local-variable 'skeleton-untabify) nil)
(set (make-local-variable 'skeleton-filter-function) 'sh-feature)
(set (make-local-variable 'skeleton-newline-indent-rigidly) t)
(set (make-local-variable 'sh-indent-supported-here) nil)
Leo
--- End Message ---