Skip to content

rolandwalker/syntactic-sugar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Overview

Effect-free forms such as if/then/else for Emacs Lisp.

Quickstart

(require 'syntactic-sugar)
 
(if t
    (then (message "true"))
  (else (message "false")))
 
(unwind-protect
    (protected
      (error "Error"))
  (unwind
    (message "cleanup")))

Explanation

This library offers absolutely no functionality! The following macros are provided as synonyms for progn:

then
else
protected
unwind

These macros can be used to clarify if or unwind-protect forms.

Note that as synonyms for progn, these forms have no useful effects, and no additional syntax check is done, so nothing prevents you from writing obfuscatory expressions such as

(if t (else 1) (then 2))      ; same as (if t (progn 1) (progn 2))

or idiotic expressions such as

(if t
    (protected 1)
  (unwind 2))

So, think of these macros as glorified comments. And realize that if you are tempted to use them, if in fact you have even read the documentation to this point, you are hopelessly impure at heart.

To use syntactic-sugar, place the syntactic-sugar.el library somewhere Emacs can find it, and add the following to your ~/.emacs file:

(require 'syntactic-sugar)

Notes

When this library is loaded, the provided forms are registered as keywords in font-lock. This may be disabled via customize.

The included macros are intentionally not autoloaded, because they are outside the package namespace.

Compatibility and Requirements

GNU Emacs version 24.4-devel     : yes, at the time of writing
GNU Emacs version 24.3           : yes
GNU Emacs version 23.3           : yes
GNU Emacs version 22.2           : yes
GNU Emacs version 21.x and lower : unknown

No external dependencies

About

Effect-free forms such as if/then/else for Emacs Lisp.

Resources

Stars

Watchers

Forks

Packages

No packages published