I have the following problem : when i use 'C-x r t' (string-rectangle), i am prompted to enter some string, to replace the selected rectangle. Lets say i type ";;" (to comment out the rectangle). This works just fine, but the next time i call the same function, and i want to replace with nothing (empty string), i can not do that, because there is "default" string ";;" that i previously used, and if i just hit enter the command will use that ";;" string instead of empty one. How do i set it to empty string ?
Similar problem i had with some search/replace functions. Basicaly, when it remembers the last string i used, and sets it to default, how do i "enter" empty string instead ?
EDIT :
Kill-rectangle, mentioned by YoungFrog solves the specific problem, but i had another thing in mind : basicaly, in what ever function emacs remembers the last value you entered, and uses it as "default" when you just hit enter, you should be able to clear that "default" to whatever was real default before you first used the function. Here is another example :
In dired mode, if you 'M-x rgrep' it asks you for 3 inputs :
1) What to search for : whatever you enter here, will be used as default next time you use rgrep. As someone pointed out, it makes no sense to search for empty string, so clearing this "default" value is indeed never needed i guess.
2) Next it will ask in what files to search for. It's real default is "all" files. If i enter *.txt, and search, next time when i use rgrep, *.txt will be used as "default". Now i wish to clear this "default" *.txt, and return to its original default, "all", just as i wanted to clear ";;" "default" in string-rectangle function to it's real default, empty string.
Of course, this specific problem for all files could probably be solved with typing * ? But this general problem potentialy remains with other commands that remember last used value.
3) It will next ask for Base directory, no problem here.
So, the way i see it, whenever emacs tries to help me by remembering my last used value in some command (which i find very helpful most of the time) there should be a way to clear that used value as if i never used that command before.
P.S. I am still new to emacs, and perhaps the functionality i require is not needed, as there is always some workaround ?
delete-rectangle
is an option. – politza Jun 20 '15 at 10:03clear rectangle
. – Kaushal Modi Jun 20 '15 at 12:18comment-dwim
? Also entering "empty" string for search wouldn't make sense, but you are able to enter an empty string for the replace part. I am curious to see more examples where entering an empty string might be needed by a user. – Kaushal Modi Jun 20 '15 at 12:23string-rectangle
. Whenever an empty string makes sense as a possible input there should be a way to enter it, as distinguished from accepting a default value. Look closely at the doc for the command (and at its source code, if you are comfortable with that), to see if there is in fact a design flaw here. If you think there is, then please report it:M-x report-emacs-bug
. – Drew Jun 20 '15 at 14:412)
, the you can literally enterall
, which is slightly different from*
: it matches.*
too. – npostavs Sep 19 '15 at 5:05