Not offhand, but I looked it up and I think what you want is `key-description'. It prints key sequences, so e.g. (key-description "\370") evals to "M-x".
That seems to work also, what's the problem?
It's not part of emacs, I just wrote it as an example.
This one prompts you to type a literal key sequence (exactly like with `describe-key', C-h k) and inserts it at the point in a representation that the *-set-key functions can use. As written it's bound to to C-c k, and…
>Is there a C macro that can do this? No, of course. C macros only see strings; you need to parse a syntax tree to do your reverse example (like lisp macros). No argument from me. >Lisp's macro system allows you…
You're right, it's not even valid C99. My mistake.
C99 + GCC extensions + POSIX: #define for_duration(seconds, body) \ { \ pthread_t tid_task, tid_watcher; \ \ void* task(void* arg) { \ body ; \ pthread_cancel(tid_watcher); \ return NULL; \ } \ \ void* watcher(void*…
Not offhand, but I looked it up and I think what you want is `key-description'. It prints key sequences, so e.g. (key-description "\370") evals to "M-x".
That seems to work also, what's the problem?
It's not part of emacs, I just wrote it as an example.
This one prompts you to type a literal key sequence (exactly like with `describe-key', C-h k) and inserts it at the point in a representation that the *-set-key functions can use. As written it's bound to to C-c k, and…
>Is there a C macro that can do this? No, of course. C macros only see strings; you need to parse a syntax tree to do your reverse example (like lisp macros). No argument from me. >Lisp's macro system allows you…
You're right, it's not even valid C99. My mistake.
C99 + GCC extensions + POSIX: #define for_duration(seconds, body) \ { \ pthread_t tid_task, tid_watcher; \ \ void* task(void* arg) { \ body ; \ pthread_cancel(tid_watcher); \ return NULL; \ } \ \ void* watcher(void*…