GNU bug report logs - #12223
24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Sat, 18 Aug 2012 13:13:02 UTC

Severity: normal

Tags: patch

Found in version 24.2

Done: Leo <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12223 in the body.
You can then email your comments to 12223 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12223; Package emacs. (Sat, 18 Aug 2012 13:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 18 Aug 2012 13:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
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




Reply sent to Leo <sdl.web <at> gmail.com>:
You have taken responsibility. (Mon, 27 Aug 2012 11:06:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Mon, 27 Aug 2012 11:06:02 GMT) Full text and rfc822 format available.

Message #10 received at 12223-done <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: 12223-done <at> debbugs.gnu.org
Subject: Re: bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by
	backward-delete-char-untabify-method
Date: Mon, 27 Aug 2012 19:04:17 +0800
Fixed in emacs-24





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.