unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Sincronise eshell directory to file
@ 2008-11-13 10:52 Lorenzo Isella
  2008-11-13 11:36 ` Paul R
  2008-11-13 12:15 ` Peter Dyballa
  0 siblings, 2 replies; 5+ messages in thread
From: Lorenzo Isella @ 2008-11-13 10:52 UTC (permalink / raw)
  To: help-gnu-emacs

Dear All,
My typical working pattern in emacs is to have an eshell + a buffer
(showing one of the program I intend to modify).
I switch between several of these code buffers and it would be very
useful for me to automatically change directory (within eshell) to the
one corresponding to the file I am visiting though the buffer.
Does anyone know how this can be achieved?
Cheers

Lorenzo




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sincronise eshell directory to file
  2008-11-13 10:52 Lorenzo Isella
@ 2008-11-13 11:36 ` Paul R
  2008-11-13 12:15 ` Peter Dyballa
  1 sibling, 0 replies; 5+ messages in thread
From: Paul R @ 2008-11-13 11:36 UTC (permalink / raw)
  To: Lorenzo Isella; +Cc: help-gnu-emacs

Hello Lorenzo,

Lorenzo> Dear All, My typical working pattern in emacs is to have an
Lorenzo> eshell + a buffer (showing one of the program I intend to
Lorenzo> modify). I switch between several of these code buffers and it
Lorenzo> would be very useful for me to automatically change directory
Lorenzo> (within eshell) to the one corresponding to the file I am
Lorenzo> visiting though the buffer. Does anyone know how this can be
Lorenzo> achieved? Cheers

You can probably hack something like a custom command that you would
call from your current buffer. It would read `default-directory, then
take you to your eshell buffer and issue a `cd the_default-directory'.


-- 
  Paul




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sincronise eshell directory to file
  2008-11-13 10:52 Lorenzo Isella
  2008-11-13 11:36 ` Paul R
@ 2008-11-13 12:15 ` Peter Dyballa
  2008-11-13 17:29   ` Lorenzo Isella
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Dyballa @ 2008-11-13 12:15 UTC (permalink / raw)
  To: Lorenzo Isella; +Cc: help-gnu-emacs


Am 13.11.2008 um 11:52 schrieb Lorenzo Isella:

> I switch between several of these code buffers and it would be very
> useful for me to automatically change directory (within eshell) to the
> one corresponding to the file I am visiting though the buffer.


Could you imagine running N *eshell* buffers? Then you won't have to  
change directories ...

--
Greetings

   Pete

Email is a wonderful thing for people whose role in life is to be on  
top of things. But not for me; my role is to be on the bottom of  
things. What I do takes long hours of studying and uninterruptible  
concentration.
				– Donald Knuth







^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sincronise eshell directory to file
       [not found] <mailman.233.1226573539.26697.help-gnu-emacs@gnu.org>
@ 2008-11-13 14:57 ` Andreas Politz
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Politz @ 2008-11-13 14:57 UTC (permalink / raw)
  To: help-gnu-emacs

Lorenzo Isella wrote:
> Dear All,
> My typical working pattern in emacs is to have an eshell + a buffer
> (showing one of the program I intend to modify).
> I switch between several of these code buffers and it would be very
> useful for me to automatically change directory (within eshell) to the
> one corresponding to the file I am visiting though the buffer.
> Does anyone know how this can be achieved?
> Cheers
> 
> Lorenzo
> 
> 


Here is a basic solution which uses `window-configuration-change-hook'.
What's left is getting eshell to play along, change the prompt and
handle partial input for example.

(defun eshell-follow-dir-hook nil
   (when (not (eq major-mode 'eshell-mode))
     (let ((pwd default-directory))
       (walk-windows #'(lambda (win)
			(with-selected-window win
			  (when (and (eq major-mode 'eshell-mode)
				     (not (equal pwd default-directory)))
			    (cd pwd))))
		    'no-minibuffer))))

(add-hook 'window-configuration-change-hook 'eshell-follow-dir-hook)


-ap


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sincronise eshell directory to file
  2008-11-13 12:15 ` Peter Dyballa
@ 2008-11-13 17:29   ` Lorenzo Isella
  0 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Isella @ 2008-11-13 17:29 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

2008/11/13 Peter Dyballa <Peter_Dyballa@web.de>:
>
> Am 13.11.2008 um 11:52 schrieb Lorenzo Isella:
>
>> I switch between several of these code buffers and it would be very
>> useful for me to automatically change directory (within eshell) to the
>> one corresponding to the file I am visiting though the buffer.
>
>
> Could you imagine running N *eshell* buffers? Then you won't have to change
> directories ...
>

Well, if possible I would like to avoid the proliferation of buffers,
unless it is necessary.
Cheers

Lorenzo




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-11-13 17:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.233.1226573539.26697.help-gnu-emacs@gnu.org>
2008-11-13 14:57 ` Sincronise eshell directory to file Andreas Politz
2008-11-13 10:52 Lorenzo Isella
2008-11-13 11:36 ` Paul R
2008-11-13 12:15 ` Peter Dyballa
2008-11-13 17:29   ` Lorenzo Isella

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).