Questions tagged [coding-conventions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer
470 views

Why do people add their initials to the names of tailor-made functions added to their config file?

Is it a namespace trick to prevent future problems? I noticed a pattern in the Emacs community. When people create some tailor made function and insert it on their init files, they use a convention on ...
Pedro Delfino's user avatar
0 votes
0 answers
44 views

How to detect whether current major-mode allows dashes ("-") in its symbol names?

To enable smart-dash ("an Emacs minor mode which redefines the dash key to insert an underscore within C-style identifiers and a dash otherwise") after falling in love with Kebab/Lisp case, ...
Daanturo's user avatar
  • 180
0 votes
1 answer
112 views

Best practice for long string literals in emacs lis?

What are best practices for handling long string literals in Emacs Lisp? E.g. (... stuff that causes indentation ... (error "`my-config-alist' mapped command `%s' to `%S' ...
kdb's user avatar
  • 1,561
0 votes
2 answers
171 views

Idiomatic conversion of non-nil to explicit t

Is there an idiomatic/commonly used/established convention to convert non-nil values to t that other Elisp programmers are likely to recognize? Sometimes I have a non-nil value, say from calling ...
chwarr's user avatar
  • 105
2 votes
1 answer
33 views

Giving faces compliant names

The description of defface in (info "(elisp) Defining Faces") says that the name of a face should not end in -face. But most faces declared in font-lock.el do use the suffix -face. How does this fit ...
Andreas Matthias's user avatar
0 votes
0 answers
136 views

Are super and hyper key modifier permitted in major/minor modes?

I looked to (info "(elisp)Key Binding Conventions") and (info "(elisp)Keymaps and Minor Modes") and (info "(elisp)Major Mode Conventions") and didn't found any restriction to use H- and s- modifier in ...
gavenkoa's user avatar
  • 3,412
8 votes
2 answers
3k views

add-to-list vs add-hook?

What is the difference between add-to-list vs add-hook? For example I see in progmodes/make-mode.el: (add-hook 'completion-at-point-functions #'makefile-completions-at-point nil t) ...
gavenkoa's user avatar
  • 3,412
3 votes
2 answers
226 views

When to return nil vs. signal error?

This may be a more general programming question that just for Emacs Lisp, but I'm wondering when a function should signal an error vs. return nil. Raising an error is "failing loudly", which is ...
Tianxiang Xiong's user avatar
9 votes
2 answers
4k views

Why does `eval-when-compile` run at file load and byte-compiled to .elc?

Common idiom to workaround macro expansion or resolve warning about undefined variables during byte-compilation: (eval-when-compile (require 'cl-lib)) But this require ... compiled into .elc file! ...
gavenkoa's user avatar
  • 3,412
4 votes
1 answer
311 views

When to split long elisp files to separate files? [closed]

Some Lisp programmers advocate keeping code mainly into one file, following the concepts of Literate Programming in the Large, (note: the video is more about the method than Axiom, an open source ...
gsl's user avatar
  • 1,762
16 votes
1 answer
850 views

Why do elisp files have end of file comments?

Why do elisp files usually end with ;;; file.el ends here? Is there some historical reason why this was useful? I've seen it recommended in elisp style guides and I still see it in modern elisp ...
Qudit's user avatar
  • 827
2 votes
3 answers
202 views

Macros prefixed with 'with'

Many emacs macros are prefixed with 'with' keyword in elisp. In an imperative language like python, with statement is used to create a temporary variable like this, with controlled_execution() as ...
Madhavan's user avatar
  • 1,977
9 votes
3 answers
1k views

Closing parenthesis on own line unacceptable? [closed]

I've been using Emacs for quite a number of years now, but I only recently stumbled over the coding standards. There it is stated: Don't make a habit of putting close-parentheses on lines by ...
Meaningful Username's user avatar