aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorKaroly Lorentey2006-06-12 07:27:12 +0000
committerKaroly Lorentey2006-06-12 07:27:12 +0000
commit476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch)
tree4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /lisp/progmodes
parenta13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff)
parent6b519504c3297595101628e823e72c91e562ab45 (diff)
downloademacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz
emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.zip
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-294 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-295 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-296 Update from CVS: admin/FOR-RELEASE: Update refcard section. * emacs@sv.gnu.org/emacs--devo--0--patch-297 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-298 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-299 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-300 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-301 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-302 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-303 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-304 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-103 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-104 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/compile.el39
-rw-r--r--lisp/progmodes/cperl-mode.el10
-rw-r--r--lisp/progmodes/gdb-ui.el161
-rw-r--r--lisp/progmodes/gud.el83
-rw-r--r--lisp/progmodes/inf-lisp.el31
-rw-r--r--lisp/progmodes/make-mode.el108
-rw-r--r--lisp/progmodes/sh-script.el82
7 files changed, 319 insertions, 195 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 527624bfc4e..5da86972ec5 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -228,7 +228,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
228\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ 228\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
229\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\ 229\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\
230\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\ 230\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\
231 *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\)\\)?" 231 *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\)?"
232 1 (2 . 5) (4 . 6) (7 . 8)) 232 1 (2 . 5) (4 . 6) (7 . 8))
233 233
234 (lcc 234 (lcc
@@ -236,7 +236,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
236 2 3 4 (1)) 236 2 3 4 (1))
237 237
238 (makepp 238 (makepp
239 "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\) \\|.*?\\)\ 239 "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\|Imported\\) \\|.*?\\)\
240`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]\\)" 240`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]\\)"
241 4 5 nil (1 . 2) 3 241 4 5 nil (1 . 2) 3
242 ("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]" nil nil 242 ("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]" nil nil
@@ -293,15 +293,34 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
293\\(?:: \\(warning:\\)?\\|$\\| ),\\)" 1 2 nil (3)) 293\\(?:: \\(warning:\\)?\\|$\\| ),\\)" 1 2 nil (3))
294 294
295 (gcov-file 295 (gcov-file
296 "^ +-: \\(0\\):Source:\\(.+\\)$" 2 1 nil 0) 296 "^ *-: *\\(0\\):Source:\\(.+\\)$"
297 (gcov-bb-file 297 2 1 nil 0 nil
298 "^ +-: \\(0\\):Object:\\(?:.+\\)$" nil 1 nil 0) 298 (1 compilation-line-face prepend) (2 compilation-info-face prepend))
299 (gcov-never-called-line 299 (gcov-header
300 "^ +\\(#####\\): +\\([0-9]+\\):.+$" nil 2 nil 2 nil 300 "^ *-: *\\(0\\):\\(?:Object\\|Graph\\|Data\\|Runs\\|Programs\\):.+$"
301 (1 compilation-error-face)) 301 nil 1 nil 0 nil
302 (1 compilation-line-face prepend))
303 ;; Underlines over all lines of gcov output are too uncomfortable to read.
304 ;; However, hyperlinks embedded in the lines are useful.
305 ;; So I put default face on the lines; and then put
306 ;; compilation-*-face by manually to eliminate the underlines.
307 ;; The hyperlinks are still effective.
308 (gcov-nomark
309 "^ *-: *\\([1-9]\\|[0-9]\\{2,\\}\\):.*$"
310 nil 1 nil 0 nil
311 (0 'default t)
312 (1 compilation-line-face prepend))
302 (gcov-called-line 313 (gcov-called-line
303 "^ +[-0-9]+: +\\([1-9]\\|[0-9]\\{2,\\}\\):.*$" nil 1 nil 0) 314 "^ *\\([0-9]+\\): *\\([0-9]+\\):.*$"
304) 315 nil 2 nil 0 nil
316 (0 'default t)
317 (1 compilation-info-face prepend) (2 compilation-line-face prepend))
318 (gcov-never-called
319 "^ *\\(#####\\): *\\([0-9]+\\):.*$"
320 nil 2 nil 2 nil
321 (0 'default t)
322 (1 compilation-error-face prepend) (2 compilation-line-face prepend))
323 )
305 "Alist of values for `compilation-error-regexp-alist'.") 324 "Alist of values for `compilation-error-regexp-alist'.")
306 325
307(defcustom compilation-error-regexp-alist 326(defcustom compilation-error-regexp-alist
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 36f75b757b5..ad44753f352 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -6298,7 +6298,7 @@ $^E Information about the last system error other than that provided by $!.
6298$^F The highest system file descriptor, ordinarily 2. 6298$^F The highest system file descriptor, ordinarily 2.
6299$^H The current set of syntax checks enabled by `use strict'. 6299$^H The current set of syntax checks enabled by `use strict'.
6300$^I The value of the in-place edit extension (perl -i option). 6300$^I The value of the in-place edit extension (perl -i option).
6301$^L What formats output to perform a formfeed. Default is \f. 6301$^L What formats output to perform a formfeed. Default is \\f.
6302$^M A buffer for emergency memory allocation when running out of memory. 6302$^M A buffer for emergency memory allocation when running out of memory.
6303$^O The operating system name under which this copy of Perl was built. 6303$^O The operating system name under which this copy of Perl was built.
6304$^P Internal debugging flag. 6304$^P Internal debugging flag.
@@ -6380,11 +6380,11 @@ $~ The name of the current report format.
6380@ARGV Command line arguments (not including the command name - see $0). 6380@ARGV Command line arguments (not including the command name - see $0).
6381@INC List of places to look for perl scripts during do/include/use. 6381@INC List of places to look for perl scripts during do/include/use.
6382@_ Parameter array for subroutines; result of split() unless in list context. 6382@_ Parameter array for subroutines; result of split() unless in list context.
6383\\ Creates reference to what follows, like \$var, or quotes non-\w in strings. 6383\\ Creates reference to what follows, like \\$var, or quotes non-\\w in strings.
6384\\0 Octal char, e.g. \\033. 6384\\0 Octal char, e.g. \\033.
6385\\E Case modification terminator. See \\Q, \\L, and \\U. 6385\\E Case modification terminator. See \\Q, \\L, and \\U.
6386\\L Lowercase until \\E . See also \l, lc. 6386\\L Lowercase until \\E . See also \\l, lc.
6387\\U Upcase until \\E . See also \u, uc. 6387\\U Upcase until \\E . See also \\u, uc.
6388\\Q Quote metacharacters until \\E . See also quotemeta. 6388\\Q Quote metacharacters until \\E . See also quotemeta.
6389\\a Alarm character (octal 007). 6389\\a Alarm character (octal 007).
6390\\b Backspace character (octal 010). 6390\\b Backspace character (octal 010).
@@ -6655,7 +6655,7 @@ ucfirst [ EXPR ] Returns EXPR with upcased first letter.
6655untie VAR Unlink an object from a simple Perl variable. 6655untie VAR Unlink an object from a simple Perl variable.
6656use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'. 6656use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'.
6657... xor ... Low-precedence synonym for exclusive or. 6657... xor ... Low-precedence synonym for exclusive or.
6658prototype \&SUB Returns prototype of the function given a reference. 6658prototype \\&SUB Returns prototype of the function given a reference.
6659=head1 Top-level heading. 6659=head1 Top-level heading.
6660=head2 Second-level heading. 6660=head2 Second-level heading.
6661=head3 Third-level heading (is there such?). 6661=head3 Third-level heading (is there such?).
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index f5d08d533fd..bb821907aa8 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -71,11 +71,11 @@
71;;; Known Bugs: 71;;; Known Bugs:
72 72
73;; 1) Strings that are watched don't update in the speedbar when their 73;; 1) Strings that are watched don't update in the speedbar when their
74;; contents change unless the first character changes. 74;; contents change unless the first character changes.
75;; 2) Cannot handle multiple debug sessions. 75;; 2) Cannot handle multiple debug sessions.
76;; 3) Initially, the assembler buffer does not display the cursor at the 76;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
77;; current line if the line is not visible in the window (but when testing 77;; 4) M-x gdb doesn't work if the corefile is specified in the command in the
78;; gdb-assembler-custom with a lisp debugger it does!). 78;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer).
79 79
80;;; Problems with watch expressions, GDB/MI: 80;;; Problems with watch expressions, GDB/MI:
81;; 1) They go out of scope when the inferior is re-run. 81;; 1) They go out of scope when the inferior is re-run.
@@ -83,15 +83,10 @@
83;; 3) VARNUM increments even when variable object is not created 83;; 3) VARNUM increments even when variable object is not created
84;; (maybe trivial). 84;; (maybe trivial).
85 85
86;; Known Bugs:
87;; 1) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
88
89;;; TODO: 86;;; TODO:
90;; 1) Use MI command -data-read-memory for memory window. 87;; 1) Use MI command -data-read-memory for memory window.
91;; 2) Use tree-widget.el instead of the speedbar for watch-expressions? 88;; 2) Use tree-widget.el instead of the speedbar for watch-expressions?
92;; 3) Mark breakpoint locations on scroll-bar of source buffer? 89;; 3) Mark breakpoint locations on scroll-bar of source buffer?
93;; 4) With gud-print and gud-pstar, print the variable name in the GUD
94;; buffer instead of the value's history number.
95 90
96;;; Code: 91;;; Code:
97 92
@@ -130,6 +125,7 @@ and #define directives otherwise.")
130(defvar gdb-source-window nil) 125(defvar gdb-source-window nil)
131(defvar gdb-inferior-status nil) 126(defvar gdb-inferior-status nil)
132(defvar gdb-continuation nil) 127(defvar gdb-continuation nil)
128(defvar gdb-look-up-stack nil)
133 129
134(defvar gdb-buffer-type nil 130(defvar gdb-buffer-type nil
135 "One of the symbols bound in `gdb-buffer-rules'.") 131 "One of the symbols bound in `gdb-buffer-rules'.")
@@ -430,7 +426,8 @@ With arg, use separate IO iff arg is positive."
430 (when gud-tooltip-mode 426 (when gud-tooltip-mode
431 (make-local-variable 'gdb-define-alist) 427 (make-local-variable 'gdb-define-alist)
432 (gdb-create-define-alist) 428 (gdb-create-define-alist)
433 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))) 429 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))
430 (gdb-force-mode-line-update "ready"))
434 431
435(defun gdb-find-watch-expression () 432(defun gdb-find-watch-expression ()
436 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) 433 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list))
@@ -493,26 +490,28 @@ With arg, use separate IO iff arg is positive."
493 'gdb-mouse-set-clear-breakpoint) 490 'gdb-mouse-set-clear-breakpoint)
494 (define-key gud-minor-mode-map [left-fringe mouse-1] 491 (define-key gud-minor-mode-map [left-fringe mouse-1]
495 'gdb-mouse-set-clear-breakpoint) 492 'gdb-mouse-set-clear-breakpoint)
496 (define-key gud-minor-mode-map [left-fringe mouse-2] 493 (define-key gud-minor-mode-map [left-margin C-mouse-1]
497 'gdb-mouse-until) 494 'gdb-mouse-toggle-breakpoint-margin)
495 (define-key gud-minor-mode-map [left-fringe C-mouse-1]
496 'gdb-mouse-toggle-breakpoint-fringe)
497
498 (define-key gud-minor-mode-map [left-margin drag-mouse-1] 498 (define-key gud-minor-mode-map [left-margin drag-mouse-1]
499 'gdb-mouse-until) 499 'gdb-mouse-until)
500 (define-key gud-minor-mode-map [left-fringe drag-mouse-1] 500 (define-key gud-minor-mode-map [left-fringe drag-mouse-1]
501 'gdb-mouse-until) 501 'gdb-mouse-until)
502 (define-key gud-minor-mode-map [left-margin mouse-2] 502 (define-key gud-minor-mode-map [left-margin mouse-3]
503 'gdb-mouse-until)
504 (define-key gud-minor-mode-map [left-fringe mouse-3]
503 'gdb-mouse-until) 505 'gdb-mouse-until)
506
504 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1] 507 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
505 'gdb-mouse-jump) 508 'gdb-mouse-jump)
506 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1] 509 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
507 'gdb-mouse-jump) 510 'gdb-mouse-jump)
508 (define-key gud-minor-mode-map [left-fringe C-mouse-2] 511 (define-key gud-minor-mode-map [left-fringe C-mouse-3]
509 'gdb-mouse-jump) 512 'gdb-mouse-jump)
510 (define-key gud-minor-mode-map [left-margin C-mouse-2] 513 (define-key gud-minor-mode-map [left-margin C-mouse-3]
511 'gdb-mouse-jump) 514 'gdb-mouse-jump)
512 (define-key gud-minor-mode-map [left-margin mouse-3]
513 'gdb-mouse-toggle-breakpoint-margin)
514 (define-key gud-minor-mode-map [left-fringe mouse-3]
515 'gdb-mouse-toggle-breakpoint-fringe)
516 515
517 (setq comint-input-sender 'gdb-send) 516 (setq comint-input-sender 'gdb-send)
518 517
@@ -543,7 +542,8 @@ With arg, use separate IO iff arg is positive."
543 gdb-signalled nil 542 gdb-signalled nil
544 gdb-source-window nil 543 gdb-source-window nil
545 gdb-inferior-status nil 544 gdb-inferior-status nil
546 gdb-continuation nil) 545 gdb-continuation nil
546 gdb-look-up-stack nil)
547 547
548 (setq gdb-buffer-type 'gdba) 548 (setq gdb-buffer-type 'gdba)
549 549
@@ -738,7 +738,7 @@ With arg, enter name of variable to be watched in the minibuffer."
738 `(lambda () (gdb-var-evaluate-expression-handler 738 `(lambda () (gdb-var-evaluate-expression-handler
739 ,(car var) nil))))) 739 ,(car var) nil)))))
740 (if (search-forward "Undefined command" nil t) 740 (if (search-forward "Undefined command" nil t)
741 (message-box "Watching expressions requires gdb 6.0 onwards") 741 (message-box "Watching expressions requires GDB 6.0 onwards")
742 (message-box "No symbol \"%s\" in current context." expr)))) 742 (message-box "No symbol \"%s\" in current context." expr))))
743 743
744(defun gdb-speedbar-update () 744(defun gdb-speedbar-update ()
@@ -1106,7 +1106,8 @@ This filter may simply queue input for a later time."
1106 (let ((item (concat string "\n"))) 1106 (let ((item (concat string "\n")))
1107 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring)) 1107 (if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
1108 (process-send-string proc item))) 1108 (process-send-string proc item)))
1109 (if (string-match "\\\\$" string) 1109 (if (and (string-match "\\\\$" string)
1110 (not comint-input-sender-no-newline)) ;;Try to catch C-d.
1110 (setq gdb-continuation (concat gdb-continuation string "\n")) 1111 (setq gdb-continuation (concat gdb-continuation string "\n"))
1111 (let ((item (concat gdb-continuation string "\n"))) 1112 (let ((item (concat gdb-continuation string "\n")))
1112 (gdb-enqueue-input item) 1113 (gdb-enqueue-input item)
@@ -1238,6 +1239,7 @@ happens to be in effect."
1238 "An annotation handler for `prompt'. 1239 "An annotation handler for `prompt'.
1239This sends the next command (if any) to gdb." 1240This sends the next command (if any) to gdb."
1240 (when gdb-first-prompt 1241 (when gdb-first-prompt
1242 (gdb-force-mode-line-update "initializing...")
1241 (gdb-init-1) 1243 (gdb-init-1)
1242 (setq gdb-first-prompt nil)) 1244 (setq gdb-first-prompt nil))
1243 (let ((sink gdb-output-sink)) 1245 (let ((sink gdb-output-sink))
@@ -1334,9 +1336,20 @@ directives."
1334It is just like `gdb-stopping', except that if we already set the output 1336It is just like `gdb-stopping', except that if we already set the output
1335sink to `user' in `gdb-stopping', that is fine." 1337sink to `user' in `gdb-stopping', that is fine."
1336 (setq gud-running nil) 1338 (setq gud-running nil)
1337 (unless (or gud-overlay-arrow-position gud-last-frame 1339 (unless (or gud-overlay-arrow-position gud-last-frame)
1338 (not gud-last-last-frame)) 1340 ;;Pop up GUD buffer to display current frame when it doesn't have source
1339 (gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame))) 1341 ;;information i.e id not compiled with -g as with libc routines generally.
1342 (let ((special-display-regexps (append special-display-regexps '(".*")))
1343 (special-display-frame-alist gdb-frame-parameters)
1344 (same-window-regexps nil))
1345 (display-buffer gud-comint-buffer))
1346 ;;Try to find source further up stack e.g after signal.
1347 (setq gdb-look-up-stack
1348 (if (gdb-get-buffer 'gdb-stack-buffer) 'keep
1349 (progn
1350 (gdb-get-buffer-create 'gdb-stack-buffer)
1351 (gdb-invalidate-frames)
1352 'delete))))
1340 (unless (member gdb-inferior-status '("exited" "signal")) 1353 (unless (member gdb-inferior-status '("exited" "signal"))
1341 (setq gdb-inferior-status "stopped") 1354 (setq gdb-inferior-status "stopped")
1342 (gdb-force-mode-line-update gdb-inferior-status)) 1355 (gdb-force-mode-line-update gdb-inferior-status))
@@ -1945,36 +1958,57 @@ static char *magick[] = {
1945(defun gdb-info-stack-custom () 1958(defun gdb-info-stack-custom ()
1946 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer) 1959 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
1947 (save-excursion 1960 (save-excursion
1948 (let ((buffer-read-only nil) 1961 (unless (eq gdb-look-up-stack 'delete)
1949 bl el) 1962 (let ((buffer-read-only nil)
1950 (goto-char (point-min)) 1963 bl el)
1951 (while (< (point) (point-max)) 1964 (goto-char (point-min))
1952 (setq bl (line-beginning-position) 1965 (while (< (point) (point-max))
1953 el (line-end-position)) 1966 (setq bl (line-beginning-position)
1954 (when (looking-at "#") 1967 el (line-end-position))
1955 (add-text-properties bl el 1968 (when (looking-at "#")
1956 '(mouse-face highlight 1969 (add-text-properties bl el
1957 help-echo "mouse-2, RET: Select frame"))) 1970 '(mouse-face highlight
1958 (goto-char bl) 1971 help-echo "mouse-2, RET: Select frame")))
1959 (when (looking-at "^#\\([0-9]+\\)") 1972 (goto-char bl)
1960 (when (string-equal (match-string 1) gdb-frame-number) 1973 (when (looking-at "^#\\([0-9]+\\)")
1974 (when (string-equal (match-string 1) gdb-frame-number)
1961 (put-text-property bl (+ bl 4) 1975 (put-text-property bl (+ bl 4)
1962 'face '(:inverse-video t))) 1976 'face '(:inverse-video t)))
1963 (when (re-search-forward 1977 (when (re-search-forward
1964 (concat 1978 (concat
1965 (if (string-equal (match-string 1) "0") "" " in ") 1979 (if (string-equal (match-string 1) "0") "" " in ")
1966 "\\([^ ]+\\) (") el t) 1980 "\\([^ ]+\\) (") el t)
1967 (put-text-property (match-beginning 1) (match-end 1)
1968 'face font-lock-function-name-face)
1969 (setq bl (match-end 0))
1970 (while (re-search-forward "<\\([^>]+\\)>" el t)
1971 (put-text-property (match-beginning 1) (match-end 1) 1981 (put-text-property (match-beginning 1) (match-end 1)
1982 'face font-lock-function-name-face)
1983 (setq bl (match-end 0))
1984 (while (re-search-forward "<\\([^>]+\\)>" el t)
1985 (put-text-property (match-beginning 1) (match-end 1)
1972 'face font-lock-function-name-face)) 1986 'face font-lock-function-name-face))
1973 (goto-char bl) 1987 (goto-char bl)
1974 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t) 1988 (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
1975 (put-text-property (match-beginning 1) (match-end 1) 1989 (put-text-property (match-beginning 1) (match-end 1)
1976 'face font-lock-variable-name-face)))) 1990 'face font-lock-variable-name-face))))
1977 (forward-line 1)))))) 1991 (forward-line 1))))
1992 (when gdb-look-up-stack
1993 (goto-char (point-min))
1994 (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
1995 (let ((start (line-beginning-position))
1996 (file (match-string 1))
1997 (line (match-string 2)))
1998 (re-search-backward "^#*\\([0-9]+\\)" start t)
1999 (gdb-enqueue-input
2000 (list (concat gdb-server-prefix "frame "
2001 (match-string 1) "\n") 'gdb-set-hollow))
2002 (gdb-enqueue-input
2003 (list (concat gdb-server-prefix "frame 0\n") 'ignore)))))))
2004 (if (eq gdb-look-up-stack 'delete)
2005 (kill-buffer (gdb-get-buffer 'gdb-stack-buffer)))
2006 (setq gdb-look-up-stack nil))
2007
2008(defun gdb-set-hollow ()
2009 (with-current-buffer (gud-find-file (car gud-last-last-frame))
2010 (setq fringe-indicator-alist
2011 '((overlay-arrow . hollow-right-triangle)))))
1978 2012
1979(defun gdb-stack-buffer-name () 2013(defun gdb-stack-buffer-name ()
1980 (with-current-buffer gud-comint-buffer 2014 (with-current-buffer gud-comint-buffer
@@ -2030,8 +2064,7 @@ static char *magick[] = {
2030 (if event (posn-set-point (event-end event))) 2064 (if event (posn-set-point (event-end event)))
2031 (gdb-enqueue-input 2065 (gdb-enqueue-input
2032 (list (concat gdb-server-prefix "frame " 2066 (list (concat gdb-server-prefix "frame "
2033 (gdb-get-frame-number) "\n") 'ignore)) 2067 (gdb-get-frame-number) "\n") 'ignore)))
2034 (gud-display-frame))
2035 2068
2036 2069
2037;; Threads buffer. This displays a selectable thread list. 2070;; Threads buffer. This displays a selectable thread list.
@@ -2049,13 +2082,14 @@ static char *magick[] = {
2049(defun gdb-info-threads-custom () 2082(defun gdb-info-threads-custom ()
2050 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer) 2083 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
2051 (let ((buffer-read-only nil)) 2084 (let ((buffer-read-only nil))
2052 (goto-char (point-min)) 2085 (save-excursion
2053 (while (< (point) (point-max)) 2086 (goto-char (point-min))
2054 (unless (looking-at "No ") 2087 (while (< (point) (point-max))
2055 (add-text-properties (line-beginning-position) (line-end-position) 2088 (unless (looking-at "No ")
2056 '(mouse-face highlight 2089 (add-text-properties (line-beginning-position) (line-end-position)
2090 '(mouse-face highlight
2057 help-echo "mouse-2, RET: select thread"))) 2091 help-echo "mouse-2, RET: select thread")))
2058 (forward-line 1))))) 2092 (forward-line 1))))))
2059 2093
2060(defun gdb-threads-buffer-name () 2094(defun gdb-threads-buffer-name ()
2061 (with-current-buffer gud-comint-buffer 2095 (with-current-buffer gud-comint-buffer
@@ -2868,7 +2902,11 @@ of the current session."
2868 gud-comint-buffer 2902 gud-comint-buffer
2869 (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer) 2903 (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
2870 '(gdba gdbmi))) 2904 '(gdba gdbmi)))
2871 (if (member buffer-file-name gdb-source-file-list) 2905 ;;Pre GDB 6.3 "info sources" doesn't give absolute file name.
2906 (if (member (if (string-equal gdb-version "pre-6.4")
2907 (file-name-nondirectory buffer-file-name)
2908 buffer-file-name)
2909 gdb-source-file-list)
2872 (with-current-buffer (find-buffer-visiting buffer-file-name) 2910 (with-current-buffer (find-buffer-visiting buffer-file-name)
2873 (set (make-local-variable 'gud-minor-mode) 2911 (set (make-local-variable 'gud-minor-mode)
2874 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) 2912 (buffer-local-value 'gud-minor-mode gud-comint-buffer))
@@ -3203,7 +3241,8 @@ is set in them."
3203 (when gud-tooltip-mode 3241 (when gud-tooltip-mode
3204 (make-local-variable 'gdb-define-alist) 3242 (make-local-variable 'gdb-define-alist)
3205 (gdb-create-define-alist) 3243 (gdb-create-define-alist)
3206 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))) 3244 (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))
3245 (gdb-force-mode-line-update "ready"))
3207 3246
3208; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. 3247; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards.
3209(defun gdb-var-list-children-1 (varnum) 3248(defun gdb-var-list-children-1 (varnum)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index bda30b196e1..1ce5d404a80 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -101,8 +101,8 @@ If SOFT is non-nil, returns nil if the symbol doesn't already exist."
101 (if (boundp sym) (symbol-value sym)))) 101 (if (boundp sym) (symbol-value sym))))
102 102
103(defvar gud-running nil 103(defvar gud-running nil
104 "Non-nil if debuggee is running. 104 "Non-nil if debugged program is running.
105Used to grey out relevant togolbar icons.") 105Used to grey out relevant toolbar icons.")
106 106
107;; Use existing Info buffer, if possible. 107;; Use existing Info buffer, if possible.
108(defun gud-goto-info () 108(defun gud-goto-info ()
@@ -130,10 +130,10 @@ Used to grey out relevant togolbar icons.")
130 130
131(defun gud-stop-subjob () 131(defun gud-stop-subjob ()
132 (interactive) 132 (interactive)
133 (if (string-equal 133 (with-current-buffer gud-comint-buffer
134 (buffer-local-value 'gud-target-name gud-comint-buffer) "emacs") 134 (if (string-equal gud-target-name "emacs")
135 (comint-stop-subjob) 135 (comint-stop-subjob)
136 (comint-interrupt-subjob))) 136 (comint-interrupt-subjob))))
137 137
138(easy-mmode-defmap gud-menu-map 138(easy-mmode-defmap gud-menu-map
139 '(([help] "Info" . gud-goto-info) 139 '(([help] "Info" . gud-goto-info)
@@ -141,13 +141,15 @@ Used to grey out relevant togolbar icons.")
141 :enable (and (not emacs-basic-display) 141 :enable (and (not emacs-basic-display)
142 (display-graphic-p) 142 (display-graphic-p)
143 (fboundp 'x-show-tip)) 143 (fboundp 'x-show-tip))
144 :visible (memq gud-minor-mode
145 '(gdbmi gdba dbx sdb xdb pdb))
144 :button (:toggle . gud-tooltip-mode)) 146 :button (:toggle . gud-tooltip-mode))
145 ([refresh] "Refresh" . gud-refresh) 147 ([refresh] "Refresh" . gud-refresh)
146 ([run] menu-item "Run" gud-run 148 ([run] menu-item "Run" gud-run
147 :enable (and (not gud-running) 149 :enable (not gud-running)
148 (memq gud-minor-mode '(gdbmi gdb dbx jdb))) 150 :visible (and (memq gud-minor-mode '(gdbmi gdb dbx jdb))
149 :visible (not (eq gud-minor-mode 'gdba))) 151 (not (eq gud-minor-mode 'gdba))))
150 ([go] menu-item "Run/Continue" gud-go 152 ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go
151 :visible (and (not gud-running) 153 :visible (and (not gud-running)
152 (eq gud-minor-mode 'gdba))) 154 (eq gud-minor-mode 'gdba)))
153 ([stop] menu-item "Stop" gud-stop-subjob 155 ([stop] menu-item "Stop" gud-stop-subjob
@@ -155,26 +157,27 @@ Used to grey out relevant togolbar icons.")
155 (and gud-running 157 (and gud-running
156 (eq gud-minor-mode 'gdba)))) 158 (eq gud-minor-mode 'gdba))))
157 ([until] menu-item "Continue to selection" gud-until 159 ([until] menu-item "Continue to selection" gud-until
158 :enable (and (not gud-running) 160 :enable (not gud-running)
159 (memq gud-minor-mode '(gdbmi gdba gdb perldb))) 161 :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb))
160 :visible (gud-tool-bar-item-visible-no-fringe)) 162 (gud-tool-bar-item-visible-no-fringe)))
161 ([remove] menu-item "Remove Breakpoint" gud-remove 163 ([remove] menu-item "Remove Breakpoint" gud-remove
162 :enable (not gud-running) 164 :enable (not gud-running)
163 :visible (gud-tool-bar-item-visible-no-fringe)) 165 :visible (gud-tool-bar-item-visible-no-fringe))
164 ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak 166 ([tbreak] menu-item "Temporary Breakpoint" gud-tbreak
165 :enable (memq gud-minor-mode 167 :enable (not gud-running)
168 :visible (memq gud-minor-mode
166 '(gdbmi gdba gdb sdb xdb bashdb))) 169 '(gdbmi gdba gdb sdb xdb bashdb)))
167 ([break] menu-item "Set Breakpoint" gud-break 170 ([break] menu-item "Set Breakpoint" gud-break
168 :enable (not gud-running) 171 :enable (not gud-running)
169 :visible (gud-tool-bar-item-visible-no-fringe)) 172 :visible (gud-tool-bar-item-visible-no-fringe))
170 ([up] menu-item "Up Stack" gud-up 173 ([up] menu-item "Up Stack" gud-up
171 :enable (and (not gud-running) 174 :enable (not gud-running)
172 (memq gud-minor-mode 175 :visible (memq gud-minor-mode
173 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))) 176 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
174 ([down] menu-item "Down Stack" gud-down 177 ([down] menu-item "Down Stack" gud-down
175 :enable (and (not gud-running) 178 :enable (not gud-running)
176 (memq gud-minor-mode 179 :visible (memq gud-minor-mode
177 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))) 180 '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
178 ([pp] menu-item "Print S-expression" gud-pp 181 ([pp] menu-item "Print S-expression" gud-pp
179 :enable (and (not gud-running) 182 :enable (and (not gud-running)
180 gdb-active-process) 183 gdb-active-process)
@@ -183,23 +186,23 @@ Used to grey out relevant togolbar icons.")
183 'gud-target-name gud-comint-buffer) "emacs") 186 'gud-target-name gud-comint-buffer) "emacs")
184 (eq gud-minor-mode 'gdba))) 187 (eq gud-minor-mode 'gdba)))
185 ([print*] menu-item "Print Dereference" gud-pstar 188 ([print*] menu-item "Print Dereference" gud-pstar
186 :enable (and (not gud-running) 189 :enable (not gud-running)
187 (memq gud-minor-mode '(gdbmi gdba gdb)))) 190 :visible (memq gud-minor-mode '(gdbmi gdba gdb)))
188 ([print] menu-item "Print Expression" gud-print 191 ([print] menu-item "Print Expression" gud-print
189 :enable (not gud-running)) 192 :enable (not gud-running))
190 ([watch] menu-item "Watch Expression" gud-watch 193 ([watch] menu-item "Watch Expression" gud-watch
191 :enable (and (not gud-running) 194 :enable (not gud-running)
192 (memq gud-minor-mode '(gdbmi gdba)))) 195 :visible (memq gud-minor-mode '(gdbmi gdba)))
193 ([finish] menu-item "Finish Function" gud-finish 196 ([finish] menu-item "Finish Function" gud-finish
194 :enable (and (not gud-running) 197 :enable (not gud-running)
195 (memq gud-minor-mode 198 :visible (memq gud-minor-mode
196 '(gdbmi gdba gdb xdb jdb pdb bashdb)))) 199 '(gdbmi gdba gdb xdb jdb pdb bashdb)))
197 ([stepi] menu-item "Step Instruction" gud-stepi 200 ([stepi] menu-item "Step Instruction" gud-stepi
198 :enable (and (not gud-running) 201 :enable (not gud-running)
199 (memq gud-minor-mode '(gdbmi gdba gdb dbx)))) 202 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
200 ([nexti] menu-item "Next Instruction" gud-nexti 203 ([nexti] menu-item "Next Instruction" gud-nexti
201 :enable (and (not gud-running) 204 :enable (not gud-running)
202 (memq gud-minor-mode '(gdbmi gdba gdb dbx)))) 205 :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
203 ([step] menu-item "Step Line" gud-step 206 ([step] menu-item "Step Line" gud-step
204 :enable (not gud-running)) 207 :enable (not gud-running))
205 ([next] menu-item "Next Line" gud-next 208 ([next] menu-item "Next Line" gud-next
@@ -2565,7 +2568,7 @@ comint mode, which see."
2565 (existing-buffer (get-buffer (concat "*gud" filepart "*")))) 2568 (existing-buffer (get-buffer (concat "*gud" filepart "*"))))
2566 (pop-to-buffer (concat "*gud" filepart "*")) 2569 (pop-to-buffer (concat "*gud" filepart "*"))
2567 (when (and existing-buffer (get-buffer-process existing-buffer)) 2570 (when (and existing-buffer (get-buffer-process existing-buffer))
2568 (error "This program is already running under gdb")) 2571 (error "This program is already being debugged"))
2569 ;; Set the dir, in case the buffer already existed with a different dir. 2572 ;; Set the dir, in case the buffer already existed with a different dir.
2570 (setq default-directory dir) 2573 (setq default-directory dir)
2571 ;; Set default-directory to the file's directory. 2574 ;; Set default-directory to the file's directory.
@@ -2693,10 +2696,10 @@ It is saved for when this flag is not set.")
2693 ((memq (process-status proc) '(signal exit)) 2696 ((memq (process-status proc) '(signal exit))
2694 ;; Stop displaying an arrow in a source file. 2697 ;; Stop displaying an arrow in a source file.
2695 (setq gud-overlay-arrow-position nil) 2698 (setq gud-overlay-arrow-position nil)
2696 (with-current-buffer gud-comint-buffer 2699 (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
2697 (if (memq gud-minor-mode-type '(gdbmi gdba)) 2700 '(gdba gdbmi))
2698 (gdb-reset) 2701 (gdb-reset)
2699 (gud-reset))) 2702 (gud-reset))
2700 (let* ((obuf (current-buffer))) 2703 (let* ((obuf (current-buffer)))
2701 ;; save-excursion isn't the right thing if 2704 ;; save-excursion isn't the right thing if
2702 ;; process-buffer is current-buffer 2705 ;; process-buffer is current-buffer
@@ -3313,7 +3316,8 @@ Treats actions as defuns."
3313 (kill-local-variable 'gdb-define-alist) 3316 (kill-local-variable 'gdb-define-alist)
3314 (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) 3317 (remove-hook 'after-save-hook 'gdb-create-define-alist t))))
3315 3318
3316(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode) 3319(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode
3320 python-mode)
3317 "List of modes for which to enable GUD tooltips." 3321 "List of modes for which to enable GUD tooltips."
3318 :type 'sexp 3322 :type 'sexp
3319 :group 'gud 3323 :group 'gud
@@ -3427,9 +3431,8 @@ With arg, dereference expr iff arg is positive."
3427 (case gud-minor-mode 3431 (case gud-minor-mode
3428 (gdba (concat "server print " expr)) 3432 (gdba (concat "server print " expr))
3429 ((dbx gdbmi) (concat "print " expr)) 3433 ((dbx gdbmi) (concat "print " expr))
3430 (xdb (concat "p " expr)) 3434 ((xdb pdb) (concat "p " expr))
3431 (sdb (concat expr "/")) 3435 (sdb (concat expr "/"))))
3432 (perldb expr)))
3433 3436
3434(defun gud-tooltip-tips (event) 3437(defun gud-tooltip-tips (event)
3435 "Show tip for identifier or selection under the mouse. 3438 "Show tip for identifier or selection under the mouse.
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 092c7736c27..4a50e00063c 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -233,30 +233,37 @@ documentation for variable `inferior-lisp-buffer'.
233 233
234\\{inferior-lisp-mode-map} 234\\{inferior-lisp-mode-map}
235 235
236Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and 236Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
237`inferior-lisp-mode-hook' (in that order). 237`inferior-lisp-mode-hook' (in that order).
238 238
239You can send text to the inferior Lisp process from other buffers containing 239You can send text to the inferior Lisp process from other buffers containing
240Lisp source. 240Lisp source.
241 switch-to-lisp switches the current buffer to the Lisp process buffer. 241 `switch-to-lisp' switches the current buffer to the Lisp process buffer.
242 lisp-eval-defun sends the current defun to the Lisp process. 242 `lisp-eval-defun' sends the current defun to the Lisp process.
243 lisp-compile-defun compiles the current defun. 243 `lisp-compile-defun' compiles the current defun.
244 lisp-eval-region sends the current region to the Lisp process. 244 `lisp-eval-region' sends the current region to the Lisp process.
245 lisp-compile-region compiles the current region. 245 `lisp-compile-region' compiles the current region.
246 246
247 Prefixing the lisp-eval/compile-defun/region commands with 247 Prefixing the lisp-eval/compile-defun/region commands with
248 a \\[universal-argument] causes a switch to the Lisp process buffer after sending 248 a \\[universal-argument] causes a switch to the Lisp process buffer after sending
249 the text. 249 the text.
250 250
251Commands: 251Commands:\\<inferior-lisp-mode-map>
252Return after the end of the process' output sends the text from the 252\\[comint-send-input] after the end of the process' output sends the text from the
253 end of process to point. 253 end of process to point.
254Return before the end of the process' output copies the sexp ending at point 254\\[comint-send-input] before the end of the process' output copies the sexp ending at point
255 to the end of the process' output, and sends it. 255 to the end of the process' output, and sends it.
256Delete converts tabs to spaces as it moves back. 256\\[comint-copy-old-input] copies the sexp ending at point to the end of the process' output,
257Tab indents for Lisp; with argument, shifts rest 257 allowing you to edit it before sending it.
258If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] on old input
259 copies the entire old input to the end of the process' output, allowing
260 you to edit it before sending it. When not used on old input, or if
261 `comint-use-prompt-regexp' is non-nil, \\[comint-insert-input] behaves according to
262 its global binding.
263\\[backward-delete-char-untabify] converts tabs to spaces as it moves back.
264\\[lisp-indent-line] indents for Lisp; with argument, shifts rest
258 of expression rigidly with the current line. 265 of expression rigidly with the current line.
259C-M-q does Tab on each line starting within following expression. 266\\[indent-sexp] does \\[lisp-indent-line] on each line starting within following expression.
260Paragraphs are separated only by blank lines. Semicolons start comments. 267Paragraphs are separated only by blank lines. Semicolons start comments.
261If you accidentally suspend your process, use \\[comint-continue-subjob] 268If you accidentally suspend your process, use \\[comint-continue-subjob]
262to continue it." 269to continue it."
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 66507dd78df..a3146df3e45 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -291,6 +291,9 @@ not be enclosed in { } or ( )."
291;; that if you change this regexp you might have to fix the imenu index in 291;; that if you change this regexp you might have to fix the imenu index in
292;; makefile-imenu-generic-expression. 292;; makefile-imenu-generic-expression.
293(defconst makefile-macroassign-regex 293(defconst makefile-macroassign-regex
294 ;; We used to match not just the varname but also the whole value
295 ;; (spanning potentially several lines).
296 ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
294 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" 297 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
295 "Regex used to find macro assignment lines in a makefile.") 298 "Regex used to find macro assignment lines in a makefile.")
296 299
@@ -623,39 +626,38 @@ The function must satisfy this calling convention:
623 map) 626 map)
624 "The keymap that is used in Makefile mode.") 627 "The keymap that is used in Makefile mode.")
625 628
626(defvar makefile-browser-map nil 629
630(defvar makefile-browser-map
631 (let ((map (make-sparse-keymap)))
632 (define-key map "n" 'makefile-browser-next-line)
633 (define-key map "\C-n" 'makefile-browser-next-line)
634 (define-key map "p" 'makefile-browser-previous-line)
635 (define-key map "\C-p" 'makefile-browser-previous-line)
636 (define-key map " " 'makefile-browser-toggle)
637 (define-key map "i" 'makefile-browser-insert-selection)
638 (define-key map "I" 'makefile-browser-insert-selection-and-quit)
639 (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation)
640 (define-key map "q" 'makefile-browser-quit)
641 ;; disable horizontal movement
642 (define-key map "\C-b" 'undefined)
643 (define-key map "\C-f" 'undefined)
644 map)
627 "The keymap that is used in the macro- and target browser.") 645 "The keymap that is used in the macro- and target browser.")
628(if makefile-browser-map 646
629 () 647
630 (setq makefile-browser-map (make-sparse-keymap)) 648(defvar makefile-mode-syntax-table
631 (define-key makefile-browser-map "n" 'makefile-browser-next-line) 649 (let ((st (make-syntax-table)))
632 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) 650 (modify-syntax-entry ?\( "() " st)
633 (define-key makefile-browser-map "p" 'makefile-browser-previous-line) 651 (modify-syntax-entry ?\) ")( " st)
634 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) 652 (modify-syntax-entry ?\[ "(] " st)
635 (define-key makefile-browser-map " " 'makefile-browser-toggle) 653 (modify-syntax-entry ?\] ")[ " st)
636 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) 654 (modify-syntax-entry ?\{ "(} " st)
637 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) 655 (modify-syntax-entry ?\} "){ " st)
638 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) 656 (modify-syntax-entry ?\' "\" " st)
639 (define-key makefile-browser-map "q" 'makefile-browser-quit) 657 (modify-syntax-entry ?\` "\" " st)
640 ;; disable horizontal movement 658 (modify-syntax-entry ?# "< " st)
641 (define-key makefile-browser-map "\C-b" 'undefined) 659 (modify-syntax-entry ?\n "> " st)
642 (define-key makefile-browser-map "\C-f" 'undefined)) 660 st))
643
644
645(defvar makefile-mode-syntax-table nil)
646(if makefile-mode-syntax-table
647 ()
648 (setq makefile-mode-syntax-table (make-syntax-table))
649 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table)
650 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table)
651 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table)
652 (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table)
653 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table)
654 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
655 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
656 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
657 (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
658 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
659 661
660(defvar makefile-imake-mode-syntax-table (copy-syntax-table 662(defvar makefile-imake-mode-syntax-table (copy-syntax-table
661 makefile-mode-syntax-table)) 663 makefile-mode-syntax-table))
@@ -1302,30 +1304,9 @@ definition and conveniently use this command."
1302 (save-excursion 1304 (save-excursion
1303 (beginning-of-line) 1305 (beginning-of-line)
1304 (cond 1306 (cond
1305 ((looking-at "^#+") 1307 ((looking-at "^#+\\s-*")
1306 ;; Found a comment. Set the fill prefix, and find the paragraph 1308 ;; Found a comment. Return nil to let normal filling take place.
1307 ;; boundaries by searching for lines that look like comment-only 1309 nil)
1308 ;; lines.
1309 (let ((fill-prefix (match-string-no-properties 0))
1310 (fill-paragraph-function nil))
1311 (save-excursion
1312 (save-restriction
1313 (narrow-to-region
1314 ;; Search backwards.
1315 (save-excursion
1316 (while (and (zerop (forward-line -1))
1317 (looking-at "^#")))
1318 ;; We may have gone too far. Go forward again.
1319 (or (looking-at "^#")
1320 (forward-line 1))
1321 (point))
1322 ;; Search forwards.
1323 (save-excursion
1324 (while (looking-at "^#")
1325 (forward-line))
1326 (point)))
1327 (fill-paragraph nil)
1328 t))))
1329 1310
1330 ;; Must look for backslashed-region before looking for variable 1311 ;; Must look for backslashed-region before looking for variable
1331 ;; assignment. 1312 ;; assignment.
@@ -1354,7 +1335,9 @@ definition and conveniently use this command."
1354 (makefile-backslash-region (point-min) (point-max) nil) 1335 (makefile-backslash-region (point-min) (point-max) nil)
1355 (goto-char (point-max)) 1336 (goto-char (point-max))
1356 (if (< (skip-chars-backward "\n") 0) 1337 (if (< (skip-chars-backward "\n") 0)
1357 (delete-region (point) (point-max)))))) 1338 (delete-region (point) (point-max)))))
1339 ;; Return non-nil to indicate it's been filled.
1340 t)
1358 1341
1359 ((looking-at makefile-macroassign-regex) 1342 ((looking-at makefile-macroassign-regex)
1360 ;; Have a macro assign. Fill just this line, and then backslash 1343 ;; Have a macro assign. Fill just this line, and then backslash
@@ -1363,10 +1346,13 @@ definition and conveniently use this command."
1363 (narrow-to-region (point) (line-beginning-position 2)) 1346 (narrow-to-region (point) (line-beginning-position 2))
1364 (let ((fill-paragraph-function nil)) 1347 (let ((fill-paragraph-function nil))
1365 (fill-paragraph nil)) 1348 (fill-paragraph nil))
1366 (makefile-backslash-region (point-min) (point-max) nil))))) 1349 (makefile-backslash-region (point-min) (point-max) nil))
1350 ;; Return non-nil to indicate it's been filled.
1351 t)
1367 1352
1368 ;; Always return non-nil so we don't fill anything else. 1353 (t
1369 t) 1354 ;; Return non-nil so we don't fill anything else.
1355 t))))
1370 1356
1371 1357
1372 1358
@@ -1882,5 +1868,5 @@ If it isn't in one, return nil."
1882 1868
1883(provide 'make-mode) 1869(provide 'make-mode)
1884 1870
1885;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 1871;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
1886;;; make-mode.el ends here 1872;;; make-mode.el ends here
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index ab3da050456..ef80d28c578 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -814,6 +814,18 @@ See `sh-feature'.")
814 (:weight bold))) 814 (:weight bold)))
815 "Face to show a here-document" 815 "Face to show a here-document"
816 :group 'sh-indentation) 816 :group 'sh-indentation)
817
818;; These colours are probably icky. It's just a placeholder though.
819(defface sh-quoted-exec
820 '((((class color) (background dark))
821 (:foreground "salmon"))
822 (((class color) (background light))
823 (:foreground "magenta"))
824 (t
825 (:weight bold)))
826 "Face to show quoted execs like ``"
827 :group 'sh-indentation)
828
817;; backward-compatibility alias 829;; backward-compatibility alias
818(put 'sh-heredoc-face 'face-alias 'sh-heredoc) 830(put 'sh-heredoc-face 'face-alias 'sh-heredoc)
819(defvar sh-heredoc-face 'sh-heredoc) 831(defvar sh-heredoc-face 'sh-heredoc)
@@ -833,7 +845,7 @@ See `sh-feature'.")
833 font-lock-variable-name-face)) 845 font-lock-variable-name-face))
834 846
835 (rc sh-append es) 847 (rc sh-append es)
836 848 (bash sh-append shell ("\\$(\\(\\sw+\\)" (1 'sh-quoted-exec t) ))
837 (sh sh-append shell 849 (sh sh-append shell
838 ;; Variable names. 850 ;; Variable names.
839 ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2 851 ("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2
@@ -967,6 +979,49 @@ Point is at the beginning of the next line."
967 ;; This looks silly, but it's because `sh-here-doc-re' keeps changing. 979 ;; This looks silly, but it's because `sh-here-doc-re' keeps changing.
968 (re-search-forward sh-here-doc-re limit t)) 980 (re-search-forward sh-here-doc-re limit t))
969 981
982(defun sh-quoted-subshell (limit)
983 "Search for a subshell embedded in a string. Find all the unescaped
984\" characters within said subshell, remembering that subshells can nest."
985 (if (re-search-forward "\"\\(?:.\\|\n\\)*?\\(\\$(\\|`\\)" limit t)
986 ;; bingo we have a $( or a ` inside a ""
987 (let ((char (char-after (point)))
988 (continue t)
989 (pos (point))
990 (data nil) ;; value to put into match-data (and return)
991 (last nil) ;; last char seen
992 (bq (equal (match-string 1) "`")) ;; ` state flip-flop
993 (seen nil) ;; list of important positions
994 (nest 1)) ;; subshell nesting level
995 (while (and continue char (<= pos limit))
996 ;; unescaped " inside a $( ... ) construct.
997 ;; state machine time...
998 ;; \ => ignore next char;
999 ;; ` => increase or decrease nesting level based on bq flag
1000 ;; ) [where nesting > 0] => decrease nesting
1001 ;; ( [where nesting > 0] => increase nesting
1002 ;; ( [preceeded by $ ] => increase nesting
1003 ;; " [nesting <= 0 ] => terminate, we're done.
1004 ;; " [nesting > 0 ] => remember this, it's not a proper "
1005 (if (eq ?\\ last) nil
1006 (if (eq ?\` char) (setq nest (+ nest (if bq -1 1)) bq (not bq))
1007 (if (and (> nest 0) (eq ?\) char)) (setq nest (1- nest))
1008 (if (and (eq ?$ last) (eq ?\( char)) (setq nest (1+ nest))
1009 (if (and (> nest 0) (eq ?\( char)) (setq nest (1+ nest))
1010 (if (eq char ?\")
1011 (if (>= 0 nest) (setq continue nil)
1012 (setq seen (cons pos seen)) ) ))))))
1013 ;;(message "POS: %d [%d]" pos nest)
1014 (setq last char
1015 pos (1+ pos)
1016 char (char-after pos)) )
1017 (when seen
1018 ;;(message "SEEN: %S" seen)
1019 (setq data (list (current-buffer)))
1020 (mapc (lambda (P)
1021 (setq data (cons P (cons (1+ P) data)) ) ) seen)
1022 (store-match-data data))
1023 data) ))
1024
970(defun sh-is-quoted-p (pos) 1025(defun sh-is-quoted-p (pos)
971 (and (eq (char-before pos) ?\\) 1026 (and (eq (char-before pos) ?\\)
972 (not (sh-is-quoted-p (1- pos))))) 1027 (not (sh-is-quoted-p (1- pos)))))
@@ -997,6 +1052,17 @@ Point is at the beginning of the next line."
997 (when (save-excursion (backward-char 2) (looking-at ";;\\|in")) 1052 (when (save-excursion (backward-char 2) (looking-at ";;\\|in"))
998 sh-st-punc))) 1053 sh-st-punc)))
999 1054
1055(defun sh-apply-quoted-subshell ()
1056 "Apply the `sh-st-punc' syntax to all the matches in `match-data'.
1057This is used to flag quote characters in subshell constructs inside strings
1058\(which should therefore not be treated as normal quote characters\)"
1059 (let ((m (match-data)) a b)
1060 (while m
1061 (setq a (car m)
1062 b (cadr m)
1063 m (cddr m))
1064 (put-text-property a b 'syntax-table sh-st-punc))) sh-st-punc)
1065
1000(defconst sh-font-lock-syntactic-keywords 1066(defconst sh-font-lock-syntactic-keywords
1001 ;; A `#' begins a comment when it is unquoted and at the beginning of a 1067 ;; A `#' begins a comment when it is unquoted and at the beginning of a
1002 ;; word. In the shell, words are separated by metacharacters. 1068 ;; word. In the shell, words are separated by metacharacters.
@@ -1007,6 +1073,9 @@ Point is at the beginning of the next line."
1007 ("\\(\\\\\\)'" 1 ,sh-st-punc) 1073 ("\\(\\\\\\)'" 1 ,sh-st-punc)
1008 ;; Make sure $@ and @? are correctly recognized as sexps. 1074 ;; Make sure $@ and @? are correctly recognized as sexps.
1009 ("\\$\\([?@]\\)" 1 ,sh-st-symbol) 1075 ("\\$\\([?@]\\)" 1 ,sh-st-symbol)
1076 ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
1077 (sh-quoted-subshell
1078 (1 (sh-apply-quoted-subshell) t t))
1010 ;; Find HEREDOC starters and add a corresponding rule for the ender. 1079 ;; Find HEREDOC starters and add a corresponding rule for the ender.
1011 (sh-font-lock-here-doc 1080 (sh-font-lock-here-doc
1012 (2 (sh-font-lock-open-heredoc 1081 (2 (sh-font-lock-open-heredoc
@@ -1019,11 +1088,12 @@ Point is at the beginning of the next line."
1019 (")" 0 (sh-font-lock-paren (match-beginning 0))))) 1088 (")" 0 (sh-font-lock-paren (match-beginning 0)))))
1020 1089
1021(defun sh-font-lock-syntactic-face-function (state) 1090(defun sh-font-lock-syntactic-face-function (state)
1022 (if (nth 3 state) 1091 (let ((q (nth 3 state)))
1023 (if (char-valid-p (nth 3 state)) 1092 (if q
1024 font-lock-string-face 1093 (if (char-valid-p q)
1025 sh-heredoc-face) 1094 (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face)
1026 font-lock-comment-face)) 1095 sh-heredoc-face)
1096 font-lock-comment-face)))
1027 1097
1028(defgroup sh-indentation nil 1098(defgroup sh-indentation nil
1029 "Variables controlling indentation in shell scripts. 1099 "Variables controlling indentation in shell scripts.