[OS X Emacs] How to efficiently work with shells/term? drag & drop, history, several instances
Hofert Jan Marius
marius.hofert at math.ethz.ch
Sat Sep 24 04:09:34 EDT 2011
I could figure out a minimal setup where the problem appears:
Preferences.el just looks like this:
;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.)
;; enable drag and drop of files in the shell (or eshell)
;; see http://news.gmane.org/gmane.emacs.macintosh.osx
(defun smart-dnd-always-insert-file-name ()
"Setup `smart-dnd-mode' so that drag&drop always inserts the file path."
(smart-dnd-setup '((".*" . "\"%r\""))))
(add-hook 'shell-mode-hook 'smart-dnd-always-insert-file-name)
(add-hook 'eshell-mode-hook 'smart-dnd-always-insert-file-name)
Okay, assume you have a file foo.txt on your desktop and this is the only file open in Aquamacs. Then typing M-x shell opens up a shell. In the shell type a pwd shows /Users/<myusername>/Desktop. Fine. Assume there is a folder "myfolder" on the desktop and you want to navigate to it (via tab completion). So type in "cd myf" and hit tab. Okay *this* works.
Assume you have Preferences.el open in Aquamacs and you type in M-x shell. Again, a shell opens as expected. A pwd again shows /Users/<myusername>/Desktop. Assume, as before, that you want to change to myfolder. But typing in "cd myf" + tab does not work [one receives "No completions of myf"]. I then typed in just "cd" and hit tab to see *what* completions are available. To my surprise, I obtained precisely the files and folders within /Users/<myusername>/Library/Preferences/Aquamacs Emacs.
This means that the file from which you open the shell plays a role. Indeed, it determines on which level tab completion works. But it's quite confusing that pwd shows that one is on the Desktop level while tab completion suggests that one is on the level of the file from which the shell was opened.
On 2011-09-24, at 24:10 , David Reitter wrote:
> On Sep 23, 2011, at 4:55 PM, Hofert Jan Marius wrote:
> > ... TAB-completion does not work anymore.
> Neither do I reproduce, nor does this make any sense from a technical standpoint.
> How did you verify that this piece of code disables tab completion?
> (I take it you're not referring to drag&dropped paths that are then to be extended with TAB, even though that might work, too - haven't checked.)
> 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
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
More information about the MacOSX-Emacs