Register
4coder»Forums»Possible to unset the mark?
Benny Mildh
2 posts
Tinker. Coder. Sailor. <br> <br> Have decided to give 4coder some serious ...
Possible to unset the mark?
3 months ago Edited by Benny Mildh on Aug. 15, 2019, 9:32 a.m.
Greetings!

Sometimes, due to having a new custom built keyboard and trying to customizing 4coder at the same time, I accidentally activate the "set_mark" function. Or, possibly, some other function. The effect is, I'm left with a mark, a white rectangular box where the cursor used to be.

Is there some way to unset the mark?

I looked in the command lister but cannot find it.

Regards
bmildh
Patrik
2 posts
Possible to unset the mark?
3 months ago
Do you want to set the mark to it’s previous position? If so, no, there isn’t a command for that, though you could make one. If you never use the mark you can call the set_notepad_like_mode command or whatever it is called and you will only get a cursor, no mark. Another thing you can do is have a keybind that puts the mark at the beginning of the file. Or, though I would rather use the notepad-like thing, set the colour of the mark to the background colour. That way you won’t see it. I used to do the last one for free typing and in a ”command mode” I set the mark colour back to it’s original. Now, I switch between notepad and original/emacs mode.
Benny Mildh
2 posts
Tinker. Coder. Sailor. <br> <br> Have decided to give 4coder some serious ...
Possible to unset the mark?
3 months ago
Thank you.

I'm not sure what to do. I'll ponder over it. Best thing is probably to get better at my keyboard and my bindings, not setting off the mark at all. I'll try the notepad thing though.
Allen Webster
480 posts / 2 projects

Heyo

Possible to unset the mark?
3 months ago Edited by Allen Webster on Aug. 16, 2019, 4:37 a.m.
4coder is designed to treat the mark as always existing wherever you left it. I believe this is a little different from emacs but emacs is weird and I never really had more than a 10% grasp of it before I switched to 4coder. I don't know what it would mean for the mark to "not exist" in 4coder, you'd have to write a whole new customization layer with a different meaning for the mark.

If the problem you're having is that you accidentally set the mark when you wanted to leave it somewhere else, you may have more luck trying to implement a "mark history" that let's you pop a stack and set the mark to it's previous position. That would also be a pretty big problem, because the setting the mark isn't hookable in any way, so you'd have to track down all the places where you set the mark, and all the places where the default code sets the mark, and modify your mark stack.

If you had that hook, or better yet, the whole mark stack, would that be better for you?

In "notepad" mode you never have a "mark" in the emacs sense, so you can't accidentally set it but you also can't intentionally leave it by a single key press. Instead you have "select a range".