Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs/elisp: What is the hash (pound, number sign, octothorp) symbol used for?

Tags:

emacs

elisp

What does this do?

(add-hook 'compilation-mode-hook #'my-setup-compile-mode) 

...and is it different than

(add-hook 'compilation-mode-hook 'my-setup-compile-mode) 
like image 688
Cheeso Avatar asked Apr 23 '10 20:04

Cheeso


1 Answers

There is no difference:

(eq 'my-add #'my-add) 

yields t

The # can be used in front of a lambda expression indicating to the byte-compiler that the following expression can be byte compiled, see the docs for Anonymous Functions. But there's nothing to compile in the case of a symbol.

In general, it is used in the printed representation along with the left angle bracket (<) to indicate that the object printed is a description (but cannot be read). For example:

#<buffer foo.txt> 

It is also used in constructs by the reader to represent circular structures. See the docs for Read Syntax for Circular Objects.

And then you have its use for denoting the base for integers, e.g. #x2c -> 44.

Plus more I'm sure.

like image 88
Trey Jackson Avatar answered Sep 21 '22 22:09

Trey Jackson