aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorJoakim Verona2012-09-10 16:03:53 +0200
committerJoakim Verona2012-09-10 16:03:53 +0200
commitb035a30e5cd2f34fedc04c253eeb5a11afed8145 (patch)
treeb9350cce389602f4967bdc1beed745929155ad5d /lisp/progmodes
parent4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (diff)
parenta31a4cdacb196cc96dcb9bd229edb1d635e01344 (diff)
downloademacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.tar.gz
emacs-b035a30e5cd2f34fedc04c253eeb5a11afed8145.zip
upstream
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-cmds.el17
-rw-r--r--lisp/progmodes/cc-engine.el8
-rw-r--r--lisp/progmodes/flymake.el5
-rw-r--r--lisp/progmodes/python.el16
-rw-r--r--lisp/progmodes/ruby-mode.el173
-rw-r--r--lisp/progmodes/sh-script.el31
-rw-r--r--lisp/progmodes/vhdl-mode.el15
7 files changed, 145 insertions, 120 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 7cd0a0b0ae2..eec6873dc19 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -493,13 +493,16 @@ inside a literal or a macro, nothing special happens."
493 (insert-char ?\n 1) 493 (insert-char ?\n 1)
494 ;; In AWK (etc.) or in a macro, make sure this CR hasn't changed 494 ;; In AWK (etc.) or in a macro, make sure this CR hasn't changed
495 ;; the syntax. (There might already be an escaped NL there.) 495 ;; the syntax. (There might already be an escaped NL there.)
496 (when (or (c-at-vsemi-p (1- (point))) 496 (when (or
497 (let ((pt (point))) 497 (save-excursion
498 (save-excursion 498 (c-skip-ws-backward (c-point 'bopl))
499 (backward-char) 499 (c-at-vsemi-p))
500 (and (c-beginning-of-macro) 500 (let ((pt (point)))
501 (progn (c-end-of-macro) 501 (save-excursion
502 (< (point) pt)))))) 502 (backward-char)
503 (and (c-beginning-of-macro)
504 (progn (c-end-of-macro)
505 (< (point) pt))))))
503 (backward-char) 506 (backward-char)
504 (insert-char ?\\ 1) 507 (insert-char ?\\ 1)
505 (forward-char)) 508 (forward-char))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 142ec4cdd66..2aa04cb2b0b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3091,6 +3091,8 @@ comment at the start of cc-engine.el for more info."
3091 c-state-cache-good-pos 1 3091 c-state-cache-good-pos 1
3092 c-state-nonlit-pos-cache nil 3092 c-state-nonlit-pos-cache nil
3093 c-state-nonlit-pos-cache-limit 1 3093 c-state-nonlit-pos-cache-limit 1
3094 c-state-semi-nonlit-pos-cache nil
3095 c-state-semi-nonlit-pos-cache-limit 1
3094 c-state-brace-pair-desert nil 3096 c-state-brace-pair-desert nil
3095 c-state-point-min 1 3097 c-state-point-min 1
3096 c-state-point-min-lit-type nil 3098 c-state-point-min-lit-type nil
@@ -3350,6 +3352,8 @@ comment at the start of cc-engine.el for more info."
3350 c-state-cache-good-pos 3352 c-state-cache-good-pos
3351 c-state-nonlit-pos-cache 3353 c-state-nonlit-pos-cache
3352 c-state-nonlit-pos-cache-limit 3354 c-state-nonlit-pos-cache-limit
3355 c-state-semi-nonlit-pos-cache
3356 c-state-semi-nonlit-pos-cache-limit
3353 c-state-brace-pair-desert 3357 c-state-brace-pair-desert
3354 c-state-point-min 3358 c-state-point-min
3355 c-state-point-min-lit-type 3359 c-state-point-min-lit-type
@@ -9579,12 +9583,12 @@ comment at the start of cc-engine.el for more info."
9579 (setq tmpsymbol nil) 9583 (setq tmpsymbol nil)
9580 (while (and (> (point) placeholder) 9584 (while (and (> (point) placeholder)
9581 (zerop (c-backward-token-2 1 t)) 9585 (zerop (c-backward-token-2 1 t))
9582 (/= (char-after) ?=)) 9586 (not (looking-at "=\\([^=]\\|$\\)")))
9583 (and c-opt-inexpr-brace-list-key 9587 (and c-opt-inexpr-brace-list-key
9584 (not tmpsymbol) 9588 (not tmpsymbol)
9585 (looking-at c-opt-inexpr-brace-list-key) 9589 (looking-at c-opt-inexpr-brace-list-key)
9586 (setq tmpsymbol 'topmost-intro-cont))) 9590 (setq tmpsymbol 'topmost-intro-cont)))
9587 (eq (char-after) ?=)) 9591 (looking-at "=\\([^=]\\|$\\)"))
9588 (looking-at c-brace-list-key)) 9592 (looking-at c-brace-list-key))
9589 (save-excursion 9593 (save-excursion
9590 (while (and (< (point) indent-point) 9594 (while (and (< (point) indent-point)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index ad285274928..10d5fdf9c64 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -977,6 +977,9 @@ from compile.el")
977;; :type '(repeat (string number number number)) 977;; :type '(repeat (string number number number))
978;;) 978;;)
979 979
980(defvar flymake-warning-re "^[wW]arning"
981 "Regexp matching against err-text to detect a warning.")
982
980(defun flymake-parse-line (line) 983(defun flymake-parse-line (line)
981 "Parse LINE to see if it is an error or warning. 984 "Parse LINE to see if it is an error or warning.
982Return its components if so, nil otherwise." 985Return its components if so, nil otherwise."
@@ -997,7 +1000,7 @@ Return its components if so, nil otherwise."
997 (match-string (nth 4 (car patterns)) line) 1000 (match-string (nth 4 (car patterns)) line)
998 (flymake-patch-err-text (substring line (match-end 0))))) 1001 (flymake-patch-err-text (substring line (match-end 0)))))
999 (or err-text (setq err-text "<no error text>")) 1002 (or err-text (setq err-text "<no error text>"))
1000 (if (and err-text (string-match "^[wW]arning" err-text)) 1003 (if (and err-text (string-match flymake-warning-re err-text))
1001 (setq err-type "w") 1004 (setq err-type "w")
1002 ) 1005 )
1003 (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx 1006 (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 601850ed0fb..ffc6c1ac885 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1824,7 +1824,11 @@ When MSG is non-nil messages the first line of STRING."
1824 (lines (split-string string "\n" t))) 1824 (lines (split-string string "\n" t)))
1825 (and msg (message "Sent: %s..." (nth 0 lines))) 1825 (and msg (message "Sent: %s..." (nth 0 lines)))
1826 (if (> (length lines) 1) 1826 (if (> (length lines) 1)
1827 (let* ((temp-file-name (make-temp-file "py")) 1827 (let* ((temporary-file-directory
1828 (if (file-remote-p default-directory)
1829 (concat (file-remote-p default-directory) "/tmp")
1830 temporary-file-directory))
1831 (temp-file-name (make-temp-file "py"))
1828 (file-name (or (buffer-file-name) temp-file-name))) 1832 (file-name (or (buffer-file-name) temp-file-name)))
1829 (with-temp-file temp-file-name 1833 (with-temp-file temp-file-name
1830 (insert string) 1834 (insert string)
@@ -1931,8 +1935,14 @@ FILE-NAME."
1931 (interactive "fFile to send: ") 1935 (interactive "fFile to send: ")
1932 (let* ((process (or process (python-shell-get-or-create-process))) 1936 (let* ((process (or process (python-shell-get-or-create-process)))
1933 (temp-file-name (when temp-file-name 1937 (temp-file-name (when temp-file-name
1934 (expand-file-name temp-file-name))) 1938 (expand-file-name
1935 (file-name (or (expand-file-name file-name) temp-file-name))) 1939 (or (file-remote-p temp-file-name 'localname)
1940 temp-file-name))))
1941 (file-name (or (when file-name
1942 (expand-file-name
1943 (or (file-remote-p file-name 'localname)
1944 file-name)))
1945 temp-file-name)))
1936 (when (not file-name) 1946 (when (not file-name)
1937 (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil")) 1947 (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil"))
1938 (python-shell-send-string 1948 (python-shell-send-string
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 457c7fee36c..77ec8084ea2 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -64,8 +64,8 @@
64 "Regexp to match keywords that nest without blocks.") 64 "Regexp to match keywords that nest without blocks.")
65 65
66(defconst ruby-indent-beg-re 66(defconst ruby-indent-beg-re
67 (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|" 67 (concat "^\\s *" (regexp-opt '("class" "module" "def" "if" "unless" "case"
68 (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin"))) 68 "while" "until" "for" "begin")) "\\_>")
69 "Regexp to match where the indentation gets deeper.") 69 "Regexp to match where the indentation gets deeper.")
70 70
71(defconst ruby-modifier-beg-keywords 71(defconst ruby-modifier-beg-keywords
@@ -98,6 +98,10 @@
98 98
99(defconst ruby-block-end-re "\\_<end\\_>") 99(defconst ruby-block-end-re "\\_<end\\_>")
100 100
101(defconst ruby-defun-beg-re
102 '"\\(def\\|class\\|module\\)"
103 "Regexp to match the beginning of a defun, in the general sense.")
104
101(eval-and-compile 105(eval-and-compile
102 (defconst ruby-here-doc-beg-re 106 (defconst ruby-here-doc-beg-re
103 "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" 107 "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)"
@@ -138,18 +142,11 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
138 142
139(defvar ruby-mode-map 143(defvar ruby-mode-map
140 (let ((map (make-sparse-keymap))) 144 (let ((map (make-sparse-keymap)))
141 (define-key map "{" 'ruby-electric-brace)
142 (define-key map "}" 'ruby-electric-brace)
143 (define-key map (kbd "M-C-a") 'ruby-beginning-of-defun)
144 (define-key map (kbd "M-C-e") 'ruby-end-of-defun)
145 (define-key map (kbd "M-C-b") 'ruby-backward-sexp) 145 (define-key map (kbd "M-C-b") 'ruby-backward-sexp)
146 (define-key map (kbd "M-C-f") 'ruby-forward-sexp) 146 (define-key map (kbd "M-C-f") 'ruby-forward-sexp)
147 (define-key map (kbd "M-C-p") 'ruby-beginning-of-block) 147 (define-key map (kbd "M-C-p") 'ruby-beginning-of-block)
148 (define-key map (kbd "M-C-n") 'ruby-end-of-block) 148 (define-key map (kbd "M-C-n") 'ruby-end-of-block)
149 (define-key map (kbd "M-C-h") 'ruby-mark-defun)
150 (define-key map (kbd "M-C-q") 'ruby-indent-exp) 149 (define-key map (kbd "M-C-q") 'ruby-indent-exp)
151 (define-key map (kbd "C-M-h") 'backward-kill-word)
152 (define-key map (kbd "C-j") 'reindent-then-newline-and-indent)
153 (define-key map (kbd "C-c {") 'ruby-toggle-block) 150 (define-key map (kbd "C-c {") 'ruby-toggle-block)
154 map) 151 map)
155 "Keymap used in Ruby mode.") 152 "Keymap used in Ruby mode.")
@@ -840,20 +837,13 @@ and `\\' when preceded by `?'."
840 (+ indent ruby-indent-level) 837 (+ indent ruby-indent-level)
841 indent)))) 838 indent))))
842 839
843(defun ruby-electric-brace (arg)
844 "Insert a brace and re-indent the current line."
845 (interactive "P")
846 (self-insert-command (prefix-numeric-value arg))
847 (ruby-indent-line t))
848
849;; TODO: Why isn't one ruby-*-of-defun written in terms of the other?
850(defun ruby-beginning-of-defun (&optional arg) 840(defun ruby-beginning-of-defun (&optional arg)
851 "Move backward to the beginning of the current top-level defun. 841 "Move backward to the beginning of the current top-level defun.
852With ARG, move backward multiple defuns. Negative ARG means 842With ARG, move backward multiple defuns. Negative ARG means
853move forward." 843move forward."
854 (interactive "p") 844 (interactive "p")
855 (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\b") 845 (and (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>")
856 nil 'move (or arg 1)) 846 nil t (or arg 1))
857 (beginning-of-line))) 847 (beginning-of-line)))
858 848
859(defun ruby-end-of-defun (&optional arg) 849(defun ruby-end-of-defun (&optional arg)
@@ -861,19 +851,18 @@ move forward."
861With ARG, move forward multiple defuns. Negative ARG means 851With ARG, move forward multiple defuns. Negative ARG means
862move backward." 852move backward."
863 (interactive "p") 853 (interactive "p")
864 (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\($\\|\\b[^_]\\)") 854 (ruby-forward-sexp)
865 nil 'move (or arg 1)) 855 (when (looking-back (concat "^\\s *" ruby-block-end-re))
866 (beginning-of-line)) 856 (forward-line 1)))
867 (forward-line 1))
868 857
869(defun ruby-beginning-of-indent () 858(defun ruby-beginning-of-indent ()
870 "TODO: document" 859 "Backtrack to a line which can be used as a reference for
871 ;; I don't understand this function. 860calculating indentation on the lines after it."
872 ;; It seems like it should move to the line where indentation should deepen, 861 (while (and (re-search-backward ruby-indent-beg-re nil 'move)
873 ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def, 862 (if (ruby-in-ppss-context-p 'anything)
874 ;; so this will only match other block beginners at the beginning of the line. 863 t
875 (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>") nil 'move) 864 ;; We can stop, then.
876 (beginning-of-line))) 865 (beginning-of-line)))))
877 866
878(defun ruby-move-to-block (n) 867(defun ruby-move-to-block (n)
879 "Move to the beginning (N < 0) or the end (N > 0) of the current block 868 "Move to the beginning (N < 0) or the end (N > 0) of the current block
@@ -1024,15 +1013,6 @@ With ARG, do it many times. Negative ARG means move forward."
1024 ((error))) 1013 ((error)))
1025 i))) 1014 i)))
1026 1015
1027(defun ruby-mark-defun ()
1028 "Put mark at end of this Ruby function, point at beginning."
1029 (interactive)
1030 (push-mark (point))
1031 (ruby-end-of-defun)
1032 (push-mark (point) nil t)
1033 (ruby-beginning-of-defun)
1034 (re-search-backward "^\n" (- (point) 1) t))
1035
1036(defun ruby-indent-exp (&optional ignored) 1016(defun ruby-indent-exp (&optional ignored)
1037 "Indent each line in the balanced expression following the point." 1017 "Indent each line in the balanced expression following the point."
1038 (interactive "*P") 1018 (interactive "*P")
@@ -1073,7 +1053,7 @@ See `add-log-current-defun-function'."
1073 (let (mname mlist (indent 0)) 1053 (let (mname mlist (indent 0))
1074 ;; get current method (or class/module) 1054 ;; get current method (or class/module)
1075 (if (re-search-backward 1055 (if (re-search-backward
1076 (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" 1056 (concat "^[ \t]*" ruby-defun-beg-re "[ \t]+"
1077 "\\(" 1057 "\\("
1078 ;; \\. and :: for class method 1058 ;; \\. and :: for class method
1079 "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)" 1059 "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
@@ -1127,46 +1107,65 @@ See `add-log-current-defun-function'."
1127 (if mlist (concat mlist mname) mname) 1107 (if mlist (concat mlist mname) mname)
1128 mlist))))) 1108 mlist)))))
1129 1109
1130(defun ruby-brace-to-do-end () 1110(defun ruby-brace-to-do-end (orig end)
1131 (when (looking-at "{") 1111 (let (beg-marker end-marker)
1132 (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))) 1112 (goto-char end)
1133 (when (eq (char-before) ?\}) 1113 (when (eq (char-before) ?\})
1134 (delete-char -1) 1114 (delete-char -1)
1135 (if (eq (char-syntax (char-before)) ?w) 1115 (skip-chars-backward " \t")
1136 (insert " ")) 1116 (when (not (bolp))
1137 (insert "end") 1117 (insert "\n"))
1138 (if (eq (char-syntax (char-after)) ?w) 1118 (insert "end")
1139 (insert " ")) 1119 (setq end-marker (point-marker))
1140 (goto-char orig) 1120 (when (and (not (eobp)) (eq (char-syntax (char-after)) ?w))
1141 (delete-char 1) 1121 (insert " "))
1142 (if (eq (char-syntax (char-before)) ?w) 1122 (goto-char orig)
1143 (insert " ")) 1123 (delete-char 1)
1144 (insert "do") 1124 (when (eq (char-syntax (char-before)) ?w)
1145 (when (looking-at "\\sw\\||") 1125 (insert " "))
1146 (insert " ") 1126 (insert "do")
1147 (backward-char)) 1127 (setq beg-marker (point-marker))
1148 t)))) 1128 (when (looking-at "\\(\\s \\)*|")
1149 1129 (unless (match-beginning 1)
1150(defun ruby-do-end-to-brace () 1130 (insert " "))
1151 (when (and (or (bolp) 1131 (goto-char (1+ (match-end 0)))
1152 (not (memq (char-syntax (char-before)) '(?w ?_)))) 1132 (search-forward "|"))
1153 (looking-at "\\<do\\(\\s \\|$\\)")) 1133 (unless (looking-at "\\s *$")
1154 (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))) 1134 (insert "\n"))
1155 (backward-char 3) 1135 (indent-region beg-marker end-marker)
1156 (when (looking-at ruby-block-end-re) 1136 (goto-char beg-marker)
1157 (delete-char 3) 1137 t)))
1158 (insert "}") 1138
1159 (goto-char orig) 1139(defun ruby-do-end-to-brace (orig end)
1160 (delete-char 2) 1140 (goto-char (- end 3))
1161 (insert "{") 1141 (when (looking-at ruby-block-end-re)
1162 (if (looking-at "\\s +|") 1142 (delete-char 3)
1163 (delete-char (- (match-end 0) (match-beginning 0) 1))) 1143 (insert "}")
1164 t)))) 1144 (goto-char orig)
1145 (delete-char 2)
1146 (insert "{")
1147 (if (looking-at "\\s +|")
1148 (delete-char (- (match-end 0) (match-beginning 0) 1)))
1149 t))
1165 1150
1166(defun ruby-toggle-block () 1151(defun ruby-toggle-block ()
1152 "Toggle block type from do-end to braces or back.
1153The block must begin on the current line or above it and end after the point.
1154If the result is do-end block, it will always be multiline."
1167 (interactive) 1155 (interactive)
1168 (or (ruby-brace-to-do-end) 1156 (let ((start (point)) beg end)
1169 (ruby-do-end-to-brace))) 1157 (end-of-line)
1158 (unless
1159 (if (and (re-search-backward "\\({\\)\\|\\_<do\\(\\s \\|$\\||\\)")
1160 (progn
1161 (setq beg (point))
1162 (save-match-data (ruby-forward-sexp))
1163 (setq end (point))
1164 (> end start)))
1165 (if (match-beginning 1)
1166 (ruby-brace-to-do-end beg end)
1167 (ruby-do-end-to-brace beg end)))
1168 (goto-char start))))
1170 1169
1171(declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit)) 1170(declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit))
1172(declare-function ruby-syntax-enclosing-percent-literal "ruby-mode" (limit)) 1171(declare-function ruby-syntax-enclosing-percent-literal "ruby-mode" (limit))
@@ -1193,8 +1192,6 @@ It will be properly highlighted even when the call omits parens."))
1193 (ruby-syntax-enclosing-percent-literal end) 1192 (ruby-syntax-enclosing-percent-literal end)
1194 (funcall 1193 (funcall
1195 (syntax-propertize-rules 1194 (syntax-propertize-rules
1196 ;; #{ }, #$hoge, #@foo are not comments.
1197 ("\\(#\\)[{$@]" (1 "."))
1198 ;; $' $" $` .... are variables. 1195 ;; $' $" $` .... are variables.
1199 ;; ?' ?" ?` are ascii codes. 1196 ;; ?' ?" ?` are ascii codes.
1200 ("\\([?$]\\)[#\"'`]" 1197 ("\\([?$]\\)[#\"'`]"
@@ -1326,8 +1323,7 @@ This should only be called after matching against `ruby-here-doc-end-re'."
1326 (concat "-?\\([\"']\\|\\)" contents "\\1")))))) 1323 (concat "-?\\([\"']\\|\\)" contents "\\1"))))))
1327 1324
1328 (defconst ruby-font-lock-syntactic-keywords 1325 (defconst ruby-font-lock-syntactic-keywords
1329 `( ;; #{ }, #$hoge, #@foo are not comments 1326 `(
1330 ("\\(#\\)[{$@]" 1 (1 . nil))
1331 ;; the last $', $", $` in the respective string is not variable 1327 ;; the last $', $", $` in the respective string is not variable
1332 ;; the last ?', ?", ?` in the respective string is not ascii code 1328 ;; the last ?', ?", ?` in the respective string is not ascii code
1333 ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" 1329 ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)"
@@ -1549,6 +1545,9 @@ See `font-lock-syntax-table'.")
1549 ;; variables 1545 ;; variables
1550 '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>" 1546 '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
1551 2 font-lock-variable-name-face) 1547 2 font-lock-variable-name-face)
1548 ;; symbols
1549 '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
1550 2 font-lock-reference-face)
1552 ;; variables 1551 ;; variables
1553 '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W" 1552 '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"
1554 1 font-lock-variable-name-face) 1553 1 font-lock-variable-name-face)
@@ -1557,12 +1556,9 @@ See `font-lock-syntax-table'.")
1557 ;; constants 1556 ;; constants
1558 '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" 1557 '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
1559 2 font-lock-type-face) 1558 2 font-lock-type-face)
1560 ;; symbols
1561 '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
1562 2 font-lock-reference-face)
1563 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face) 1559 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face)
1564 ;; expression expansion 1560 ;; expression expansion
1565 '("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)" 1561 '(ruby-match-expression-expansion
1566 0 font-lock-variable-name-face t) 1562 0 font-lock-variable-name-face t)
1567 ;; warn lower camel case 1563 ;; warn lower camel case
1568 ;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)" 1564 ;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)"
@@ -1570,6 +1566,11 @@ See `font-lock-syntax-table'.")
1570 ) 1566 )
1571 "Additional expressions to highlight in Ruby mode.") 1567 "Additional expressions to highlight in Ruby mode.")
1572 1568
1569(defun ruby-match-expression-expansion (limit)
1570 (when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move)
1571 (or (ruby-in-ppss-context-p 'string)
1572 (ruby-match-expression-expansion limit))))
1573
1573;;;###autoload 1574;;;###autoload
1574(define-derived-mode ruby-mode prog-mode "Ruby" 1575(define-derived-mode ruby-mode prog-mode "Ruby"
1575 "Major mode for editing Ruby scripts. 1576 "Major mode for editing Ruby scripts.
@@ -1586,6 +1587,10 @@ The variable `ruby-indent-level' controls the amount of indentation.
1586 'ruby-imenu-create-index) 1587 'ruby-imenu-create-index)
1587 (set (make-local-variable 'add-log-current-defun-function) 1588 (set (make-local-variable 'add-log-current-defun-function)
1588 'ruby-add-log-current-method) 1589 'ruby-add-log-current-method)
1590 (set (make-local-variable 'beginning-of-defun-function)
1591 'ruby-beginning-of-defun)
1592 (set (make-local-variable 'end-of-defun-function)
1593 'ruby-end-of-defun)
1589 1594
1590 (add-hook 1595 (add-hook
1591 (cond ((boundp 'before-save-hook) 'before-save-hook) 1596 (cond ((boundp 'before-save-hook) 'before-save-hook)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index a422462775d..b4d550bcee0 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1062,21 +1062,22 @@ subshells can nest."
1062 (backward-char 1)) 1062 (backward-char 1))
1063 (when (eq (char-before) ?|) 1063 (when (eq (char-before) ?|)
1064 (backward-char 1) t))) 1064 (backward-char 1) t)))
1065 (when (progn (backward-char 2) 1065 (and (> (point) (1+ (point-min)))
1066 (if (> start (line-end-position)) 1066 (progn (backward-char 2)
1067 (put-text-property (point) (1+ start) 1067 (if (> start (line-end-position))
1068 'syntax-multiline t)) 1068 (put-text-property (point) (1+ start)
1069 ;; FIXME: The `in' may just be a random argument to 1069 'syntax-multiline t))
1070 ;; a normal command rather than the real `in' keyword. 1070 ;; FIXME: The `in' may just be a random argument to
1071 ;; I.e. we should look back to try and find the 1071 ;; a normal command rather than the real `in' keyword.
1072 ;; corresponding `case'. 1072 ;; I.e. we should look back to try and find the
1073 (and (looking-at ";[;&]\\|\\_<in") 1073 ;; corresponding `case'.
1074 ;; ";; esac )" is a case that looks like a case-pattern 1074 (and (looking-at ";[;&]\\|\\_<in")
1075 ;; but it's really just a close paren after a case 1075 ;; ";; esac )" is a case that looks like a case-pattern
1076 ;; statement. I.e. if we skipped over `esac' just now, 1076 ;; but it's really just a close paren after a case
1077 ;; we're not looking at a case-pattern. 1077 ;; statement. I.e. if we skipped over `esac' just now,
1078 (not (looking-at "..[ \t\n]+esac[^[:word:]_]")))) 1078 ;; we're not looking at a case-pattern.
1079 sh-st-punc)))) 1079 (not (looking-at "..[ \t\n]+esac[^[:word:]_]"))))
1080 sh-st-punc))))
1080 1081
1081(defun sh-font-lock-backslash-quote () 1082(defun sh-font-lock-backslash-quote ()
1082 (if (eq (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) ?\') 1083 (if (eq (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) ?\')
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 607ccd8b7e7..0ca3439dd60 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -4138,10 +4138,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
4138 (set (make-local-variable 'imenu-generic-expression) 4138 (set (make-local-variable 'imenu-generic-expression)
4139 vhdl-imenu-generic-expression) 4139 vhdl-imenu-generic-expression)
4140 (when (and vhdl-index-menu (fboundp 'imenu)) 4140 (when (and vhdl-index-menu (fboundp 'imenu))
4141 (if (or (not (boundp 'font-lock-maximum-size)) 4141 (imenu-add-to-menubar "Index")))
4142 (> font-lock-maximum-size (buffer-size)))
4143 (imenu-add-to-menubar "Index")
4144 (message "Scanning buffer for index...buffer too big"))))
4145 4142
4146;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4143;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4147;; Source file menu (using `easy-menu.el') 4144;; Source file menu (using `easy-menu.el')
@@ -14385,10 +14382,10 @@ if required."
14385 (define-key vhdl-speedbar-key-map (int-to-string key) 14382 (define-key vhdl-speedbar-key-map (int-to-string key)
14386 `(lambda () (interactive) (vhdl-speedbar-set-depth ,key))) 14383 `(lambda () (interactive) (vhdl-speedbar-set-depth ,key)))
14387 (setq key (1+ key))))) 14384 (setq key (1+ key)))))
14388 (define-key speedbar-key-map "h" 14385 (define-key speedbar-mode-map "h"
14389 (lambda () (interactive) 14386 (lambda () (interactive)
14390 (speedbar-change-initial-expansion-list "vhdl directory"))) 14387 (speedbar-change-initial-expansion-list "vhdl directory")))
14391 (define-key speedbar-key-map "H" 14388 (define-key speedbar-mode-map "H"
14392 (lambda () (interactive) 14389 (lambda () (interactive)
14393 (speedbar-change-initial-expansion-list "vhdl project"))) 14390 (speedbar-change-initial-expansion-list "vhdl project")))
14394 ;; menu 14391 ;; menu
@@ -17400,7 +17397,8 @@ to visually support naming conventions.")
17400 "Display VARIABLE's documentation in *Help* buffer." 17397 "Display VARIABLE's documentation in *Help* buffer."
17401 (interactive) 17398 (interactive)
17402 (unless (featurep 'xemacs) 17399 (unless (featurep 'xemacs)
17403 (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) 17400 (help-setup-xref (list #'vhdl-doc-variable variable)
17401 (called-interactively-p 'interactive)))
17404 (with-output-to-temp-buffer 17402 (with-output-to-temp-buffer
17405 (if (fboundp 'help-buffer) (help-buffer) "*Help*") 17403 (if (fboundp 'help-buffer) (help-buffer) "*Help*")
17406 (princ (documentation-property variable 'variable-documentation)) 17404 (princ (documentation-property variable 'variable-documentation))
@@ -17412,7 +17410,8 @@ to visually support naming conventions.")
17412 "Display VHDL Mode documentation in *Help* buffer." 17410 "Display VHDL Mode documentation in *Help* buffer."
17413 (interactive) 17411 (interactive)
17414 (unless (featurep 'xemacs) 17412 (unless (featurep 'xemacs)
17415 (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) 17413 (help-setup-xref (list #'vhdl-doc-mode)
17414 (called-interactively-p 'interactive)))
17416 (with-output-to-temp-buffer 17415 (with-output-to-temp-buffer
17417 (if (fboundp 'help-buffer) (help-buffer) "*Help*") 17416 (if (fboundp 'help-buffer) (help-buffer) "*Help*")
17418 (princ mode-name) 17417 (princ mode-name)