unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : Set the default-directory dynamically according to the buffer-file-name.
Date: Fri, 01 Oct 2021 09:09:35 +0200	[thread overview]
Message-ID: <87zgrtgr0w.fsf@zoho.eu> (raw)
In-Reply-To: CAGP6POJDHHPrFzdEkwaJdbu802Q4-=wCBbXUeLmbdCLkGvBqaQ@mail.gmail.com

Hongyi Zhao wrote:

>> (if (not WHATEVER)
>>     (message "PROBLEM NOTIFICATION")
>>   (DO-STUFF))
>>
>> If you want to stop everything and be sure the
>> message is seen, you might want to raise an error:
>>
>> (unless WHATEVER (error "PROBLEM")) ; End it all
>> (DO-STUFF)
>
> Do you mean this is a good practice for usage scenarios in
> production environments?

Well, yes, but also in every other environment where your
aspiration is to write good, idiomatic Lisp.

He is showing the syntax and how it is put together for
two scenarios.

But the more tricky question is another, namely when should
one use the first one (i.e., `message' the situation, then
branch out) and when is the situation in fact an `error', much
like division by zero?

(/ 1337 0) ; Arithmetic error

-- 
underground experts united
https://dataswamp.org/~incal




      reply	other threads:[~2021-10-01  7:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 14:31 Set the default-directory dynamically according to the buffer-file-name Hongyi Zhao
2021-09-29 14:50 ` Hongyi Zhao
2021-09-29 15:31 ` Tassilo Horn
2021-09-30  1:08   ` Hongyi Zhao
2021-09-30  3:37     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30  7:00       ` Hongyi Zhao
2021-09-30  7:39         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-30  8:54           ` Hongyi Zhao
2021-09-30  9:58             ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-09-29 15:47 ` [External] : " Drew Adams
2021-10-01  4:41   ` Hongyi Zhao
2021-10-01  7:09     ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgrtgr0w.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).