Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [error-handling]

The tag has no usage guidance.

36
votes
2answers
6k views

What do I do when Emacs is frozen? [duplicate]

What should I do when Emacs stops responding? My current "emacs-is-frozen" protocol looks like this: Spam C-g (it sometimes works) Wait for a while. pkill -9 emacs What alternate steps could I try ...
19
votes
3answers
977 views

How to gracefully handle errors in init file

I would like a way to catch errors when running my init file, and then handle them gracefully. A lot of my most important customizations and keybindings show up at the end of my init file to make sure ...
15
votes
3answers
3k views

Show line number on error

Say that emacs throws some error that I don't understand. Or maybe the error says "Symbol's value as variable is void: modes", but there are many occurrences of the symbol modes in my code, so I need ...
12
votes
1answer
489 views

Get backtrace from error programmatically

If an error is signalled in Emacs Lisp code, and debug-on-error is t, I get a backtrace buffer that makes it easy to figure out where the error occurred. However, for errors that occur while ...
8
votes
2answers
280 views

Rethrowing an error in Emacs Lisp

I need to call a function and perform a cleanup only if the function fails, and then relaunch the error. Here is the pseudo-code: (condition-case err (call-function) (error (cleanup) ;; ...
5
votes
1answer
549 views

Capturing stderr of subprocesses

I'm trying to capture stderr separately from stdout for a (synchronous) process run from emacs. I've found one way of doing it based on some code copied from emacs' shell-command function (I don't ...
4
votes
3answers
1k views

File mode specification error: How to find syntax problem: Missing :END: line in org-mode properties?

When I launch my emacs software (Aquamacs.app) I see a message File mode specification error: (error ":END: line missing at position 23740") Unfortunately, I do not know in which file this problem ...
4
votes
1answer
277 views

How to condition-case Lisp nesting exceeds `max-lisp-eval-depth'?

I'd like to catch too big recursive call nesting in elisp, like this: (condition-case nil (potentially-too-recursive-function) (xxx (message "Gave up, using defaults"))) What is the symbol in ...
4
votes
1answer
147 views

How to abort saving in a before-save-hook function?

If, in a function run from before-save-hook, I want to abort the saving of a file, so that the file is not saved and the user is signaled, how can I do that? Is it possible (without rebinding C-xC-s ...
3
votes
3answers
169 views

How to call another function, if one function gives an error message

Suppose I call a function which is named as foo. Sometimes that function foo will give a message such as "Example of error message". If that is the case, then something else should be executed. ...
3
votes
1answer
47 views

When I (byte-compile-file “my-package.el”), can I treat warnings as errors?

As part of CI testing, I'm byte-compiling package files to make sure there are no errors. I'd like to take this a step further and ensure there are no warnings, either (like 'function not known to be ...
3
votes
2answers
823 views

Emacs flickers when I run certain commands (gif screencast included)

After I did an overhaul of my .emacs file yesterday (adding/removing packages, organizing, etc.), I'm left with an annoying screen flicker. It happens when I move the cursor to the edge of the buffer ...
3
votes
3answers
404 views

Finding frames by name

I'm trying to write a little compilation monitor frame that gets compilation updates written to it without the overhead of seeing absolutely everything going on in the compile. I've been working with ...
3
votes
1answer
314 views

define-error for older Emacs?

I'm using define-error to throw custom errors. But it looks like this function wasn't yet implemented in emacs-24.3, for instance. It still seems to work for emacs-24.3 if I write this: (when (...
3
votes
1answer
92 views

How does one define a widget of type editable-list with validation?

I create my widget with the following code: (widget-create 'editable-list :entry-format "%i %d %v" :value '("") '(editable-field ...
3
votes
2answers
404 views

Orgmode table error - shrunk field?

I'm very new to Emacs and Org mode, so I'm basically fumbling around. I'm getting an alarm bell ding whenever I type in an table in an *.org file. A message says "invalid function: org-table-with-...
3
votes
1answer
68 views

Perform function until it returns user-error

I want to define a function org-move-subtree-top that calls org-move-subtree-up until it returns a user-error (in this case "Cannot move past superior level or buffer limit"). How can I do this in ...
2
votes
1answer
1k views

Symbol's function definition is void: insert-string

;; Specify the startup banner. Default value is `official', it displays ;; the official spacemacs logo. An integer value is the index of text ;; banner, `random' chooses a random text banner in `core/...
2
votes
1answer
40 views

Standard way of reporting user errors to user?

I am writing an emacs package which provides some commands to the user. The user can run things like M-x foobar and M-x eggsspam. However, some of these commands can fail. As an example, without ...
2
votes
1answer
34 views

Exiting from outer calling functions on error

Consider the following: (defun my-divide-by-0() (condition-case nil (/ 1 0) (error (progn (message "Could not evaluate: 1/0") nil)))) (defun my-test() (interactive) (my-divide-by-0) ...
2
votes
1answer
230 views

What is the difference between the error handler in condition-case and the error function

I am wondering the semantic of the error function. For condition-case, the Elisp manual says: The arguments after the protected form are handlers. Each handler lists one or more condition names (...
2
votes
1answer
82 views

Taking action depending on the presence of particular message in the echo area

I have my proper function to run latex, say my-tex. Sometimes one should run latex two times to get references right. A message like below in the echo area appears to tell this. How to identify ...
2
votes
1answer
32 views

Catch invalid calc expression

Inspired by this blog I wrote a function which replaces arithmetic expressions between two $ symbols with the mathematical result inline (and deletes the $ symbols). How can I modify this such that it ...
2
votes
1answer
142 views

How do I catch signals?

After reading the documentation, here's what I've tried: (condition-case err (signal 'my-error 'my-data) (my-error (message "data: %S" err))) Evaluating this form still throws the signal, ...
2
votes
1answer
132 views

Break on all errors in edebug

How can I make Emacs break on an error, even if the error is being handled somewhere? In my current scenario, the setup of a major mode is modifying the buffer and I want to find out why (and then ...
2
votes
1answer
50 views

Invoke function on message

The debug-on-message variable tells Emacs to start the debugger when a matching message is displayed. How can I get Emacs to invoke my own function when a matching message is displayed? My motivation ...
2
votes
1answer
33 views

Which function should I advise to do something when a user-error is unhandled?

I need to advise emacs to do something when any error dings to the user. I can't find any documentation on which function I actually need to advise. Which function do I need to advise to do ...
1
vote
1answer
414 views

How to prevent Emacs from opening error buffer

I got someone ask this question: How can I prevent errors that should really just be a bell or flashing screen not open a window with an error?
1
vote
1answer
63 views

Keep going mode for require-package

In my initialization file, I have got: (require-package 'clips-mode) The thing is that, lately, this package fails to be loaded sometimes (it's already downloaded but I guess it fails when it tries ...
1
vote
1answer
74 views

How can I disable the “<C-lwindow> is undefined” error?

I use Windows 10's virtual desktop feature. The hotkey for switching between virtual desktops is Ctrl-Win-Left / Ctrl-Win-Right. When Emacs is focused and I want to switch dekstops, I get an error ...
1
vote
2answers
110 views

Is the unwind-protect's clean form always evaluated?

I have this loop: (catch 'QUIT (while (search-forward-regexp "\\([^\n\\]\\(?:\\\\\\\\\\)*\\|^\\(?:\\\\\\\\\\)+\\)%.*\n" nil t) (save-excursion (let ((b (make-...
1
vote
1answer
44 views

Latex compilation message in the echo area dissapears too soon

The outcome (success/error) of a Latex compilation (TeX-command-run-all) is printed in the echo area. Once you press a key, however, the echo area is cleared and the message is gone. I usually look at ...
1
vote
1answer
184 views

Running emacs client: how do you know if the init files had errors loading

I use emacs 25, in nw mode, with "alias emacs='emacsclient -nw'" When I add something to my personal.el, I do brew services restart emacs My issue is, if I make a big blunder inside my personal.el ...
1
vote
1answer
13 views

After setting bookmark: `Wrong type argument: listp, "~/.spacemacs`

So I did just M-x bookmark-save in my original .spacemacs file, which lead to the case that when I booted Spacemacs, I get the following error: Upgrading bookmark format from 0 to 1... mapcar: Wrong ...
1
vote
0answers
743 views

Can't exit Emacs with error “End of file during parsing”

Every time I press c-x c-c to exit Emacs, it shows "End of file during parsing" in the minibuffer. I cursorily examined my .emacs and did not find any mismatching parenthesis. Any idea what's the ...
0
votes
1answer
317 views

Error in post-command-hook during org-agenda-todo

Ever since upgrading to emacs 24.4.1, when I set something as 'done' from the agenda, I frequently get the error: Error in post-command-hook (org-add-log-note): (error "Variable binding depth exceeds ...
0
votes
1answer
29 views

Identify which mode is throwing an error

I am attempting to edit a file. Emacs is preventing me from making the edit, and throwing: Args out of range: #<buffer user.action.js>, 4965, 17721. It is completely not obvious to me where this ...
0
votes
1answer
30 views

How Can I Prevent make-process from failing if the default-directory doesn't exist?

Usually, when you open a file, Emacs prompts you to run M-x make-directory RET RET if the directory doesn't exist. However, after writing my own advice, I realized that opening files in directories ...
0
votes
1answer
95 views

redirect stderr to a file in call-process-region

I have been reading the documentation for call-process-region here and I am trying to redirect stderr to a file. from the the documentation, this looks correct (call-process-region beg end perltidy-...
0
votes
2answers
164 views

autoload list of packages in Emacs 25.0.92

According to emacs.SE answer I am trying to make Emacs (version 25.0.92) autoload packages if they are not already installed on my computer. At my .emacs file now I have only: (package-initialize) (...
0
votes
1answer
543 views

Cryptic startup error messages

I just started out on emacs so this might have a really simple answer. I'm getting an error message on startup and have no idea what it means. The debug message doesn't help much either. What do ...
0
votes
0answers
34 views

Why AUCTeX/pdflatex show me help in Japanese?

I had this error message displayed to me by AUCTeX (already corrected using \ddot{\boldsymbol x}) ERROR: Extra }, or forgotten $. --- TeX said --- <recently read> } l.51 \[ \boldsymbol M\ddot\...
0
votes
1answer
29 views

helm-mu on macOS throws Invalid read syntax: (")

Hej guys, I get an error when searching through my mails with helm-mu. Messages gives Invalid face reference: helm-grep-finish [96 times] error in process filter: helm-mu-candidate-parser: End of ...
0
votes
0answers
58 views

“No such file or directory, bind-key” after installing use-package [duplicate]

I'm using Emacs on Windows 10. I want to override key bindings, so after reading How to override major mode bindings, I installed use-package with the built-in package manager (via M-x package-install ...
0
votes
0answers
216 views

toggle-debug-on-error only works for the first error, how can i fix this?

when I enable debug on error it works perfectly the first time. when I go and fix my error and rerun my function debug on error no longer triggers for new errors. Is there a way to enable it so ...
0
votes
0answers
89 views

On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Edited question of August 2017: After a long search I found the reason, why a wonderful software called pdfsizeopt (for my question from April 2017 see below) does not work, when called from Emacs, ...