How repeat last comand (in minibuffer)? - emacs

Emacs 25.1, Windows 7 64 bit.
Suppose I have some text
111111111
222222222
333333333
444444444
555555555
111111111
222222222
And I want to find the occurrences of the text 111111111.
For that I use command occur (M-x occur) and it work fine. But 5 minutes later I want to repeat this command, so I try calling the command repeat (C-x z) but Emacs doesn't repeat it (occur with text 111111111).
So, how I can repeat it?

To repeat complex commands that take arguments you have to use not repeat, but repeat-complex-command. That will prompt you if you'd like to repeat occur.
To call repeat-complex-command you can use the keybindings C-x M-:.

Related

Close the specific Window in Emacs

its really easy to create window in emacs, like C-x 2 create a window downside of the current window and C-x 3 create a window right of current window. So its easily to create a layout like:
| 2 |
1 |------------| 4
| 3 |
now it comes to the question, how do i fast kill the specific window (like i work in window No. 1, look something in No.2 and dont want No.3 so want fast kill it) without jumping to that window? I know that we can use C-x o to switch to that window and use C-x 0 to kill it. Are there anyway to do it like for example presse C-x k 3 to kill the window No.3?
If you use library frame-cmds.el then you can use command delete-windows-on to delete all windows for a given buffer. The buffer name is read with completion, so this is usually pretty quick.
Interactively:
Without a prefix arg, deletes matching windows on all frames
With prefix arg >= 0, deletes matching windows on only the selected (current) frame
With prefix arg < 0, deletes matching windows on all visible frames
You can of course use delete-windows-on to define your own command that always acts as does delete-windows-on with a positive prefix arg. Just use (delete-windows-on nil t).
(If you use Icicles then C-u C-x 0 (command icicle-delete-window) and command icicle-delete-window-by-name give you similar behavior. These are multi-commands, which means you can delete multiple window with a single command invocation.)

Why can't I edit text in Emacs buffer *hmoccur* after I disable read-only?

Windows 10 (64 bit), Emacs 25.1, Helm package.
Suppose I has some text that has word test. And I run command "helm-occur" to find this word. Here result:
So, now I want to save result to buffer hmoccur. I use C-x C-s.
So here result.
As you can see this buffer is read only. So I use command read-only-mode to disable read only. Here result:
And now I want to edit this buffer(add letter "a").
But I get the next strange message (a is undefined). And as result not print letter "a"
:

How can you clear or overwrite a line of text in DrRacket?

I would like to display text and then overwrite it (for simple progress bars, etc.). The usual trick of displaying a carriage return ("\r") works fine when running Racket in the terminal in Linux and Windows, but in DrRacket and GRacket the carriage return does not seem to move the cursor to the beginning of the line.
With this code as an example:
(for ([x 5])
(display "\r")
(display x)
(flush-output) ; The result is the same with or without this line
(sleep 0.1))
Running in the terminal results in a counter that overwrites itself; at the end only 4 is displayed in the terminal.
Running in DrRacket results in the numbers displaying and not being overwritten:
0
1
2
3
4
Is there a way to overwrite a line of text in the interactions window of DrRacket?
For an authoritative answer on this, you'll want to hear from Robby Findler on the racket users mailing list, (see https://lists.racket-lang.org/).
I'm about 85% certain that the interactions window doesn't do this: that is, allow you to overwrite already displayed text. If you wanted to do something like this, you'd probably want to create your own text window using the graphical toolbox. That way, you could alter the text in the window in any way you wanted.

Emacs buffer copy with single stroke

assume I have focus on BrokerSyncMasteredRecord.cc. I want to fast copy BrokerSyncMasteredRecord.cc to the left by one stroke(like some hotkeys). the final state in pic 2. Currently, I can only use C-x b and type in a few chars of the buffer name. this is very slow.
NOTE: this should not be another opened replica buffer(e.g., BrokerSyncMasteredRecord.cc[replicated], you know what i mean if you are a emacs user) but exact the same buffer, just show in two different windows
I'll just quote the Emacs tutorial (f1 t) for you:
* MULTIPLE WINDOWS
------------------
One of the nice features of Emacs is that you can display more than
one window on the screen at the same time. (Note that Emacs uses the
term "frames"--described in the next section--for what some other
applications call "windows". The Emacs manual contains a Glossary of
Emacs terms.)
>> Move the cursor to this line and type C-l C-l.
>> Now type C-x 2 which splits the screen into two windows.
Both windows display this tutorial. The editing cursor stays in
the top window.
This basic tutorial is just 1000 lines, almost small enough to use as a capcha
for asking questions about Emacs:)

Deleting the first 'x' characters from every line in a region with Emacs

I want to delete the first x characters for every line in a region.
Is there any key binding available to do this without using regex?
The best way to do this is to use the "rectangle" family of commands. For example, mark the beginning of the region. Go to the end of the region and place the point at column X. Run the command kill-rectangle using C-x r k.
Of course, this is not limited to deleting characters at the beginning of lines.
If the mark is on column 0, put the point on column x and use kill-rectange:
C-x r k runs the command kill-rectangle, which is an interactive
autoloaded Lisp function in `rect.el'.
It is bound to C-x r k.
(kill-rectangle START END &optional FILL)
Delete the region-rectangle and save it as the last killed one.
When called from a program the rectangle's corners are START and END.
You might prefer to use `delete-extract-rectangle' from a program.
One command that I really love for these types of jobs is multiple cursor's edit lines:
http://www.youtube.com/watch?v=jNa3axo40qM
It is overkill compared to kill-rectangle (the best solution to the original problem) but it is an amazing tool in the toolbox. Definitely worth taking a look at it.
Select the required rectangle using rectangle command
M-x rectangle-mark-mode
Then use command
M-x kill-region