reddit / emacs

Tramp mode: opening a local resource

oh-void · 2022-06-23 14:40
Hi All, Recently I discovered TRAMP mode, and I really love it. There's just one little annoyance: I run Emacs as a daemon and, while trying to open a file with emacsclient in a new frame, TRAMP gets in the way and stubbornly tries to resolve an ssh:// link. Is there a way to avoid this behavior or, if that happens, to instruct Emacs to point to the local filesystem instead? So far I've managed to use iBuffer and delete the entry corresponding to TRAMP, but I hope there's some better way to solve my problem. Any help is really appreciated. Thank you!
onetom · 2022-06-23 15:20
what does"stubbornly tries to resolve" mean? what is the symptom more precisely? the way you described your problem, it sounds like you can successfully use emacsclient, if you are not requesting to open a new window. can you provide concrete examples of the emacsclient invocations for both the new window and no new window cases? is it possible to reproduce your situation with emacs -q?
FrozenOnPluto · 2022-06-23 17:25
Are you trying to open a file woth a name that looks like tramp path? Like you have a file, locally, called /ssh:foo@1.2.3.4/foo or something? As above … question lacks meaningful details :)
oh-void · 2022-06-23 18:05
Sorry for the lack of details, I try to elaborate a little further. This is the sequence of actions I perform: \- START: emacs running as a daemon, with no frame visibile and no buffer other that scratch and messages open \- run emacsclient -c -n and a new frame opens as expected \- C-x C-f and I get prompted for a file name in the mini buffer. Problem is: the current directory is set to the last ssh:// path I used with Tramp. \- I then M-x cd to specify a local directory as the default one, but the operation has no effect This does not always happen, meaning I can't reproduce it at will (with or without init file parsed). I am currently running Emacs 27.1 on a Debian 11. If you need more/specific information just let me know.
FrozenOnPluto · 2022-06-23 19:01
When you C-x C-f just backspace (or C-a C-k to go to begin of line and kill)? Ie if its assuming relative to current buffer (nornal) or a past buffer (that wouldn’t be default I think) then you aren’t stuck with that, just back up. I use vertico (or seectrum etc) to see the current directory in minibuf while navigating with C-x C-f (find file and open), along with marginalia and orderless and its magnificent. I live on tramp fpr 75% of my files and never have a problem .. if I’m on a remote buffer then I expect find-files to assume same path, but I cam backup or wipe out path in the minibuffer live easy using same old emacs controls, and vertico/etc will update the list of visible files in real time Also projectile .. switch buffers between projects and open file within project help. Or just type / onto end of path and go from there and it should ignore whatever is before that for example).. shadow pathing?
oh-void · 2022-06-23 19:55
Thank you for the hints! I just found out that C-a C-k in visit file minibuffer doesn't work, while backspace is fine. As soon as I'll experiment the Tramp issue again I'll try out your suggestions. Maybe there's something wrong with my Emacs installation/configuration.
FrozenOnPluto · 2022-06-23 20:05
Minibuf should more or less work like any other emacs line. C-a C-k should work fine.. Assumption there is normal mode, not evil-mode bindings. I don’t use the vi emulation, nor Doom, nor Spacemacs etc. i build up from vanilla with my own config. If troubles always try with -q no conf mode to verify if a problem is your config
[deleted] · 2022-06-23 20:42
[deleted]
oh-void · 2022-06-23 20:43
I use evil mode, but Emacs keybindings work as expected in other minibuffers. I'll definitely try the -q switch.
7890yuiop · 2022-06-23 22:00
You can *usually* just start typing a new path at the end of the default/suggested path (without deleting it), if you separate them with extra `/` characters. See `C-h i g (emacs)Minibuffer File` for details.
oh-void · 2022-06-24 11:02
I have a growing feeling the issue I'm experiencing has something to do with my specific setup of Emacs. As soon as I can I'll also do some tests on a fresh Emacs installation. Thank you!