unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Klaus Zeitler <kzeitler@lucent.com>
Cc: Nick Roberts <nickrob@snap.net.nz>, emacs-devel@gnu.org
Subject: Re: Don't change default-directory in gud.el?
Date: Wed, 03 Nov 2004 08:29:17 +0100	[thread overview]
Message-ID: <q5gfz3rpf02.fsf@lucent.com> (raw)
In-Reply-To: <m1pt2vehb5.fsf-monnier+emacs@gnu.org> (Stefan's message of "Tue, 02 Nov 2004 22:37:00 -0500")

>>>>> "Stefan" == Stefan  <monnier@iro.umontreal.ca> 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:             kzeitler@lucent.com  |
 ------------------------------------------
---
Subtlety is the art of saying what you think and
getting out of the way before it is understood.

      reply	other threads:[~2004-11-03  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-03  0:49 Don't change default-directory in gud.el? Nick Roberts
2004-11-03  3:37 ` Stefan
2004-11-03  7:29   ` Klaus Zeitler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=q5gfz3rpf02.fsf@lucent.com \
    --to=kzeitler@lucent.com \
    --cc=emacs-devel@gnu.org \
    --cc=nickrob@snap.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).