Any way for Xemacs to track directories with spaces?

Karr, David David.Karr at wamu.net
Thu Feb 12 13:17:56 EST 2004


My first thought was that it's unfortunate it handles quotes, but not "\
", which is how the shell completes directories with spaces.  I figured,
however, that this is better than nothing.  Unfortunately, I find that
this doesn't work.  It looks like it would, but it still fails with
"couldn't cd".  Using edebug, I stepped through
"shell-directory-tracker" and the advice, and the advice appeared to
properly strip out the embedded quotes, but then after I stepped out of
the advice, the next message area info I saw was "couldn't cd".

-----Original Message-----
From: Jeff Mincy [mailto:jeff at delphioutpost.com] 
Sent: Thursday, February 12, 2004 9:25 AM
To: Karr, David
Cc: XEmacs Beta List
Subject: Re: Any way for Xemacs to track directories with spaces?


On Thu, 12 Feb 2004, david.karr at wamu.net wrote:

> I briefly looked in the FAQ for this, but I didn't find it.
> 
> Is there anyway to get shell buffers (running bash) and Xemacs to 
> understand directories with spaces in them?  If I "cd" to a directory,

> either putting the directory in quotes, or escaping the space, bash 
> deals with that fine, but Xemacs is unable to track that.


This advice below handles
  bash% cd "Program Files" 
but not 
  bash% cd Program\ Files

Add to your init file.


;;****************************************************************
;; SHELL-PROCESS-CD, PUSHD
;;  Strip quotes from filename argument so that cd "/Program Files"
works.
;;****************************************************************
(defadvice shell-process-cd (before strip-quotes first activate)
  "jwm: Strip quotes from filename"
  (if (and (> (length arg) 2)
           (eql (aref arg 0) ?\")
           (eql (aref arg (1- (length arg))) ?\"))
      (setq arg (subseq arg 1 (- (length arg) 1)))))
(defadvice shell-process-pushd (before strip-quotes first activate)
  "jwm: Strip quotes from filename"
  (if (and (> (length arg) 2)
           (eql (aref arg 0) ?\")
           (eql (aref arg (1- (length arg))) ?\"))
      (setq arg (subseq arg 1 (- (length arg) 1)))))




More information about the XEmacs-Beta mailing list