diff options
| author | Kenichi Handa | 2012-10-30 20:38:37 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-10-30 20:38:37 +0900 |
| commit | 6ccc848cd85e75d77d6b11a46f5f23f860db9ff5 (patch) | |
| tree | e10cb69f3bbe6f2d9616d3867f12bf035c70e0f8 /lisp/progmodes | |
| parent | aee5b18ec3c7844ca125249914113eeaef04342c (diff) | |
| parent | fcc1acdadbeae00d8dcabeb6dccb20da9672af2c (diff) | |
| download | emacs-6ccc848cd85e75d77d6b11a46f5f23f860db9ff5.tar.gz emacs-6ccc848cd85e75d77d6b11a46f5f23f860db9ff5.zip | |
merge trun
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/compile.el | 20 | ||||
| -rw-r--r-- | lisp/progmodes/gud.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 99 |
3 files changed, 71 insertions, 53 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 10fd7a75eaa..06525b354b1 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1568,12 +1568,20 @@ Returns the compilation buffer created." | |||
| 1568 | ;; Then evaluate a cd command if any, but don't perform it yet, else | 1568 | ;; Then evaluate a cd command if any, but don't perform it yet, else |
| 1569 | ;; start-command would do it again through the shell: (cd "..") AND | 1569 | ;; start-command would do it again through the shell: (cd "..") AND |
| 1570 | ;; sh -c "cd ..; make" | 1570 | ;; sh -c "cd ..; make" |
| 1571 | (cd (if (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]" | 1571 | (cd (cond |
| 1572 | command) | 1572 | ((not (string-match "\\`\\s *cd\\(?:\\s +\\(\\S +?\\|'[^']*'\\|\"\\(?:[^\"`$\\]\\|\\\\.\\)*\"\\)\\)?\\s *[;&\n]" |
| 1573 | (if (match-end 1) | 1573 | command)) |
| 1574 | (substitute-env-vars (match-string 1 command)) | 1574 | default-directory) |
| 1575 | "~") | 1575 | ((not (match-end 1)) "~") |
| 1576 | default-directory)) | 1576 | ((eq (aref command (match-beginning 1)) ?\') |
| 1577 | (substring command (1+ (match-beginning 1)) | ||
| 1578 | (1- (match-end 1)))) | ||
| 1579 | ((eq (aref command (match-beginning 1)) ?\") | ||
| 1580 | (replace-regexp-in-string | ||
| 1581 | "\\\\\\(.\\)" "\\1" | ||
| 1582 | (substring command (1+ (match-beginning 1)) | ||
| 1583 | (1- (match-end 1))))) | ||
| 1584 | (t (substitute-env-vars (match-string 1 command))))) | ||
| 1577 | (erase-buffer) | 1585 | (erase-buffer) |
| 1578 | ;; Select the desired mode. | 1586 | ;; Select the desired mode. |
| 1579 | (if (not (eq mode t)) | 1587 | (if (not (eq mode t)) |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 719471278a8..13eac8392a2 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -148,7 +148,8 @@ Used to gray out relevant toolbar icons.") | |||
| 148 | ([run] menu-item "Run" gud-run | 148 | ([run] menu-item "Run" gud-run |
| 149 | :enable (not gud-running) | 149 | :enable (not gud-running) |
| 150 | :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) | 150 | :visible (memq gud-minor-mode '(gdbmi gdb dbx jdb))) |
| 151 | ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go | 151 | ([go] menu-item (if (bound-and-true-p gdb-active-process) |
| 152 | "Continue" "Run") gud-go | ||
| 152 | :visible (and (eq gud-minor-mode 'gdbmi) | 153 | :visible (and (eq gud-minor-mode 'gdbmi) |
| 153 | (gdb-show-run-p))) | 154 | (gdb-show-run-p))) |
| 154 | ([stop] menu-item "Stop" gud-stop-subjob | 155 | ([stop] menu-item "Stop" gud-stop-subjob |
| @@ -178,7 +179,7 @@ Used to gray out relevant toolbar icons.") | |||
| 178 | '(gdbmi gdb dbx xdb jdb pdb))) | 179 | '(gdbmi gdb dbx xdb jdb pdb))) |
| 179 | ([pp] menu-item "Print S-expression" gud-pp | 180 | ([pp] menu-item "Print S-expression" gud-pp |
| 180 | :enable (and (not gud-running) | 181 | :enable (and (not gud-running) |
| 181 | gdb-active-process) | 182 | (bound-and-true-p gdb-active-process)) |
| 182 | :visible (and (string-equal | 183 | :visible (and (string-equal |
| 183 | (buffer-local-value | 184 | (buffer-local-value |
| 184 | 'gud-target-name gud-comint-buffer) "emacs") | 185 | 'gud-target-name gud-comint-buffer) "emacs") |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 06ded5fb53d..daa83620051 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -1033,51 +1033,57 @@ subshells can nest." | |||
| 1033 | (defun sh-font-lock-paren (start) | 1033 | (defun sh-font-lock-paren (start) |
| 1034 | (unless (nth 8 (syntax-ppss)) | 1034 | (unless (nth 8 (syntax-ppss)) |
| 1035 | (save-excursion | 1035 | (save-excursion |
| 1036 | (goto-char start) | 1036 | (let ((open nil)) |
| 1037 | ;; Skip through all patterns | 1037 | (goto-char start) |
| 1038 | (while | 1038 | ;; Skip through all patterns |
| 1039 | (progn | 1039 | (while |
| 1040 | (while | 1040 | (progn |
| 1041 | (progn | 1041 | (while |
| 1042 | (forward-comment (- (point-max))) | 1042 | (progn |
| 1043 | (when (and (eolp) (sh-is-quoted-p (point))) | 1043 | (forward-comment (- (point-max))) |
| 1044 | (forward-char -1) | 1044 | (when (and (eolp) (sh-is-quoted-p (point))) |
| 1045 | t))) | 1045 | (forward-char -1) |
| 1046 | ;; Skip through one pattern | 1046 | t))) |
| 1047 | (while | 1047 | ;; Skip through one pattern |
| 1048 | (or (/= 0 (skip-syntax-backward "w_")) | 1048 | (while |
| 1049 | (/= 0 (skip-chars-backward "-$=?[]*@/\\\\")) | 1049 | (or (/= 0 (skip-syntax-backward "w_")) |
| 1050 | (and (sh-is-quoted-p (1- (point))) | 1050 | (/= 0 (skip-chars-backward "-$=?[]*@/\\\\")) |
| 1051 | (goto-char (- (point) 2))) | 1051 | (and (sh-is-quoted-p (1- (point))) |
| 1052 | (when (memq (char-before) '(?\" ?\' ?\})) | 1052 | (goto-char (- (point) 2))) |
| 1053 | (condition-case nil (progn (backward-sexp 1) t) | 1053 | (when (memq (char-before) '(?\" ?\' ?\})) |
| 1054 | (error nil))))) | 1054 | (condition-case nil (progn (backward-sexp 1) t) |
| 1055 | ;; Patterns can be preceded by an open-paren (Bug#1320). | 1055 | (error nil))))) |
| 1056 | (if (eq (char-before (point)) ?\() | 1056 | ;; Patterns can be preceded by an open-paren (bug#1320). |
| 1057 | (when (eq (char-before (point)) ?\() | ||
| 1058 | (backward-char 1) | ||
| 1059 | (setq open (point))) | ||
| 1060 | (while (progn | ||
| 1061 | (forward-comment (- (point-max))) | ||
| 1062 | ;; Maybe we've bumped into an escaped newline. | ||
| 1063 | (sh-is-quoted-p (point))) | ||
| 1057 | (backward-char 1)) | 1064 | (backward-char 1)) |
| 1058 | (while (progn | 1065 | (when (eq (char-before) ?|) |
| 1059 | (forward-comment (- (point-max))) | 1066 | (backward-char 1) t))) |
| 1060 | ;; Maybe we've bumped into an escaped newline. | 1067 | (and (> (point) (1+ (point-min))) |
| 1061 | (sh-is-quoted-p (point))) | 1068 | (progn (backward-char 2) |
| 1062 | (backward-char 1)) | 1069 | (if (> start (line-end-position)) |
| 1063 | (when (eq (char-before) ?|) | 1070 | (put-text-property (point) (1+ start) |
| 1064 | (backward-char 1) t))) | 1071 | 'syntax-multiline t)) |
| 1065 | (and (> (point) (1+ (point-min))) | 1072 | ;; FIXME: The `in' may just be a random argument to |
| 1066 | (progn (backward-char 2) | 1073 | ;; a normal command rather than the real `in' keyword. |
| 1067 | (if (> start (line-end-position)) | 1074 | ;; I.e. we should look back to try and find the |
| 1068 | (put-text-property (point) (1+ start) | 1075 | ;; corresponding `case'. |
| 1069 | 'syntax-multiline t)) | 1076 | (and (looking-at ";[;&]\\|\\_<in") |
| 1070 | ;; FIXME: The `in' may just be a random argument to | 1077 | ;; ";; esac )" is a case that looks |
| 1071 | ;; a normal command rather than the real `in' keyword. | 1078 | ;; like a case-pattern but it's really just a close |
| 1072 | ;; I.e. we should look back to try and find the | 1079 | ;; paren after a case statement. I.e. if we skipped |
| 1073 | ;; corresponding `case'. | 1080 | ;; over `esac' just now, we're not looking |
| 1074 | (and (looking-at ";[;&]\\|\\_<in") | 1081 | ;; at a case-pattern. |
| 1075 | ;; ";; esac )" is a case that looks like a case-pattern | 1082 | (not (looking-at "..[ \t\n]+esac[^[:word:]_]")))) |
| 1076 | ;; but it's really just a close paren after a case | 1083 | (progn |
| 1077 | ;; statement. I.e. if we skipped over `esac' just now, | 1084 | (when open |
| 1078 | ;; we're not looking at a case-pattern. | 1085 | (put-text-property open (1+ open) 'syntax-table sh-st-punc)) |
| 1079 | (not (looking-at "..[ \t\n]+esac[^[:word:]_]")))) | 1086 | sh-st-punc)))))) |
| 1080 | sh-st-punc)))) | ||
| 1081 | 1087 | ||
| 1082 | (defun sh-font-lock-backslash-quote () | 1088 | (defun sh-font-lock-backslash-quote () |
| 1083 | (if (eq (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) ?\') | 1089 | (if (eq (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) ?\') |
| @@ -1629,7 +1635,8 @@ before the newline and in that case point should be just before the token." | |||
| 1629 | (cmd "|" cmd) (cmd "|&" cmd) | 1635 | (cmd "|" cmd) (cmd "|&" cmd) |
| 1630 | (cmd "&&" cmd) (cmd "||" cmd) | 1636 | (cmd "&&" cmd) (cmd "||" cmd) |
| 1631 | (cmd ";" cmd) (cmd "&" cmd)) | 1637 | (cmd ";" cmd) (cmd "&" cmd)) |
| 1632 | (pattern (pattern "|" pattern)) | 1638 | (rpattern (rpattern "|" rpattern)) |
| 1639 | (pattern (rpattern) ("case-(" rpattern)) | ||
| 1633 | (branches (branches ";;" branches) | 1640 | (branches (branches ";;" branches) |
| 1634 | (branches ";&" branches) (branches ";;&" branches) ;bash. | 1641 | (branches ";&" branches) (branches ";;&" branches) ;bash. |
| 1635 | (pattern "case-)" cmd))) | 1642 | (pattern "case-)" cmd))) |
| @@ -1715,6 +1722,7 @@ Does not preserve point." | |||
| 1715 | (tok (smie-default-forward-token))) | 1722 | (tok (smie-default-forward-token))) |
| 1716 | (cond | 1723 | (cond |
| 1717 | ((equal tok ")") "case-)") | 1724 | ((equal tok ")") "case-)") |
| 1725 | ((equal tok "(") "case-(") | ||
| 1718 | ((and tok (string-match "\\`[a-z]" tok) | 1726 | ((and tok (string-match "\\`[a-z]" tok) |
| 1719 | (assoc tok smie-grammar) | 1727 | (assoc tok smie-grammar) |
| 1720 | (not | 1728 | (not |
| @@ -1759,6 +1767,7 @@ Does not preserve point." | |||
| 1759 | (let ((tok (smie-default-backward-token))) | 1767 | (let ((tok (smie-default-backward-token))) |
| 1760 | (cond | 1768 | (cond |
| 1761 | ((equal tok ")") "case-)") | 1769 | ((equal tok ")") "case-)") |
| 1770 | ((equal tok "(") "case-(") | ||
| 1762 | ((and tok (string-match "\\`[a-z]" tok) | 1771 | ((and tok (string-match "\\`[a-z]" tok) |
| 1763 | (assoc tok smie-grammar) | 1772 | (assoc tok smie-grammar) |
| 1764 | (not (save-excursion (sh-smie--sh-keyword-p tok)))) | 1773 | (not (save-excursion (sh-smie--sh-keyword-p tok)))) |