Skip to content

Commit

Permalink
Add sharp quote advice
Browse files Browse the repository at this point in the history
Closes #7
Closes #12
  • Loading branch information
dgutov committed Jan 25, 2015
1 parent 3407bd7 commit 26a37b7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ name clashes.

* Prefer syntax-quoted forms over building lists manually.

## Anonymous (lambda) functions
## Functions

* Use `lambda`s for local bindings and function calls, **not** for
hooks or global variables. Define named functions for the latter,
Expand Down Expand Up @@ -408,6 +408,20 @@ name clashes.
(cl-remove-if-not (lambda (x) (evenp x)) numbers)
```

* Use a sharp quote (`#'`) when quoting function names. It's a good
hint for the byte-compiler, which will warn you if the function is
undefined. Some macros use it too.

```el
;; good
(cl-remove-if-not #'evenp numbers)
(global-set-key (kbd "C-l C-l") #'redraw-display)
;; bad
(cl-remove-if-not 'evenp numbers)
(global-set-key (kbd "C-l C-l") 'redraw-display)
```

### Macro Declarations

* Always declare the [debug-specification](http://www.gnu.org/software/emacs/manual/html_node/elisp/Specification-List.html#Specification-List),
Expand Down

0 comments on commit 26a37b7

Please sign in to comment.