3

In org-mode, C-u C-u C-u Tab expands all trees. When I wanted to check what it's bound to, I wasn't able to do that using C-h k as it quickly told me what C-u is bound to. From experiments, I know that pressing C-u n times sets the prefix argument to 4^n. So why doesn't C-u 6 4 Tab do the same thing as C-u C-u C-u Tab?

  • 1
    The command in question receives and inspects the raw prefix argument. It does not look at the prefix-numeric-value of that raw prefix arg. See @Tyler's answer for more info. – Drew Dec 19 '17 at 20:00
  • 1
    I changed the title to something more general, as the issue applies to more situations than just org-mode, I hope you don't mind! – Tyler Dec 19 '17 at 20:44
4

There is a subtle distinction between C-u C-u C-u Tab and C-u 64 Tab. When you use only the C-u key, without using digits (i.e., 64), what actually gets passed to the org-cycle function (which is what Tab calls here) is a list: (64). If you use C-u 64 Tab, the argument passed to org-cycle is the integer 64.

It's up to the author of a function to decide how they handle this difference. In the case of org-mode, at least in the case of org-cycle, the underlying code assumes that users will only use C-u. It does this in a cond statement, where the tests take the form (equal arg '(64)). This will only be true when you use pass a list, not when you pass an integer.

You can find a full explanation in the Elisp manual: (elisp) Prefix Command Arguments, and also (elisp) Interactive Codes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.