emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103595: gdb-mi addition for bug#7889


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103595: gdb-mi addition for bug#7889.
Date: Wed, 09 Mar 2011 00:43:27 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103595
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-03-09 00:43:27 -0800
message:
  gdb-mi addition for bug#7889.
  
  * lisp/progmodes/gdb-mi.el (gdb): Improve 2010-12-08 change.
  Check for GDBHISTFILE, HISTSIZE, etc.
modified:
  lisp/ChangeLog
  lisp/progmodes/gdb-mi.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-08 17:11:19 +0000
+++ b/lisp/ChangeLog    2011-03-09 08:43:27 +0000
@@ -1,3 +1,8 @@
+2011-03-09  Glenn Morris  <address@hidden>
+
+       * progmodes/gdb-mi.el (gdb): Improve 2010-12-08 change.
+       Check for GDBHISTFILE, HISTSIZE, etc.  (Bug#7889)
+
 2011-03-08  Chong Yidong  <address@hidden>
 
        * emacs-lisp/package.el (package-refresh-contents)

=== modified file 'lisp/progmodes/gdb-mi.el'
--- a/lisp/progmodes/gdb-mi.el  2011-02-10 16:56:00 +0000
+++ b/lisp/progmodes/gdb-mi.el  2011-03-09 08:43:27 +0000
@@ -648,21 +648,34 @@
   (set (make-local-variable 'gud-minor-mode) 'gdbmi)
   (setq comint-input-sender 'gdb-send)
   (when (ring-empty-p comint-input-ring) ; cf shell-mode
-    (let (hfile)
-      (when (catch 'done
-             (dolist (file '(".gdbinit" "~/.gdbinit"))
-               (if (file-readable-p (setq file (expand-file-name file)))
-                   (with-temp-buffer
-                     (insert-file-contents file)
-                     (and (re-search-forward
-                           "^ *set history filename  *\\(.*\\)" nil t)
-                          (file-readable-p
-                           (setq hfile (expand-file-name
-                                        (match-string 1)
-                                        (file-name-directory file))))
-                          (throw 'done t))))))
-       (set (make-local-variable 'comint-input-ring-file-name) hfile)
-       (comint-read-input-ring t))))
+    (let ((hfile (expand-file-name (or (getenv "GBDHISTFILE")
+                                      (if (eq system-type 'ms-dos)
+                                          "_gdb_history"
+                                        ".gdb_history"))))
+         ;; gdb defaults to 256, but we'll default to comint-input-ring-size.
+         (hsize (getenv "HISTSIZE")))
+      (dolist (file (append '("~/.gdbinit")
+                           (unless (string-equal (expand-file-name ".")
+                                             (expand-file-name "~"))
+                             '(".gdbinit"))))
+       (if (file-readable-p (setq file (expand-file-name file)))
+           (with-temp-buffer
+             (insert-file-contents file)
+             ;; TODO? check for "set history save\\(  *on\\)?" and do
+             ;; not use history otherwise?
+             (while (re-search-forward
+                     "^ *set history \\(filename\\|size\\)  *\\(.*\\)" nil t)
+               (cond ((string-equal (match-string 1) "filename")
+                      (setq hfile (expand-file-name
+                                   (match-string 2)
+                                   (file-name-directory file))))
+                     ((string-equal (match-string 1) "size")
+                      (setq hsize (match-string 2))))))))
+      (if (integerp hsize)
+         (set (make-local-variable 'comint-input-ring-size) hsize))
+      (if (stringp hfile)
+         (set (make-local-variable 'comint-input-ring-file-name) hfile))
+      (comint-read-input-ring t)))
   (gud-def gud-tbreak "tbreak %f:%l" "\C-t"
           "Set temporary breakpoint at current line.")
   (gud-def gud-jump


reply via email to

[Prev in Thread] Current Thread [Next in Thread]