Questions tagged [elisp-conventions]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
0 answers
57 views

Composing Prefix Commands

There are several commands in Emacs that work as prefixes to other commands, changing the behavior of the next command in some way. The most well-known example is the commands that set up the "...
mtraceur's user avatar
  • 256
4 votes
1 answer
110 views

Buffer Name Surrounded by Asterisks (*)

For example, *scratch*, *Messages*. Is this some kind of convention? If so, what does it mean?
shynur's user avatar
  • 4,608
4 votes
1 answer
115 views

“Obarray” Got Its Name From ...?

What does the name “obarray” stand for? Obarray seems to be a property unique to Elisp that is not found in other Lisp-like languages. So its name probably came up with by the early Emacs developers;...
shynur's user avatar
  • 4,608
4 votes
1 answer
70 views

Idiomatic way to access values of an alist

The theme modus-vivendi exports an alist of named colors: (deftheme modus-vivendi "Elegant, highly legible and customizable dark theme. Conforms with the highest legibility standard for color ...
firstname gklsodascb's user avatar
4 votes
1 answer
453 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
6 votes
2 answers
920 views

Underscore in if-let

I often find myself wanting to do something like this: (if-let* ((foo (get-foo)) (_ (conditionp foo)) (bar (get-bar-from-foo foo))) ...) As an alternative to: (let ((foo (get-...
C4ffeine Add1ct's user avatar
0 votes
2 answers
153 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
32 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
2 votes
1 answer
73 views

How to automate user-testing with elisp?

Is it possible to automate testing user input? An example of this could be multiple editing operations, undo, saving, reverting the buffer etc. Then checking the buffer contents is what the test ...
ideasman42's user avatar
  • 8,546
4 votes
1 answer
1k views

Difference between pcase-let & cl-destructuring-bind?

I noticed both pcase-let and cl-destructuring-bind seem to perform the same operation. Is there any difference or reason to use one instead of the other? eg: (pcase-let ((`(,filename ,buf) (pop ...
ideasman42's user avatar
  • 8,546
3 votes
2 answers
125 views

When writing a new major mode, should it add itself to auto-mode-alist?

I am defining a new major mode, foo-mode, which is closely and only associated with .foo files. Should foo-mode.el fiddle with auto-mode-alist to add this association, or is that the user's ...
Jack Kelly's user avatar
5 votes
1 answer
1k views

Double hyphen in Elisp function names

Why do some people use -- in their function names? Here's an example from elfeed-search.el: (defun elfeed-search--header () "Returns the string to be used as the Elfeed header." (if (eql (car ...
american-ninja-warrior's user avatar
20 votes
2 answers
4k views

Convention about using C-x or C-c as prefix keys

What are the conventions for using C-x, C-c, or M- as prefix keys? For example: is C-x, etc., for saving or visiting buffers? Is C-c, etc., for text editing? Background Maybe this is a silly ...
anquegi's user avatar
  • 749