[Top][All Lists]

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

bug#7575: gdb command history saving

From: Pete Beardmore
Subject: bug#7575: gdb command history saving
Date: Thu, 2 Jun 2011 18:58:41 +0100
User-agent: Internet Messaging Program (IMP) H3 (4.3.6)

 Glen Morris wrote:

Glen Morris wrote:

You could add something like the following to gdb-mode-hook:

  (setq comint-input-ring-file-name "~/.gdbhist")
  (comint-read-input-ring t)

shell-mode tries to do this by default; perhaps gdb-mode should do

I've added this to M-x gdb.

Hi, sorry for the late come back and thank you for the comments. Could i ask whether you tested a w32 emacs version evoked from a MinGW/Msys bash prompt? My GNU/Linux emacs gdb history works out of the box so i still think this is a bug, possibly to do with file encodings?!

As a workaround, i started with the gdb-mode-hook you provided (thank you) and added a few more comint settings..

(add-hook 'gdb-mode-hook '(lambda()
                        (setq comint-input-ring-file-name "~/.gdbhist")
                        (comint-read-input-ring t)
                        (setq comint-input-ring-size 1000)
                        (setq comint-input-ignoredups t)

..but obviously this wouldn't solve the problem of not writing the commands back to the file after the session.

(add-hook 'kill-buffer-hook 'comint-write-input-ring)

..took care of the buffer being killed, but I also defined this advice to take care of quitting..

(defadvice gdb-send-item (before gdb-save-history first nil activate)
  "write input ring on quit"
(if (equal (type-of item) 'string) ; avoid problems with some horrible, seemingly unprintable structures sent to this function..
    (if (string-match "^q\\(u\\|ui\\|uit\\)?$" item)
       (progn (comint-write-input-ring)
      (message "history file '%s' written" comint-input-ring-file-name)))))


reply via email to

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