aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorChong Yidong2012-04-27 11:10:38 +0800
committerChong Yidong2012-04-27 11:10:38 +0800
commita8e7d6d783219972c08fd49a3a2afaf26eb139c2 (patch)
tree5e86d23d9285389791dc8321d8a8a2ece2247bea /lisp/progmodes
parentb360839071ef6c7a9e917fe57a4aaeb39138e8c0 (diff)
parentc5bb756916baa63cc663d68d4c24e5ad33a764e8 (diff)
downloademacs-a8e7d6d783219972c08fd49a3a2afaf26eb139c2.tar.gz
emacs-a8e7d6d783219972c08fd49a3a2afaf26eb139c2.zip
Merge changes from emacs-24 branch
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/gdb-mi.el30
-rw-r--r--lisp/progmodes/which-func.el4
2 files changed, 29 insertions, 5 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 9f9551cc5d8..0cc5de90573 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -603,6 +603,8 @@ NOARG must be t when this macro is used outside `gud-def'"
603 (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter)) 603 (set (make-local-variable 'gud-marker-filter) #'gud-gdb-marker-filter))
604 (funcall filter proc string)))) 604 (funcall filter proc string))))
605 605
606(defvar gdb-control-level 0)
607
606;;;###autoload 608;;;###autoload
607(defun gdb (command-line) 609(defun gdb (command-line)
608 "Run gdb on program FILE in buffer *gud-FILE*. 610 "Run gdb on program FILE in buffer *gud-FILE*.
@@ -677,6 +679,7 @@ detailed description of this mode.
677 (set-process-filter proc #'gdb--check-interpreter)) 679 (set-process-filter proc #'gdb--check-interpreter))
678 680
679 (set (make-local-variable 'gud-minor-mode) 'gdbmi) 681 (set (make-local-variable 'gud-minor-mode) 'gdbmi)
682 (set (make-local-variable 'gdb-control-level) 0)
680 (setq comint-input-sender 'gdb-send) 683 (setq comint-input-sender 'gdb-send)
681 (when (ring-empty-p comint-input-ring) ; cf shell-mode 684 (when (ring-empty-p comint-input-ring) ; cf shell-mode
682 (let ((hfile (expand-file-name (or (getenv "GDBHISTFILE") 685 (let ((hfile (expand-file-name (or (getenv "GDBHISTFILE")
@@ -1705,6 +1708,16 @@ static char *magick[] = {
1705 :group 'gdb) 1708 :group 'gdb)
1706 1709
1707 1710
1711(defvar gdb-control-commands-regexp
1712 (concat
1713 "^\\("
1714 "commands\\|if\\|while\\|define\\|document\\|python\\|"
1715 "while-stepping\\|stepping\\|ws\\|actions"
1716 "\\)\\([[:blank:]]+.*\\)?$")
1717 "Regexp matching GDB commands that enter a recursive reading loop.
1718As long as GDB is in the recursive reading loop, it does not expect
1719commands to be prefixed by \"-interpreter-exec console\".")
1720
1708(defun gdb-send (proc string) 1721(defun gdb-send (proc string)
1709 "A comint send filter for gdb." 1722 "A comint send filter for gdb."
1710 (with-current-buffer gud-comint-buffer 1723 (with-current-buffer gud-comint-buffer
@@ -1714,11 +1727,15 @@ static char *magick[] = {
1714 (if (not (string= "" string)) 1727 (if (not (string= "" string))
1715 (setq gdb-last-command string) 1728 (setq gdb-last-command string)
1716 (if gdb-last-command (setq string gdb-last-command))) 1729 (if gdb-last-command (setq string gdb-last-command)))
1717 (if (string-match "^-" string) 1730 (if (or (string-match "^-" string)
1718 ;; MI command 1731 (> gdb-control-level 0))
1732 ;; Either MI command or we are feeding GDB's recursive reading loop.
1719 (progn 1733 (progn
1720 (setq gdb-first-done-or-error t) 1734 (setq gdb-first-done-or-error t)
1721 (process-send-string proc (concat string "\n"))) 1735 (process-send-string proc (concat string "\n"))
1736 (if (and (string-match "^end$" string)
1737 (> gdb-control-level 0))
1738 (setq gdb-control-level (1- gdb-control-level))))
1722 ;; CLI command 1739 ;; CLI command
1723 (if (string-match "\\\\$" string) 1740 (if (string-match "\\\\$" string)
1724 (setq gdb-continuation (concat gdb-continuation string "\n")) 1741 (setq gdb-continuation (concat gdb-continuation string "\n"))
@@ -1729,7 +1746,12 @@ static char *magick[] = {
1729 (if gdb-enable-debug 1746 (if gdb-enable-debug
1730 (push (cons 'mi-send to-send) gdb-debug-log)) 1747 (push (cons 'mi-send to-send) gdb-debug-log))
1731 (process-send-string proc to-send)) 1748 (process-send-string proc to-send))
1732 (setq gdb-continuation nil)))) 1749 (if (and (string-match "^end$" string)
1750 (> gdb-control-level 0))
1751 (setq gdb-control-level (1- gdb-control-level)))
1752 (setq gdb-continuation nil)))
1753 (if (string-match gdb-control-commands-regexp string)
1754 (setq gdb-control-level (1+ gdb-control-level))))
1733 1755
1734(defun gdb-mi-quote (string) 1756(defun gdb-mi-quote (string)
1735 "Return STRING quoted properly as an MI argument. 1757 "Return STRING quoted properly as an MI argument.
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index cdaeadde906..d57a3128a16 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -179,7 +179,9 @@ and you want to simplify them for the mode line
179(defvar which-func-table (make-hash-table :test 'eq :weakness 'key)) 179(defvar which-func-table (make-hash-table :test 'eq :weakness 'key))
180 180
181(defconst which-func-current 181(defconst which-func-current
182 '(:eval (gethash (selected-window) which-func-table which-func-unknown))) 182 '(:eval (replace-regexp-in-string
183 "%" "%%"
184 (gethash (selected-window) which-func-table which-func-unknown))))
183;;;###autoload (put 'which-func-current 'risky-local-variable t) 185;;;###autoload (put 'which-func-current 'risky-local-variable t)
184 186
185(defvar which-func-mode nil 187(defvar which-func-mode nil