How do I add carriage return to the beginning of my tramp-shell-prompt-pattern? - emacs

I am using a new server that when sshing into requires me the press "return" in order to see my shell prompt. I believe this is causing my emacs tramp to get hung up. When I tried to open a file through tramp on the new server I am repeatedly asked for the password. I read that this could be due to tramp not recognizing the prompt. The prompt is the same as on other servers that work, which makes me think it is this that is causing issues.
I'm thinking the solution would be to add carriage return to the variable tramp-shell-prompt-pattern. How would I do this?
maybe something like:
(setq tramp-shell-prompt-pattern "\r\(?:^\|\)[^]#$%> ]*#?[]#$%>] *\(\[[0-9;]*[a-zA-Z] *\)*")
adding \r to the front of the default?
Also, I don't know if it will be possible to remove this behavior on the server side. I tried creating a .hushlogin file in my home directory, but it had no effect.
I came across this question which addresses the problem of the shell requiring user input. The solution didn't work
(setq tramp-shell-prompt-pattern "^[^$>\n]*[#$%>] *\\(\[[0-9;]*[a-zA-Z] *\\)*")
Thanks for your help. Clearly I'm a novice.

Related

What does `workbench.action.terminal.switchTerminal` do?

Tried this command, seems to be doing nothing 🤔, does anyone know the purpose of it?
It's now been removed from the command palette:
Thanks for the report and for digging into this stuff 🙂. This command isn't meant to be exposed in the command palette as its only purpose is to drive the terminal dropdown behind the scenes.
There was a bug caused by this action that prevented users from pasting into a terminal since the key binding for pasting was set to this command as well as the paste command - so I am wondering as part of the fix for the pasting issue, they've made this command in the meantime not work.
Another user couldn't tell what this action does either and I can't myself. Perhaps that is why the default settings for it are unbound.

How to transfer files with Tramp using scp or rsync

I've read the TRAMP manual and dozens of forums across the web but I couldn't find an answer to this question. I am trying to set up a link in org-mode that transfers a file from a remote server to my local machine (or vice-versa).
According to the manual I have to write something like
/scp:user#host:filepathonremotemachine
and that's it. No specification of where the file should be moved to, which is weird.
I've tried to do it this way and it simply opened the file (as if I was using ssh); tried other combinations also, without any luck.
There is a specific reason for why I am trying to do this with tramp and not a shell:command link. Any help is very welcome
UPDATE
Apparently TRAMP is less useful than what it promises. That leaves me with the shell:command link option. The problem then revolves around avoiding the openssh window that pops out. The closest solution I found was here and it resumes to setting up an ssh-agent. I am not very familiar with this procedure and I would prefer to use the authinfo.gpg authentication method. Do I have this option? Thanks.
Tramp itself offers just alternative implementations of native Emeacs functions. In this sense, it is dumb, as every library, because it doesn't know what the caller wants.
I'm not an org-mode specialist, but could you please show, which kind of link you have in mind? Without any remoteness, just a link which copies a file locally. Replacing local file names with remote ones will be easy then.
I assume, you need something like an external link, evaluating Lisp code. Like
elisp:(copy-file "/path/src" "/path/target")
The following works (for some definition of "works"):
* link to copy a file
[[shell:scp remote.host.com:/path/to/file /tmp][scp]]
But you must have arranged for passwordless login to the remote host beforehand (e.g. ssh-copy-id your public key to the remote): given that, there is no output in the org buffer, no openssh popup, just the standard question from org-mode asking if you really want to execute the shell command and the file is copied quietly to its destination.

emacs key commands different in Windows and Linux?

I'm trying to finally bite the bullet and learn emacs. Mainly so that I am comfortable editing files on a server through ssh. So I installed emacs on Windows in order practice. Right away I noticed this difference: when I press ctrl - rightarrow on windows, the cursor jumps to the next work. When I do this in emacs on the server, the cursor moves to the next character only. I believe the latter is the "normal" behaviour (M - rightarrow will jump to the next word in both versions). How can I get my windows emacs to behave exactly like the one on the server? I don't want to learn habits on windows that won't carry over to the server.
You mention server, I assume you are connecting to it over SSH? It is very likely that something over the route steals modifiers off your C-arrow movements.
If this is the case, try to edit your files locally. Here's how: How can I use Emacs tramp to ssh to a remote host and edit a file as another user on an ad-hoc basis?

In emacs, what does "Terminal 7 is locked, cannot read from it" mean?

When using emacs, I occasionally get the error Terminal 7 is locked, cannot read from it. What does this error mean?
Currently, I am receiving the error while I try to connect to an IRC server using erc, but I have received it before, though I don't remember for what. When it happened before, I was able to retry and eventually it worked, but now I get the same error every time.
I'm running a server session with emacs --daemon and have connected various clients with emacsclient -t.
I have searched for this online, but the only thing I can find is this. Aside from not being the exact question I have, it has no accepted answer. :(
This error means that some Elisp code is trying to read from the minibuffer (for example) while in the middle of some other command in another "terminal" (e.g. another tty). "In the middle" here means for example that you're using a minibuffer in that other terminal, or that you've hit a prefix key.
I suggest you try to come up with a reproducible way to trigger this error and then send it via M-x report-emacs-bug.

Password on Emacs Boot Up

I was wondering whether there is a way to ask for a specific password when booting Emacs? I think I can ask for a pre-defined password which I can define in my .emacs file but I dont know how? I'm mainly interested to do this in an x- or graphical environment..
btw, I do know that the .emacs file can be seen and etc..but in my case it's not an issue.
I use epg to keep encrypted data in file. Then it simply loaded as normal emacs lisp file, as in my config. EPG will automatically ask for passphrase, and you can analyze return code of load function to determine, was loading successful or not
If I understand correctly, you are in a situation where multiple people share the same account on a computer -- that is, not only will they run the same emacs binary, they also have the same home directory where Emacs searches for the .emacs file.
It seems like you not only want to prevent others from reading the .emacs file, you actually don't want them to be able to run emacs at all.
Unfortunately for you, Emacs can be started with -q or -Q in which case the .emacs file is not evaluated at all. Thus any "protection" that relies on your .emacs file can easily be circumvented.
How about restricting access to the emacs binary instead? Maybe make it only executable for members of a certain Unix group (which of course is pointless if multiple people share the same account), or something along those lines. But note that this will not prevent them from installing their own local copy of Emacs.