[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r103200: * lisp/progmodes/sh-script.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r103200: * lisp/progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case |
Date: |
Wed, 09 Feb 2011 13:59:55 -0500 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 103200
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-02-09 13:59:55 -0500
message:
* lisp/progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case
of here-doc that immediately follows a comment.
* .bzrignore: Ignore globals.h and related stamp.
* test/indent/shell.sh:
* test/indent/shell.rc: New files.
added:
test/indent/shell.rc
test/indent/shell.sh
modified:
.bzrignore
ChangeLog
lisp/ChangeLog
lisp/progmodes/sh-script.el
test/ChangeLog
=== modified file '.bzrignore'
--- a/.bzrignore 2011-01-22 07:18:23 +0000
+++ b/.bzrignore 2011-02-09 18:59:55 +0000
@@ -83,3 +83,5 @@
src/temacs
test/indent/*.new
+*
+src/globals.h
+src/gl-stamp
=== modified file 'ChangeLog'
--- a/ChangeLog 2011-02-09 01:40:01 +0000
+++ b/ChangeLog 2011-02-09 18:59:55 +0000
@@ -1,3 +1,7 @@
+2011-02-09 Stefan Monnier <address@hidden>
+
+ * .bzrignore: Ignore globals.h and related stamp.
+
2011-02-09 Paul Eggert <address@hidden>
* lib/Makefile.in, lib/gnulib.mk: Regenerate.
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-02-09 01:22:26 +0000
+++ b/lisp/ChangeLog 2011-02-09 18:59:55 +0000
@@ -1,3 +1,8 @@
+2011-02-09 Stefan Monnier <address@hidden>
+
+ * progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case
+ of here-doc that immediately follows a comment.
+
2011-02-09 Deniz Dogan <address@hidden>
* net/rcirc.el (rcirc-ctcp-sender-PING): Simplifying.
=== modified file 'lisp/progmodes/sh-script.el'
--- a/lisp/progmodes/sh-script.el 2011-02-05 19:46:47 +0000
+++ b/lisp/progmodes/sh-script.el 2011-02-09 18:59:55 +0000
@@ -948,12 +948,12 @@
;; 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))
- (ppss (save-excursion (syntax-ppss (1- (point))))))
+ (ppss (save-excursion (syntax-ppss eol))))
(if (nth 4 ppss)
;; The \n not only starts the heredoc but also closes a comment.
;; Let's close the comment just before the \n.
- (put-text-property (1- (point)) (point) 'syntax-table '(12))) ;">"
- (if (or (nth 5 ppss) (> (count-lines start (point)) 1))
+ (put-text-property (1- eol) eol 'syntax-table '(12))) ;">"
+ (if (or (nth 5 ppss) (> (count-lines start eol) 1))
;; If the sh-escaped-line-re part of sh-here-doc-open-re has matched
;; several lines, make sure we refontify them together.
;; Furthermore, if (nth 5 ppss) is non-nil (i.e. the \n is
@@ -961,7 +961,7 @@
;; Don't bother fixing it now, but place a multiline property so
;; that when jit-lock-context-* refontifies the rest of the
;; buffer, it also refontifies the current line with it.
- (put-text-property start (point) 'syntax-multiline t))
+ (put-text-property start (1+ eol) 'syntax-multiline t))
(put-text-property eol (1+ eol) 'sh-here-doc-marker str)
(prog1 sh-here-doc-syntax
(goto-char (+ 2 start))))))
@@ -1083,33 +1083,33 @@
(defun sh-syntax-propertize-function (start end)
(goto-char start)
(sh-syntax-propertize-here-doc end)
- (funcall
- (syntax-propertize-rules
+ (funcall
+ (syntax-propertize-rules
(sh-here-doc-open-re
(2 (sh-font-lock-open-heredoc
(match-beginning 0) (match-string 1) (match-beginning 2))))
("\\s|" (0 (prog1 nil (sh-syntax-propertize-here-doc end))))
- ;; A `#' begins a comment when it is unquoted and at the
- ;; beginning of a word. In the shell, words are separated by
- ;; metacharacters. The list of special chars is taken from
- ;; the single-unix spec of the shell command language (under
- ;; `quoting') but with `$' removed.
- ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
- ;; In a '...' the backslash is not escaping.
- ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
- ;; Make sure $@ and $? are correctly recognized as sexps.
- ("\\$\\(address@hidden)" (1 "_"))
- ;; Distinguish the special close-paren in `case'.
- (")" (0 (sh-font-lock-paren (match-beginning 0))))
- ;; Highlight (possibly nested) subshells inside "" quoted
- ;; regions correctly.
+ ;; A `#' begins a comment when it is unquoted and at the
+ ;; beginning of a word. In the shell, words are separated by
+ ;; metacharacters. The list of special chars is taken from
+ ;; the single-unix spec of the shell command language (under
+ ;; `quoting') but with `$' removed.
+ ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
+ ;; In a '...' the backslash is not escaping.
+ ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
+ ;; Make sure $@ and $? are correctly recognized as sexps.
+ ("\\$\\(address@hidden)" (1 "_"))
+ ;; Distinguish the special close-paren in `case'.
+ (")" (0 (sh-font-lock-paren (match-beginning 0))))
+ ;; Highlight (possibly nested) subshells inside "" quoted
+ ;; regions correctly.
("\"\\(?:\\(?:[^\\\"]\\|\\)*?[^\\]\\(?:\\\\\\\\\\)*\\)??\\(\\$(\\|`\\)"
- (1 (ignore
- ;; Save excursion because we want to also apply other
- ;; syntax-propertize rules within the affected region.
+ (1 (ignore
+ ;; Save excursion because we want to also apply other
+ ;; syntax-propertize rules within the affected region.
(if (nth 8 (syntax-ppss))
(goto-char (1+ (match-beginning 0)))
- (save-excursion
+ (save-excursion
(sh-font-lock-quoted-subshell end)))))))
(point) end))
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2011-01-27 23:45:04 +0000
+++ b/test/ChangeLog 2011-02-09 18:59:55 +0000
@@ -1,3 +1,8 @@
+2011-02-09 Stefan Monnier <address@hidden>
+
+ * indent/shell.sh:
+ * indent/shell.rc: New files.
+
2011-01-27 Chong Yidong <address@hidden>
* automated/font-parse-tests.el: Move from
=== added file 'test/indent/shell.rc'
--- a/test/indent/shell.rc 1970-01-01 00:00:00 +0000
+++ b/test/indent/shell.rc 2011-02-09 18:59:55 +0000
@@ -0,0 +1,30 @@
+#!/bin/rc
+
+if (foo) {
+ echo 1
+}
+if not {
+ echo 2
+}
+
+if (foo)
+ echo 3 # KNOWN INDENT BUG
+if not
+ echo 4 # KNOWN INDENT BUG
+
+switch ($a) {
+ case 3
+ echo 4
+ case 5
+ echo 7
+ for (i in a b c) {
+ echo $i
+ }
+ for (i in a b c)
+ echo "$i" # KNOWN INDENT BUG
+ echo titi
+
+ case *
+ echo other
+}
+
=== added file 'test/indent/shell.sh'
--- a/test/indent/shell.sh 1970-01-01 00:00:00 +0000
+++ b/test/indent/shell.sh 2011-02-09 18:59:55 +0000
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+setlock -n /tmp/getmail.lock && echo getmail isn\'t running
+
+# adsgsdg
+
+foo () {
+
+ bar () {
+ blilbi
+ }
+
+ case toto
+ in a) hello # KNOWN INDENT BUG
+ ;; b) hi # KNOWN INDENT BUG
+ esac
+
+ case $toto in
+ a) echo 1;; b) echo 2;;
+ c) echo 3;;
+ esac
+
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=/\\1=''/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add
+ # quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ cat # KNOWN INDENT BUG
+
+ case toto in
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+ 5)
+ hello ;;
+ 3) hello $(adfad)
+ echo esac ;; # KNOWN INDENT BUG
+ 5) hello ;;
+ 4) hello ;&
+ 4) hello ;;&
+ 5) hello ;;
+ 5) hello ;;
+ esac
+
+ echo "'" wfgfe
+
+ #!/bin/bash
+ cat << EOF \
+ | cat sadfsafd \
+ sadfsafd "KNOWN INDENT BUG" \
+ | tee -a bug.txt
+asdfsaf
+This is a test case for a bug in bash shell mode text highlighting
+EOF
+
+ cat <<EOF1 <<EOF2 # KNOWN INDENT BUG
+help1
+EOF1
+help2
+EOF2
+}
+bar () {
+ if [ $# == 0 ]; then
+ while
+ f # KNOWN INDENT BUG
+ do
+ bla;
+ done
+ echo "Highlighting is screwed up now"
+ if [ 1 = 1 ]; then
+ # adsgsdg
+ echo "screwed up"
+ fi
+
+ $@ $? $#
+
+ for f in *
+ do
+ sdfg
+ done
+
+ if swrgfef
+ then blas
+ else sdf
+ fi
+
+ fi
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r103200: * lisp/progmodes/sh-script.el (sh-font-lock-open-heredoc): Fix case,
Stefan Monnier <=