summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
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))
\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\
\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?:\
\\(?: *\\(\\(?:Future\\|Runtime\\)?[Ww]arning\\|W:\\)\\|\
- *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\)\\)?"
+ *\\([Ii]nfo\\(?:\\>\\|rmationa?l?\\)\\|I:\\|instantiated from\\)\\)?"
1 (2 . 5) (4 . 6) (7 . 8))
(lcc
@@ -236,7 +236,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
2 3 4 (1))
(makepp
- "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\) \\|.*?\\)\
+ "^makepp: \\(?:\\(?:warning\\(:\\).*?\\|\\(Scanning\\|[LR]e?l?oading makefile\\|Imported\\) \\|.*?\\)\
`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]\\)"
4 5 nil (1 . 2) 3
("`\\(\\(\\S +?\\)\\(?::\\([0-9]+\\)\\)?\\)['(]" nil nil
@@ -293,15 +293,34 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = \\([0-9]+\\)\\)?"
\\(?:: \\(warning:\\)?\\|$\\| ),\\)" 1 2 nil (3))
(gcov-file
- "^ +-: \\(0\\):Source:\\(.+\\)$" 2 1 nil 0)
- (gcov-bb-file
- "^ +-: \\(0\\):Object:\\(?:.+\\)$" nil 1 nil 0)
- (gcov-never-called-line
- "^ +\\(#####\\): +\\([0-9]+\\):.+$" nil 2 nil 2 nil
- (1 compilation-error-face))
+ "^ *-: *\\(0\\):Source:\\(.+\\)$"
+ 2 1 nil 0 nil
+ (1 compilation-line-face prepend) (2 compilation-info-face prepend))
+ (gcov-header
+ "^ *-: *\\(0\\):\\(?:Object\\|Graph\\|Data\\|Runs\\|Programs\\):.+$"
+ nil 1 nil 0 nil
+ (1 compilation-line-face prepend))
+ ;; Underlines over all lines of gcov output are too uncomfortable to read.
+ ;; However, hyperlinks embedded in the lines are useful.
+ ;; So I put default face on the lines; and then put
+ ;; compilation-*-face by manually to eliminate the underlines.
+ ;; The hyperlinks are still effective.
+ (gcov-nomark
+ "^ *-: *\\([1-9]\\|[0-9]\\{2,\\}\\):.*$"
+ nil 1 nil 0 nil
+ (0 'default t)
+ (1 compilation-line-face prepend))
(gcov-called-line
- "^ +[-0-9]+: +\\([1-9]\\|[0-9]\\{2,\\}\\):.*$" nil 1 nil 0)
-)
+ "^ *\\([0-9]+\\): *\\([0-9]+\\):.*$"
+ nil 2 nil 0 nil
+ (0 'default t)
+ (1 compilation-info-face prepend) (2 compilation-line-face prepend))
+ (gcov-never-called
+ "^ *\\(#####\\): *\\([0-9]+\\):.*$"
+ nil 2 nil 2 nil
+ (0 'default t)
+ (1 compilation-error-face prepend) (2 compilation-line-face prepend))
+ )
"Alist of values for `compilation-error-regexp-alist'.")
(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 $!.
$^F The highest system file descriptor, ordinarily 2.
$^H The current set of syntax checks enabled by `use strict'.
$^I The value of the in-place edit extension (perl -i option).
-$^L What formats output to perform a formfeed. Default is \f.
+$^L What formats output to perform a formfeed. Default is \\f.
$^M A buffer for emergency memory allocation when running out of memory.
$^O The operating system name under which this copy of Perl was built.
$^P Internal debugging flag.
@@ -6380,11 +6380,11 @@ $~ The name of the current report format.
@ARGV Command line arguments (not including the command name - see $0).
@INC List of places to look for perl scripts during do/include/use.
@_ Parameter array for subroutines; result of split() unless in list context.
-\\ Creates reference to what follows, like \$var, or quotes non-\w in strings.
+\\ Creates reference to what follows, like \\$var, or quotes non-\\w in strings.
\\0 Octal char, e.g. \\033.
\\E Case modification terminator. See \\Q, \\L, and \\U.
-\\L Lowercase until \\E . See also \l, lc.
-\\U Upcase until \\E . See also \u, uc.
+\\L Lowercase until \\E . See also \\l, lc.
+\\U Upcase until \\E . See also \\u, uc.
\\Q Quote metacharacters until \\E . See also quotemeta.
\\a Alarm character (octal 007).
\\b Backspace character (octal 010).
@@ -6655,7 +6655,7 @@ ucfirst [ EXPR ] Returns EXPR with upcased first letter.
untie VAR Unlink an object from a simple Perl variable.
use PACKAGE [SYMBOL1, ...] Compile-time `require' with consequent `import'.
... xor ... Low-precedence synonym for exclusive or.
-prototype \&SUB Returns prototype of the function given a reference.
+prototype \\&SUB Returns prototype of the function given a reference.
=head1 Top-level heading.
=head2 Second-level heading.
=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 @@
;;; Known Bugs:
;; 1) Strings that are watched don't update in the speedbar when their
-;; contents change unless the first character changes.
+;; contents change unless the first character changes.
;; 2) Cannot handle multiple debug sessions.
-;; 3) Initially, the assembler buffer does not display the cursor at the
-;; current line if the line is not visible in the window (but when testing
-;; gdb-assembler-custom with a lisp debugger it does!).
+;; 3) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
+;; 4) M-x gdb doesn't work if the corefile is specified in the command in the
+;; minibuffer, use M-x gdba instead (or specify the core in the GUD buffer).
;;; Problems with watch expressions, GDB/MI:
;; 1) They go out of scope when the inferior is re-run.
@@ -83,15 +83,10 @@
;; 3) VARNUM increments even when variable object is not created
;; (maybe trivial).
-;; Known Bugs:
-;; 1) M-x gdb doesn't work with "run" command in .gdbinit, use M-x gdba instead.
-
;;; TODO:
;; 1) Use MI command -data-read-memory for memory window.
;; 2) Use tree-widget.el instead of the speedbar for watch-expressions?
;; 3) Mark breakpoint locations on scroll-bar of source buffer?
-;; 4) With gud-print and gud-pstar, print the variable name in the GUD
-;; buffer instead of the value's history number.
;;; Code:
@@ -130,6 +125,7 @@ and #define directives otherwise.")
(defvar gdb-source-window nil)
(defvar gdb-inferior-status nil)
(defvar gdb-continuation nil)
+(defvar gdb-look-up-stack nil)
(defvar gdb-buffer-type nil
"One of the symbols bound in `gdb-buffer-rules'.")
@@ -430,7 +426,8 @@ With arg, use separate IO iff arg is positive."
(when gud-tooltip-mode
(make-local-variable 'gdb-define-alist)
(gdb-create-define-alist)
- (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))))
+ (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))
+ (gdb-force-mode-line-update "ready"))
(defun gdb-find-watch-expression ()
(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."
'gdb-mouse-set-clear-breakpoint)
(define-key gud-minor-mode-map [left-fringe mouse-1]
'gdb-mouse-set-clear-breakpoint)
- (define-key gud-minor-mode-map [left-fringe mouse-2]
- 'gdb-mouse-until)
+ (define-key gud-minor-mode-map [left-margin C-mouse-1]
+ 'gdb-mouse-toggle-breakpoint-margin)
+ (define-key gud-minor-mode-map [left-fringe C-mouse-1]
+ 'gdb-mouse-toggle-breakpoint-fringe)
+
(define-key gud-minor-mode-map [left-margin drag-mouse-1]
'gdb-mouse-until)
(define-key gud-minor-mode-map [left-fringe drag-mouse-1]
'gdb-mouse-until)
- (define-key gud-minor-mode-map [left-margin mouse-2]
+ (define-key gud-minor-mode-map [left-margin mouse-3]
+ 'gdb-mouse-until)
+ (define-key gud-minor-mode-map [left-fringe mouse-3]
'gdb-mouse-until)
+
(define-key gud-minor-mode-map [left-margin C-drag-mouse-1]
'gdb-mouse-jump)
(define-key gud-minor-mode-map [left-fringe C-drag-mouse-1]
'gdb-mouse-jump)
- (define-key gud-minor-mode-map [left-fringe C-mouse-2]
+ (define-key gud-minor-mode-map [left-fringe C-mouse-3]
'gdb-mouse-jump)
- (define-key gud-minor-mode-map [left-margin C-mouse-2]
+ (define-key gud-minor-mode-map [left-margin C-mouse-3]
'gdb-mouse-jump)
- (define-key gud-minor-mode-map [left-margin mouse-3]
- 'gdb-mouse-toggle-breakpoint-margin)
- (define-key gud-minor-mode-map [left-fringe mouse-3]
- 'gdb-mouse-toggle-breakpoint-fringe)
(setq comint-input-sender 'gdb-send)
@@ -543,7 +542,8 @@ With arg, use separate IO iff arg is positive."
gdb-signalled nil
gdb-source-window nil
gdb-inferior-status nil
- gdb-continuation nil)
+ gdb-continuation nil
+ gdb-look-up-stack nil)
(setq gdb-buffer-type 'gdba)
@@ -738,7 +738,7 @@ With arg, enter name of variable to be watched in the minibuffer."
`(lambda () (gdb-var-evaluate-expression-handler
,(car var) nil)))))
(if (search-forward "Undefined command" nil t)
- (message-box "Watching expressions requires gdb 6.0 onwards")
+ (message-box "Watching expressions requires GDB 6.0 onwards")
(message-box "No symbol \"%s\" in current context." expr))))
(defun gdb-speedbar-update ()
@@ -1106,7 +1106,8 @@ This filter may simply queue input for a later time."
(let ((item (concat string "\n")))
(if gdb-enable-debug (push (cons 'send item) gdb-debug-ring))
(process-send-string proc item)))
- (if (string-match "\\\\$" string)
+ (if (and (string-match "\\\\$" string)
+ (not comint-input-sender-no-newline)) ;;Try to catch C-d.
(setq gdb-continuation (concat gdb-continuation string "\n"))
(let ((item (concat gdb-continuation string "\n")))
(gdb-enqueue-input item)
@@ -1238,6 +1239,7 @@ happens to be in effect."
"An annotation handler for `prompt'.
This sends the next command (if any) to gdb."
(when gdb-first-prompt
+ (gdb-force-mode-line-update "initializing...")
(gdb-init-1)
(setq gdb-first-prompt nil))
(let ((sink gdb-output-sink))
@@ -1334,9 +1336,20 @@ directives."
It is just like `gdb-stopping', except that if we already set the output
sink to `user' in `gdb-stopping', that is fine."
(setq gud-running nil)
- (unless (or gud-overlay-arrow-position gud-last-frame
- (not gud-last-last-frame))
- (gud-display-line (car gud-last-last-frame) (cdr gud-last-last-frame)))
+ (unless (or gud-overlay-arrow-position gud-last-frame)
+ ;;Pop up GUD buffer to display current frame when it doesn't have source
+ ;;information i.e id not compiled with -g as with libc routines generally.
+ (let ((special-display-regexps (append special-display-regexps '(".*")))
+ (special-display-frame-alist gdb-frame-parameters)
+ (same-window-regexps nil))
+ (display-buffer gud-comint-buffer))
+ ;;Try to find source further up stack e.g after signal.
+ (setq gdb-look-up-stack
+ (if (gdb-get-buffer 'gdb-stack-buffer) 'keep
+ (progn
+ (gdb-get-buffer-create 'gdb-stack-buffer)
+ (gdb-invalidate-frames)
+ 'delete))))
(unless (member gdb-inferior-status '("exited" "signal"))
(setq gdb-inferior-status "stopped")
(gdb-force-mode-line-update gdb-inferior-status))
@@ -1945,36 +1958,57 @@ static char *magick[] = {
(defun gdb-info-stack-custom ()
(with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
(save-excursion
- (let ((buffer-read-only nil)
- bl el)
- (goto-char (point-min))
- (while (< (point) (point-max))
- (setq bl (line-beginning-position)
- el (line-end-position))
- (when (looking-at "#")
- (add-text-properties bl el
- '(mouse-face highlight
- help-echo "mouse-2, RET: Select frame")))
- (goto-char bl)
- (when (looking-at "^#\\([0-9]+\\)")
- (when (string-equal (match-string 1) gdb-frame-number)
+ (unless (eq gdb-look-up-stack 'delete)
+ (let ((buffer-read-only nil)
+ bl el)
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (setq bl (line-beginning-position)
+ el (line-end-position))
+ (when (looking-at "#")
+ (add-text-properties bl el
+ '(mouse-face highlight
+ help-echo "mouse-2, RET: Select frame")))
+ (goto-char bl)
+ (when (looking-at "^#\\([0-9]+\\)")
+ (when (string-equal (match-string 1) gdb-frame-number)
(put-text-property bl (+ bl 4)
'face '(:inverse-video t)))
- (when (re-search-forward
- (concat
- (if (string-equal (match-string 1) "0") "" " in ")
- "\\([^ ]+\\) (") el t)
- (put-text-property (match-beginning 1) (match-end 1)
- 'face font-lock-function-name-face)
- (setq bl (match-end 0))
- (while (re-search-forward "<\\([^>]+\\)>" el t)
+ (when (re-search-forward
+ (concat
+ (if (string-equal (match-string 1) "0") "" " in ")
+ "\\([^ ]+\\) (") el t)
(put-text-property (match-beginning 1) (match-end 1)
+ 'face font-lock-function-name-face)
+ (setq bl (match-end 0))
+ (while (re-search-forward "<\\([^>]+\\)>" el t)
+ (put-text-property (match-beginning 1) (match-end 1)
'face font-lock-function-name-face))
- (goto-char bl)
- (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
- (put-text-property (match-beginning 1) (match-end 1)
- 'face font-lock-variable-name-face))))
- (forward-line 1))))))
+ (goto-char bl)
+ (while (re-search-forward "\\(\\(\\sw\\|[_.]\\)+\\)=" el t)
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'face font-lock-variable-name-face))))
+ (forward-line 1))))
+ (when gdb-look-up-stack
+ (goto-char (point-min))
+ (when (re-search-forward "\\(\\S-+?\\):\\([0-9]+\\)" nil t)
+ (let ((start (line-beginning-position))
+ (file (match-string 1))
+ (line (match-string 2)))
+ (re-search-backward "^#*\\([0-9]+\\)" start t)
+ (gdb-enqueue-input
+ (list (concat gdb-server-prefix "frame "
+ (match-string 1) "\n") 'gdb-set-hollow))
+ (gdb-enqueue-input
+ (list (concat gdb-server-prefix "frame 0\n") 'ignore)))))))
+ (if (eq gdb-look-up-stack 'delete)
+ (kill-buffer (gdb-get-buffer 'gdb-stack-buffer)))
+ (setq gdb-look-up-stack nil))
+
+(defun gdb-set-hollow ()
+ (with-current-buffer (gud-find-file (car gud-last-last-frame))
+ (setq fringe-indicator-alist
+ '((overlay-arrow . hollow-right-triangle)))))
(defun gdb-stack-buffer-name ()
(with-current-buffer gud-comint-buffer
@@ -2030,8 +2064,7 @@ static char *magick[] = {
(if event (posn-set-point (event-end event)))
(gdb-enqueue-input
(list (concat gdb-server-prefix "frame "
- (gdb-get-frame-number) "\n") 'ignore))
- (gud-display-frame))
+ (gdb-get-frame-number) "\n") 'ignore)))
;; Threads buffer. This displays a selectable thread list.
@@ -2049,13 +2082,14 @@ static char *magick[] = {
(defun gdb-info-threads-custom ()
(with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
(let ((buffer-read-only nil))
- (goto-char (point-min))
- (while (< (point) (point-max))
- (unless (looking-at "No ")
- (add-text-properties (line-beginning-position) (line-end-position)
- '(mouse-face highlight
+ (save-excursion
+ (goto-char (point-min))
+ (while (< (point) (point-max))
+ (unless (looking-at "No ")
+ (add-text-properties (line-beginning-position) (line-end-position)
+ '(mouse-face highlight
help-echo "mouse-2, RET: select thread")))
- (forward-line 1)))))
+ (forward-line 1))))))
(defun gdb-threads-buffer-name ()
(with-current-buffer gud-comint-buffer
@@ -2868,7 +2902,11 @@ of the current session."
gud-comint-buffer
(memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
'(gdba gdbmi)))
- (if (member buffer-file-name gdb-source-file-list)
+ ;;Pre GDB 6.3 "info sources" doesn't give absolute file name.
+ (if (member (if (string-equal gdb-version "pre-6.4")
+ (file-name-nondirectory buffer-file-name)
+ buffer-file-name)
+ gdb-source-file-list)
(with-current-buffer (find-buffer-visiting buffer-file-name)
(set (make-local-variable 'gud-minor-mode)
(buffer-local-value 'gud-minor-mode gud-comint-buffer))
@@ -3203,7 +3241,8 @@ is set in them."
(when gud-tooltip-mode
(make-local-variable 'gdb-define-alist)
(gdb-create-define-alist)
- (add-hook 'after-save-hook 'gdb-create-define-alist nil t))))))
+ (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))))
+ (gdb-force-mode-line-update "ready"))
; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards.
(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."
(if (boundp sym) (symbol-value sym))))
(defvar gud-running nil
- "Non-nil if debuggee is running.
-Used to grey out relevant togolbar icons.")
+ "Non-nil if debugged program is running.
+Used to grey out relevant toolbar icons.")
;; Use existing Info buffer, if possible.
(defun gud-goto-info ()
@@ -130,10 +130,10 @@ Used to grey out relevant togolbar icons.")
(defun gud-stop-subjob ()
(interactive)
- (if (string-equal
- (buffer-local-value 'gud-target-name gud-comint-buffer) "emacs")
- (comint-stop-subjob)
- (comint-interrupt-subjob)))
+ (with-current-buffer gud-comint-buffer
+ (if (string-equal gud-target-name "emacs")
+ (comint-stop-subjob)
+ (comint-interrupt-subjob))))
(easy-mmode-defmap gud-menu-map
'(([help] "Info" . gud-goto-info)
@@ -141,13 +141,15 @@ Used to grey out relevant togolbar icons.")
:enable (and (not emacs-basic-display)
(display-graphic-p)
(fboundp 'x-show-tip))
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba dbx sdb xdb pdb))
:button (:toggle . gud-tooltip-mode))
([refresh] "Refresh" . gud-refresh)
([run] menu-item "Run" gud-run
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdb dbx jdb)))
- :visible (not (eq gud-minor-mode 'gdba)))
- ([go] menu-item "Run/Continue" gud-go
+ :enable (not gud-running)
+ :visible (and (memq gud-minor-mode '(gdbmi gdb dbx jdb))
+ (not (eq gud-minor-mode 'gdba))))
+ ([go] menu-item (if gdb-active-process "Continue" "Run") gud-go
:visible (and (not gud-running)
(eq gud-minor-mode 'gdba)))
([stop] menu-item "Stop" gud-stop-subjob
@@ -155,26 +157,27 @@ Used to grey out relevant togolbar icons.")
(and gud-running
(eq gud-minor-mode 'gdba))))
([until] menu-item "Continue to selection" gud-until
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb perldb)))
- :visible (gud-tool-bar-item-visible-no-fringe))
+ :enable (not gud-running)
+ :visible (and (memq gud-minor-mode '(gdbmi gdba gdb perldb))
+ (gud-tool-bar-item-visible-no-fringe)))
([remove] menu-item "Remove Breakpoint" gud-remove
:enable (not gud-running)
:visible (gud-tool-bar-item-visible-no-fringe))
([tbreak] menu-item "Temporary Breakpoint" gud-tbreak
- :enable (memq gud-minor-mode
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
'(gdbmi gdba gdb sdb xdb bashdb)))
([break] menu-item "Set Breakpoint" gud-break
:enable (not gud-running)
:visible (gud-tool-bar-item-visible-no-fringe))
([up] menu-item "Up Stack" gud-up
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
([down] menu-item "Down Stack" gud-down
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb dbx xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb dbx xdb jdb pdb bashdb)))
([pp] menu-item "Print S-expression" gud-pp
:enable (and (not gud-running)
gdb-active-process)
@@ -183,23 +186,23 @@ Used to grey out relevant togolbar icons.")
'gud-target-name gud-comint-buffer) "emacs")
(eq gud-minor-mode 'gdba)))
([print*] menu-item "Print Dereference" gud-pstar
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb)))
([print] menu-item "Print Expression" gud-print
:enable (not gud-running))
([watch] menu-item "Watch Expression" gud-watch
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba)))
([finish] menu-item "Finish Function" gud-finish
- :enable (and (not gud-running)
- (memq gud-minor-mode
- '(gdbmi gdba gdb xdb jdb pdb bashdb))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode
+ '(gdbmi gdba gdb xdb jdb pdb bashdb)))
([stepi] menu-item "Step Instruction" gud-stepi
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
([nexti] menu-item "Next Instruction" gud-nexti
- :enable (and (not gud-running)
- (memq gud-minor-mode '(gdbmi gdba gdb dbx))))
+ :enable (not gud-running)
+ :visible (memq gud-minor-mode '(gdbmi gdba gdb dbx)))
([step] menu-item "Step Line" gud-step
:enable (not gud-running))
([next] menu-item "Next Line" gud-next
@@ -2565,7 +2568,7 @@ comint mode, which see."
(existing-buffer (get-buffer (concat "*gud" filepart "*"))))
(pop-to-buffer (concat "*gud" filepart "*"))
(when (and existing-buffer (get-buffer-process existing-buffer))
- (error "This program is already running under gdb"))
+ (error "This program is already being debugged"))
;; Set the dir, in case the buffer already existed with a different dir.
(setq default-directory dir)
;; Set default-directory to the file's directory.
@@ -2693,10 +2696,10 @@ It is saved for when this flag is not set.")
((memq (process-status proc) '(signal exit))
;; Stop displaying an arrow in a source file.
(setq gud-overlay-arrow-position nil)
- (with-current-buffer gud-comint-buffer
- (if (memq gud-minor-mode-type '(gdbmi gdba))
- (gdb-reset)
- (gud-reset)))
+ (if (memq (buffer-local-value 'gud-minor-mode gud-comint-buffer)
+ '(gdba gdbmi))
+ (gdb-reset)
+ (gud-reset))
(let* ((obuf (current-buffer)))
;; save-excursion isn't the right thing if
;; process-buffer is current-buffer
@@ -3313,7 +3316,8 @@ Treats actions as defuns."
(kill-local-variable 'gdb-define-alist)
(remove-hook 'after-save-hook 'gdb-create-define-alist t))))
-(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode)
+(defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode
+ python-mode)
"List of modes for which to enable GUD tooltips."
:type 'sexp
:group 'gud
@@ -3427,9 +3431,8 @@ With arg, dereference expr iff arg is positive."
(case gud-minor-mode
(gdba (concat "server print " expr))
((dbx gdbmi) (concat "print " expr))
- (xdb (concat "p " expr))
- (sdb (concat expr "/"))
- (perldb expr)))
+ ((xdb pdb) (concat "p " expr))
+ (sdb (concat expr "/"))))
(defun gud-tooltip-tips (event)
"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'.
\\{inferior-lisp-mode-map}
-Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and
+Customization: Entry to this mode runs the hooks on `comint-mode-hook' and
`inferior-lisp-mode-hook' (in that order).
You can send text to the inferior Lisp process from other buffers containing
Lisp source.
- switch-to-lisp switches the current buffer to the Lisp process buffer.
- lisp-eval-defun sends the current defun to the Lisp process.
- lisp-compile-defun compiles the current defun.
- lisp-eval-region sends the current region to the Lisp process.
- lisp-compile-region compiles the current region.
+ `switch-to-lisp' switches the current buffer to the Lisp process buffer.
+ `lisp-eval-defun' sends the current defun to the Lisp process.
+ `lisp-compile-defun' compiles the current defun.
+ `lisp-eval-region' sends the current region to the Lisp process.
+ `lisp-compile-region' compiles the current region.
Prefixing the lisp-eval/compile-defun/region commands with
a \\[universal-argument] causes a switch to the Lisp process buffer after sending
the text.
-Commands:
-Return after the end of the process' output sends the text from the
+Commands:\\<inferior-lisp-mode-map>
+\\[comint-send-input] after the end of the process' output sends the text from the
end of process to point.
-Return before the end of the process' output copies the sexp ending at point
+\\[comint-send-input] before the end of the process' output copies the sexp ending at point
to the end of the process' output, and sends it.
-Delete converts tabs to spaces as it moves back.
-Tab indents for Lisp; with argument, shifts rest
+\\[comint-copy-old-input] copies the sexp ending at point to the end of the process' output,
+ allowing you to edit it before sending it.
+If `comint-use-prompt-regexp' is nil (the default), \\[comint-insert-input] on old input
+ copies the entire old input to the end of the process' output, allowing
+ you to edit it before sending it. When not used on old input, or if
+ `comint-use-prompt-regexp' is non-nil, \\[comint-insert-input] behaves according to
+ its global binding.
+\\[backward-delete-char-untabify] converts tabs to spaces as it moves back.
+\\[lisp-indent-line] indents for Lisp; with argument, shifts rest
of expression rigidly with the current line.
-C-M-q does Tab on each line starting within following expression.
+\\[indent-sexp] does \\[lisp-indent-line] on each line starting within following expression.
Paragraphs are separated only by blank lines. Semicolons start comments.
If you accidentally suspend your process, use \\[comint-continue-subjob]
to 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 ( )."
;; that if you change this regexp you might have to fix the imenu index in
;; makefile-imenu-generic-expression.
(defconst makefile-macroassign-regex
+ ;; We used to match not just the varname but also the whole value
+ ;; (spanning potentially several lines).
+ ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
"^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
"Regex used to find macro assignment lines in a makefile.")
@@ -623,39 +626,38 @@ The function must satisfy this calling convention:
map)
"The keymap that is used in Makefile mode.")
-(defvar makefile-browser-map nil
+
+(defvar makefile-browser-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "n" 'makefile-browser-next-line)
+ (define-key map "\C-n" 'makefile-browser-next-line)
+ (define-key map "p" 'makefile-browser-previous-line)
+ (define-key map "\C-p" 'makefile-browser-previous-line)
+ (define-key map " " 'makefile-browser-toggle)
+ (define-key map "i" 'makefile-browser-insert-selection)
+ (define-key map "I" 'makefile-browser-insert-selection-and-quit)
+ (define-key map "\C-c\C-m" 'makefile-browser-insert-continuation)
+ (define-key map "q" 'makefile-browser-quit)
+ ;; disable horizontal movement
+ (define-key map "\C-b" 'undefined)
+ (define-key map "\C-f" 'undefined)
+ map)
"The keymap that is used in the macro- and target browser.")
-(if makefile-browser-map
- ()
- (setq makefile-browser-map (make-sparse-keymap))
- (define-key makefile-browser-map "n" 'makefile-browser-next-line)
- (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line)
- (define-key makefile-browser-map "p" 'makefile-browser-previous-line)
- (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line)
- (define-key makefile-browser-map " " 'makefile-browser-toggle)
- (define-key makefile-browser-map "i" 'makefile-browser-insert-selection)
- (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit)
- (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation)
- (define-key makefile-browser-map "q" 'makefile-browser-quit)
- ;; disable horizontal movement
- (define-key makefile-browser-map "\C-b" 'undefined)
- (define-key makefile-browser-map "\C-f" 'undefined))
-
-
-(defvar makefile-mode-syntax-table nil)
-(if makefile-mode-syntax-table
- ()
- (setq makefile-mode-syntax-table (make-syntax-table))
- (modify-syntax-entry ?\( "() " makefile-mode-syntax-table)
- (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table)
- (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table)
- (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table)
- (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table)
- (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
- (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
- (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
- (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
- (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
+
+
+(defvar makefile-mode-syntax-table
+ (let ((st (make-syntax-table)))
+ (modify-syntax-entry ?\( "() " st)
+ (modify-syntax-entry ?\) ")( " st)
+ (modify-syntax-entry ?\[ "(] " st)
+ (modify-syntax-entry ?\] ")[ " st)
+ (modify-syntax-entry ?\{ "(} " st)
+ (modify-syntax-entry ?\} "){ " st)
+ (modify-syntax-entry ?\' "\" " st)
+ (modify-syntax-entry ?\` "\" " st)
+ (modify-syntax-entry ?# "< " st)
+ (modify-syntax-entry ?\n "> " st)
+ st))
(defvar makefile-imake-mode-syntax-table (copy-syntax-table
makefile-mode-syntax-table))
@@ -1302,30 +1304,9 @@ definition and conveniently use this command."
(save-excursion
(beginning-of-line)
(cond
- ((looking-at "^#+")
- ;; Found a comment. Set the fill prefix, and find the paragraph
- ;; boundaries by searching for lines that look like comment-only
- ;; lines.
- (let ((fill-prefix (match-string-no-properties 0))
- (fill-paragraph-function nil))
- (save-excursion
- (save-restriction
- (narrow-to-region
- ;; Search backwards.
- (save-excursion
- (while (and (zerop (forward-line -1))
- (looking-at "^#")))
- ;; We may have gone too far. Go forward again.
- (or (looking-at "^#")
- (forward-line 1))
- (point))
- ;; Search forwards.
- (save-excursion
- (while (looking-at "^#")
- (forward-line))
- (point)))
- (fill-paragraph nil)
- t))))
+ ((looking-at "^#+\\s-*")
+ ;; Found a comment. Return nil to let normal filling take place.
+ nil)
;; Must look for backslashed-region before looking for variable
;; assignment.
@@ -1354,7 +1335,9 @@ definition and conveniently use this command."
(makefile-backslash-region (point-min) (point-max) nil)
(goto-char (point-max))
(if (< (skip-chars-backward "\n") 0)
- (delete-region (point) (point-max))))))
+ (delete-region (point) (point-max)))))
+ ;; Return non-nil to indicate it's been filled.
+ t)
((looking-at makefile-macroassign-regex)
;; Have a macro assign. Fill just this line, and then backslash
@@ -1363,10 +1346,13 @@ definition and conveniently use this command."
(narrow-to-region (point) (line-beginning-position 2))
(let ((fill-paragraph-function nil))
(fill-paragraph nil))
- (makefile-backslash-region (point-min) (point-max) nil)))))
+ (makefile-backslash-region (point-min) (point-max) nil))
+ ;; Return non-nil to indicate it's been filled.
+ t)
- ;; Always return non-nil so we don't fill anything else.
- t)
+ (t
+ ;; Return non-nil so we don't fill anything else.
+ t))))
@@ -1882,5 +1868,5 @@ If it isn't in one, return nil."
(provide 'make-mode)
-;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
+;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0
;;; 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'.")
(:weight bold)))
"Face to show a here-document"
:group 'sh-indentation)
+
+;; These colours are probably icky. It's just a placeholder though.
+(defface sh-quoted-exec
+ '((((class color) (background dark))
+ (:foreground "salmon"))
+ (((class color) (background light))
+ (:foreground "magenta"))
+ (t
+ (:weight bold)))
+ "Face to show quoted execs like ``"
+ :group 'sh-indentation)
+
;; backward-compatibility alias
(put 'sh-heredoc-face 'face-alias 'sh-heredoc)
(defvar sh-heredoc-face 'sh-heredoc)
@@ -833,7 +845,7 @@ See `sh-feature'.")
font-lock-variable-name-face))
(rc sh-append es)
-
+ (bash sh-append shell ("\\$(\\(\\sw+\\)" (1 'sh-quoted-exec t) ))
(sh sh-append shell
;; Variable names.
("\\$\\({#?\\)?\\([A-Za-z_][A-Za-z0-9_]*\\|[-#?@!]\\)" 2
@@ -967,6 +979,49 @@ Point is at the beginning of the next line."
;; This looks silly, but it's because `sh-here-doc-re' keeps changing.
(re-search-forward sh-here-doc-re limit t))
+(defun sh-quoted-subshell (limit)
+ "Search for a subshell embedded in a string. Find all the unescaped
+\" characters within said subshell, remembering that subshells can nest."
+ (if (re-search-forward "\"\\(?:.\\|\n\\)*?\\(\\$(\\|`\\)" limit t)
+ ;; bingo we have a $( or a ` inside a ""
+ (let ((char (char-after (point)))
+ (continue t)
+ (pos (point))
+ (data nil) ;; value to put into match-data (and return)
+ (last nil) ;; last char seen
+ (bq (equal (match-string 1) "`")) ;; ` state flip-flop
+ (seen nil) ;; list of important positions
+ (nest 1)) ;; subshell nesting level
+ (while (and continue char (<= pos limit))
+ ;; unescaped " inside a $( ... ) construct.
+ ;; state machine time...
+ ;; \ => ignore next char;
+ ;; ` => increase or decrease nesting level based on bq flag
+ ;; ) [where nesting > 0] => decrease nesting
+ ;; ( [where nesting > 0] => increase nesting
+ ;; ( [preceeded by $ ] => increase nesting
+ ;; " [nesting <= 0 ] => terminate, we're done.
+ ;; " [nesting > 0 ] => remember this, it's not a proper "
+ (if (eq ?\\ last) nil
+ (if (eq ?\` char) (setq nest (+ nest (if bq -1 1)) bq (not bq))
+ (if (and (> nest 0) (eq ?\) char)) (setq nest (1- nest))
+ (if (and (eq ?$ last) (eq ?\( char)) (setq nest (1+ nest))
+ (if (and (> nest 0) (eq ?\( char)) (setq nest (1+ nest))
+ (if (eq char ?\")
+ (if (>= 0 nest) (setq continue nil)
+ (setq seen (cons pos seen)) ) ))))))
+ ;;(message "POS: %d [%d]" pos nest)
+ (setq last char
+ pos (1+ pos)
+ char (char-after pos)) )
+ (when seen
+ ;;(message "SEEN: %S" seen)
+ (setq data (list (current-buffer)))
+ (mapc (lambda (P)
+ (setq data (cons P (cons (1+ P) data)) ) ) seen)
+ (store-match-data data))
+ data) ))
+
(defun sh-is-quoted-p (pos)
(and (eq (char-before pos) ?\\)
(not (sh-is-quoted-p (1- pos)))))
@@ -997,6 +1052,17 @@ Point is at the beginning of the next line."
(when (save-excursion (backward-char 2) (looking-at ";;\\|in"))
sh-st-punc)))
+(defun sh-apply-quoted-subshell ()
+ "Apply the `sh-st-punc' syntax to all the matches in `match-data'.
+This is used to flag quote characters in subshell constructs inside strings
+\(which should therefore not be treated as normal quote characters\)"
+ (let ((m (match-data)) a b)
+ (while m
+ (setq a (car m)
+ b (cadr m)
+ m (cddr m))
+ (put-text-property a b 'syntax-table sh-st-punc))) sh-st-punc)
+
(defconst sh-font-lock-syntactic-keywords
;; A `#' begins a comment when it is unquoted and at the beginning of a
;; word. In the shell, words are separated by metacharacters.
@@ -1007,6 +1073,9 @@ Point is at the beginning of the next line."
("\\(\\\\\\)'" 1 ,sh-st-punc)
;; Make sure $@ and @? are correctly recognized as sexps.
("\\$\\([?@]\\)" 1 ,sh-st-symbol)
+ ;; highlight (possibly nested) subshells inside "" quoted regions correctly.
+ (sh-quoted-subshell
+ (1 (sh-apply-quoted-subshell) t t))
;; Find HEREDOC starters and add a corresponding rule for the ender.
(sh-font-lock-here-doc
(2 (sh-font-lock-open-heredoc
@@ -1019,11 +1088,12 @@ Point is at the beginning of the next line."
(")" 0 (sh-font-lock-paren (match-beginning 0)))))
(defun sh-font-lock-syntactic-face-function (state)
- (if (nth 3 state)
- (if (char-valid-p (nth 3 state))
- font-lock-string-face
- sh-heredoc-face)
- font-lock-comment-face))
+ (let ((q (nth 3 state)))
+ (if q
+ (if (char-valid-p q)
+ (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face)
+ sh-heredoc-face)
+ font-lock-comment-face)))
(defgroup sh-indentation nil
"Variables controlling indentation in shell scripts.