[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110746: * lisp/progmodes/sh-script.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110746: * lisp/progmodes/sh-script.el (sh--inside-noncommand-expression): |
Date: |
Tue, 30 Oct 2012 23:10:25 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110746
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11263
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-10-30 23:10:25 -0400
message:
* lisp/progmodes/sh-script.el (sh--inside-noncommand-expression):
Rename from sh--inside-arithmetic-expression, handle more cases.
modified:
lisp/ChangeLog
lisp/progmodes/sh-script.el
test/indent/shell.sh
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-10-31 02:45:34 +0000
+++ b/lisp/ChangeLog 2012-10-31 03:10:25 +0000
@@ -1,5 +1,9 @@
2012-10-31 Stefan Monnier <address@hidden>
+ * progmodes/sh-script.el (sh--inside-noncommand-expression):
+ Rename from sh--inside-arithmetic-expression, handle more cases
+ (bug#11263).
+
* progmodes/sh-script.el (sh--inside-arithmetic-expression): New func.
(sh-font-lock-open-heredoc): Use it (bug#12770).
=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el 2012-10-31 02:45:34 +0000
+++ b/lisp/progmodes/sh-script.el 2012-10-31 03:10:25 +0000
@@ -940,14 +940,16 @@
(concat "<<-?\\s-*\\\\?\\(\\(?:['\"][^'\"]+['\"]\\|\\sw\\|[-/~._]\\)+\\)"
sh-escaped-line-re "\\(\n\\)")))
-(defun sh--inside-arithmetic-expression (pos)
+(defun sh--inside-noncommand-expression (pos)
(save-excursion
(let ((ppss (syntax-ppss pos)))
(when (nth 1 ppss)
(goto-char (nth 1 ppss))
- (and (eq ?\( (char-after))
- (eq ?\( (char-before))
- (eq ?\$ (char-before (1- (point)))))))))
+ (pcase (char-after)
+ ;; $((...)) or $[...] or ${...}.
+ (`?\( (and (eq ?\( (char-before))
+ (eq ?\$ (char-before (1- (point))))))
+ ((or `?\{ `?\[) (eq ?\$ (char-before))))))))
(defun sh-font-lock-open-heredoc (start string eol)
"Determine the syntax of the \\n after a <<EOF.
@@ -958,7 +960,7 @@
Point is at the beginning of the next line."
(unless (or (memq (char-before start) '(?< ?>))
(sh-in-comment-or-string start)
- (sh--inside-arithmetic-expression start))
+ (sh--inside-noncommand-expression start))
;; We're looking at <<STRING, so we add "^STRING$" to the syntactic
;; font-lock keywords to detect the end of this here document.
(let ((str (replace-regexp-in-string "['\"]" "" string))
=== modified file 'test/indent/shell.sh'
--- a/test/indent/shell.sh 2012-10-31 02:45:34 +0000
+++ b/test/indent/shell.sh 2012-10-31 03:10:25 +0000
@@ -9,6 +9,11 @@
# This should not be treated as a heredoc (bug#12770).
2
+foo='bar<<' # bug#11263
+echo ${foo%<<aa} # bug#11263
+echo $((1<<8)) # bug#11263
+echo $[1<<8] # bug#11263
+
declare -a VERSION
for i in $(ls "$PREFIX/sbin") ; do
echo -e $N')' $i
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110746: * lisp/progmodes/sh-script.el (sh--inside-noncommand-expression):,
Stefan Monnier <=