Skip to main content
Share Your Experience: Take the 2024 Developer Survey
3 votes
Accepted

Use 'mapcar' to build a hooks list; "wrong-type-argument listp lambda"

Look at the error message: (wrong-type-argument listp lambda). This means that it wanted a list, and it found a compiled lambda function. The reason for this is that use-package is a macro, and macros ...
db48x's user avatar
  • 18.3k
3 votes
Accepted

How to fix lsp-mode for Elisp?

emacs-lisp-mode is derived from prog-mode (as so many modes are), so lsp was already being started in your Emacs Lisp buffers. The warning simply tells you that lsp doesn’t know what programming ...
db48x's user avatar
  • 18.3k
2 votes
Accepted

Automatically add a newline when dragging text from Firefox into Emacs

The Elisp manual for drag and drop suggests that it's handled by dnd.el and x-dnd.el. Looking at the source, dnd.el contains the generic parts of handling drag-and-drop, and x-dnd.el is the code ...
Pkkm's user avatar
  • 263
2 votes
Accepted

How to proper install and configure js2-mode via use-package declaration?

If it works correctly then it is correct. Otherwise it is wrong. Why do you need our approval? Also note that js2-mode is included with Emacs; there is no longer any need to install it from ELPA.
db48x's user avatar
  • 18.3k
2 votes
Accepted

`completion-at-point-functions` and filesystem path completion

EDIT I suddenly, realized that I did not inspect comint--complete-file-name-data, then while I was checking some things, I accidentally added comint-filename-completion to the global hook (i.e. as ...
dalanicolai's user avatar
  • 7,865
2 votes

Precomposing all commands in a keymap with a function using a variable in another command

Did you check the documentation for defvar-keymap? You are supposed to pass it a function¹, but you are instead immediately evaluating some code that tries to use your position variable. Of course it ...
db48x's user avatar
  • 18.3k
2 votes
Accepted

set the correct major mode for script files based on interpreter

Such a functionality is already built into Emacs. Interpreters are mapped to modes with the variable interpreter-mode-alist. It contains by default ("python[0-9.]*" . python-mode) and many ...
jmg's user avatar
  • 213
1 vote
Accepted

Run functions/hooks automatically when a specific FILE is opened

Just do it in a find-file-hook function. Just have the function test for your file, and if the file to visit is different then do nothing. C-h v find-file-hook tells us: find-file-hook is a variable ...
Drew's user avatar
  • 77.9k
1 vote
Accepted

Configure compile command to take buffer-file-name as its source file argument

Directory variables may be used to solve the problem. Contents of .dir-locals.el in the root of the project directory: ((c-mode . ((eval . (setq-local compile-command ...
David Smith's user avatar
1 vote

company-mode: static sources overwrites LSP

add-to-list is a function that insert the new element at the beginning of the list (unless the append argument is used). Thus the new element takes priority and is used exclusively. I suggest you use ...
Dmitry's user avatar
  • 3,803
1 vote
Accepted

Placing a hook after each character insertion

Inserting characters into the buffer is normally done via self-insert-command, which has a hook called post-self-insert-hook that you can use: (defun backward-char-after-insert () (backward-char)) ...
rpluim's user avatar
  • 5,325
1 vote
Accepted

Macros expanding to addhook

Adding eight anonymous functions to the hook makes no sense to me, vs this: (add-hook 'pdf-view-mode-hook #'my-pdf-view-mode-config) (defun my-pdf-view-mode-config () "Called via `pdf-view-...
phils's user avatar
  • 51.6k
1 vote
Accepted

Return a list of functions with a given property or creating a group of functions

A group of anything is usually going to be a list, and I can't imagine wanting anything different here. A list of functions to be called is typically a "hook" in Emacs. A hook is still just ...
phils's user avatar
  • 51.6k
1 vote

Cannot get rid of isearch overlays

I just found the solution (defun nordlow/isearch-navigate-symbol-pre-command-hook () (when (memq last-command '(nordlow/isearch-previous-symbol-at-point nordlow/isearch-...
Nordlöw's user avatar
  • 507
1 vote
Accepted

Add parsing of latex-style .el file to LaTeX-hook using AUCTeX

Since AUCTeX release 13.2.3 (2023-12-07) support for completion, fontification etc. for ltcmd (former xparse) is available out of the box (see https://tex.stackexchange.com/a/703376/105447), so you ...
gusbrs's user avatar
  • 786
1 vote

Calling git commit from shell-command results in incorrect log message

Yes, appears to be a Windows thing. Simply replacing the -m '' with -m \"\" does the job. Could have sworn I tried that, but I guess not.
user2567544's user avatar
1 vote

How to enable `fill-paragraph` command to be executed every time ChatGPT replies via gptel package?

It looks like gptel has a hook called gptel-post-response-hook, so you could do something like this: (defun clean-gpt-buffer () (fill-region (point-min) (point-max))) (add-hook gptel-post-response-...
Trevoke's user avatar
  • 2,450
1 vote
Accepted

frame hook load theme causes frame to crash after creation

Read C-hv after-make-frame-functions. You've given it a function which takes NO arguments, but which is going to be called with one. So that's going to cause an error. Any time you use add-hook with ...
phils's user avatar
  • 51.6k
1 vote

Changing the definitions of outline-minor-mode headings

Are you asking how to invoke those functions when you turn on the minor mode? If so then use the minor mode's hook, e.g., outline-minor-mode-hook. (defun foo () "..." (taxocask-elisp-...
Drew's user avatar
  • 77.9k
1 vote

olivetti misbehaving on save, in org buffers

I experienced a similar issue in Doom Emacs. In my case, When I edited .mdx file in olivetti-mode and used the save-buffer command, Emacs would exits olivetti-mode. After I switched from 'fundamental-...
ruseel's user avatar
  • 111
1 vote

Org mode refiling gobbles a newline and absorbs the next heading

I had a similar issue and the solution for me was to create an advice like this: (defun my/org--capture-refile (orig-fun &rest args) (let ((org-reverse-note-order (org-capture-get :...
Camilo QS's user avatar

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