[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Don't change default-directory in gud.el?
From: |
Klaus Zeitler |
Subject: |
Re: Don't change default-directory in gud.el? |
Date: |
Wed, 03 Nov 2004 08:29:17 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (usg-unix-v) |
>>>>> "Stefan" == Stefan <address@hidden> writes:
Stefan>
>> Currently, in gud.el, the default-directory of the GUD buffer gets set
>> from the pathname (if any) of the program to be debugged. This is not
>> consistent what happens if gdb is invoked from the command line, where
>> the working directory remains unchanged.
Stefan>
Stefan> I think the problem is not so much about whether Emacs does or
Stefan> doesn't do something, but about how much work is needed to get the
Stefan> other behavior. In the case of the chdir, it's actually
Stefan> surprisingly difficult to undo the chdir, so I completely agree
Stefan> that it should be removed.
Actually I think in most cases it's what the user wants, but since this
behavior has bothered me every once in a while, I've been using the following
modification for gud-common-init:
;; Set the dir, in case the buffer already existed with a different dir.
;; (setq default-directory dir)
(setq default-directory (or gud-default-directory dir))
with the following definitions for gud-default-directory:
(defvar gud-default-directory nil
"*Default directory for debugging process.
Note that the directory must end with a '/'.")
(defun gud-set-default-directory (dir)
"*Set a new default directory for debugger process."
(interactive
(list (read-file-name "GUD default directory: " nil default-directory t)))
(if (file-directory-p dir)
(message "%s" (setq gud-default-directory
(expand-file-name (file-name-as-directory dir))))
(message "Directory '%s' does not exist")))
(defun gud-show-default-directory ()
"*Show default directory for debugger process."
(interactive)
(message "GUD default directory: %s" gud-default-directory))
--
------------------------------------------
| Klaus Zeitler Lucent Technologies |
| Email: address@hidden |
------------------------------------------
---
Subtlety is the art of saying what you think and
getting out of the way before it is understood.