unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Create shell from ido
@ 2010-01-28  1:54 Nathaniel Flath
  2010-01-29  5:00 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Nathaniel Flath @ 2010-01-28  1:54 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

Hello,
I have ido activated.  If I do C-x C-f and navigate to a directory, C-d will
open a dired buffer in that directory.  Is there a way to open a shell
buffer instead?

Thanks,
Nathaniel Flath

[-- Attachment #2: Type: text/html, Size: 213 bytes --]

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

* Re: Create shell from ido
       [not found] <mailman.332.1264643682.14305.help-gnu-emacs@gnu.org>
@ 2010-01-28  9:25 ` José A. Romero L.
  2010-01-28 10:46   ` Andreas Röhler
  0 siblings, 1 reply; 5+ messages in thread
From: José A. Romero L. @ 2010-01-28  9:25 UTC (permalink / raw)
  To: help-gnu-emacs

On 28 Sty, 02:54, Nathaniel Flath <flat0...@gmail.com> wrote:
> Hello,
> I have ido activated.  If I do C-x C-f and navigate to a directory, C-d will
> open a dired buffer in that directory.  Is there a way to open a shell
> buffer instead?
>
> Thanks,
> Nathaniel Flath

Depends on the shell you want to use. For regular shell you could use
something like this:

(defun nf/openshell (&optional dir)
  (interactive "DDirectory to open shell into: ")
  (shell)
  (if dir
      (comint-send-string
       (current-buffer)
       (concat "cd " (shell-quote-wildcard-pattern dir) "

"))))

in any case, it doesn't seem  to be possible to open a shell directly
in any  arbitrary directory other than  default-directory. You always
have to send a "cd something" to move to where you want to be (though
I'd be glad to find out I'm wrong). In any case, that's the same I do
in  SrC (http://www.emacswiki.org/emacs/Sunrise_Commander)  and works
quite well for me.

Cheers,
--
José A. Romero L.
escherdragon at gmail.com
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


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

* Re: Create shell from ido
  2010-01-28  9:25 ` José A. Romero L.
@ 2010-01-28 10:46   ` Andreas Röhler
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Röhler @ 2010-01-28 10:46 UTC (permalink / raw)
  To: help-gnu-emacs

José A. Romero L. wrote:
> On 28 Sty, 02:54, Nathaniel Flath <flat0...@gmail.com> wrote:
>   
>> Hello,
>> I have ido activated.  If I do C-x C-f and navigate to a directory, C-d will
>> open a dired buffer in that directory.  Is there a way to open a shell
>> buffer instead?
>>
>> Thanks,
>> Nathaniel Flath
>>     
>
> Depends on the shell you want to use. For regular shell you could use
> something like this:
>
> (defun nf/openshell (&optional dir)
>   (interactive "DDirectory to open shell into: ")
>   (shell)
>   (if dir
>       (comint-send-string
>        (current-buffer)
>        (concat "cd " (shell-quote-wildcard-pattern dir) "
>
> "))))
>
> in any case, it doesn't seem  to be possible to open a shell directly
> in any  arbitrary directory other than  default-directory. 

It's not ido, but it should do it:

(defun My-Shell-where-I-want-it ()
 (interactive)
 (dired "My-precious-directory")
 (shell))

Maybe adapt that for ido, if necessary.

Cheers

Andreas
> You always
> have to send a "cd something" to move to where you want to be (though
> I'd be glad to find out I'm wrong). In any case, that's the same I do
> in  SrC (http://www.emacswiki.org/emacs/Sunrise_Commander)  and works
> quite well for me.
>
> Cheers,
> --
> José A. Romero L.
> escherdragon at gmail.com
> "We who cut mere stones must always be envisioning cathedrals."
> (Quarry worker's creed)
>
>   





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

* Re: Create shell from ido
  2010-01-28  1:54 Create shell from ido Nathaniel Flath
@ 2010-01-29  5:00 ` Kevin Rodgers
  2010-01-29  6:14   ` Nathaniel Flath
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2010-01-29  5:00 UTC (permalink / raw)
  To: help-gnu-emacs

Nathaniel Flath wrote:
> Hello,
> I have ido activated.  If I do C-x C-f and navigate to a directory, C-d 
> will open a dired buffer in that directory.  Is there a way to open a 
> shell buffer instead?

I don't use ido, so I don't even know how to test this.  But here's what I came
up with from looking at ido.el.  I didn't understand how to properly implement
ido-magic-control-s, so you have to type `C-x C-f C-x C-s' (by analogy with
`C-x C-f C-x C-d', which runs ido-enter-dired):

(defun ido-enter-shell ()
   "Drop into `shell' from file switching."
   (interactive)
   (setq ido-exit 'shell)
   (exit-minibuffer))

(define-key ido-file-dir-completion-map "\C-x\C-s" 'ido-enter-shell)

-- 
Kevin Rodgers
Denver, Colorado, USA





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

* Re: Create shell from ido
  2010-01-29  5:00 ` Kevin Rodgers
@ 2010-01-29  6:14   ` Nathaniel Flath
  0 siblings, 0 replies; 5+ messages in thread
From: Nathaniel Flath @ 2010-01-29  6:14 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1276 bytes --]

That doesn't work, unfortunately - I tried it., as well as emulating the
other dired stuff.  I'm not sure why that doesn't work, but I managed to
write a function that does:

(defun ido-shell ()
  (interactive)
  (let ((dirname (expand-file-name (ido-read-directory-name "Shell in
directory: "))))
    (shell dirname)
    (comint-send-string (current-buffer) (concat "cd " dirname "\n"))))

Thanks,
Nathaniel Flath

On Fri, Jan 29, 2010 at 12:00 AM, Kevin Rodgers
<kevin.d.rodgers@gmail.com>wrote:

> Nathaniel Flath wrote:
>
>> Hello,
>> I have ido activated.  If I do C-x C-f and navigate to a directory, C-d
>> will open a dired buffer in that directory.  Is there a way to open a shell
>> buffer instead?
>>
>
> I don't use ido, so I don't even know how to test this.  But here's what I
> came
> up with from looking at ido.el.  I didn't understand how to properly
> implement
> ido-magic-control-s, so you have to type `C-x C-f C-x C-s' (by analogy with
> `C-x C-f C-x C-d', which runs ido-enter-dired):
>
> (defun ido-enter-shell ()
>  "Drop into `shell' from file switching."
>  (interactive)
>  (setq ido-exit 'shell)
>  (exit-minibuffer))
>
> (define-key ido-file-dir-completion-map "\C-x\C-s" 'ido-enter-shell)
>
> --
> Kevin Rodgers
> Denver, Colorado, USA
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1930 bytes --]

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

end of thread, other threads:[~2010-01-29  6:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-28  1:54 Create shell from ido Nathaniel Flath
2010-01-29  5:00 ` Kevin Rodgers
2010-01-29  6:14   ` Nathaniel Flath
     [not found] <mailman.332.1264643682.14305.help-gnu-emacs@gnu.org>
2010-01-28  9:25 ` José A. Romero L.
2010-01-28 10:46   ` Andreas Röhler

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