1

How can I find Org Mode emacs lisp functions like org-current-level which is used in the answer for Org subtree from yasnippet?

I looked for the command in the Org Mode Manual but didn't find it there.

Drew
  • 75,699
  • 9
  • 109
  • 225
Ben Bkhdt
  • 13
  • 3

2 Answers2

2

Use M-x apropos-function RET org-.

C-h f apropos-function tells you that command apropos-function does this:

apropos-function is an autoloaded interactive compiled Lisp function in apropos.el.

(apropos-function PATTERN)

Show functions that match PATTERN.

PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words.

This is the same as running apropos-command with a C-u prefix, or a non-nil apropos-do-all argument.

But if you want to know only about Org commands, not all Org functions (commands are functions, but not all functions are commands), then use M-x apropos-command RET org-.

C-h f apropos-command tells you:

apropos-command is an autoloaded interactive compiled Lisp function in apropos.el.

It is bound to C-h a, <f1> a, <help> a, <menu-bar> <help-menu> <search-documentation> <find-commands-by-name>.

(apropos-command PATTERN &optional DO-ALL VAR-PREDICATE)

Show commands (interactively callable functions) that match PATTERN.

PATTERN can be a word, a list of words (separated by spaces), or a regexp (using some regexp special characters). If it is a word, search for matches for that word as a substring. If it is a list of words, search for matches for any two (or more) of those words.

With C-u prefix, or if apropos-do-all is non-nil, also show noninteractive functions.

If VAR-PREDICATE is non-nil, show only variables, and only those that satisfy the predicate VAR-PREDICATE.

When called from a Lisp program, a string PATTERN is used as a regexp, while a list of strings is used as a word list.

Drew
  • 75,699
  • 9
  • 109
  • 225
1

The best way is to ask Emacs by using "tab completion": C-h f org-<TAB> will give you a completion buffer with all the functions that Emacs knows about that start with org-. You can click on one to see its doc string. SInce there will be a lot of them, you may need to scroll the buffer (just switch to the buffer and use the arrow keys) or refine the search by typing more of the name, e.g. C-h f org-current-<TAB>).

The manual does a good job of describing the functions that a user should know about, but those tend to be the ones that are bound to keys.

It also describes the most common user options, but it leaves out a lot: one problem with Org mode is that it has too many options :-) Options are implemented as (global) variables and you can get similar help from emacs using C-h v org-<TAB> and use the methods above to navigate the completion buffer or refine the search.

Another way to find user options is to say M-x customize RET and type org- in the search box.

Bon voyage!

NickD
  • 27,023
  • 3
  • 23
  • 42