unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* shell-current-directory - other window command needed
@ 2009-10-28 15:34 The Quiet Center
  2009-10-28 16:14 ` Andreas Politz
       [not found] ` <mailman.9631.1256746814.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: The Quiet Center @ 2009-10-28 15:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

shell-current-directory is an emacs package which allows one to create
a shell whose starting directory is the same as the buffer the command
'shell-current-directory' was invoked in.

The code for the command is here:
http://github.com/metaperl/emacs/blob/master/shell-current-directory.el#L92

What I would like to have is a command 'shell-current-directory-other-
window' which does the same thing, but opens the shell in the other-
window --- the window you would be in if you typed C-x o in the
current window.

I suppose one way to do it is to:
1 - save the current buffer (name?) as orig-buffer
2 - invoke shell-current-directory
3 - save the shell-buffer (name?) as new-shell-buffer
4 - switch-to-buffer orig-buffer
5 - other-window
6 - switch-to-buffer new-shell-buffer

But I am not quite adept enough at elisp to do this :)


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

* Re: shell-current-directory - other window command needed
  2009-10-28 15:34 shell-current-directory - other window command needed The Quiet Center
@ 2009-10-28 16:14 ` Andreas Politz
  2009-10-28 19:02   ` Peter Dyballa
       [not found] ` <mailman.9631.1256746814.2239.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Politz @ 2009-10-28 16:14 UTC (permalink / raw)
  To: help-gnu-emacs

The Quiet Center <thequietcenter@gmail.com> writes:

> Hello,
>
> shell-current-directory is an emacs package which allows one to create
> a shell whose starting directory is the same as the buffer the command
> 'shell-current-directory' was invoked in.
>
> The code for the command is here:
> http://github.com/metaperl/emacs/blob/master/shell-current-directory.el#L92
>
> What I would like to have is a command 'shell-current-directory-other-
> window' which does the same thing, but opens the shell in the other-
> window --- the window you would be in if you typed C-x o in the
> current window.
>
> I suppose one way to do it is to:
> 1 - save the current buffer (name?) as orig-buffer
> 2 - invoke shell-current-directory
> 3 - save the shell-buffer (name?) as new-shell-buffer
> 4 - switch-to-buffer orig-buffer
> 5 - other-window
> 6 - switch-to-buffer new-shell-buffer
>
> But I am not quite adept enough at elisp to do this :)

(let (buf)
  (save-window-excursion
    (shell-current-directory-whatever)
    (setq buf (current-buffer)))
  (pop-to-buffer buf))

  
I guess this will work.

-ap





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

* Re: shell-current-directory - other window command needed
  2009-10-28 16:14 ` Andreas Politz
@ 2009-10-28 19:02   ` Peter Dyballa
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Dyballa @ 2009-10-28 19:02 UTC (permalink / raw)
  To: Emacs Users


Am 28.10.2009 um 17:14 schrieb Andreas Politz:

>> shell-current-directory is an emacs package which allows one to  
>> create
>> a shell whose starting directory is the same as the buffer the  
>> command
>> 'shell-current-directory' was invoked in.
>>
>> The code for the command is here:
>> http://github.com/metaperl/emacs/blob/master/shell-current- 
>> directory.el#L92


The behaviour of M-x shell RET in recent Emacsen is exactly like  
this: it sets the new shell's current working directory to that of  
the buffer from which it was invoked. If the buffer is not associated  
with a file, then $HOME or, maybe, the directory from where GNU Emacs  
was launched, is chosen.

--
Greetings

   Pete

Hard Disk, n.:
	A device that allows users to delete vast quantities
	of data with simple mnemonic commands.








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

* Re: shell-current-directory - other window command needed
       [not found] ` <mailman.9631.1256746814.2239.help-gnu-emacs@gnu.org>
@ 2009-10-28 19:11   ` The Quiet Center
  0 siblings, 0 replies; 4+ messages in thread
From: The Quiet Center @ 2009-10-28 19:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 28, 12:14 pm, Andreas Politz <poli...@fh-trier.de> wrote:
> The Quiet Center <thequietcen...@gmail.com> writes:
>
>
> > What I would like to have is a command 'shell-current-directory-other-
> > window' which does the same thing, but opens the shell in the other-

>
> I guess this will work.

Yes, it works. Thank you. You are credited in the file:
http://github.com/metaperl/emacs/blob/master/shell-current-directory.el#L6

Now to fix the emacswiki version, or point it to git.



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

end of thread, other threads:[~2009-10-28 19:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-28 15:34 shell-current-directory - other window command needed The Quiet Center
2009-10-28 16:14 ` Andreas Politz
2009-10-28 19:02   ` Peter Dyballa
     [not found] ` <mailman.9631.1256746814.2239.help-gnu-emacs@gnu.org>
2009-10-28 19:11   ` The Quiet Center

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