japanoise / emsys

ersatz-emacs text editor
MIT License
3 stars 2 forks source link

Option for C-u as universal argument #24

Closed japanoise closed 1 month ago

japanoise commented 1 month ago

As discussed on #21

japanoise commented 1 month ago

@nicholascarroll for vis

No time to look at this today unfortunately. But I'm thinking the flag will be EMSYS_C_U_UNIVERSAL_ARGUMENT or somesuch, and you can #define it by doing something with the makefile or the make command (maybe a compile-time configuration file, like the traditional config.def.h & config.h pair)

If we're going to add C-u I'd like to do it the right way, similar to how it behaves in GNU Emacs, where after pressing it you can type in a number for the uarg, and by default the value is four: https://www.gnu.org/software/emacs/manual/html_node/emacs/Arguments.html

japanoise commented 1 month ago

Fuck it, I have time to add config.def.h. I'll do that now

nicholascarroll commented 1 month ago

haha go on then! But why not make the flag mean standard emacs behaviour. That would cover other possible commands or keybindings as well.

japanoise commented 1 month ago

haha go on then! But why not make the flag mean standard emacs behaviour. That would cover other possible commands or keybindings as well.

Maybe one for standard emacs behavior that itself enables a bunch of other flags. That way if you want one thing to behave like real emacs and another thing to behave like emsys, you can be granular.

nicholascarroll commented 1 month ago

Ahhhh OK. So config.h is a thing. Yes this is great.

nicholascarroll commented 1 month ago

I am not quite sure whether I should be putting this in config.def.h (but commented out), or in config.h (where it will get walloped by .gitignore).

Anyway I did it in config.h:

#ifndef _EMSYS_CONFIG_H
#define _EMSYS_CONFIG_H

/* Universal Argument C-u */
#define EMSYS_CU_UARG

/* CUA mode*/
#define EMSYS_CUA

#endif /* _EMSYS_CONFIG_H */

I have implemented this in a branch called CUA and will put in a PR once the current one goes through. Is it OK if the same PR also includes a CUA mode, also done using config.h?

japanoise commented 1 month ago

I have implemented this in a branch called CUA and will put in a PR once the current one goes through. Is it OK if the same PR also includes a CUA mode, also done using config.h?

Sounds great!

I am not quite sure whether I should be putting this in config.def.h (but commented out), or in config.h (where it will get walloped by .gitignore).

config.def.h is where it should go. Non default defines can just be commented out:

#ifndef _EMSYS_CONFIG_H
#define _EMSYS_CONFIG_H

/* Universal Argument C-u */
/* #define EMSYS_CU_UARG */

/* CUA mode*/
/* #define EMSYS_CUA */

#endif /* _EMSYS_CONFIG_H */
nicholascarroll commented 1 month ago

done. PR #28

japanoise commented 1 month ago

PR merged