Questions tagged [coding-conventions]
The coding-conventions tag has no summary.
15 questions
2
votes
2
answers
87
views
Readable and conventional way to fill in nil/non-nil only parameters
Some functions require a list of parameters that only tell the difference based on nil or non-nil. Is there a way to fill such parameters in a readable and conventional way?
For example, add-hook ...
0
votes
1
answer
40
views
Can packages rebind keys globally?
I observe a strange behavior in "my" emacs.
For some reason the <next> (aka pgdn) key and the <prior> (aka pgup) key are bound to (pager-page-up) and (pager-page-down), ...
4
votes
1
answer
516
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 ...
0
votes
0
answers
53
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,
...
0
votes
1
answer
170
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' ...
0
votes
2
answers
296
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 ...
2
votes
1
answer
47
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 ...
0
votes
0
answers
142
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 ...
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)
instead ...
3
votes
2
answers
264
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 ...
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! ...
4
votes
1
answer
363
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 ...
17
votes
1
answer
922
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 ...
2
votes
3
answers
231
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 ...
10
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 ...