aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorPaul Eggert2012-04-21 17:53:32 -0700
committerPaul Eggert2012-04-21 17:53:32 -0700
commitbbd347f5f7e99da1a559dad818b5fa8f59c0901e (patch)
tree77c1fc54c2240b08d2859109d18cac8812a8ffb1 /lisp/progmodes
parente4ecdc9c71af4199129d5dd2db1a32ff6b725fe4 (diff)
parent9ee7d8b93cb143b473e6dffb708e777bc6fe5bd0 (diff)
downloademacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.tar.gz
emacs-bbd347f5f7e99da1a559dad818b5fa8f59c0901e.zip
Merge from trunk.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/cc-cmds.el39
-rw-r--r--lisp/progmodes/cc-engine.el5
-rw-r--r--lisp/progmodes/cc-menus.el41
-rw-r--r--lisp/progmodes/cc-mode.el4
-rw-r--r--lisp/progmodes/flymake.el8
-rw-r--r--lisp/progmodes/gdb-mi.el123
-rw-r--r--lisp/progmodes/grep.el16
-rw-r--r--lisp/progmodes/gud.el4
-rw-r--r--lisp/progmodes/hideshow.el11
-rw-r--r--lisp/progmodes/perl-mode.el22
-rw-r--r--lisp/progmodes/python.el14
-rw-r--r--lisp/progmodes/verilog-mode.el2
-rw-r--r--lisp/progmodes/which-func.el11
13 files changed, 181 insertions, 119 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 55ab6c9981c..9cf20ccb516 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -679,7 +679,7 @@ settings of `c-cleanup-list' are done."
679 ;; We want to inhibit blinking the paren since this would be 679 ;; We want to inhibit blinking the paren since this would be
680 ;; most disruptive. We'll blink it ourselves later on. 680 ;; most disruptive. We'll blink it ourselves later on.
681 (old-blink-paren blink-paren-function) 681 (old-blink-paren blink-paren-function)
682 blink-paren-function) 682 blink-paren-function case-fold-search)
683 683
684 (c-save-buffer-state () 684 (c-save-buffer-state ()
685 (setq safepos (c-safe-position (point) (c-parse-state)) 685 (setq safepos (c-safe-position (point) (c-parse-state))
@@ -1086,7 +1086,7 @@ numeric argument is supplied, or the point is inside a literal."
1086 1086
1087 (interactive "*P") 1087 (interactive "*P")
1088 (let ((c-echo-syntactic-information-p nil) 1088 (let ((c-echo-syntactic-information-p nil)
1089 final-pos close-paren-inserted found-delim) 1089 final-pos close-paren-inserted found-delim case-fold-search)
1090 1090
1091 (self-insert-command (prefix-numeric-value arg)) 1091 (self-insert-command (prefix-numeric-value arg))
1092 (setq final-pos (point)) 1092 (setq final-pos (point))
@@ -1172,7 +1172,8 @@ newline cleanups are done if appropriate; see the variable `c-cleanup-list'."
1172 (interactive "*P") 1172 (interactive "*P")
1173 (let ((literal (c-save-buffer-state () (c-in-literal))) 1173 (let ((literal (c-save-buffer-state () (c-in-literal)))
1174 ;; shut this up 1174 ;; shut this up
1175 (c-echo-syntactic-information-p nil)) 1175 (c-echo-syntactic-information-p nil)
1176 case-fold-search)
1176 (self-insert-command (prefix-numeric-value arg)) 1177 (self-insert-command (prefix-numeric-value arg))
1177 1178
1178 (if (and (not arg) (not literal)) 1179 (if (and (not arg) (not literal))
@@ -1585,7 +1586,7 @@ defun."
1585 ; structure with other users of c-state-cache. 1586 ; structure with other users of c-state-cache.
1586 (orig-point-min (point-min)) (orig-point-max (point-max)) 1587 (orig-point-min (point-min)) (orig-point-max (point-max))
1587 lim ; Position of { which has been widened to. 1588 lim ; Position of { which has been widened to.
1588 where pos) 1589 where pos case-fold-search)
1589 1590
1590 (save-restriction 1591 (save-restriction
1591 (if (eq c-defun-tactic 'go-outward) 1592 (if (eq c-defun-tactic 'go-outward)
@@ -1709,7 +1710,8 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'."
1709 ; structure with other users of c-state-cache. 1710 ; structure with other users of c-state-cache.
1710 (orig-point-min (point-min)) (orig-point-max (point-max)) 1711 (orig-point-min (point-min)) (orig-point-max (point-max))
1711 lim 1712 lim
1712 where pos) 1713 where pos case-fold-search)
1714
1713 (save-restriction 1715 (save-restriction
1714 (if (eq c-defun-tactic 'go-outward) 1716 (if (eq c-defun-tactic 'go-outward)
1715 (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace 1717 (setq lim (c-widen-to-enclosing-decl-scope ; e.g. class, namespace
@@ -1769,8 +1771,8 @@ with a brace block."
1769 (interactive) 1771 (interactive)
1770 (c-save-buffer-state 1772 (c-save-buffer-state
1771 (beginning-of-defun-function end-of-defun-function 1773 (beginning-of-defun-function end-of-defun-function
1772 where pos name-end) 1774 where pos name-end case-fold-search)
1773 1775
1774 (save-restriction 1776 (save-restriction
1775 (widen) 1777 (widen)
1776 (save-excursion 1778 (save-excursion
@@ -1969,7 +1971,7 @@ As opposed to \\[c-beginning-of-defun] and \\[c-end-of-defun], this
1969function does not require the declaration to contain a brace block." 1971function does not require the declaration to contain a brace block."
1970 (interactive) 1972 (interactive)
1971 1973
1972 (let (decl-limits) 1974 (let (decl-limits case-fold-search)
1973 (c-save-buffer-state nil 1975 (c-save-buffer-state nil
1974 ;; We try to be line oriented, unless there are several 1976 ;; We try to be line oriented, unless there are several
1975 ;; declarations on the same line. 1977 ;; declarations on the same line.
@@ -2001,11 +2003,12 @@ function does not require the declaration to contain a brace block."
2001(defun c-cpp-define-name () 2003(defun c-cpp-define-name ()
2002 "Return the name of the current CPP macro, or NIL if we're not in one." 2004 "Return the name of the current CPP macro, or NIL if we're not in one."
2003 (interactive) 2005 (interactive)
2004 (save-excursion 2006 (let (case-fold-search)
2005 (and c-opt-cpp-macro-define-start 2007 (save-excursion
2006 (c-beginning-of-macro) 2008 (and c-opt-cpp-macro-define-start
2007 (looking-at c-opt-cpp-macro-define-start) 2009 (c-beginning-of-macro)
2008 (match-string-no-properties 1)))) 2010 (looking-at c-opt-cpp-macro-define-start)
2011 (match-string-no-properties 1)))))
2009 2012
2010 2013
2011;; Movement by statements. 2014;; Movement by statements.
@@ -2888,7 +2891,8 @@ See `c-indent-comment-alist' for a description."
2888 (eq (match-end 0) eot)) 2891 (eq (match-end 0) eot))
2889 'cpp-end-block) 2892 'cpp-end-block)
2890 (t 2893 (t
2891 'other)))) 2894 'other)))
2895 case-fold-search)
2892 (if (and (memq line-type '(anchored-comment empty-line)) 2896 (if (and (memq line-type '(anchored-comment empty-line))
2893 c-indent-comments-syntactically-p) 2897 c-indent-comments-syntactically-p)
2894 (let ((c-syntactic-context (c-guess-basic-syntax))) 2898 (let ((c-syntactic-context (c-guess-basic-syntax)))
@@ -3024,7 +3028,7 @@ are treated as conditional clause limits. Normally they are ignored."
3024 (let* ((forward (> count 0)) 3028 (let* ((forward (> count 0))
3025 (increment (if forward -1 1)) 3029 (increment (if forward -1 1))
3026 (search-function (if forward 're-search-forward 're-search-backward)) 3030 (search-function (if forward 're-search-forward 're-search-backward))
3027 new) 3031 new case-fold-search)
3028 (unless (integerp target-depth) 3032 (unless (integerp target-depth)
3029 (setq target-depth (if target-depth -1 0))) 3033 (setq target-depth (if target-depth -1 0)))
3030 (save-excursion 3034 (save-excursion
@@ -3226,7 +3230,7 @@ balanced expression is found."
3226In the macro case this also has the effect of realigning any line 3230In the macro case this also has the effect of realigning any line
3227continuation backslashes, unless `c-auto-align-backslashes' is nil." 3231continuation backslashes, unless `c-auto-align-backslashes' is nil."
3228 (interactive "*") 3232 (interactive "*")
3229 (let ((here (point-marker)) decl-limits) 3233 (let ((here (point-marker)) decl-limits case-fold-search)
3230 (unwind-protect 3234 (unwind-protect
3231 (progn 3235 (progn
3232 (c-save-buffer-state nil 3236 (c-save-buffer-state nil
@@ -4638,7 +4642,8 @@ inside a preprocessor directive."
4638 4642
4639 (interactive "*") 4643 (interactive "*")
4640 (let* (c-lit-limits c-lit-type 4644 (let* (c-lit-limits c-lit-type
4641 (c-macro-start c-macro-start)) 4645 (c-macro-start c-macro-start)
4646 case-fold-search)
4642 4647
4643 (c-save-buffer-state () 4648 (c-save-buffer-state ()
4644 (setq c-lit-limits (c-literal-limits nil nil t) 4649 (setq c-lit-limits (c-literal-limits nil nil t)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index cf38001c123..65e28c11e21 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -5382,7 +5382,7 @@ comment at the start of cc-engine.el for more info."
5382 new-beg new-end need-new-beg need-new-end) 5382 new-beg new-end need-new-beg need-new-end)
5383 ;; Locate the barrier before the changed region 5383 ;; Locate the barrier before the changed region
5384 (goto-char (if beg-lit-limits (car beg-lit-limits) beg)) 5384 (goto-char (if beg-lit-limits (car beg-lit-limits) beg))
5385 (c-syntactic-skip-backward "^;{}" (max (- beg 2048) (point-min))) 5385 (c-syntactic-skip-backward "^;{}" (c-determine-limit 512))
5386 (setq new-beg (point)) 5386 (setq new-beg (point))
5387 5387
5388 ;; Remove the syntax-table properties from each pertinent <...> pair. 5388 ;; Remove the syntax-table properties from each pertinent <...> pair.
@@ -5393,8 +5393,7 @@ comment at the start of cc-engine.el for more info."
5393 5393
5394 ;; Locate the barrier after END. 5394 ;; Locate the barrier after END.
5395 (goto-char (if end-lit-limits (cdr end-lit-limits) end)) 5395 (goto-char (if end-lit-limits (cdr end-lit-limits) end))
5396 (c-syntactic-re-search-forward "[;{}]" 5396 (c-syntactic-re-search-forward "[;{}]" (c-determine-+ve-limit 512) 'end)
5397 (min (+ end 2048) (point-max)) 'end)
5398 (setq new-end (point)) 5397 (setq new-end (point))
5399 5398
5400 ;; Remove syntax-table properties from the remaining pertinent <...> 5399 ;; Remove syntax-table properties from the remaining pertinent <...>
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index f57fcbff5ca..a53d65f6307 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -63,6 +63,20 @@ For example:
63 63
64A sample value might look like: `\\(_P\\|_PROTO\\)'.") 64A sample value might look like: `\\(_P\\|_PROTO\\)'.")
65 65
66;; *Warning for cc-mode developers*
67;;
68;; `cc-imenu-objc-generic-expression' elements depend on
69;; `cc-imenu-c++-generic-expression'. So if you change this
70;; expression, you need to change following variables,
71;; `cc-imenu-objc-generic-expression-*-index',
72;; too. `cc-imenu-objc-function' uses these *-index variables, in
73;; order to know where the each regexp *group \\(foobar\\)* elements
74;; are started.
75;;
76;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
77;; being initialized.
78;;
79
66(defvar cc-imenu-c++-generic-expression 80(defvar cc-imenu-c++-generic-expression
67 `( 81 `(
68 ;; Try to match ::operator definitions first. Otherwise `X::operator new ()' 82 ;; Try to match ::operator definitions first. Otherwise `X::operator new ()'
@@ -187,23 +201,8 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
187 ")" 201 ")"
188 "[.," c-alnum " \t\n\r]*" 202 "[.," c-alnum " \t\n\r]*"
189 "{" 203 "{"
190 )) 1)) 204 )) 1))
191 "Imenu generic expression for Java mode. See 205 "Imenu generic expression for Java mode. See `imenu-generic-expression'.")
192`imenu-generic-expression'.")
193
194;; *Warning for cc-mode developers*
195;;
196;; `cc-imenu-objc-generic-expression' elements depend on
197;; `cc-imenu-c++-generic-expression'. So if you change this
198;; expression, you need to change following variables,
199;; `cc-imenu-objc-generic-expression-*-index',
200;; too. `cc-imenu-objc-function' uses these *-index variables, in
201;; order to know where the each regexp *group \\(foobar\\)* elements
202;; are started.
203;;
204;; *-index variables are initialized during `cc-imenu-objc-generic-expression'
205;; being initialized.
206;;
207 206
208;; Internal variables 207;; Internal variables
209(defvar cc-imenu-objc-generic-expression-noreturn-index nil) 208(defvar cc-imenu-objc-generic-expression-noreturn-index nil)
@@ -224,7 +223,7 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
224 "\\|" 223 "\\|"
225 ;; > General function name regexp 224 ;; > General function name regexp
226 ;; Pick a token by (match-string 3) 225 ;; Pick a token by (match-string 3)
227 (car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 5 226 (car (cdr (nth 2 cc-imenu-c++-generic-expression))) ; -> index += 6
228 (prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "") 227 (prog2 (setq cc-imenu-objc-generic-expression-general-func-index 3) "")
229 ;; > Special case for definitions using phony prototype macros like: 228 ;; > Special case for definitions using phony prototype macros like:
230 ;; > `int main _PROTO( (int argc,char *argv[]) )'. 229 ;; > `int main _PROTO( (int argc,char *argv[]) )'.
@@ -233,11 +232,11 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
233 (concat 232 (concat
234 "\\|" 233 "\\|"
235 (car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1 234 (car (cdr (nth 3 cc-imenu-c++-generic-expression))) ; -> index += 1
236 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "") 235 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 10) "")
237 ) 236 )
238 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 8) "") 237 (prog2 (setq cc-imenu-objc-generic-expression-objc-base-index 9) "")
239 "") ; -> index += 0 238 "") ; -> index += 0
240 (prog2 (setq cc-imenu-objc-generic-expression-proto-index 8) "") 239 (prog2 (setq cc-imenu-objc-generic-expression-proto-index 9) "")
241 ;; 240 ;;
242 ;; For Objective-C 241 ;; For Objective-C
243 ;; Pick a token by (match-string 8 or 9) 242 ;; Pick a token by (match-string 8 or 9)
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 7c018feefbb..ff18f56bbe8 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1170,10 +1170,10 @@ Note that the style variables are always made local to the buffer."
1170 ;; 1170 ;;
1171 ;; 1171 ;;
1172 ;; void myfunc(T* p) {} 1172 ;; void myfunc(T* p) {}
1173 ;; 1173 ;;
1174 ;; Type a space in the first blank line, and the fontification of the next 1174 ;; Type a space in the first blank line, and the fontification of the next
1175 ;; line was fouled up by context fontification. 1175 ;; line was fouled up by context fontification.
1176 (let ((new-beg beg) (new-end end) new-region) 1176 (let ((new-beg beg) (new-end end) new-region case-fold-search)
1177 (if c-in-after-change-fontification 1177 (if c-in-after-change-fontification
1178 (setq c-in-after-change-fontification nil) 1178 (setq c-in-after-change-fontification nil)
1179 (save-restriction 1179 (save-restriction
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 07393c6954d..ed8eb81932e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1356,8 +1356,12 @@ if ARG is omitted or nil."
1356 (setq flymake-timer 1356 (setq flymake-timer
1357 (run-at-time nil 1 'flymake-on-timer-event (current-buffer))) 1357 (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
1358 1358
1359 (when flymake-start-syntax-check-on-find-file 1359 (when (and flymake-start-syntax-check-on-find-file
1360 (flymake-start-syntax-check))))) 1360 ;; Since we write temp files in current dir, there's no point
1361 ;; trying if the directory is read-only (bug#8954).
1362 (file-writable-p (file-name-directory buffer-file-name)))
1363 (with-demoted-errors
1364 (flymake-start-syntax-check))))))
1361 1365
1362 ;; Turning the mode OFF. 1366 ;; Turning the mode OFF.
1363 (t 1367 (t
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 89450cd2276..1be74ff544b 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -375,9 +375,8 @@ Emacs always switches to the thread which caused the stop."
375 :version "23.2" 375 :version "23.2"
376 :link '(info-link "(gdb)GDB/MI Async Records")) 376 :link '(info-link "(gdb)GDB/MI Async Records"))
377 377
378(defcustom gdb-stopped-hooks nil 378(defcustom gdb-stopped-functions nil
379 "This variable holds a list of functions to be called whenever 379 "List of functions called whenever GDB stops.
380GDB stops.
381 380
382Each function takes one argument, a parsed MI response, which 381Each function takes one argument, a parsed MI response, which
383contains fields of corresponding MI *stopped async record: 382contains fields of corresponding MI *stopped async record:
@@ -818,6 +817,8 @@ detailed description of this mode.
818 nil 'local) 817 nil 'local)
819 (local-set-key "\C-i" 'completion-at-point) 818 (local-set-key "\C-i" 'completion-at-point)
820 819
820 (local-set-key [remap comint-delchar-or-maybe-eof] 'gdb-delchar-or-quit)
821
821 (setq gdb-first-prompt t) 822 (setq gdb-first-prompt t)
822 (setq gud-running nil) 823 (setq gud-running nil)
823 824
@@ -859,15 +860,8 @@ detailed description of this mode.
859 860
860 (gdb-get-buffer-create 'gdb-inferior-io) 861 (gdb-get-buffer-create 'gdb-inferior-io)
861 (gdb-clear-inferior-io) 862 (gdb-clear-inferior-io)
862 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) 863 (gdb-inferior-io--init-proc (get-process "gdb-inferior"))
863 (gdb-input 864
864 ;; Needs GDB 6.4 onwards
865 (concat "-inferior-tty-set "
866 (or
867 ;; The process can run on a remote host.
868 (process-get (get-process "gdb-inferior") 'remote-tty)
869 (process-tty-name (get-process "gdb-inferior"))))
870 'ignore)
871 (if (eq window-system 'w32) 865 (if (eq window-system 'w32)
872 (gdb-input "-gdb-set new-console off" 'ignore)) 866 (gdb-input "-gdb-set new-console off" 'ignore))
873 (gdb-input "-gdb-set height 0" 'ignore) 867 (gdb-input "-gdb-set height 0" 'ignore)
@@ -905,6 +899,25 @@ detailed description of this mode.
905 (setq gdb-non-stop nil) 899 (setq gdb-non-stop nil)
906 (gdb-input "-gdb-set non-stop 0" 'ignore))) 900 (gdb-input "-gdb-set non-stop 0" 'ignore)))
907 901
902(defun gdb-delchar-or-quit (arg)
903 "Delete ARG characters or send a quit command to GDB.
904Send a quit only if point is at the end of the buffer, there is
905no input, and GDB is waiting for input."
906 (interactive "p")
907 (unless (and (eq (current-buffer) gud-comint-buffer)
908 (eq gud-minor-mode 'gdbmi))
909 (error "Not in a GDB-MI buffer"))
910 (let ((proc (get-buffer-process gud-comint-buffer)))
911 (if (and (eobp) proc (process-live-p proc)
912 (not gud-running)
913 (= (point) (marker-position (process-mark proc))))
914 ;; Sending an EOF does not work with GDB-MI; submit an
915 ;; explicit quit command.
916 (progn
917 (insert "quit")
918 (comint-send-input t t))
919 (delete-char arg))))
920
908(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") 921(defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.")
909 922
910(defun gdb-create-define-alist () 923(defun gdb-create-define-alist ()
@@ -929,7 +942,6 @@ detailed description of this mode.
929 (push (cons name define) gdb-define-alist)))) 942 (push (cons name define) gdb-define-alist))))
930 943
931(declare-function tooltip-show "tooltip" (text &optional use-echo-area)) 944(declare-function tooltip-show "tooltip" (text &optional use-echo-area))
932(defvar tooltip-use-echo-area)
933 945
934(defun gdb-tooltip-print (expr) 946(defun gdb-tooltip-print (expr)
935 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) 947 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
@@ -937,7 +949,7 @@ detailed description of this mode.
937 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t) 949 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t)
938 (tooltip-show 950 (tooltip-show
939 (concat expr " = " (read (match-string 1))) 951 (concat expr " = " (read (match-string 1)))
940 (or gud-tooltip-echo-area tooltip-use-echo-area 952 (or gud-tooltip-echo-area
941 (not (display-graphic-p))))))) 953 (not (display-graphic-p)))))))
942 954
943;; If expr is a macro for a function don't print because of possible dangerous 955;; If expr is a macro for a function don't print because of possible dangerous
@@ -1056,7 +1068,7 @@ positive, otherwise don't automatically raise it."
1056 (if gdb-speedbar-auto-raise "en" "dis")))) 1068 (if gdb-speedbar-auto-raise "en" "dis"))))
1057 1069
1058(define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch) 1070(define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch)
1059(define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch) 1071(define-key global-map (vconcat gud-key-prefix "\C-w") 'gud-watch)
1060 1072
1061(declare-function tooltip-identifier-from-point "tooltip" (point)) 1073(declare-function tooltip-identifier-from-point "tooltip" (point))
1062 1074
@@ -1510,6 +1522,31 @@ DOC is an optional documentation string."
1510 (gdb-display-buffer 1522 (gdb-display-buffer
1511 (gdb-get-buffer-create 'gdb-inferior-io) t)) 1523 (gdb-get-buffer-create 'gdb-inferior-io) t))
1512 1524
1525(defun gdb-inferior-io--init-proc (proc)
1526 ;; Set up inferior I/O. Needs GDB 6.4 onwards.
1527 (set-process-filter proc 'gdb-inferior-filter)
1528 (set-process-sentinel proc 'gdb-inferior-io-sentinel)
1529 (gdb-input
1530 (concat "-inferior-tty-set "
1531 ;; The process can run on a remote host.
1532 (or (process-get proc 'remote-tty)
1533 (process-tty-name proc)))
1534 'ignore))
1535
1536(defun gdb-inferior-io-sentinel (proc str)
1537 (when (eq (process-status proc) 'failed)
1538 ;; When the debugged process exits, Emacs gets an EIO error on
1539 ;; read from the pty, and stops listening to it. If the gdb
1540 ;; process is still running, remove the pty, make a new one, and
1541 ;; pass it to gdb.
1542 (let ((gdb-proc (get-buffer-process gud-comint-buffer))
1543 (io-buffer (process-buffer proc)))
1544 (when (and gdb-proc (process-live-p gdb-proc)
1545 (buffer-live-p io-buffer))
1546 ;; `comint-exec' deletes the original process as a side effect.
1547 (comint-exec io-buffer "gdb-inferior" nil nil nil)
1548 (gdb-inferior-io--init-proc (get-buffer-process io-buffer))))))
1549
1513(defconst gdb-frame-parameters 1550(defconst gdb-frame-parameters
1514 '((height . 14) (width . 80) 1551 '((height . 14) (width . 80)
1515 (unsplittable . t) 1552 (unsplittable . t)
@@ -1746,24 +1783,27 @@ If `gdb-thread-number' is nil, just wrap NAME in asterisks."
1746 (setq gdb-output-sink 'user) 1783 (setq gdb-output-sink 'user)
1747 (setq gdb-pending-triggers nil)) 1784 (setq gdb-pending-triggers nil))
1748 1785
1749(defun gdb-update () 1786(defun gdb-update (&optional no-proc)
1750 "Update buffers showing status of debug session." 1787 "Update buffers showing status of debug session.
1788If NO-PROC is non-nil, do not try to contact the GDB process."
1751 (when gdb-first-prompt 1789 (when gdb-first-prompt
1752 (gdb-force-mode-line-update 1790 (gdb-force-mode-line-update
1753 (propertize "initializing..." 'face font-lock-variable-name-face)) 1791 (propertize "initializing..." 'face font-lock-variable-name-face))
1754 (gdb-init-1) 1792 (gdb-init-1)
1755 (setq gdb-first-prompt nil)) 1793 (setq gdb-first-prompt nil))
1756 1794
1757 (gdb-get-main-selected-frame) 1795 (unless no-proc
1796 (gdb-get-main-selected-frame))
1797
1758 ;; We may need to update gdb-threads-list so we can use 1798 ;; We may need to update gdb-threads-list so we can use
1759 (gdb-get-buffer-create 'gdb-threads-buffer) 1799 (gdb-get-buffer-create 'gdb-threads-buffer)
1760 ;; gdb-break-list is maintained in breakpoints handler 1800 ;; gdb-break-list is maintained in breakpoints handler
1761 (gdb-get-buffer-create 'gdb-breakpoints-buffer) 1801 (gdb-get-buffer-create 'gdb-breakpoints-buffer)
1762 1802
1763 (gdb-emit-signal gdb-buf-publisher 'update) 1803 (unless no-proc
1804 (gdb-emit-signal gdb-buf-publisher 'update))
1764 1805
1765 (gdb-get-changed-registers) 1806 (gdb-get-changed-registers)
1766
1767 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) 1807 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
1768 (dolist (var gdb-var-list) 1808 (dolist (var gdb-var-list)
1769 (setcar (nthcdr 5 var) nil)) 1809 (setcar (nthcdr 5 var) nil))
@@ -2045,7 +2085,7 @@ current thread and update GDB buffers."
2045 ;; In all-stop this updates gud-running properly as well. 2085 ;; In all-stop this updates gud-running properly as well.
2046 (gdb-update) 2086 (gdb-update)
2047 (setq gdb-first-done-or-error nil)) 2087 (setq gdb-first-done-or-error nil))
2048 (run-hook-with-args 'gdb-stopped-hooks result))) 2088 (run-hook-with-args 'gdb-stopped-functions result)))
2049 2089
2050;; Remove the trimmings from log stream containing debugging messages 2090;; Remove the trimmings from log stream containing debugging messages
2051;; being produced by GDB's internals, use warning face and send to GUD 2091;; being produced by GDB's internals, use warning face and send to GUD
@@ -2085,23 +2125,28 @@ current thread and update GDB buffers."
2085 (setq gdb-output-sink 'emacs)) 2125 (setq gdb-output-sink 'emacs))
2086 2126
2087 (gdb-clear-partial-output) 2127 (gdb-clear-partial-output)
2088 (when gdb-first-done-or-error
2089 (unless (or token-number gud-running)
2090 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
2091 (gdb-update)
2092 (setq gdb-first-done-or-error nil))
2093 2128
2094 (setq gdb-filter-output 2129 ;; The process may already be dead (e.g. C-d at the gdb prompt).
2095 (gdb-concat-output gdb-filter-output output-field)) 2130 (let* ((proc (get-buffer-process gud-comint-buffer))
2131 (no-proc (or (null proc)
2132 (memq (process-status proc) '(exit signal)))))
2096 2133
2097 (if token-number 2134 (when gdb-first-done-or-error
2098 (progn 2135 (unless (or token-number gud-running no-proc)
2099 (with-current-buffer 2136 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
2100 (gdb-get-buffer-create 'gdb-partial-output-buffer) 2137 (gdb-update no-proc)
2101 (funcall 2138 (setq gdb-first-done-or-error nil))
2102 (cdr (assoc (string-to-number token-number) gdb-handler-alist)))) 2139
2103 (setq gdb-handler-alist 2140 (setq gdb-filter-output
2104 (assq-delete-all token-number gdb-handler-alist))))) 2141 (gdb-concat-output gdb-filter-output output-field))
2142
2143 (when token-number
2144 (with-current-buffer
2145 (gdb-get-buffer-create 'gdb-partial-output-buffer)
2146 (funcall
2147 (cdr (assoc (string-to-number token-number) gdb-handler-alist))))
2148 (setq gdb-handler-alist
2149 (assq-delete-all token-number gdb-handler-alist)))))
2105 2150
2106(defun gdb-concat-output (so-far new) 2151(defun gdb-concat-output (so-far new)
2107 (cond 2152 (cond
@@ -4105,9 +4150,15 @@ This arrangement depends on the value of `gdb-many-windows'."
4105 (gud-find-file gdb-main-file))) 4150 (gud-find-file gdb-main-file)))
4106 (setq gdb-source-window win))))) 4151 (setq gdb-source-window win)))))
4107 4152
4153;; Called from `gud-sentinel' in gud.el:
4108(defun gdb-reset () 4154(defun gdb-reset ()
4109 "Exit a debugging session cleanly. 4155 "Exit a debugging session cleanly.
4110Kills the gdb buffers, and resets variables and the source buffers." 4156Kills the gdb buffers, and resets variables and the source buffers."
4157 ;; The gdb-inferior buffer has a pty hooked up to the main gdb
4158 ;; process. This pty must be deleted explicitly.
4159 (let ((pty (get-process "gdb-inferior")))
4160 (if pty (delete-process pty)))
4161 ;; Find gdb-mi buffers and kill them.
4111 (dolist (buffer (buffer-list)) 4162 (dolist (buffer (buffer-list))
4112 (unless (eq buffer gud-comint-buffer) 4163 (unless (eq buffer gud-comint-buffer)
4113 (with-current-buffer buffer 4164 (with-current-buffer buffer
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d41364547f2..a6ae42f86b1 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -728,9 +728,9 @@ This function is called from `compilation-filter-hook'."
728(defun grep (command-args) 728(defun grep (command-args)
729 "Run grep, with user-specified args, and collect output in a buffer. 729 "Run grep, with user-specified args, and collect output in a buffer.
730While grep runs asynchronously, you can use \\[next-error] (M-x next-error), 730While grep runs asynchronously, you can use \\[next-error] (M-x next-error),
731or \\<grep-mode-map>\\[compile-goto-error] in the grep \ 731or \\<grep-mode-map>\\[compile-goto-error] in the *grep* \
732output buffer, to go to the lines where grep 732buffer, to go to the lines where grep found
733found matches. 733matches. To kill the grep job before it finishes, type \\[kill-compilation].
734 734
735For doing a recursive `grep', see the `rgrep' command. For running 735For doing a recursive `grep', see the `rgrep' command. For running
736`grep' in a specific directory, see `lgrep'. 736`grep' in a specific directory, see `lgrep'.
@@ -957,10 +957,11 @@ With \\[universal-argument] prefix, you can edit the constructed shell command l
957before it is executed. 957before it is executed.
958With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'. 958With two \\[universal-argument] prefixes, directly edit and run `grep-find-command'.
959 959
960Collect output in a buffer. While find runs asynchronously, you 960Collect output in a buffer. While the recursive grep is running,
961can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \ 961you can use \\[next-error] (M-x next-error), or \\<grep-mode-map>\\[compile-goto-error] \
962in the grep output buffer, 962in the grep output buffer,
963to go to the lines where grep found matches. 963to visit the lines where matches were found. To kill the job
964before it finishes, type \\[kill-compilation].
964 965
965This command shares argument histories with \\[lgrep] and \\[grep-find]. 966This command shares argument histories with \\[lgrep] and \\[grep-find].
966 967
@@ -1024,7 +1025,8 @@ to specify a command to run."
1024 (shell-quote-argument ")") 1025 (shell-quote-argument ")")
1025 " -prune -o ")) 1026 " -prune -o "))
1026 (and grep-find-ignored-files 1027 (and grep-find-ignored-files
1027 (concat (shell-quote-argument "(") 1028 (concat (shell-quote-argument "!") " -type d "
1029 (shell-quote-argument "(")
1028 ;; we should use shell-quote-argument here 1030 ;; we should use shell-quote-argument here
1029 " -name " 1031 " -name "
1030 (mapconcat 1032 (mapconcat
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 6b1f891b230..1f60c351252 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -66,10 +66,10 @@ Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python) and jdb."
66 66
67(defcustom gud-key-prefix "\C-x\C-a" 67(defcustom gud-key-prefix "\C-x\C-a"
68 "Prefix of all GUD commands valid in C buffers." 68 "Prefix of all GUD commands valid in C buffers."
69 :type 'string 69 :type 'key-sequence
70 :group 'gud) 70 :group 'gud)
71 71
72(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh) 72(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh)
73(define-key ctl-x-map " " 'gud-break) ;; backward compatibility hack 73(define-key ctl-x-map " " 'gud-break) ;; backward compatibility hack
74 74
75(defvar gud-marker-filter nil) 75(defvar gud-marker-filter nil)
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index e2016e206a8..b6d2b5e319c 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -802,12 +802,15 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments."
802 (forward-comment (point-max))) 802 (forward-comment (point-max)))
803 (re-search-forward re (point-max) t)) 803 (re-search-forward re (point-max) t))
804 (if (match-beginning 1) 804 (if (match-beginning 1)
805 ;; we have found a block beginning 805 ;; We have found a block beginning.
806 (progn 806 (progn
807 (goto-char (match-beginning 1)) 807 (goto-char (match-beginning 1))
808 (if hs-hide-all-non-comment-function 808 (unless (if hs-hide-all-non-comment-function
809 (funcall hs-hide-all-non-comment-function) 809 (funcall hs-hide-all-non-comment-function)
810 (hs-hide-block-at-point t))) 810 (hs-hide-block-at-point t))
811 ;; Go to end of matched data to prevent from getting stuck
812 ;; with an endless loop.
813 (goto-char (match-end 0))))
811 ;; found a comment, probably 814 ;; found a comment, probably
812 (let ((c-reg (hs-inside-comment-p))) 815 (let ((c-reg (hs-inside-comment-p)))
813 (when (and c-reg (car c-reg)) 816 (when (and c-reg (car c-reg))
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index aab5f8f65a4..9df9943cc00 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -1,6 +1,6 @@
1;;; perl-mode.el --- Perl code editing commands for GNU Emacs 1;;; perl-mode.el --- Perl code editing commands for GNU Emacs
2 2
3;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc.
4 4
5;; Author: William F. Mann 5;; Author: William F. Mann
6;; Maintainer: FSF 6;; Maintainer: FSF
@@ -133,11 +133,6 @@
133 map) 133 map)
134 "Keymap used in Perl mode.") 134 "Keymap used in Perl mode.")
135 135
136(autoload 'c-macro-expand "cmacexp"
137 "Display the result of expanding all C macros occurring in the region.
138The expansion is entirely correct because it uses the C preprocessor."
139 t)
140
141(defvar perl-mode-syntax-table 136(defvar perl-mode-syntax-table
142 (let ((st (make-syntax-table (standard-syntax-table)))) 137 (let ((st (make-syntax-table (standard-syntax-table))))
143 (modify-syntax-entry ?\n ">" st) 138 (modify-syntax-entry ?\n ">" st)
@@ -511,6 +506,14 @@ If nil, continued arguments are aligned with the first argument."
511 :type '(choice integer (const nil)) 506 :type '(choice integer (const nil))
512 :group 'perl) 507 :group 'perl)
513 508
509(defcustom perl-indent-parens-as-block nil
510 "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks.
511The closing bracket is aligned with the line of the opening bracket,
512not the contents of the brackets."
513 :version "24.2"
514 :type 'boolean
515 :group 'perl)
516
514(defcustom perl-tab-always-indent tab-always-indent 517(defcustom perl-tab-always-indent tab-always-indent
515 "Non-nil means TAB in Perl mode always indents the current line. 518 "Non-nil means TAB in Perl mode always indents the current line.
516Otherwise it inserts a tab character if you type it past the first 519Otherwise it inserts a tab character if you type it past the first
@@ -853,7 +856,8 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'."
853 (cond ((nth 3 state) 'noindent) ; In a quoted string? 856 (cond ((nth 3 state) 'noindent) ; In a quoted string?
854 ((null containing-sexp) ; Line is at top level. 857 ((null containing-sexp) ; Line is at top level.
855 (skip-chars-forward " \t\f") 858 (skip-chars-forward " \t\f")
856 (if (= (following-char) ?{) 859 (if (memq (following-char)
860 (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{)))
857 0 ; move to beginning of line if it starts a function body 861 0 ; move to beginning of line if it starts a function body
858 ;; indent a little if this is a continuation line 862 ;; indent a little if this is a continuation line
859 (perl-backward-to-noncomment) 863 (perl-backward-to-noncomment)
@@ -897,7 +901,9 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'."
897 0 perl-continued-statement-offset) 901 0 perl-continued-statement-offset)
898 (current-column) 902 (current-column)
899 (if (save-excursion (goto-char indent-point) 903 (if (save-excursion (goto-char indent-point)
900 (looking-at "[ \t]*{")) 904 (looking-at
905 (if perl-indent-parens-as-block
906 "[ \t]*[{(\[]" "[ \t]*{")))
901 perl-continued-brace-offset 0))) 907 perl-continued-brace-offset 0)))
902 ;; This line starts a new statement. 908 ;; This line starts a new statement.
903 ;; Position at last unclosed open. 909 ;; Position at last unclosed open.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f7566c31b41..2922330e6f9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -69,11 +69,7 @@
69(require 'comint) 69(require 'comint)
70(require 'ansi-color) 70(require 'ansi-color)
71 71
72(eval-when-compile 72(eval-when-compile (require 'compile))
73 (require 'compile)
74 (require 'hippie-exp))
75
76(autoload 'comint-mode "comint")
77 73
78(defgroup python nil 74(defgroup python nil
79 "Silly walks in the Python language." 75 "Silly walks in the Python language."
@@ -1488,8 +1484,6 @@ Don't save anything for STR matching `inferior-python-filter-regexp'."
1488 res) 1484 res)
1489 (t (concat res s))))) 1485 (t (concat res s)))))
1490 1486
1491(autoload 'comint-check-proc "comint")
1492
1493(defvar python-version-checked nil) 1487(defvar python-version-checked nil)
1494(defun python-check-version (cmd) 1488(defun python-check-version (cmd)
1495 "Check that CMD runs a suitable version of Python." 1489 "Check that CMD runs a suitable version of Python."
@@ -1684,8 +1678,6 @@ value to determine defaults."
1684 "Caches (directory . file) pair used in the last `python-load-file' command. 1678 "Caches (directory . file) pair used in the last `python-load-file' command.
1685Used for determining the default in the next one.") 1679Used for determining the default in the next one.")
1686 1680
1687(autoload 'comint-get-source "comint")
1688
1689(defun python-load-file (file-name) 1681(defun python-load-file (file-name)
1690 "Load a Python file FILE-NAME into the inferior Python process. 1682 "Load a Python file FILE-NAME into the inferior Python process.
1691If the file has extension `.py' import or reload it as a module. 1683If the file has extension `.py' import or reload it as a module.
@@ -1776,7 +1768,7 @@ will."
1776 ;; allow C-c C-f in help buffer. 1768 ;; allow C-c C-f in help buffer.
1777 (let ((temp-buffer-show-hook ; avoid xref stuff 1769 (let ((temp-buffer-show-hook ; avoid xref stuff
1778 (lambda () 1770 (lambda ()
1779 (toggle-read-only 1) 1771 (setq buffer-read-only t)
1780 (setq view-return-to-alist 1772 (setq view-return-to-alist
1781 (list (cons (selected-window) help-return-method)))))) 1773 (list (cons (selected-window) help-return-method))))))
1782 (with-output-to-temp-buffer (help-buffer) 1774 (with-output-to-temp-buffer (help-buffer)
@@ -1959,7 +1951,7 @@ the string's indentation."
1959 ;; paragraph in a multi-line string properly, so narrow 1951 ;; paragraph in a multi-line string properly, so narrow
1960 ;; to the string and then fill around (the end of) the 1952 ;; to the string and then fill around (the end of) the
1961 ;; current line. 1953 ;; current line.
1962 ((eq t (nth 3 syntax)) ; in fenced string 1954 ((nth 3 syntax) ; in fenced string
1963 (goto-char (nth 8 syntax)) ; string start 1955 (goto-char (nth 8 syntax)) ; string start
1964 (setq start (line-beginning-position)) 1956 (setq start (line-beginning-position))
1965 (setq end (condition-case () ; for unbalanced quotes 1957 (setq end (condition-case () ; for unbalanced quotes
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index c8ef8f0324c..0139795dd38 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -3592,7 +3592,7 @@ Key bindings specific to `verilog-mode-map' are:
3592 (set (make-local-variable 'imenu-generic-expression) 3592 (set (make-local-variable 'imenu-generic-expression)
3593 verilog-imenu-generic-expression) 3593 verilog-imenu-generic-expression)
3594 ;; Tell which-func-modes that imenu knows about verilog 3594 ;; Tell which-func-modes that imenu knows about verilog
3595 (when (boundp 'which-func-modes) 3595 (when (and (boundp 'which-func-modes) (listp which-func-modes))
3596 (add-to-list 'which-func-modes 'verilog-mode)) 3596 (add-to-list 'which-func-modes 'verilog-mode))
3597 ;; hideshow support 3597 ;; hideshow support
3598 (when (boundp 'hs-special-modes-alist) 3598 (when (boundp 'hs-special-modes-alist)
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 721c610517a..c8435c14ea2 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -1,6 +1,6 @@
1;;; which-func.el --- print current function in mode line 1;;; which-func.el --- print current function in mode line
2 2
3;; Copyright (C) 1994, 1997-1998, 2001-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1997-1998, 2001-2012 Free Software Foundation, Inc.
4 4
5;; Author: Alex Rezinsky <alexr@msil.sps.mot.com> 5;; Author: Alex Rezinsky <alexr@msil.sps.mot.com>
6;; (doesn't seem to be responsive any more) 6;; (doesn't seem to be responsive any more)
@@ -72,14 +72,15 @@
72 :group 'tools 72 :group 'tools
73 :version "20.3") 73 :version "20.3")
74 74
75(defcustom which-func-modes 75(defcustom which-func-modes t
76 '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode python-mode 76 ;; '(emacs-lisp-mode c-mode c++-mode objc-mode perl-mode cperl-mode python-mode
77 makefile-mode sh-mode fortran-mode f90-mode ada-mode 77 ;; makefile-mode sh-mode fortran-mode f90-mode ada-mode
78 diff-mode) 78 ;; diff-mode)
79 "List of major modes for which Which Function mode should be used. 79 "List of major modes for which Which Function mode should be used.
80For other modes it is disabled. If this is equal to t, 80For other modes it is disabled. If this is equal to t,
81then Which Function mode is enabled in any major mode that supports it." 81then Which Function mode is enabled in any major mode that supports it."
82 :group 'which-func 82 :group 'which-func
83 :version "24.2" ; explicit list -> t
83 :type '(choice (const :tag "All modes" t) 84 :type '(choice (const :tag "All modes" t)
84 (repeat (symbol :tag "Major mode")))) 85 (repeat (symbol :tag "Major mode"))))
85 86