diff options
author | Miles Bader <miles@gnu.org> | 2006-06-07 18:05:10 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2006-06-07 18:05:10 +0000 |
commit | b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch) | |
tree | de3804210a8cd955e0d3b9abc15679480930bc82 /lisp/progmodes | |
parent | 885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff) | |
parent | 26c9afc3239e18b03537faaea33e3e82e28099e6 (diff) | |
download | emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 285-296)
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: admin/FOR-RELEASE: Update refcard section.
* gnus--rel--5.10 (patch 102-104)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/cc-styles.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/cc-vars.el | 1 | ||||
-rw-r--r-- | lisp/progmodes/compile.el | 39 | ||||
-rw-r--r-- | lisp/progmodes/gdb-ui.el | 154 | ||||
-rw-r--r-- | lisp/progmodes/grep.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/gud.el | 85 | ||||
-rw-r--r-- | lisp/progmodes/hideif.el | 14 | ||||
-rw-r--r-- | lisp/progmodes/inf-lisp.el | 31 | ||||
-rw-r--r-- | lisp/progmodes/make-mode.el | 128 | ||||
-rw-r--r-- | lisp/progmodes/sh-script.el | 90 |
10 files changed, 338 insertions, 208 deletions
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 6f623623535..c2b9b435e4c 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -264,7 +264,7 @@ element of the list is added with `add-hook'. Do not change this variable directly. Use the function `c-add-style' to add new styles or modify existing styles (it is not a good idea to modify existing styles -- you should create a new style that inherits -the existing style.") +the existing style).") ;; Functions that manipulate styles diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 64e38be62d0..0e6738710c5 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -812,6 +812,7 @@ macro exceeds this column then the next tab stop from that line is used as alignment column instead." :type 'integer :group 'c) +;;;###autoload(put 'c-backslash-column 'safe-local-variable 'integerp) (defcustom-c-stylevar c-backslash-max-column 72 "*Maximum alignment column for line continuation backslashes. 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/gdb-ui.el b/lisp/progmodes/gdb-ui.el index f5d08d533fd..0f92523e306 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'.") @@ -493,26 +489,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 +541,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 +737,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 +1105,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) @@ -1334,9 +1334,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 +1956,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 +2062,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 +2080,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 +2900,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)) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 410a973d1b4..d207094cafe 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -553,7 +553,7 @@ easily repeat a find command." (read-string "compile.el: No `grep-find-command' command available. Press RET.") (list nil)))) - (when (and grep-find-command command-args) + (when command-args (let ((null-device nil)) ; see grep (grep command-args)))) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index d2e6cfc4ae4..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 @@ -3166,7 +3169,7 @@ class of the file (using s to separate nested class ids)." (defvar gdb-script-font-lock-keywords '(("^define\\s-+\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-function-name-face)) ("\\$\\(\\w+\\)" (1 font-lock-variable-name-face)) - ("^\\s-*\\(\\(\\w\\|\\s_\\)+\\)" (1 font-lock-keyword-face)))) + ("^\\s-*\\(\\w\\(\\w\\|\\s_\\)*\\)" (1 font-lock-keyword-face)))) ;; FIXME: The keyword "end" associated with "document" ;; should have font-lock-keyword-face (currently font-lock-doc-face). @@ -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/hideif.el b/lisp/progmodes/hideif.el index 04e44e2dac1..a100424108d 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -928,15 +928,17 @@ Return as (TOP . BOTTOM) the extent of ifdef block." (setq hide-ifdef-hiding t)) (setq buffer-read-only (or hide-ifdef-read-only hif-outside-read-only))) - (defun show-ifdef-block () "Show the ifdef block (true or false part) enclosing or before the cursor." (interactive) - (if hide-ifdef-lines - (save-excursion - (beginning-of-line) - (hif-show-ifdef-region (1- (point)) (progn (end-of-line) (point)))) - (let ((top-bottom (hif-find-ifdef-block))) + (let ((top-bottom (hif-find-ifdef-block))) + (if hide-ifdef-lines + (hif-show-ifdef-region + (save-excursion + (goto-char (car top-bottom)) (line-beginning-position)) + (save-excursion + (goto-char (1+ (cdr top-bottom))) + (hif-end-of-line) (point))) (hif-show-ifdef-region (1- (car top-bottom)) (cdr top-bottom))))) 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 3bbfeaac683..d22aedb6058 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -246,6 +246,7 @@ You will be offered to complete on one of those in the minibuffer whenever you enter a \".\" at the beginning of a line in `makefile-mode'." :type '(repeat (list string)) :group 'makefile) +(put 'makefile-special-targets-list 'risky-local-variable t) (defcustom makefile-runtime-macros-list '(("@") ("&") (">") ("<") ("*") ("^") ("+") ("?") ("%") ("$")) @@ -290,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.") @@ -544,7 +548,8 @@ This should identify a `make' command that can handle the `-q' option." :type 'string :group 'makefile) -(defcustom makefile-query-one-target-method 'makefile-query-by-make-minus-q +(defcustom makefile-query-one-target-method-function + 'makefile-query-by-make-minus-q "*Function to call to determine whether a make target is up to date. The function must satisfy this calling convention: @@ -560,6 +565,8 @@ The function must satisfy this calling convention: makefile, any nonzero integer value otherwise." :type 'function :group 'makefile) +(defvaralias 'makefile-query-one-target-method + 'makefile-query-one-target-method-function) (defcustom makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*" "*Name of the Up-to-date overview buffer." @@ -619,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)) @@ -670,9 +676,11 @@ The function must satisfy this calling convention: (defvar makefile-target-table nil "Table of all target names known for this buffer.") +(put 'makefile-target-table 'risky-local-variable t) (defvar makefile-macro-table nil "Table of all macro names known for this buffer.") +(put 'makefile-macro-table 'risky-local-variable t) (defvar makefile-browser-client "A buffer in Makefile mode that is currently using the browser.") @@ -724,11 +732,10 @@ The function must satisfy this calling convention: If you are editing a file for a different make, try one of the variants `makefile-automake-mode', `makefile-gmake-mode', -`makefile-makepp-mode', `makefile-bsdmake-mode' or, -`makefile-imake-mode'All but the -last should be correctly chosen based on the file name, except if -it is *.mk. This function ends by invoking the function(s) -`makefile-mode-hook'. +`makefile-makepp-mode', `makefile-bsdmake-mode' or, +`makefile-imake-mode'. All but the last should be correctly +chosen based on the file name, except if it is *.mk. This +function ends by invoking the function(s) `makefile-mode-hook'. It is strongly recommended to use `font-lock-mode', because that provides additional parsing information. This is used for @@ -1298,29 +1305,8 @@ definition and conveniently use this command." (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)))) + ;; Found a comment. Return nil to let normal filling take place. + nil) ;; Must look for backslashed-region before looking for variable ;; assignment. @@ -1349,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 @@ -1358,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)))) @@ -1616,7 +1607,8 @@ with the generated name!" (defun makefile-query-targets (filename target-table prereq-list) "Fill the up-to-date overview buffer. -Checks each target in TARGET-TABLE using `makefile-query-one-target-method' +Checks each target in TARGET-TABLE using +`makefile-query-one-target-method-function' and generates the overview, one line per target name." (insert (mapconcat @@ -1625,7 +1617,7 @@ and generates the overview, one line per target name." (no-prereqs (not (member target-name prereq-list))) (needs-rebuild (or no-prereqs (funcall - makefile-query-one-target-method + makefile-query-one-target-method-function target-name filename)))) (format "\t%s%s" @@ -1876,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 0e73427a33c..b80fe4c0fbc 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 (characterp (nth 3 state)) - font-lock-string-face - sh-heredoc-face) - font-lock-comment-face)) + (let ((q (nth 3 state))) + (if q + (if (characterp 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. @@ -1390,11 +1460,11 @@ with your script for an edit-interpret-debug cycle." (make-local-variable 'sh-shell-file) (make-local-variable 'sh-shell) (make-local-variable 'skeleton-pair-alist) - (make-local-variable 'skeleton-pair-filter) + (make-local-variable 'skeleton-pair-filter-function) (make-local-variable 'comint-dynamic-complete-functions) (make-local-variable 'comint-prompt-regexp) (make-local-variable 'font-lock-defaults) - (make-local-variable 'skeleton-filter) + (make-local-variable 'skeleton-filter-function) (make-local-variable 'skeleton-newline-indent-rigidly) (make-local-variable 'sh-shell-variables) (make-local-variable 'sh-shell-variables-initialized) @@ -1422,10 +1492,10 @@ with your script for an edit-interpret-debug cycle." (font-lock-syntactic-face-function . sh-font-lock-syntactic-face-function)) skeleton-pair-alist '((?` _ ?`)) - skeleton-pair-filter 'sh-quoted-p + skeleton-pair-filter-function 'sh-quoted-p skeleton-further-elements '((< '(- (min sh-indentation (current-column))))) - skeleton-filter 'sh-feature + skeleton-filter-function 'sh-feature skeleton-newline-indent-rigidly t sh-indent-supported-here nil) (set (make-local-variable 'parse-sexp-ignore-comments) t) |