Skip to main content
7 votes
Accepted

Hook to switch the linter binaries in Emacs Lisp according to virtual environment

It would be a good idea to write a docstring for the defvar'd variables like linter-execs. The explanations in the post would ...
Gareth Rees's user avatar
  • 49.7k
6 votes
Accepted

Checking if val is present in list

You want member: (member val lst) For example ...
choroba's user avatar
  • 1,393
6 votes

Expand string patterns in Elisp

Scoping In Emacs Lisp a nesting a defun inside another defun does not create a lexically scoped function. The symbol for the '...
ben rudgers's user avatar
  • 2,663
5 votes
Accepted

elisp function to replace text in an org file

You can make a better (interactive) declaration. Because this modifies the buffer, we want to disable it on read-only buffers. We do that this way: ...
Toby Speight's user avatar
  • 81.8k
5 votes
Accepted

`nov.el` function to search the entire `epub` ebook

One thing you could do to speed up the search, is to search for a match first in the raw html, and if you find a match, only then render it using (nov-render-html) ...
dalanicolai's user avatar
4 votes

Example of emacs setup code written in elisp

target platform Neither the Review Context nor the code comments describe what OS platform(s) we are targeting. ...
J_H's user avatar
  • 35.2k
4 votes
Accepted

Multiple regexp replace in string

Style-wise, it looks odd to see the function argument named in all-caps. Standard convention is to use lower-case (but still upcase it in the doc-string). Trying to run the code, it immediately ...
Toby Speight's user avatar
  • 81.8k
4 votes
Accepted

Check for pangrams in elisp

(setq letters (get-letters s)) You are setting the same letters variable from different functions; in Emacs Lisp, that sets a ...
coredump's user avatar
  • 913
4 votes
Accepted

Installing packages when needed

When quoting a list of symbols, it's redundant to quote each symbol within the list. There's no need to eval a symbol. This sequence looks strange: ...
Toby Speight's user avatar
  • 81.8k
4 votes

Expand string patterns in Elisp

It's unusual to defun within a function. If you just want expat available while executing ...
Toby Speight's user avatar
  • 81.8k
4 votes

X-up utility for EVE Online

The conclusion to Shepmaster's excellent answer pointed out that if the yaml-rust library were augmented, it would be possible to consume the ...
Matthew Piziak's user avatar
3 votes

Rubik's cube mode for emacs

First, congrats on writing a Rubik's Cube mode. That is a feat. There are, however, three parts I would love to see improved in a follow-up version: Currently, none of the symbols are private; ...
Zeta's user avatar
  • 19.3k
3 votes
Accepted

replace a text from emacs buffer to insert it vertically with emacs lisp script

Few general points about your code: (while condition &body) form already treats &body as an implicit ...
wvxvw's user avatar
  • 961
3 votes
Accepted

Edis: Emacs driven indentation script

One of the pitfalls with any language using formatting constructs you're not that familiar with, is that it becomes an unreadable mess. Your code though is properly formatted, properly indented (it ...
Mast's user avatar
  • 13.5k
2 votes

Iterating over global keymap, removing all bindings to super keys

Apart from using dolist as mentioned by @brfennpocock it looks mostly fine. system-type is a symbol though, so you can compare ...
ferada's user avatar
  • 11.1k
2 votes

Testing whether lambda expression returns true for any list element

If you already have Common Lisp-derived functions in there, use CL-SOME instead: ...
ferada's user avatar
  • 11.1k
2 votes

Checking if val is present in list

The Good Thing The code works and does what was intended. Making it shorter and improving readability are improvements not bug fixes. Readability It is hard to follow the logic of the code. Adding ...
ben rudgers's user avatar
  • 2,663
2 votes
Accepted

Minimal substring with all characters contained in string

I know this is old, but I will write some remarks anyways, hope you will find it useful. This code lacks knowledge of usual language shortcuts, eg. (if x nil y) is ...
wvxvw's user avatar
  • 961
2 votes
Accepted

WOMOIWIW: What Org-mode Opens is What I Want

That's a cool feature I've to say. And the code looks excellent, I suppose you could argue for one or the other wrt. cond vs. if...
ferada's user avatar
  • 11.1k
1 vote
Accepted

Get the suffix for the date string

I'm concerned that make-suffix is sufficiently general that we'll have name collisions with other packages - or even new Emacs versions. Perhaps prefix with some ...
Toby Speight's user avatar
  • 81.8k
1 vote

Split a list into two parts

values should be cl-values in Emacs Lisp (and use (require 'cl-lib) instead of ...
Zeta's user avatar
  • 19.3k
1 vote

Split a list into two parts

First, as already noted in a comment, the first argument of the function is the list, and the second is the number of elements. So in the examples below I assume that this is what you want. Then, you ...
Renzo's user avatar
  • 2,065
1 vote

Power menu (Shutdown, Reboot, Sleep) in ELISP

Disclaimer: Total beginner here too. So take everything with a grain of salt. That being said this looks perfectly fine. However, I suggest you to use ...
Zeta's user avatar
  • 19.3k
1 vote

Check for pangrams in elisp

At the high level bit, there's not much to complain about and a lot to like. Not so much because the code works (a necessary but non-trivial requirement for this site). But because the logic is sound (...
ben rudgers's user avatar
  • 2,663
1 vote
Accepted

Detect resolution of X display and change font accordingly

You'll want to guard the function so you don't try to call it on non-X displays (e.g. emacs -nw): ...
Toby Speight's user avatar
  • 81.8k
1 vote

Detect resolution of X display and change font accordingly

You wrote calls to setq-default twice, with blah-blah-size-34-or-18. Call it just once, with a :size of an if expression that evaluates to 34 or 18. Put another ...
J_H's user avatar
  • 35.2k
1 vote

Testing whether lambda expression returns true for any list element

Apply 'file-exists-p on the list of files and check whether true is a member of the result: ...
choroba's user avatar
  • 1,393
1 vote

Start a process in Elisp

You can remove the let, as you only reference f once. I'd also make it a named function; this makes it easier for you to update ...
Toby Speight's user avatar
  • 81.8k

Only top scored, non community-wiki answers of a minimum length are eligible