From: Lars Ingebrigtsen Date: Wed, 16 Oct 2019 07:20:06 +0000 (+0200) Subject: Expand <<- heredocs in sh X-Git-Tag: emacs-27.0.90~1035 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=068b4fce52dce410a9cc1ee22649541a1823c711;p=emacs.git Expand <<- heredocs in sh * lisp/progmodes/sh-script.el (sh--maybe-here-document): Make <<- expansion work, too. --- diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 604d13eabef..8177329f32b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -4356,7 +4356,7 @@ The document is bounded by `sh-here-document-word'." (or arg (sh--maybe-here-document))) (defun sh--maybe-here-document () - (when (and (looking-back "[^<]<<[ E]" (line-beginning-position)) + (when (and (looking-back "[^<]<<[ E-]" (line-beginning-position)) (save-excursion (backward-char 2) (not @@ -4368,7 +4368,9 @@ The document is bounded by `sh-here-document-word'." "")) (delim (replace-regexp-in-string "['\"]" "" sh-here-document-word))) - (delete-char -1) + ;; If we're at <<-, we don't want to delete the previous char. + (unless (= (preceding-char) ?-) + (delete-char -1)) (insert sh-here-document-word) (or (eolp) (looking-at "[ \t]") (insert ?\s)) (end-of-line 1)