all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 12223@debbugs.gnu.org
Subject: bug#12223: 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	[thread overview]
Message-ID: <m1wr0wfio8.fsf@gmail.com> (raw)

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	other threads:[~2012-08-18 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-18 13:12 Leo [this message]
2012-08-27 11:04 ` bug#12223: 24.2; [PATCH] skeleton expansion in sh-mode can fail by backward-delete-char-untabify-method Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1wr0wfio8.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=12223@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.