Tramp mode - file open does not work - emacs

i try to access remote computer via ssh-tramp mode in emacs using this blog,
http://swizec.com/blog/cool-thing-thursday-emacs-tramp-mode/swizec/5646
Command recipe given:
C-x C-f //
username#
hostname
password
but, after i press C-x C-f // \n username#, it creates a new file as username# in the current dir.
What am i missing to activate tramp mode? i use ido mode which i disabled by pressing C-f

I use the following to open remote files: C-xC-f/user#host:/path/to/file.

Related

Activate tmux within a emacs shell

Invoking 'shell' by M-x shell,
and plan to start a tmux session
it report errors
$ tmux
open terminal failed: terminal does not support clear
What's the problem?
If invoking `ansi-term', the operations of yanking and pasting are invalid.
So, shell perform better than ansi-term in routines.
How could activate tmux within a shell
tmux needs a real terminal, and shell doesn't provide that (as implied by the error you get). So you need to use term with tmux.
Or you can use built in functionality of Emacs to have features of tmux. E.g. C-x 2 and C-x 3 will split the frame into windows so you can have multiple terminals in a frame (an Emacs frame is what most applications would call a window). Start an emacs server and emacsclient to have sessions that you can connect to and keep running after you close the frame.
Copy (M-w) and paste (S-<insert>) should work by default. If you want to play with bindings, the key map is called term-raw-map and the commands are kill-ring-save and term-paste.
Also learn the difference between term-line-mode (C-c C-j) and term-char-mode (C-c C-k). Briefly, line mode behaves more like shell, and char mode behaves more like a real terminal, with most Emacs keybindings unavailable. I personally keep term buffers in char mode almost always and add some keybindings to term-raw-map so I can run certain Emacs commands.

how to use emacs tramp with ssh remote to server

I want use emacs remote server(freebsd use sftp with ssh).
I already read this and write (require 'tramp) (setq tramp-default-method "ssh") in my .emacs. I use C-c C-f RET /sftp:ganluo-home-vm-freebsd-user#192.168.1.104/.
But it does not work
Look Here:I use emacs for windows so can't direct use tramp.Have to download plink.exe(I use it maybe had other way) and do some other exp:
first download here (also you can found some windows conntion unix\linux software in this website).Find plink.exe download it (offer release and development and source code)
than you can cut plink.exe in the your emacs\bin directory.
find your Environment Variables Edit/New "PATH" Add your emacs\bin complete directory and last the path must with ';'
C:\Emacs\bin;
then sign out use cmd test plink command is useful.if doesn't restart you PC.
C-c C-f /pink:YouName#HOST[IP,HOSTName]:/
it had some problem,I will post new status right here.

How to invoke Emacs from an Erlang escript?

Inspired by Git as when you type "git commit", it opens an Emacs or Vim session for you. I'm writing an Erlang escript, and I want it to open an Emacs session at the end of the execution of the escript. I've tried
os:cmd("emacs -nw file.txt")
but it doesn't seem to work. Evaluating the above command within the Erlang shell yields
"emacs: standard input is not a tty\n"
One way to do this is to keep an Emacs running with server mode (put (server-mode) in your ~/.emacs), and call emacsclient instead of emacs from Erlang. That will open the file in the existing Emacs session. emacsclient exits and returns control to your Erlang program once you hit C-x # in Emacs.

Session management in emacs using Desktop library

For session management with emacs, I appended the following lines to my .emacs file
(load "desktop")
(desktop-load-default)
(desktop-read)
I was able to save the session using M-x desktop-save. But after exiting emacs, I am unable to recover the earlier saved session. I did start emacs in the same directory as that during "desktop-save"
Please let me know if I am missing anything or not correct in my efforts
Thanks
-- Harish
Chapter 51 'Saving Emacs Sessions' of my Emacs manual (using a Emacs 23 snapshot) has this
You can save the desktop manually
with the command M-x desktop-save'.
You can also enable automatic saving
of the desktop when you exit Emacs,
and automatic restoration of the last
saved desktop when Emacs starts: use
the Customization buffer (*note Easy
Customization::) to set
desktop-save-mode' to t' for future
sessions, or add this line in your
~/.emacs' file:
(desktop-save-mode 1)
which is different from what you tried.
The following worked for me (emacs 21.3.1):
(load "desktop")
(setq desktop-save-mode 1)
(desktop-load-default)
(desktop-read)
The desktop-save-mode line is only needed if you want to save desktop automatically on exit (i.e. without bothering to type M-x deskstop-save).
The only difference is that I put those lines at the beginning of the .emacs file but I doubt that's a problem.

How do I create a directory from within Emacs?

How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
to create the directory dir/to/create, type:
M-x make-directory RET dir/to/create RET
to create directories dir/parent1/node and dir/parent2/node, type:
M-! mkdir -p dir/parent{1,2}/node RET
It assumes that Emacs's inferior shell is bash/zsh or other compatible shell.
or in a Dired mode
+
It doesn't create nonexistent parent directories.
Example:
C-x d *.py RET ; shows python source files in the CWD in `Dired` mode
+ test RET ; create `test` directory in the CWD
CWD stands for Current Working Directory.
or just create a new file with non-existing parent directories using C-x C-f and type:
M-x make-directory RET RET
Emacs asks to create the parent directories automatically while saving a new file in recent Emacs versions. For older version, see How to make Emacs create intermediate dirs - when saving a file?
Ctrl+X D (C-x d) to open a directory in "dired" mode, then + to create a directory.
You can also run single shell commands using M-!
You're basically sending a string to the command line so you don't get any nice auto-completion but it's useful if you know how to perform an action through the command line but don't know an Emacs equivalent way.
M-! mkdir /path/to/new_dir
I guess I did it the hard way earlier today. I did:
M-x shell-command
then
mkdir -p topdir/subdir
You can use M-x make-directory inside of any buffer, not necessarily a dired buffer. It is a lisp function you can use as well.
I came across this question while searching for how to automatically create directories in Emacs. The best answer I found was in another thread from a few years later. The answer from Victor Deryagin was exactly what I was looking for. Adding that code to your .emacs will make Emacs prompt you to create the directory when you go to save the file.