Emacs artist-mode (no gui) - emacs

I use emacs for only few days. Now I want to use emacs to draw ascii picture, I search that artist-mode can do it. But I don't know how to use this mode in no gui environment.

To draw a poly line, C-c C-a P to enter poly-line mode, RET (artist-key-set-point) to start the line, move point with normal movement commands, then hit RET again to end the segment and start a new one, C-u RET for the final segment.
From artist-mode docstring:
Drawing with keys
RET Does one of the following:
For lines/rectangles/squares: sets the first/second endpoint
For poly-lines: sets a point (use C-u RET to set last point)
When erase characters: toggles erasing
When cutting/copying: Sets first/last endpoint of rect/square
When pasting: Pastes
C-c C-a C-o Selects what to draw
Move around with C-n, C-p, C-f and C-b.
C-c C-a C-f Sets the character to use when filling
C-c C-a C-l Sets the character to use when drawing
C-c C-a C-e Sets the character to use when erasing
C-c C-a C-r Toggles rubber-banding
C-c C-a C-t Toggles trimming of line-endings
C-c C-a C-s Toggles borders on drawn shapes
Arrows
< Sets/unsets an arrow at the beginning
of the line/poly-line
> Sets/unsets an arrow at the end
of the line/poly-line

I find a way to get artist-mode work with mouse when ssh to server.
step:
1.artist-mode
2.xterm-mouse-mode (confirm your emacs open this mode)
3.some draw command , then draw with your mouse
Any one know how can just use keyboard without mouse can tell me.

Related

What is the command to open a file from within Emacs?

I need the command that can open a file without closing emacs
I have tried C-X C-F
You were on the right track, but it's C-x C-f rather than the capitalized form C-X C-F which would imply the Shift key is held in addition to Control. So to be explicit, you want to hold Control down while pressing x and f in succession.
The C-x C-f sequence will invoke the find-file command under vanilla emacs, which lets you choose a file to open in a new buffer.
See also Emacs Manual Section 18.2 Visiting Files.
Emacs distinguishes between uppercase and lowercase letters.
Emacs doesn't pay attention to the actual pressing of the shift key but it pays attention to the receipt of the key combination, so if you press C-F it doesn't matter whether you physically pressed ctrl+shift+f or caps-lock followed by ctrl+f.
The exact combination is C-x C-f, without shift or caps-lock.
The right way is to hold your 'Ctrl' key and press 'x' followed by 'f', Make sure your capslock is off. and be in editing mode.

Use Ctrl-X commands while in terminal in emacs?

When I'm running a terminal inside emacs (with M-x term) I can't seem to use commands that start with C-X, such as, say C-x o to switch panes or C-x C-c to exit. Instead it seems that the terminal itself is receiving these C-x signals. By contrast, C-c commands are received by emacs itself. How can I change this behavior?
term has two different input submodes. In the default (character) mode, C-x simply transmits a literal control x to the terminal. Many keybindings which are normally available in the C-x map are instead now in the C-c map, so you can switch to a different buffer in the other window with C-c 4 b. Or you can switch to line mode with C-c C-j (and back to character mode with C-c C-k).
See also the documentation.

Insert complete lines with Emacs + Evil

In Vim, I often move lines by deleting them (either with dd or visual line mode), moving my cursor to the new position, then p to put them in:
first
second
third
And if my cursor is on the line second, I can use ddp to move it down:
first
third
second
But with Emacs + Evil mode, putting the line back doesn't work as expected: if, for example, my cursor is on the i in third when I hit p, I end up with:
first
thisecondrd
How can I make Emacs + Evil mode insert new lines when putting entire yanked lines?
I use C-a to go to the beginning of the line (^ in evil-mode, probably) before yanking, if I want that behaviour. If you do this often, you can probably come up with your own thing for yank, although you have to figure out during the kill part if you're doing that. (Or you can check if the yanked thing has newlines, I guess?)
There's a transpose-lines command, by the way (C-x C-t in regular Emacs binding - someone suggested binding this to xtl - https://github.com/syl20bnr/spacemacs/blob/master/my-keybindings.el).
If I find my cursor on a line that I want to move, my natural response is to first delete the line into the kill ring with either C-a C-k C-k or C-a C-space C-n C-w (either of which can also grab several-line sequences by duplicating either the C-k or C-n or prefixing the C-n with a numeric argument) and then travel to the beginning of the line where I want to paste and doing a C-y yank.
Note that Emacs considers a file to be a steam of characters, in which newline or carriage return is not special. Unlike in vi, you can C-f forward right over a newline exactly as though it is a normal character; backspace over it; or include it in a deleted and yanked buffer. It is exactly like any other character. Perhaps Emacs is for people who think of files as sequences of characters — some of which happen to be newlines — and vi is for people who think of their file as lines, that are magically separated by who-knows-what but it certainly is not like any other character.
If the main use case you are trying to address is moving lines up or down (as opposed to the more general question of how to "make Emacs + Evil mode insert new lines when putting entire yanked lines"), I suggest you try out move-text.
It is a very small add-on package that provides two commands (move-text-up and move-text-down) for moving lines up and down, respectively. You can be anywhere on a line and call these; there is no need to kill or yank anything, and they work for regions as well.
For example, calling move-line-down in this situation (point right after second):
first line
second| line
third line
will produce
first line
third line
second| line
As you would expect, moving the current line (or region) up or down n lines works by calling the appropriate command with a numeric prefix.
The commands are bound to M-up and M-down by default but you should be able to rebind them to key sequences of your liking via
(define-key evil-normal-state-map "mu" 'move-line-up)
(define-key evil-normal-state-map "md" 'move-line-down)
move-text is package-installable from MELPA.

Emacs move-end-of-line, [END], or C-e not moving to end of line?

I've noticed that C-e <END> or M-x move-end-of-line doesn't always move the cursor to the end of the line.
Specifically this happens lines wider than the current window, it appears to move to some arbitrary point midway along the line.
Does anyone know if this is expected and more importantly, how to switch it off and make move-end-of-line, really move to the END of the line?
(Note: this is also happening in regular non-macro use.)
Emacs version in this example is GNU Emacs 23.1.97.1 (i386-mingw-nt6.1.7601)
Update.
The cursor is moving to the char that is on the edge of the window, (the display then re-centers around the cursor.)
Make sure visual-line-mode is off for the buffer.
Agree with #Slomojo here (it seems I cannot comment yet).
To add, here is the quote from the Emacs manual:
In Visual Line mode, some editing commands work on screen lines instead of logical lines: C-a (beginning-of-visual-line) moves to the beginning of the screen line, C-e (end-of-visual-line) moves to the end of the screen line, and C-k (kill-visual-line) kills text to the end of the screen line.
C-e is mapped to end-of-visual-line, the best solution isn't to deactivate visual-line-mode (don't do that especially if you're coding) but to remap C-e to end-of-line in your init file like this:
(global-set-key (kbd "C-e") 'end-of-line)
Of course I advise you to do the same for C-a and to remap it to beginning-of-line.
If you think you need to use end-of-visual-line and beginning-of-visual-line they're still mapped to end and home buttons respectively.

In Emacs, how to go back to previous line position after using semantic Jump to Symbol?

I know how to go to a variable definition in Emacs using semantic-mode. It works well in a single file (I think it doesn't work if the definition is in another file). Using C-c , j, I can go to the definition of the variable, but, how do I jump back to the previous line? Currently I use display Symref C-c , g, and select the displayed symref.
Is there any straight method?
Use:
C-u C-space or C-u C-#
If you want to navigate back between buffers, you can use:
C-x C-space or C-x C-#
This makes Emacs jump to the mark (and set the mark from position popped off the local mark ring) which has usually been set by a previous jump command.