diff options
| author | Miles Bader | 2006-05-02 05:51:52 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-05-02 05:51:52 +0000 |
| commit | fe682fb2f05fcbd9fcd2d12c2110719adcfcb58a (patch) | |
| tree | 2a89d2d9ea2689cfe80a7618885cdd9f449761dd /lisp/progmodes | |
| parent | 7e635d0ed3c42e6e779821f5c0c1c62289f4c1ee (diff) | |
| parent | 6cf93749317c2e18f850cd0f47f905895e850bfc (diff) | |
| download | emacs-fe682fb2f05fcbd9fcd2d12c2110719adcfcb58a.tar.gz emacs-fe682fb2f05fcbd9fcd2d12c2110719adcfcb58a.zip | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-58
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 239-258)
- Update from CVS
- (Ffield_beginning, find_field): Undo change of 2006-04-23.
- Rcirc patch from Ryan Yeske
- Merge from gnus--rel--5.10
- Clean up lisp/gnus/ChangeLog a bit
* gnus--rel--5.10 (patch 91-98)
- Merge from emacs--devo--0
- Update from CVS
Diffstat (limited to 'lisp/progmodes')
| -rw-r--r-- | lisp/progmodes/antlr-mode.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/asm-mode.el | 10 | ||||
| -rw-r--r-- | lisp/progmodes/cc-subword.el | 49 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 471 | ||||
| -rw-r--r-- | lisp/progmodes/gud.el | 50 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 12 |
6 files changed, 350 insertions, 244 deletions
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el index 7ddd9212f6c..e31a94030c3 100644 --- a/lisp/progmodes/antlr-mode.el +++ b/lisp/progmodes/antlr-mode.el | |||
| @@ -829,7 +829,7 @@ in the grammar's actions and semantic predicates, see | |||
| 829 | `antlr-font-lock-maximum-decoration'.") | 829 | `antlr-font-lock-maximum-decoration'.") |
| 830 | 830 | ||
| 831 | (defvar antlr-default-face 'antlr-default) | 831 | (defvar antlr-default-face 'antlr-default) |
| 832 | (defface antlr-default nil | 832 | (defface antlr-default '((t nil)) |
| 833 | "Face to prevent strings from language dependent highlighting. | 833 | "Face to prevent strings from language dependent highlighting. |
| 834 | Do not change." | 834 | Do not change." |
| 835 | :group 'antlr) | 835 | :group 'antlr) |
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el index b79237adba7..ebb532a3525 100644 --- a/lisp/progmodes/asm-mode.el +++ b/lisp/progmodes/asm-mode.el | |||
| @@ -62,9 +62,9 @@ | |||
| 62 | 62 | ||
| 63 | (defvar asm-mode-syntax-table | 63 | (defvar asm-mode-syntax-table |
| 64 | (let ((st (make-syntax-table))) | 64 | (let ((st (make-syntax-table))) |
| 65 | (modify-syntax-entry ?\n ">" st) | 65 | (modify-syntax-entry ?\n "> b" st) |
| 66 | (modify-syntax-entry ?/ ". 14b" st) | 66 | (modify-syntax-entry ?/ ". 124b" st) |
| 67 | (modify-syntax-entry ?* ". 23b" st) | 67 | (modify-syntax-entry ?* ". 23" st) |
| 68 | st) | 68 | st) |
| 69 | "Syntax table used while in Asm mode.") | 69 | "Syntax table used while in Asm mode.") |
| 70 | 70 | ||
| @@ -136,14 +136,14 @@ Special commands: | |||
| 136 | (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) | 136 | (use-local-map (nconc (make-sparse-keymap) asm-mode-map)) |
| 137 | (local-set-key (vector asm-comment-char) 'asm-comment) | 137 | (local-set-key (vector asm-comment-char) 'asm-comment) |
| 138 | (set-syntax-table (make-syntax-table asm-mode-syntax-table)) | 138 | (set-syntax-table (make-syntax-table asm-mode-syntax-table)) |
| 139 | (modify-syntax-entry asm-comment-char "<") | 139 | (modify-syntax-entry asm-comment-char "< b") |
| 140 | 140 | ||
| 141 | (make-local-variable 'comment-start) | 141 | (make-local-variable 'comment-start) |
| 142 | (setq comment-start (string asm-comment-char)) | 142 | (setq comment-start (string asm-comment-char)) |
| 143 | (make-local-variable 'comment-add) | 143 | (make-local-variable 'comment-add) |
| 144 | (setq comment-add 1) | 144 | (setq comment-add 1) |
| 145 | (make-local-variable 'comment-start-skip) | 145 | (make-local-variable 'comment-start-skip) |
| 146 | (setq comment-start-skip "\\(?:\\s<+\\|/\\*+\\)[ \t]*") | 146 | (setq comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*") |
| 147 | (make-local-variable 'comment-end-skip) | 147 | (make-local-variable 'comment-end-skip) |
| 148 | (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") | 148 | (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)") |
| 149 | (make-local-variable 'comment-end) | 149 | (make-local-variable 'comment-end) |
diff --git a/lisp/progmodes/cc-subword.el b/lisp/progmodes/cc-subword.el index 6ba76708ebf..72227e33290 100644 --- a/lisp/progmodes/cc-subword.el +++ b/lisp/progmodes/cc-subword.el | |||
| @@ -91,8 +91,8 @@ | |||
| 91 | ;; Don't complain about the `define-minor-mode' form if it isn't defined. | 91 | ;; Don't complain about the `define-minor-mode' form if it isn't defined. |
| 92 | (cc-bytecomp-defvar c-subword-mode) | 92 | (cc-bytecomp-defvar c-subword-mode) |
| 93 | 93 | ||
| 94 | ;;; Autoload directives must be on the top level, so we construct an | 94 | ;; Autoload directives must be on the top level, so we construct an |
| 95 | ;;; autoload form instead. | 95 | ;; autoload form instead. |
| 96 | ;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t) | 96 | ;;;###autoload (autoload 'c-subword-mode "cc-subword" "Mode enabling subword movement and editing keys." t) |
| 97 | 97 | ||
| 98 | (if (not (fboundp 'define-minor-mode)) | 98 | (if (not (fboundp 'define-minor-mode)) |
| @@ -107,36 +107,19 @@ telling us which (X)Emacs version you're using." | |||
| 107 | 107 | ||
| 108 | (defvar c-subword-mode-map | 108 | (defvar c-subword-mode-map |
| 109 | (let ((map (make-sparse-keymap))) | 109 | (let ((map (make-sparse-keymap))) |
| 110 | (substitute-key-definition 'forward-word | 110 | (dolist (cmd '(forward-word backward-word mark-word |
| 111 | 'c-forward-subword | 111 | kill-word backward-kill-word |
| 112 | map global-map) | 112 | transpose-words |
| 113 | (substitute-key-definition 'backward-word | 113 | capitalize-word upcase-word downcase-word)) |
| 114 | 'c-backward-subword | 114 | (let ((othercmd (let ((name (symbol-name cmd))) |
| 115 | map global-map) | 115 | (string-match "\\(.*-\\)\\(word.*\\)" name) |
| 116 | (substitute-key-definition 'mark-word | 116 | (intern (concat "c-" |
| 117 | 'c-mark-subword | 117 | (match-string 1 name) |
| 118 | map global-map) | 118 | "sub" |
| 119 | 119 | (match-string 2 name)))))) | |
| 120 | (substitute-key-definition 'kill-word | 120 | (if (fboundp 'command-remapping) |
| 121 | 'c-kill-subword | 121 | (define-key map (vector 'remap cmd) othercmd) |
| 122 | map global-map) | 122 | (substitute-key-definition cmd othercmd map global-map)))) |
| 123 | (substitute-key-definition 'backward-kill-word | ||
| 124 | 'c-backward-kill-subword | ||
| 125 | map global-map) | ||
| 126 | |||
| 127 | (substitute-key-definition 'transpose-words | ||
| 128 | 'c-transpose-subwords | ||
| 129 | map global-map) | ||
| 130 | |||
| 131 | (substitute-key-definition 'capitalize-word | ||
| 132 | 'c-capitalize-subword | ||
| 133 | map global-map) | ||
| 134 | (substitute-key-definition 'upcase-word | ||
| 135 | 'c-upcase-subword | ||
| 136 | map global-map) | ||
| 137 | (substitute-key-definition 'downcase-word | ||
| 138 | 'c-downcase-subword | ||
| 139 | map global-map) | ||
| 140 | map) | 123 | map) |
| 141 | "Keymap used in command `c-subword-mode' minor mode.") | 124 | "Keymap used in command `c-subword-mode' minor mode.") |
| 142 | 125 | ||
| @@ -308,5 +291,5 @@ Optional argument ARG is the same as for `upcase-word'." | |||
| 308 | 291 | ||
| 309 | (cc-provide 'cc-subword) | 292 | (cc-provide 'cc-subword) |
| 310 | 293 | ||
| 311 | ;;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3 | 294 | ;; arch-tag: 2be9d294-7f30-4626-95e6-9964bb93c7a3 |
| 312 | ;;; cc-subword.el ends here | 295 | ;;; cc-subword.el ends here |
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 6afa3f29348..0aba9d42b84 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | (defgroup grep nil | 37 | (defgroup grep nil |
| 38 | "Run compiler as inferior of Emacs, parse error messages." | 38 | "Run grep as inferior of Emacs, parse error messages." |
| 39 | :group 'tools | 39 | :group 'tools |
| 40 | :group 'processes) | 40 | :group 'processes) |
| 41 | 41 | ||
| @@ -48,23 +48,6 @@ | |||
| 48 | :version "22.1" | 48 | :version "22.1" |
| 49 | :group 'grep) | 49 | :group 'grep) |
| 50 | 50 | ||
| 51 | (defcustom grep-auto-highlight t | ||
| 52 | "*Specify how many grep matches to highlight (and parse) initially. | ||
| 53 | \(Highlighting applies to an grep match when the mouse is over it.) | ||
| 54 | If this is a number N, all grep matches in the first N lines | ||
| 55 | are highlighted and parsed as soon as they arrive in Emacs. | ||
| 56 | If t, highlight and parse the whole grep output as soon as it arrives. | ||
| 57 | If nil, don't highlight or parse any of the grep buffer until you try to | ||
| 58 | move to the error messages. | ||
| 59 | |||
| 60 | Those grep matches which are not parsed and highlighted initially | ||
| 61 | will be parsed and highlighted as soon as you try to move to them." | ||
| 62 | :type '(choice (const :tag "All" t) | ||
| 63 | (const :tag "None" nil) | ||
| 64 | (integer :tag "First N lines")) | ||
| 65 | :version "22.1" | ||
| 66 | :group 'grep) | ||
| 67 | |||
| 68 | (defcustom grep-highlight-matches 'auto-detect | 51 | (defcustom grep-highlight-matches 'auto-detect |
| 69 | "If t, use special markers to highlight grep matches. | 52 | "If t, use special markers to highlight grep matches. |
| 70 | 53 | ||
| @@ -108,6 +91,20 @@ call that function before using this variable in your program." | |||
| 108 | (const :tag "Not Set" nil)) | 91 | (const :tag "Not Set" nil)) |
| 109 | :group 'grep) | 92 | :group 'grep) |
| 110 | 93 | ||
| 94 | (defcustom grep-template nil | ||
| 95 | "The default command to run for \\[lgrep]. | ||
| 96 | The default value of this variable is set up by `grep-compute-defaults'; | ||
| 97 | call that function before using this variable in your program. | ||
| 98 | The following place holders should be present in the string: | ||
| 99 | <C> - place to put -i if case insensitive grep. | ||
| 100 | <F> - file names and wildcards to search. | ||
| 101 | <R> - the regular expression searched for. | ||
| 102 | <N> - place to insert null-device." | ||
| 103 | :type '(choice string | ||
| 104 | (const :tag "Not Set" nil)) | ||
| 105 | :version "22.1" | ||
| 106 | :group 'grep) | ||
| 107 | |||
| 111 | (defcustom grep-use-null-device 'auto-detect | 108 | (defcustom grep-use-null-device 'auto-detect |
| 112 | "If t, append the value of `null-device' to `grep' commands. | 109 | "If t, append the value of `null-device' to `grep' commands. |
| 113 | This is done to ensure that the output of grep includes the filename of | 110 | This is done to ensure that the output of grep includes the filename of |
| @@ -130,8 +127,8 @@ call that function before using this variable in your program." | |||
| 130 | (const :tag "Not Set" nil)) | 127 | (const :tag "Not Set" nil)) |
| 131 | :group 'grep) | 128 | :group 'grep) |
| 132 | 129 | ||
| 133 | (defcustom grep-tree-command nil | 130 | (defcustom grep-find-template nil |
| 134 | "The default find command for \\[grep-tree]. | 131 | "The default command to run for \\[rgrep]. |
| 135 | The default value of this variable is set up by `grep-compute-defaults'; | 132 | The default value of this variable is set up by `grep-compute-defaults'; |
| 136 | call that function before using this variable in your program. | 133 | call that function before using this variable in your program. |
| 137 | The following place holders should be present in the string: | 134 | The following place holders should be present in the string: |
| @@ -145,27 +142,22 @@ The following place holders should be present in the string: | |||
| 145 | :version "22.1" | 142 | :version "22.1" |
| 146 | :group 'grep) | 143 | :group 'grep) |
| 147 | 144 | ||
| 148 | (defcustom grep-tree-files-aliases '( | 145 | (defcustom grep-files-aliases '( |
| 146 | ("el" . "*.el") | ||
| 149 | ("ch" . "*.[ch]") | 147 | ("ch" . "*.[ch]") |
| 150 | ("c" . "*.c") | 148 | ("c" . "*.c") |
| 151 | ("h" . "*.h") | 149 | ("h" . "*.h") |
| 152 | ("m" . "[Mm]akefile*") | ||
| 153 | ("asm" . "*.[sS]") | 150 | ("asm" . "*.[sS]") |
| 154 | ("all" . "*") | 151 | ("m" . "[Mm]akefile*") |
| 155 | ("el" . "*.el") | 152 | ("l" . "[Cc]hange[Ll]og*") |
| 156 | ) | 153 | ) |
| 157 | "*Alist of aliases for the FILES argument to `grep-tree'." | 154 | "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'." |
| 158 | :type 'alist | 155 | :type 'alist |
| 159 | :group 'grep) | 156 | :group 'grep) |
| 160 | 157 | ||
| 161 | (defcustom grep-tree-ignore-case t | 158 | (defcustom grep-find-ignored-directories '("CVS" ".hg" "{arch}") |
| 162 | "*If non-nil, `grep-tree' ignores case in matches." | 159 | "*List of names of sub-directories which `rgrep' shall not recurse into." |
| 163 | :type 'boolean | 160 | :type '(repeat string) |
| 164 | :group 'grep) | ||
| 165 | |||
| 166 | (defcustom grep-tree-ignore-CVS-directories t | ||
| 167 | "*If non-nil, `grep-tree' does no recurse into CVS directories." | ||
| 168 | :type 'boolean | ||
| 169 | :group 'grep) | 161 | :group 'grep) |
| 170 | 162 | ||
| 171 | (defcustom grep-error-screen-columns nil | 163 | (defcustom grep-error-screen-columns nil |
| @@ -208,6 +200,8 @@ See `compilation-error-screen-columns'" | |||
| 208 | '("Compile..." . compile)) | 200 | '("Compile..." . compile)) |
| 209 | (define-key map [menu-bar grep compilation-grep] | 201 | (define-key map [menu-bar grep compilation-grep] |
| 210 | '("Another grep..." . grep)) | 202 | '("Another grep..." . grep)) |
| 203 | (define-key map [menu-bar grep compilation-grep-find] | ||
| 204 | '("Recursive grep..." . grep-find)) | ||
| 211 | (define-key map [menu-bar grep compilation-recompile] | 205 | (define-key map [menu-bar grep compilation-recompile] |
| 212 | '("Repeat grep" . recompile)) | 206 | '("Repeat grep" . recompile)) |
| 213 | (define-key map [menu-bar grep compilation-separator2] | 207 | (define-key map [menu-bar grep compilation-separator2] |
| @@ -353,6 +347,11 @@ This variable's value takes effect when `grep-compute-defaults' is called.") | |||
| 353 | ;;;###autoload | 347 | ;;;###autoload |
| 354 | (defvar grep-find-history nil) | 348 | (defvar grep-find-history nil) |
| 355 | 349 | ||
| 350 | ;; History of lgrep and rgrep regexp and files args. | ||
| 351 | (defvar grep-regexp-history nil) | ||
| 352 | (defvar grep-files-history '("ch" "el")) | ||
| 353 | |||
| 354 | |||
| 356 | ;;;###autoload | 355 | ;;;###autoload |
| 357 | (defun grep-process-setup () | 356 | (defun grep-process-setup () |
| 358 | "Setup compilation variables and buffer for `grep'. | 357 | "Setup compilation variables and buffer for `grep'. |
| @@ -378,6 +377,12 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 378 | (cons msg code)))) | 377 | (cons msg code)))) |
| 379 | (run-hooks 'grep-setup-hook)) | 378 | (run-hooks 'grep-setup-hook)) |
| 380 | 379 | ||
| 380 | (defun grep-probe (command args &optional func result) | ||
| 381 | (equal (condition-case nil | ||
| 382 | (apply (or func 'call-process) command args) | ||
| 383 | (error nil)) | ||
| 384 | (or result 0))) | ||
| 385 | |||
| 381 | ;;;###autoload | 386 | ;;;###autoload |
| 382 | (defun grep-compute-defaults () | 387 | (defun grep-compute-defaults () |
| 383 | (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) | 388 | (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) |
| @@ -385,73 +390,67 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 385 | (with-temp-buffer | 390 | (with-temp-buffer |
| 386 | (let ((hello-file (expand-file-name "HELLO" data-directory))) | 391 | (let ((hello-file (expand-file-name "HELLO" data-directory))) |
| 387 | (not | 392 | (not |
| 388 | (and (equal (condition-case nil | 393 | (and (if grep-command |
| 389 | (if grep-command | 394 | ;; `grep-command' is already set, so |
| 390 | ;; `grep-command' is already set, so | 395 | ;; use that for testing. |
| 391 | ;; use that for testing. | 396 | (grep-probe grep-command |
| 392 | (call-process-shell-command | 397 | `(nil t nil "^English" ,hello-file) |
| 393 | grep-command nil t nil | 398 | #'call-process-shell-command) |
| 394 | "^English" hello-file) | 399 | ;; otherwise use `grep-program' |
| 395 | ;; otherwise use `grep-program' | 400 | (grep-probe grep-program |
| 396 | (call-process grep-program nil t nil | 401 | `(nil t nil "-nH" "^English" ,hello-file))) |
| 397 | "-nH" "^English" hello-file)) | ||
| 398 | (error nil)) | ||
| 399 | 0) | ||
| 400 | (progn | 402 | (progn |
| 401 | (goto-char (point-min)) | 403 | (goto-char (point-min)) |
| 402 | (looking-at | 404 | (looking-at |
| 403 | (concat (regexp-quote hello-file) | 405 | (concat (regexp-quote hello-file) |
| 404 | ":[0-9]+:English"))))))))) | 406 | ":[0-9]+:English"))))))))) |
| 405 | (unless grep-command | 407 | (unless (and grep-command grep-find-command |
| 406 | (setq grep-command | 408 | grep-template grep-find-template) |
| 407 | (let ((required-options (if grep-use-null-device "-n" "-nH"))) | 409 | (let ((grep-options |
| 408 | (if (equal (condition-case nil ; in case "grep" isn't in exec-path | 410 | (concat (if grep-use-null-device "-n" "-nH") |
| 409 | (call-process grep-program nil nil nil | 411 | (if (grep-probe grep-program |
| 410 | "-e" "foo" null-device) | 412 | `(nil nil nil "-e" "foo" ,null-device) |
| 411 | (error nil)) | 413 | nil 1) |
| 412 | 1) | 414 | " -e")))) |
| 413 | (format "%s %s -e " grep-program required-options) | 415 | (unless grep-command |
| 414 | (format "%s %s " grep-program required-options))))) | 416 | (setq grep-command |
| 415 | (unless grep-find-use-xargs | 417 | (format "%s %s " grep-program grep-options))) |
| 416 | (setq grep-find-use-xargs | 418 | (unless grep-template |
| 417 | (if (and | 419 | (setq grep-template |
| 418 | (equal (call-process "find" nil nil nil | 420 | (format "%s <C> %s <R> <F>" grep-program grep-options))) |
| 419 | null-device "-print0") | 421 | (unless grep-find-use-xargs |
| 420 | 0) | 422 | (setq grep-find-use-xargs |
| 421 | (equal (call-process "xargs" nil nil nil | 423 | (if (and |
| 422 | "-0" "-e" "echo") | 424 | (grep-probe find-program `(nil nil nil ,null-device "-print0")) |
| 423 | 0)) | 425 | (grep-probe "xargs" `(nil nil nil "-0" "-e" "echo"))) |
| 424 | 'gnu))) | 426 | 'gnu))) |
| 425 | (unless grep-find-command | 427 | (unless grep-find-command |
| 426 | (setq grep-find-command | 428 | (setq grep-find-command |
| 427 | (cond ((eq grep-find-use-xargs 'gnu) | 429 | (cond ((eq grep-find-use-xargs 'gnu) |
| 428 | (format "%s . -type f -print0 | xargs -0 -e %s" | 430 | (format "%s . -type f -print0 | xargs -0 -e %s" |
| 429 | find-program grep-command)) | 431 | find-program grep-command)) |
| 430 | (grep-find-use-xargs | 432 | (grep-find-use-xargs |
| 431 | (format "%s . -type f -print | xargs %s" | 433 | (format "%s . -type f -print | xargs %s" |
| 432 | find-program grep-command)) | 434 | find-program grep-command)) |
| 433 | (t (cons (format "%s . -type f -exec %s {} %s \\;" | 435 | (t (cons (format "%s . -type f -exec %s {} %s \\;" |
| 434 | find-program grep-command null-device) | 436 | find-program grep-command null-device) |
| 435 | (+ 22 (length grep-command))))))) | 437 | (+ 22 (length grep-command))))))) |
| 436 | (unless grep-tree-command | 438 | (unless grep-find-template |
| 437 | (setq grep-tree-command | 439 | (setq grep-find-template |
| 438 | (let* ((glen (length grep-program)) | 440 | (let ((gcmd (format "%s <C> %s <R>" |
| 439 | (gcmd (concat grep-program " <C>" (substring grep-command glen)))) | 441 | grep-program grep-options))) |
| 440 | (cond ((eq grep-find-use-xargs 'gnu) | 442 | (cond ((eq grep-find-use-xargs 'gnu) |
| 441 | (format "%s <D> <X> -type f <F> -print0 | xargs -0 -e %s <R>" | 443 | (format "%s . <X> -type f <F> -print0 | xargs -0 -e %s" |
| 442 | find-program gcmd)) | 444 | find-program gcmd)) |
| 443 | (grep-find-use-xargs | 445 | (grep-find-use-xargs |
| 444 | (format "%s <D> <X> -type f <F> -print | xargs %s <R>" | 446 | (format "%s . <X> -type f <F> -print | xargs %s" |
| 445 | find-program gcmd)) | 447 | find-program gcmd)) |
| 446 | (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;" | 448 | (t (format "%s . <X> -type f <F> -exec %s {} %s \\;" |
| 447 | find-program gcmd null-device)))))) | 449 | find-program gcmd null-device)))))))) |
| 448 | (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) | 450 | (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
| 449 | (setq grep-highlight-matches | 451 | (setq grep-highlight-matches |
| 450 | (with-temp-buffer | 452 | (with-temp-buffer |
| 451 | (and (equal (condition-case nil | 453 | (and (grep-probe grep-program '(nil t nil "--help")) |
| 452 | (call-process grep-program nil t nil "--help") | ||
| 453 | (error nil)) | ||
| 454 | 0) | ||
| 455 | (progn | 454 | (progn |
| 456 | (goto-char (point-min)) | 455 | (goto-char (point-min)) |
| 457 | (search-forward "--color" nil t)) | 456 | (search-forward "--color" nil t)) |
| @@ -487,8 +486,22 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 487 | (file-name-extension buffer-file-name)))) | 486 | (file-name-extension buffer-file-name)))) |
| 488 | (replace-match tag-default t t grep-default 1)))) | 487 | (replace-match tag-default t t grep-default 1)))) |
| 489 | 488 | ||
| 489 | |||
| 490 | ;;;###autoload | 490 | ;;;###autoload |
| 491 | (defun grep (command-args &optional highlight-regexp) | 491 | (define-compilation-mode grep-mode "Grep" |
| 492 | "Sets `grep-last-buffer' and `compilation-window-height'." | ||
| 493 | (setq grep-last-buffer (current-buffer)) | ||
| 494 | (set (make-local-variable 'compilation-error-face) | ||
| 495 | grep-hit-face) | ||
| 496 | (set (make-local-variable 'compilation-error-regexp-alist) | ||
| 497 | grep-regexp-alist) | ||
| 498 | (set (make-local-variable 'compilation-process-setup-function) | ||
| 499 | 'grep-process-setup) | ||
| 500 | (set (make-local-variable 'compilation-disable-input) t)) | ||
| 501 | |||
| 502 | |||
| 503 | ;;;###autoload | ||
| 504 | (defun grep (command-args) | ||
| 492 | "Run grep, with user-specified args, and collect output in a buffer. | 505 | "Run grep, with user-specified args, and collect output in a buffer. |
| 493 | While grep runs asynchronously, you can use \\[next-error] (M-x next-error), | 506 | While grep runs asynchronously, you can use \\[next-error] (M-x next-error), |
| 494 | or \\<grep-mode-map>\\[compile-goto-error] in the grep \ | 507 | or \\<grep-mode-map>\\[compile-goto-error] in the grep \ |
| @@ -501,15 +514,10 @@ easily repeat a grep command. | |||
| 501 | A prefix argument says to default the argument based upon the current | 514 | A prefix argument says to default the argument based upon the current |
| 502 | tag the cursor is over, substituting it into the last grep command | 515 | tag the cursor is over, substituting it into the last grep command |
| 503 | in the grep command history (or into `grep-command' | 516 | in the grep command history (or into `grep-command' |
| 504 | if that history list is empty). | 517 | if that history list is empty)." |
| 505 | |||
| 506 | If specified, optional second arg HIGHLIGHT-REGEXP is the regexp to | ||
| 507 | temporarily highlight in visited source lines." | ||
| 508 | (interactive | 518 | (interactive |
| 509 | (progn | 519 | (progn |
| 510 | (unless (and grep-command | 520 | (grep-compute-defaults) |
| 511 | (or (not grep-use-null-device) (eq grep-use-null-device t))) | ||
| 512 | (grep-compute-defaults)) | ||
| 513 | (let ((default (grep-default-command))) | 521 | (let ((default (grep-default-command))) |
| 514 | (list (read-from-minibuffer "Run grep (like this): " | 522 | (list (read-from-minibuffer "Run grep (like this): " |
| 515 | (if current-prefix-arg | 523 | (if current-prefix-arg |
| @@ -522,19 +530,8 @@ temporarily highlight in visited source lines." | |||
| 522 | (compilation-start (if (and grep-use-null-device null-device) | 530 | (compilation-start (if (and grep-use-null-device null-device) |
| 523 | (concat command-args " " null-device) | 531 | (concat command-args " " null-device) |
| 524 | command-args) | 532 | command-args) |
| 525 | 'grep-mode nil highlight-regexp)) | 533 | 'grep-mode)) |
| 526 | 534 | ||
| 527 | ;;;###autoload | ||
| 528 | (define-compilation-mode grep-mode "Grep" | ||
| 529 | "Sets `grep-last-buffer' and `compilation-window-height'." | ||
| 530 | (setq grep-last-buffer (current-buffer)) | ||
| 531 | (set (make-local-variable 'compilation-error-face) | ||
| 532 | grep-hit-face) | ||
| 533 | (set (make-local-variable 'compilation-error-regexp-alist) | ||
| 534 | grep-regexp-alist) | ||
| 535 | (set (make-local-variable 'compilation-process-setup-function) | ||
| 536 | 'grep-process-setup) | ||
| 537 | (set (make-local-variable 'compilation-disable-input) t)) | ||
| 538 | 535 | ||
| 539 | ;;;###autoload | 536 | ;;;###autoload |
| 540 | (defun grep-find (command-args) | 537 | (defun grep-find (command-args) |
| @@ -547,9 +544,7 @@ This command uses a special history list for its arguments, so you can | |||
| 547 | easily repeat a find command." | 544 | easily repeat a find command." |
| 548 | (interactive | 545 | (interactive |
| 549 | (progn | 546 | (progn |
| 550 | (unless (and grep-command | 547 | (grep-compute-defaults) |
| 551 | (or (not grep-use-null-device) (eq grep-use-null-device t))) | ||
| 552 | (grep-compute-defaults)) | ||
| 553 | (if grep-find-command | 548 | (if grep-find-command |
| 554 | (list (read-from-minibuffer "Run find (like this): " | 549 | (list (read-from-minibuffer "Run find (like this): " |
| 555 | grep-find-command nil nil | 550 | grep-find-command nil nil |
| @@ -565,84 +560,190 @@ easily repeat a find command." | |||
| 565 | ;;;###autoload | 560 | ;;;###autoload |
| 566 | (defalias 'find-grep 'grep-find) | 561 | (defalias 'find-grep 'grep-find) |
| 567 | 562 | ||
| 568 | (defun grep-expand-command-macros (command &optional regexp files dir excl case-fold) | 563 | |
| 569 | "Patch grep COMMAND replacing <D>, etc." | 564 | ;; User-friendly interactive API. |
| 570 | (setq command | 565 | |
| 571 | (replace-regexp-in-string "<D>" | 566 | (defconst grep-expand-keywords |
| 572 | (or dir ".") command t t)) | 567 | '(("<C>" . (and cf (isearch-no-upper-case-p regexp t) "-i")) |
| 573 | (setq command | 568 | ("<D>" . dir) |
| 574 | (replace-regexp-in-string "<X>" | 569 | ("<F>" . files) |
| 575 | (or excl "") command t t)) | 570 | ("<N>" . null-device) |
| 576 | (setq command | 571 | ("<X>" . excl) |
| 577 | (replace-regexp-in-string "<F>" | 572 | ("<R>" . (shell-quote-argument (or regexp "")))) |
| 578 | (or files "") command t t)) | 573 | "List of substitutions performed by `grep-expand-template'. |
| 579 | (setq command | 574 | If car of an element matches, the cdr is evalled in to get the |
| 580 | (replace-regexp-in-string "<C>" | 575 | substitution string. Note dynamic scoping of variables.") |
| 581 | (if case-fold "-i" "") command t t)) | 576 | |
| 582 | (setq command | 577 | (defun grep-expand-template (template &optional regexp files dir excl) |
| 583 | (replace-regexp-in-string "<R>" | 578 | "Patch grep COMMAND string replacing <C>, <D>, <F>, <R>, and <X>." |
| 584 | (or regexp "") command t t)) | 579 | (let ((command template) |
| 585 | command) | 580 | (cf case-fold-search) |
| 586 | 581 | (case-fold-search nil)) | |
| 587 | (defvar grep-tree-last-regexp "") | 582 | (dolist (kw grep-expand-keywords command) |
| 588 | (defvar grep-tree-last-files (car (car grep-tree-files-aliases))) | 583 | (if (string-match (car kw) command) |
| 584 | (setq command | ||
| 585 | (replace-match | ||
| 586 | (or (if (symbolp (cdr kw)) | ||
| 587 | (eval (cdr kw)) | ||
| 588 | (save-match-data (eval (cdr kw)))) | ||
| 589 | "") | ||
| 590 | t t command)))))) | ||
| 591 | |||
| 592 | (defun grep-read-regexp () | ||
| 593 | "Read regexp arg for interactive grep." | ||
| 594 | (let ((default | ||
| 595 | (or (funcall (or find-tag-default-function | ||
| 596 | (get major-mode 'find-tag-default-function) | ||
| 597 | 'find-tag-default)) | ||
| 598 | ""))) | ||
| 599 | (read-string | ||
| 600 | (concat "Search for" | ||
| 601 | (if (and default (> (length default) 0)) | ||
| 602 | (format " (default %s): " default) ": ")) | ||
| 603 | nil 'grep-regexp-history default))) | ||
| 604 | |||
| 605 | (defun grep-read-files (regexp) | ||
| 606 | "Read files arg for interactive grep." | ||
| 607 | (let* ((bn (or (buffer-file-name) (buffer-name))) | ||
| 608 | (fn (and bn | ||
| 609 | (stringp bn) | ||
| 610 | (file-name-nondirectory bn))) | ||
| 611 | (default | ||
| 612 | (or (and fn | ||
| 613 | (let ((aliases grep-files-aliases) | ||
| 614 | alias) | ||
| 615 | (while aliases | ||
| 616 | (setq alias (car aliases) | ||
| 617 | aliases (cdr aliases)) | ||
| 618 | (if (string-match (wildcard-to-regexp (cdr alias)) fn) | ||
| 619 | (setq aliases nil) | ||
| 620 | (setq alias nil))) | ||
| 621 | (cdr alias))) | ||
| 622 | (and fn | ||
| 623 | (let ((ext (file-name-extension fn))) | ||
| 624 | (and ext (concat "*." ext)))))) | ||
| 625 | (files (read-string | ||
| 626 | (concat "Search for \"" regexp | ||
| 627 | "\" in files" | ||
| 628 | (if default (concat " (default " default ")")) | ||
| 629 | ": ") | ||
| 630 | nil 'grep-files-history default))) | ||
| 631 | (and files | ||
| 632 | (or (cdr (assoc files grep-files-aliases)) | ||
| 633 | files)))) | ||
| 589 | 634 | ||
| 590 | ;;;###autoload | 635 | ;;;###autoload |
| 591 | (defun grep-tree (regexp files dir &optional subdirs) | 636 | (defun lgrep (regexp &optional files) |
| 592 | "Grep for REGEXP in FILES in directory tree rooted at DIR. | 637 | "Run grep, searching for REGEXP in FILES in current directory. |
| 593 | Collect output in a buffer. | ||
| 594 | Interactively, prompt separately for each search parameter. | ||
| 595 | With prefix arg, reuse previous REGEXP. | ||
| 596 | The search is limited to file names matching shell pattern FILES. | 638 | The search is limited to file names matching shell pattern FILES. |
| 597 | FILES may use abbreviations defined in `grep-tree-files-aliases', e.g. | 639 | FILES may use abbreviations defined in `grep-files-aliases', e.g. |
| 598 | entering `ch' is equivalent to `*.[ch]'. | 640 | entering `ch' is equivalent to `*.[ch]'. |
| 599 | 641 | ||
| 600 | While find runs asynchronously, you can use the \\[next-error] command | 642 | With \\[universal-argument] prefix, allow user to edit the constructed |
| 601 | to find the text that grep hits refer to. | 643 | shell command line before it is executed. |
| 644 | With two \\[universal-argument] prefixes, edit and run grep shell command. | ||
| 602 | 645 | ||
| 603 | This command uses a special history list for its arguments, so you can | 646 | Collect output in a buffer. While grep runs asynchronously, you |
| 604 | easily repeat a find command. | 647 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] |
| 648 | in the grep output buffer, to go to the lines where grep found matches. | ||
| 605 | 649 | ||
| 606 | When used non-interactively, optional arg SUBDIRS limits the search to | 650 | This command shares argument histories with \\[rgrep] and \\[grep]." |
| 607 | those sub directories of DIR." | ||
| 608 | (interactive | 651 | (interactive |
| 609 | (let* ((regexp | 652 | (progn |
| 610 | (if current-prefix-arg | 653 | (grep-compute-defaults) |
| 611 | grep-tree-last-regexp | 654 | (cond |
| 612 | (let* ((default (current-word)) | 655 | ((and grep-command (equal current-prefix-arg '(16))) |
| 613 | (spec (read-string | 656 | (list (read-from-minibuffer "Run: " grep-command |
| 614 | (concat "Search for" | 657 | nil nil 'grep-history) |
| 615 | (if (and default (> (length default) 0)) | 658 | nil)) |
| 616 | (format " (default %s): " default) ": "))))) | 659 | ((not grep-template) |
| 617 | (if (equal spec "") default spec)))) | 660 | (list nil |
| 618 | (files | 661 | (read-string "grep.el: No `grep-template' available. Press RET."))) |
| 619 | (read-string (concat "Search for \"" regexp "\" in files (default " grep-tree-last-files "): "))) | 662 | (t (let* ((regexp (grep-read-regexp)) |
| 620 | (dir | 663 | (files (grep-read-files regexp))) |
| 621 | (read-directory-name "Base directory: " nil default-directory t))) | 664 | (list regexp files)))))) |
| 622 | (list regexp files dir))) | 665 | (when (and (stringp regexp) (> (length regexp) 0)) |
| 623 | (unless grep-tree-command | 666 | (let ((command regexp)) |
| 624 | (grep-compute-defaults)) | 667 | (if (null files) |
| 625 | (unless (and (stringp files) (> (length files) 0)) | 668 | (if (string= command grep-command) |
| 626 | (setq files grep-tree-last-files)) | 669 | (setq command nil)) |
| 627 | (when files | 670 | (setq command (grep-expand-template |
| 628 | (setq grep-tree-last-files files) | 671 | grep-template |
| 629 | (let ((mf (assoc files grep-tree-files-aliases))) | 672 | regexp |
| 630 | (if mf | 673 | files)) |
| 631 | (setq files (cdr mf))))) | 674 | (when command |
| 632 | (let ((command-args (grep-expand-command-macros | 675 | (if (equal current-prefix-arg '(4)) |
| 633 | grep-tree-command | 676 | (setq command |
| 634 | (setq grep-tree-last-regexp regexp) | 677 | (read-from-minibuffer "Confirm: " |
| 635 | (and files (concat "-name '" files "'")) | 678 | command nil nil 'grep-history)) |
| 636 | (if subdirs | 679 | (push command grep-history)))) |
| 637 | (if (stringp subdirs) | 680 | (when command |
| 638 | subdirs | 681 | ;; Setting process-setup-function makes exit-message-function work |
| 639 | (mapconcat 'identity subdirs " ")) | 682 | ;; even when async processes aren't supported. |
| 640 | nil) ;; we change default-directory to dir | 683 | (compilation-start (if (and grep-use-null-device null-device) |
| 641 | (and grep-tree-ignore-CVS-directories "-path '*/CVS' -prune -o ") | 684 | (concat command " " null-device) |
| 642 | grep-tree-ignore-case)) | 685 | command) 'grep-mode))))) |
| 643 | (default-directory (file-name-as-directory (expand-file-name dir))) | 686 | |
| 644 | (null-device nil)) ; see grep | 687 | |
| 645 | (grep command-args regexp))) | 688 | ;;;###autoload |
| 689 | (defun rgrep (regexp &optional files dir) | ||
| 690 | "Recusively grep for REGEXP in FILES in directory tree rooted at DIR. | ||
| 691 | The search is limited to file names matching shell pattern FILES. | ||
| 692 | FILES may use abbreviations defined in `grep-files-aliases', e.g. | ||
| 693 | entering `ch' is equivalent to `*.[ch]'. | ||
| 694 | |||
| 695 | With \\[universal-argument] prefix, allow user to edit the constructed | ||
| 696 | shell command line before it is executed. | ||
| 697 | With two \\[universal-argument] prefixes, edit and run grep-find shell command. | ||
| 698 | |||
| 699 | Collect output in a buffer. While find runs asynchronously, you | ||
| 700 | can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] | ||
| 701 | in the grep output buffer, to go to the lines where grep found matches. | ||
| 702 | |||
| 703 | This command shares argument histories with \\[lgrep] and \\[grep-find]." | ||
| 704 | (interactive | ||
| 705 | (progn | ||
| 706 | (grep-compute-defaults) | ||
| 707 | (cond | ||
| 708 | ((and grep-find-command (equal current-prefix-arg '(16))) | ||
| 709 | (list (read-from-minibuffer "Run: " grep-find-command | ||
| 710 | nil nil 'grep-find-history) | ||
| 711 | nil)) | ||
| 712 | ((not grep-find-template) | ||
| 713 | (list nil nil | ||
| 714 | (read-string "grep.el: No `grep-find-template' available. Press RET."))) | ||
| 715 | (t (let* ((regexp (grep-read-regexp)) | ||
| 716 | (files (grep-read-files regexp)) | ||
| 717 | (dir (read-directory-name "Base directory: " | ||
| 718 | nil default-directory t))) | ||
| 719 | (list regexp files dir)))))) | ||
| 720 | (when (and (stringp regexp) (> (length regexp) 0)) | ||
| 721 | (if (null files) | ||
| 722 | (if (not (string= regexp grep-find-command)) | ||
| 723 | (compilation-start regexp 'grep-mode)) | ||
| 724 | (let* ((default-directory (file-name-as-directory (expand-file-name dir))) | ||
| 725 | (command (grep-expand-template | ||
| 726 | grep-find-template | ||
| 727 | regexp | ||
| 728 | (concat "\\( -name " | ||
| 729 | (mapconcat #'shell-quote-argument | ||
| 730 | (split-string files) | ||
| 731 | " -o -name ") | ||
| 732 | " \\)") | ||
| 733 | default-directory | ||
| 734 | (and grep-find-ignored-directories | ||
| 735 | (concat "\\( -path '*/" | ||
| 736 | (mapconcat #'identity | ||
| 737 | grep-find-ignored-directories | ||
| 738 | "' -o -path '*/") | ||
| 739 | "' \\) -prune -o "))))) | ||
| 740 | (when command | ||
| 741 | (if current-prefix-arg | ||
| 742 | (setq command | ||
| 743 | (read-from-minibuffer "Confirm: " | ||
| 744 | command nil nil 'grep-find-history)) | ||
| 745 | (push command grep-find-history)) | ||
| 746 | (compilation-start command 'grep-mode)))))) | ||
| 646 | 747 | ||
| 647 | 748 | ||
| 648 | (provide 'grep) | 749 | (provide 'grep) |
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index e1e2b9e28cd..11259aa3965 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el | |||
| @@ -83,6 +83,8 @@ Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python), jdb, and b | |||
| 83 | (defvar gud-minor-mode nil) | 83 | (defvar gud-minor-mode nil) |
| 84 | (put 'gud-minor-mode 'permanent-local t) | 84 | (put 'gud-minor-mode 'permanent-local t) |
| 85 | 85 | ||
| 86 | (defvar gud-comint-buffer nil) | ||
| 87 | |||
| 86 | (defvar gud-keep-buffer nil) | 88 | (defvar gud-keep-buffer nil) |
| 87 | 89 | ||
| 88 | (defun gud-symbol (sym &optional soft minor-mode) | 90 | (defun gud-symbol (sym &optional soft minor-mode) |
| @@ -301,13 +303,15 @@ Uses `gud-<MINOR-MODE>-directories' to find the source files." | |||
| 301 | optional doc string DOC. Certain %-escapes in the string arguments | 303 | optional doc string DOC. Certain %-escapes in the string arguments |
| 302 | are interpreted specially if present. These are: | 304 | are interpreted specially if present. These are: |
| 303 | 305 | ||
| 304 | %f name (without directory) of current source file. | 306 | %f -- Name (without directory) of current source file. |
| 305 | %F name (without directory or extension) of current source file. | 307 | %F -- Name (without directory or extension) of current source file. |
| 306 | %d directory of current source file. | 308 | %d -- Directory of current source file. |
| 307 | %l number of current source line | 309 | %l -- Number of current source line. |
| 308 | %e text of the C lvalue or function-call expression surrounding point. | 310 | %e -- Text of the C lvalue or function-call expression surrounding point. |
| 309 | %a text of the hexadecimal address surrounding point | 311 | %a -- Text of the hexadecimal address surrounding point. |
| 310 | %p prefix argument to the command (if any) as a number | 312 | %p -- Prefix argument to the command (if any) as a number. |
| 313 | %c -- Fully qualified class name derived from the expression | ||
| 314 | surrounding point (jdb only). | ||
| 311 | 315 | ||
| 312 | The `current' source file is the file of the current buffer (if | 316 | The `current' source file is the file of the current buffer (if |
| 313 | we're in a C file) or the source file current at the last break or | 317 | we're in a C file) or the source file current at the last break or |
| @@ -444,8 +448,7 @@ required by the caller." | |||
| 444 | (when (or gdb-force-update | 448 | (when (or gdb-force-update |
| 445 | (not (save-excursion | 449 | (not (save-excursion |
| 446 | (goto-char (point-min)) | 450 | (goto-char (point-min)) |
| 447 | (let ((case-fold-search t)) | 451 | (looking-at "Watch Expressions:")))) |
| 448 | (looking-at "Watch Expressions:"))))) | ||
| 449 | (erase-buffer) | 452 | (erase-buffer) |
| 450 | (insert "Watch Expressions:\n") | 453 | (insert "Watch Expressions:\n") |
| 451 | (if gdb-speedbar-auto-raise | 454 | (if gdb-speedbar-auto-raise |
| @@ -740,8 +743,6 @@ To run GDB in text command mode, set `gud-gdb-command-name' to | |||
| 740 | ;; The completion list is constructed by the process filter. | 743 | ;; The completion list is constructed by the process filter. |
| 741 | (defvar gud-gdb-fetched-lines) | 744 | (defvar gud-gdb-fetched-lines) |
| 742 | 745 | ||
| 743 | (defvar gud-comint-buffer nil) | ||
| 744 | |||
| 745 | (defun gud-gdb-complete-command (&optional command a b) | 746 | (defun gud-gdb-complete-command (&optional command a b) |
| 746 | "Perform completion on the GDB command preceding point. | 747 | "Perform completion on the GDB command preceding point. |
| 747 | This is implemented using the GDB `complete' command which isn't | 748 | This is implemented using the GDB `complete' command which isn't |
| @@ -2804,7 +2805,9 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2804 | (let ((insource (not (eq (current-buffer) gud-comint-buffer))) | 2805 | (let ((insource (not (eq (current-buffer) gud-comint-buffer))) |
| 2805 | (frame (or gud-last-frame gud-last-last-frame)) | 2806 | (frame (or gud-last-frame gud-last-last-frame)) |
| 2806 | result) | 2807 | result) |
| 2807 | (while (and str (string-match "\\([^%]*\\)%\\([adeflpc]\\)" str)) | 2808 | (while (and str |
| 2809 | (let ((case-fold-search nil)) | ||
| 2810 | (string-match "\\([^%]*\\)%\\([adefFlpc]\\)" str))) | ||
| 2808 | (let ((key (string-to-char (match-string 2 str))) | 2811 | (let ((key (string-to-char (match-string 2 str))) |
| 2809 | subst) | 2812 | subst) |
| 2810 | (cond | 2813 | (cond |
| @@ -2889,8 +2892,11 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2889 | (set-buffer gud-comint-buffer) | 2892 | (set-buffer gud-comint-buffer) |
| 2890 | (save-restriction | 2893 | (save-restriction |
| 2891 | (widen) | 2894 | (widen) |
| 2892 | (goto-char (process-mark proc)) | 2895 | (if (marker-position gud-delete-prompt-marker) |
| 2893 | (forward-line 0) | 2896 | ;; We get here when printing an expression. |
| 2897 | (goto-char gud-delete-prompt-marker) | ||
| 2898 | (goto-char (process-mark proc)) | ||
| 2899 | (forward-line 0)) | ||
| 2894 | (if (looking-at comint-prompt-regexp) | 2900 | (if (looking-at comint-prompt-regexp) |
| 2895 | (set-marker gud-delete-prompt-marker (point))) | 2901 | (set-marker gud-delete-prompt-marker (point))) |
| 2896 | (if (memq gud-minor-mode '(gdbmi gdba)) | 2902 | (if (memq gud-minor-mode '(gdbmi gdba)) |
| @@ -2911,7 +2917,21 @@ Obeying it means displaying in another window the specified file and line." | |||
| 2911 | (defvar gud-find-expr-function 'gud-find-c-expr) | 2917 | (defvar gud-find-expr-function 'gud-find-c-expr) |
| 2912 | 2918 | ||
| 2913 | (defun gud-find-expr (&rest args) | 2919 | (defun gud-find-expr (&rest args) |
| 2914 | (apply gud-find-expr-function args)) | 2920 | (let ((expr (if (and transient-mark-mode mark-active) |
| 2921 | (buffer-substring (region-beginning) (region-end)) | ||
| 2922 | (apply gud-find-expr-function args)))) | ||
| 2923 | (save-match-data | ||
| 2924 | (if (string-match "\n" expr) | ||
| 2925 | (error "Expression must not include a newline")) | ||
| 2926 | (with-current-buffer gud-comint-buffer | ||
| 2927 | (save-excursion | ||
| 2928 | (goto-char (process-mark (get-buffer-process gud-comint-buffer))) | ||
| 2929 | (forward-line 0) | ||
| 2930 | (when (looking-at comint-prompt-regexp) | ||
| 2931 | (set-marker gud-delete-prompt-marker (point)) | ||
| 2932 | (set-marker-insertion-type gud-delete-prompt-marker t)) | ||
| 2933 | (insert (concat expr " = "))))) | ||
| 2934 | expr)) | ||
| 2915 | 2935 | ||
| 2916 | ;; The next eight functions are hacked from gdbsrc.el by | 2936 | ;; The next eight functions are hacked from gdbsrc.el by |
| 2917 | ;; Debby Ayers <ayers@asc.slb.com>, | 2937 | ;; Debby Ayers <ayers@asc.slb.com>, |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5e645535a23..9636f7eaeae 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -292,9 +292,9 @@ The criteria are that the previous line ends in a backslash outside | |||
| 292 | comments and strings, or that the bracket/paren nesting depth is nonzero." | 292 | comments and strings, or that the bracket/paren nesting depth is nonzero." |
| 293 | (or (and (eq ?\\ (char-before (line-end-position 0))) | 293 | (or (and (eq ?\\ (char-before (line-end-position 0))) |
| 294 | (not (syntax-ppss-context (syntax-ppss)))) | 294 | (not (syntax-ppss-context (syntax-ppss)))) |
| 295 | (/= 0 (syntax-ppss-depth | 295 | (< 0 (syntax-ppss-depth |
| 296 | (save-excursion ; syntax-ppss with arg changes point | 296 | (save-excursion ; syntax-ppss with arg changes point |
| 297 | (syntax-ppss (line-beginning-position))))))) | 297 | (syntax-ppss (line-beginning-position))))))) |
| 298 | 298 | ||
| 299 | (defun python-comment-line-p () | 299 | (defun python-comment-line-p () |
| 300 | "Return non-nil iff current line has only a comment." | 300 | "Return non-nil iff current line has only a comment." |
| @@ -719,7 +719,10 @@ expressions." | |||
| 719 | (python-beginning-of-string) | 719 | (python-beginning-of-string) |
| 720 | ;; Skip forward out of nested brackets. | 720 | ;; Skip forward out of nested brackets. |
| 721 | (condition-case () ; beware invalid syntax | 721 | (condition-case () ; beware invalid syntax |
| 722 | (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) | 722 | (let ((depth (syntax-ppss-depth (syntax-ppss)))) |
| 723 | ;; Beware negative depths. | ||
| 724 | (if (> depth 0) (backward-up-list depth)) | ||
| 725 | t) | ||
| 723 | (error (throw 'foo nil)))))) | 726 | (error (throw 'foo nil)))))) |
| 724 | (back-to-indentation)) | 727 | (back-to-indentation)) |
| 725 | 728 | ||
| @@ -1755,7 +1758,6 @@ lines count as headers. | |||
| 1755 | (if (featurep 'hippie-exp) | 1758 | (if (featurep 'hippie-exp) |
| 1756 | (set (make-local-variable 'hippie-expand-try-functions-list) | 1759 | (set (make-local-variable 'hippie-expand-try-functions-list) |
| 1757 | (cons 'python-try-complete hippie-expand-try-functions-list))) | 1760 | (cons 'python-try-complete hippie-expand-try-functions-list))) |
| 1758 | (unless font-lock-mode (font-lock-mode 1)) | ||
| 1759 | (when python-guess-indent (python-guess-indent)) | 1761 | (when python-guess-indent (python-guess-indent)) |
| 1760 | (set (make-local-variable 'python-command) python-python-command) | 1762 | (set (make-local-variable 'python-command) python-python-command) |
| 1761 | (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode | 1763 | (unless (boundp 'python-mode-running) ; kill the recursion from jython-mode |