emacs-china/emacs-lisp-style-guide

Name: emacs-lisp-style-guide

Owner: emacs-china

Description: :blue_book: Emacs Lisp Style Guide in Chinese

Created: 2015-04-24 10:43:11.0

Updated: 2016-12-10 11:01:58.0

Pushed: 2018-01-17 19:44:58.0

Homepage: https://github.com/emacs-china/emacs-lisp-style-guide/blob/master/README-zhCN.md

Size: 61

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

The Emacs Lisp Style Guide

Role models are important.
– Officer Alex J. Murphy / RoboCop

This Emacs Lisp style guide recommends best practices so that real-world Emacs Lisp programmers can write code that can be maintained by other real-world Emacs Lisp programmers. A style guide that reflects real-world usage gets used, and a style guide that holds to an ideal that has been rejected by the people it is supposed to help risks not getting used at all — no matter how good it is.

The guide is separated into several sections of related rules. I've tried to add the rationale behind the rules (if it's omitted, I've assumed that it's pretty obvious).

I didn't come up with all the rules out of nowhere; they are mostly based on my extensive career as a professional software engineer, feedback and suggestions from members of the Emacs Lisp community, and various highly regarded Emacs Lisp programming resources, such as “GNU Emacs Lisp Reference Manual”.

The guide is still a work in progress; some sections are missing, others are incomplete, some rules are lacking examples, some rules don't have examples that illustrate them clearly enough. In due time these issues will be addressed — just keep them in mind for now.

Please note, that the Emacs developers maintain a list of coding conventions and tips too.

You can generate a PDF or an HTML copy of this guide using Transmuter.

Table of Contents
Source Code Layout & Organization

Nearly everybody is convinced that every style but their own is ugly and unreadable. Leave out the “but their own” and they're probably right…
– Jerry Coffin (on indentation)

The indentation guidelines specified here can be taken for granted if you're writing in Emacs. It will always do the right thing when you hit <tab>.

Syntax
Naming

The only real difficulties in programming are cache invalidation and naming things.
– Phil Karlton

Macros
Functions
Macro Declarations
Loading and Autoloading
Comments

Good code is its own best documentation. As you're about to add a comment, ask yourself, “How can I improve the code so that this comment isn't needed?” Improve the code and then document it to make it even clearer.
– Steve McConnell

Good code is like a good joke - it needs no explanation.
– Russ Olsen

Comment Annotations
Docstrings

Emacs is famous for the breadth, depth, and ubiquity of its documentation. By taking the time to write docstrings in your package, you are helping to continue that tradition!

Tools
Existential

Contributing

Nothing written in this guide is set in stone. It's my desire to work together with everyone interested in Emacs Lisp coding style, so that we could ultimately create a resource that will be beneficial to the entire Emacs community.

Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help!

You can also support the style guide with financial contributions via gittip.

Support via Gittip

License

Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 Unported License

Spread the Word

A community-driven style guide is of little use to a community that doesn't know about its existence. Tweet about the guide, share it with your friends and colleagues. Every comment, suggestion or opinion we get makes the guide just a little bit better. And we want to have the best possible guide, don't we?

Cheers,
Bozhidar


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.