[ESS] [ESS-bugs] ess-mode 5.9.1; autocompletion of file path always uses initial working directory

Martin Maechler maechler at stat.math.ethz.ch
Fri Jun 4 12:06:10 CEST 2010


>>>>> "SE" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>>     on Fri, 04 Jun 2010 10:34:59 +0100 writes:

    >> Solution: Use `M-x ess-change-directory'.  This will prompt you for
    >> the directory to change to.  It will then change directory within the
    >> *S* buffer, and also update the emacs variable `default-directory'.
    >> Alternatively, if you have already executed setwd(), press `M-RET'
    >> within the *S* buffer so that Emacs can update `default-directory'.
    >> 

    SE> And just in case anyone is wondering 'why M-RET'?..

    SE> It is because XEmacs has had a similar facility in *shell* buffers bound
    SE> to that same key: shell-resync-dirs.

    SE> Emacs currently has a function called 'M-x dirs' which does the same
    SE> thing.  So you for Emacs users you can do:

     > (add-hook 'shell-mode-hook 'my-shell-hook)
     > (defun my-shell-hook ()
     >   " my hook to change local shell-mode-map."
     >   (define-key shell-mode-map (kbd "M-RET") 'dirs))

    SE> I'll get in touch with Emacs developers to see if this could be added to
    SE> Emacs, but in the meantime, the above should work.

Thank you very much, Stephen!

If you prefer anonymous functions {as in R !} to "my-.." functions
*and* want to use "that other feature", you can set the
shell-mode-hook as I do it now :

  (add-hook 'shell-mode-hook 
	    '(lambda() 
	       ;; a la Xemacs (maybe in future emacs ??):
	       (define-key shell-mode-map (kbd "M-RET") 'dirs)
	       ;; this enables "ls --color=auto"  to work in emacs *shell* etc:
	       (ansi-color-for-comint-mode-on)))

Martin



More information about the ESS-help mailing list