[OS X Emacs] How to efficiently work with shells/term? drag & drop, history, several instances

Hofert Jan Marius marius.hofert at math.ethz.ch
Thu Sep 22 11:20:32 EDT 2011


On 2011-09-22, at 16:30 , David Reitter wrote:

> On Sep 22, 2011, at 10:24 AM, Hofert Jan Marius wrote:
> 
>> Okay, I also tried eshell. With shell, eshell, and term, I can drag-in folders, but that just opens a new tab showing the path to the folder and its contents. Is there any simple way to get just the file path? 
> 
> Yes, there is.
> 
> Aquamacs comes with smart-dnd, which allows you to add a handler for drag-and-drop events for just shell-mode.  This is how dragging and dropping into LaTeX and HTML buffers works.  The manual comes with the package:
> 
> http://braeburn.aquamacs.org/code/master/aquamacs/src/site-lisp/smart-dnd.el
> 
> When you've written this and it works, post it here so others may benefit (and I'll probably add it to Aquamacs in that case).

I guess I did something wrong: I just copied the code in my Preferences.el and restarted Aquamacs. Nothing seemed to have changed: I still can't drag & drop folders to either term or shell. 

I then very briefly took a look at the code, but I've never programmed in emacs lisp, so without detailed instructions, I most likely can't get this to work.



In case I haven't described properly what my goal is, let me explain again:
Assuming you have a working directory in which you run a .cc program. The working directory is in /Users/username/my/favorite/folder/can/be/very/deeply/nested/and/contain/very/bad/characters/since/it/is/generated/automatically/
There is no way (I know about) that you can remember this folder and use <tab> completion to navigate there. On the Mac I go there with Finder. Once I'm there, I can easily create an item in the sidebar so that I just have to click once to jump there. Now if you want to compile the .cc program in this folder, you want to navigate there with the terminal. With the Mac terminal, I do the following:
1) open the Terminal
2) type in "cd "
3) click on the Finder folder containing the .cc program
4) drag the folder to the Terminal 
5) in the Terminal, I then have "cd /Users/username/my/favorite/folder/can/be/very/deeply/nested/and/contain/very/bad/characters/since/it/is/generated/automatically/" and I only have to hit <RET> to be there. 

Now I would like to know:
What is the currently known best practice with emacs to do the same thing (navigating to this folder)?

I typically have to navigate a lot between folders. I guess with the Mac terminal I am at least 5 times as fast than having to type the above path by hand (incl. using <tab> completion). If drag & drop is not easily available, then emacs is simply not made for theses tasks. I hope it was made for these tasks, too, since my intention was (and still is), to work without the Mac's terminal. 

I have used textmate for some years now [not sure when it came out, but I guess I used it for 3 years or so]. The reason why I started to take a look at emacs in the last two weeks is that I have read that many things can be done "quite fast" and especially in "one window". So far, I like emacs a lot, especially that I can work with R without having to use several different programs (textmate as editor, R.app for running R, X11 for the plots, Mac terminal for navigating between files,...). But I couldn't believe that a sophisticated editor [and more] such as emacs can't be used to easily navigate through folders. I'm sure I overlooked something. I also know that one gets used to one's habits quite fast. I'm used to navigating by drag-and-drop. I don't look for precisely this feature in Aquamacs. I simply would like to know how I can achieve navigation to a file in a similar speed as drag-and-drop. That's why I asked how experienced emacs users do that task. 
A nice feature of drag-and-drop itself is the following: You don't have to concentrate to navigate somewhere. This might sound a bit strange, but if I'm programming for some hours, I use those tasks as "breaks" to "relax". If I also have to concentrate to navigate to the right folder, this really adds up (after some hours of work).

Cheers,

Marius

> 
> 
> --
> http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
> http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!_____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx





More information about the MacOSX-Emacs mailing list