The code you submitted is a combination of a shell script and elisp.
function info() { emacs -eval "(progn (setq Man-notify-method 'bully) (info \"$1\"))" }
Defines a shell script called info . It takes 1 parameter called $1 . When you call this function (for example, from another shell script), the value of the argument is replaced with $1 , and it runs the commands specified in the sequence. So, if you call it like this:
info("something")
The shell will execute the following command:
emacs -eval "(progn (setq Man-notify-method 'bully) (info \"something\"))"
This invokes the emacs executable with two -eval arguments and a command line that contains embedded escaped quotes. This calls emacs to invoke the following elisp code:
(progn (setq Man-notify-method 'bully) (info "something"))
progn is a special form. Special forms evaluate their arguments differently than regular function calls. You can find documentation for progn in chapter 10.1 of the GNU Emacs Lisp Reference Manual . progn is a simple construct for executing a sequence of instructions in order. The reason you might need to do this is when you want to execute several statements, but the context you are in expects only one statement.
For example, an if takes 3 (or more) arguments: a condition for evaluating, an expression for evaluating if true, and an expression for evaluating if false. If more than three arguments are provided, subsequent arguments are part of the else branch. If you want to use more than one statement in a true branch, you should use progn :
(if condition (progn first-statement-if-true second-statement-if-true) first-statement-if-false second-statement-if-false )
In this case, if condition true, then first-statement-if-true and second-statement-if-true will be evaluated. Otherwise, first-statement-if-false and second-statement-if-false will be evaluated.
That way, your code will simply evaluate the two statements (setq Man-notify-method 'bully) and (info "something") in order.
setq is another special form. See chapter 11.8 for your documentation. It simply sets the variable named by the first parameter, the value of the second parameter. The first parameter is not evaluated - it is taken literally.
A value preceded by a single quote (for example, 'bully ) is not evaluated. For more information on citation, see chapter 9.3 . Therefore (setq Man-notify-method) sets a variable named Man-notify-method to the bully literal token (which is a data type called a character that is different from the string "bully" ).
I canโt find the documentation for the info function on the Internet, you can get help for any given function in emacs by typing Ch f function-name . So, typing Ch f info , I got the following:
info is an interactive autoloaded Lisp function in `info '.
[Arg list not available until function definition is loaded.]
Enter Info, the documentation browser.
Optional argument FILE specifies the file to examine;
the default is the top-level directory of Info.
Called from a program, FILE may specify an Info node of the form
`(FILENAME) NODENAME '.
In interactive use, a prefix argument directs this command
to read a file name from the minibuffer.
The search path for Info files is in the variable `Info-directory-list '.
The top-level Info directory is made by combining all the files named `dir '
in all the directories in that path.
An online reference is very useful, and emacs online help is also needed. If you donโt understand what a particular function does, just Ch f it.