Couldn't make condition-case workHow to condition-case Lisp nesting exceeds `max-lisp-eval-depth'?What is the difference between the error handler in condition-case and the error functionOn Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it doesHow Can I Prevent make-process from failing if the default-directory doesn't exist?
Swapping "Good" and "Bad"
Using Open with a filename that contains :
The three greedy pirates
Reverse dots and boxes
Why does the Antonov AN-225 not have any winglets?
Why does every calorie tracking app give a different target calorie count for the same goals?
How do native German speakers usually express skepticism (using even) about a premise?
Matrix with arrows and comments
Data Encryption by Application vs Data Encryption in Database
"was fiction" vs "were fictions"
Is it possible to split a vertex?
Backspace functionality in normal mode
Couldn't make condition-case work
Can I play a mimic PC?
Is there any reason why MCU changed the Snap to Blip
What are the indigenous English words for a prostitute?
Yet another hash table in C
What are the original Russian words for a prostitute?
Are there any sports for which the world's best player is female?
Addressing unnecessary daily meetings with manager?
What do three diagonal dots above a letter mean in the "Misal rico de Cisneros" (Spain, 1518)?
When I press the space bar it deletes the letters in front of it
What is /bin/red
The joke office
Couldn't make condition-case work
How to condition-case Lisp nesting exceeds `max-lisp-eval-depth'?What is the difference between the error handler in condition-case and the error functionOn Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it doesHow Can I Prevent make-process from failing if the default-directory doesn't exist?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Hello fellow Emacs Lisp enthusiasts!
I've encountered problem that I am even embarrassed to describe. It is very clear how to use condition-case
from all the docs and examples that I can find online, but still even the simplest example won't work for me.
Here is a minimal code snippet:
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(test-signal nil))
I use Emacs 26.1, but encounter the same behaviour on other versions as well.
Thank you for any help!
error-handling
New contributor
add a comment |
Hello fellow Emacs Lisp enthusiasts!
I've encountered problem that I am even embarrassed to describe. It is very clear how to use condition-case
from all the docs and examples that I can find online, but still even the simplest example won't work for me.
Here is a minimal code snippet:
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(test-signal nil))
I use Emacs 26.1, but encounter the same behaviour on other versions as well.
Thank you for any help!
error-handling
New contributor
add a comment |
Hello fellow Emacs Lisp enthusiasts!
I've encountered problem that I am even embarrassed to describe. It is very clear how to use condition-case
from all the docs and examples that I can find online, but still even the simplest example won't work for me.
Here is a minimal code snippet:
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(test-signal nil))
I use Emacs 26.1, but encounter the same behaviour on other versions as well.
Thank you for any help!
error-handling
New contributor
Hello fellow Emacs Lisp enthusiasts!
I've encountered problem that I am even embarrassed to describe. It is very clear how to use condition-case
from all the docs and examples that I can find online, but still even the simplest example won't work for me.
Here is a minimal code snippet:
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(test-signal nil))
I use Emacs 26.1, but encounter the same behaviour on other versions as well.
Thank you for any help!
error-handling
error-handling
New contributor
New contributor
New contributor
asked 10 hours ago
Valeriy SavchenkoValeriy Savchenko
1083 bronze badges
1083 bronze badges
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Your error symbol test-signal
is not defined. C-h f signal
says:
An error symbol is a symbol with an
error-conditions
property
that is a list of condition names.
Let's check this for some standard error symbols and the test-signal
(get 'error 'error-conditions)
;; => (error)
(get 'args-out-of-range 'error-conditions)
;; => (args-out-of-range error)
(get 'test-signal 'error-conditions)
;; => nil
To define an error symbol, use define-error
, e.g.,
(define-error 'test-signal "My error for testing")
then you can handle the error in condition-case
, e.g.,
(condition-case err
(signal 'test-signal '(1 2 3))
(test-signal (error-message-string err)))
;; => "My error for testing: 1, 2, 3"
Thanks a lot! That was the problem. I was checkineieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.
– Valeriy Savchenko
9 hours ago
@ValeriySavchenko Theinvalid-slot-type
error symbol is defined withdefine-error
since Emacs 25.1. In early versions, it is defined withput
. By the way,define-error
is added in Emacs 24.4.
– xuchunyang
9 hours ago
add a comment |
You need to define a symbol as an error to get Emacs to recognize it:
(define-error 'test-signal
"Test signal" 'error)
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(error nil))
From (elisp) Error Symbols
:
-- Function:
define-error
name message &optional parent
In order for a symbol to be an error symbol, it must be defined
withdefine-error
which takes a parent condition (defaults to
error
). This parent defines the conditions that this kind of
error belongs to. The transitive set of parents always includes
the error symbol itself, and the symbolerror
. Because quitting
is not considered an error, the set of parents ofquit
is just
(quit)
.
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "583"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Valeriy Savchenko is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f51488%2fcouldnt-make-condition-case-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your error symbol test-signal
is not defined. C-h f signal
says:
An error symbol is a symbol with an
error-conditions
property
that is a list of condition names.
Let's check this for some standard error symbols and the test-signal
(get 'error 'error-conditions)
;; => (error)
(get 'args-out-of-range 'error-conditions)
;; => (args-out-of-range error)
(get 'test-signal 'error-conditions)
;; => nil
To define an error symbol, use define-error
, e.g.,
(define-error 'test-signal "My error for testing")
then you can handle the error in condition-case
, e.g.,
(condition-case err
(signal 'test-signal '(1 2 3))
(test-signal (error-message-string err)))
;; => "My error for testing: 1, 2, 3"
Thanks a lot! That was the problem. I was checkineieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.
– Valeriy Savchenko
9 hours ago
@ValeriySavchenko Theinvalid-slot-type
error symbol is defined withdefine-error
since Emacs 25.1. In early versions, it is defined withput
. By the way,define-error
is added in Emacs 24.4.
– xuchunyang
9 hours ago
add a comment |
Your error symbol test-signal
is not defined. C-h f signal
says:
An error symbol is a symbol with an
error-conditions
property
that is a list of condition names.
Let's check this for some standard error symbols and the test-signal
(get 'error 'error-conditions)
;; => (error)
(get 'args-out-of-range 'error-conditions)
;; => (args-out-of-range error)
(get 'test-signal 'error-conditions)
;; => nil
To define an error symbol, use define-error
, e.g.,
(define-error 'test-signal "My error for testing")
then you can handle the error in condition-case
, e.g.,
(condition-case err
(signal 'test-signal '(1 2 3))
(test-signal (error-message-string err)))
;; => "My error for testing: 1, 2, 3"
Thanks a lot! That was the problem. I was checkineieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.
– Valeriy Savchenko
9 hours ago
@ValeriySavchenko Theinvalid-slot-type
error symbol is defined withdefine-error
since Emacs 25.1. In early versions, it is defined withput
. By the way,define-error
is added in Emacs 24.4.
– xuchunyang
9 hours ago
add a comment |
Your error symbol test-signal
is not defined. C-h f signal
says:
An error symbol is a symbol with an
error-conditions
property
that is a list of condition names.
Let's check this for some standard error symbols and the test-signal
(get 'error 'error-conditions)
;; => (error)
(get 'args-out-of-range 'error-conditions)
;; => (args-out-of-range error)
(get 'test-signal 'error-conditions)
;; => nil
To define an error symbol, use define-error
, e.g.,
(define-error 'test-signal "My error for testing")
then you can handle the error in condition-case
, e.g.,
(condition-case err
(signal 'test-signal '(1 2 3))
(test-signal (error-message-string err)))
;; => "My error for testing: 1, 2, 3"
Your error symbol test-signal
is not defined. C-h f signal
says:
An error symbol is a symbol with an
error-conditions
property
that is a list of condition names.
Let's check this for some standard error symbols and the test-signal
(get 'error 'error-conditions)
;; => (error)
(get 'args-out-of-range 'error-conditions)
;; => (args-out-of-range error)
(get 'test-signal 'error-conditions)
;; => nil
To define an error symbol, use define-error
, e.g.,
(define-error 'test-signal "My error for testing")
then you can handle the error in condition-case
, e.g.,
(condition-case err
(signal 'test-signal '(1 2 3))
(test-signal (error-message-string err)))
;; => "My error for testing: 1, 2, 3"
answered 10 hours ago
xuchunyangxuchunyang
9,6571 gold badge9 silver badges27 bronze badges
9,6571 gold badge9 silver badges27 bronze badges
Thanks a lot! That was the problem. I was checkineieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.
– Valeriy Savchenko
9 hours ago
@ValeriySavchenko Theinvalid-slot-type
error symbol is defined withdefine-error
since Emacs 25.1. In early versions, it is defined withput
. By the way,define-error
is added in Emacs 24.4.
– xuchunyang
9 hours ago
add a comment |
Thanks a lot! That was the problem. I was checkineieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.
– Valeriy Savchenko
9 hours ago
@ValeriySavchenko Theinvalid-slot-type
error symbol is defined withdefine-error
since Emacs 25.1. In early versions, it is defined withput
. By the way,define-error
is added in Emacs 24.4.
– xuchunyang
9 hours ago
Thanks a lot! That was the problem. I was checkin
eieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.– Valeriy Savchenko
9 hours ago
Thanks a lot! That was the problem. I was checkin
eieio
code, but their error (invalid-slot-type
) doesn't seem to be defined like this.– Valeriy Savchenko
9 hours ago
@ValeriySavchenko The
invalid-slot-type
error symbol is defined with define-error
since Emacs 25.1. In early versions, it is defined with put
. By the way, define-error
is added in Emacs 24.4.– xuchunyang
9 hours ago
@ValeriySavchenko The
invalid-slot-type
error symbol is defined with define-error
since Emacs 25.1. In early versions, it is defined with put
. By the way, define-error
is added in Emacs 24.4.– xuchunyang
9 hours ago
add a comment |
You need to define a symbol as an error to get Emacs to recognize it:
(define-error 'test-signal
"Test signal" 'error)
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(error nil))
From (elisp) Error Symbols
:
-- Function:
define-error
name message &optional parent
In order for a symbol to be an error symbol, it must be defined
withdefine-error
which takes a parent condition (defaults to
error
). This parent defines the conditions that this kind of
error belongs to. The transitive set of parents always includes
the error symbol itself, and the symbolerror
. Because quitting
is not considered an error, the set of parents ofquit
is just
(quit)
.
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
add a comment |
You need to define a symbol as an error to get Emacs to recognize it:
(define-error 'test-signal
"Test signal" 'error)
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(error nil))
From (elisp) Error Symbols
:
-- Function:
define-error
name message &optional parent
In order for a symbol to be an error symbol, it must be defined
withdefine-error
which takes a parent condition (defaults to
error
). This parent defines the conditions that this kind of
error belongs to. The transitive set of parents always includes
the error symbol itself, and the symbolerror
. Because quitting
is not considered an error, the set of parents ofquit
is just
(quit)
.
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
add a comment |
You need to define a symbol as an error to get Emacs to recognize it:
(define-error 'test-signal
"Test signal" 'error)
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(error nil))
From (elisp) Error Symbols
:
-- Function:
define-error
name message &optional parent
In order for a symbol to be an error symbol, it must be defined
withdefine-error
which takes a parent condition (defaults to
error
). This parent defines the conditions that this kind of
error belongs to. The transitive set of parents always includes
the error symbol itself, and the symbolerror
. Because quitting
is not considered an error, the set of parents ofquit
is just
(quit)
.
You need to define a symbol as an error to get Emacs to recognize it:
(define-error 'test-signal
"Test signal" 'error)
(defun foo ()
(signal 'test-signal '(1 2 3)))
(condition-case nil
(foo)
(error nil))
From (elisp) Error Symbols
:
-- Function:
define-error
name message &optional parent
In order for a symbol to be an error symbol, it must be defined
withdefine-error
which takes a parent condition (defaults to
error
). This parent defines the conditions that this kind of
error belongs to. The transitive set of parents always includes
the error symbol itself, and the symbolerror
. Because quitting
is not considered an error, the set of parents ofquit
is just
(quit)
.
answered 10 hours ago
DoMiNeLa10♦DoMiNeLa10
2,0991 gold badge7 silver badges24 bronze badges
2,0991 gold badge7 silver badges24 bronze badges
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
add a comment |
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
Thanks a lot! It helped!
– Valeriy Savchenko
9 hours ago
add a comment |
Valeriy Savchenko is a new contributor. Be nice, and check out our Code of Conduct.
Valeriy Savchenko is a new contributor. Be nice, and check out our Code of Conduct.
Valeriy Savchenko is a new contributor. Be nice, and check out our Code of Conduct.
Valeriy Savchenko is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Emacs Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f51488%2fcouldnt-make-condition-case-work%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown