unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method
@ 2012-08-18 13:12 Leo
  2012-08-27 11:04 ` Leo
  0 siblings, 1 reply; 2+ messages in thread
From: Leo @ 2012-08-18 13:12 UTC (permalink / raw)
  To: 12223

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method
  2012-08-18 13:12 bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method Leo
@ 2012-08-27 11:04 ` Leo
  0 siblings, 0 replies; 2+ messages in thread
From: Leo @ 2012-08-27 11:04 UTC (permalink / raw)
  To: 12223-done

Fixed in emacs-24






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-27 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-18 13:12 bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method Leo
2012-08-27 11:04 ` Leo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).