From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: [External] : Set the default-directory dynamically according to the buffer-file-name. Date: Fri, 1 Oct 2021 12:41:52 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30538"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 01 06:42:43 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWANf-0007lm-Ij for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 01 Oct 2021 06:42:43 +0200 Original-Received: from localhost ([::1]:34272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWANe-0001cB-2G for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 01 Oct 2021 00:42:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWAN7-0001UA-Hw for help-gnu-emacs@gnu.org; Fri, 01 Oct 2021 00:42:09 -0400 Original-Received: from mail-vs1-xe2b.google.com ([2607:f8b0:4864:20::e2b]:38619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWAN2-0003Ts-11 for help-gnu-emacs@gnu.org; Fri, 01 Oct 2021 00:42:09 -0400 Original-Received: by mail-vs1-xe2b.google.com with SMTP id y141so9950208vsy.5 for ; Thu, 30 Sep 2021 21:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tWm7zBhXZlB3Fef0Xd9BIxYjeNWWcR2/JvQ8efVtxDY=; b=RAgIvp08S539Rs/Tror7YTO9WKtRz4TtvE4jmLQNKym1BJrqkz2Tr05T/Begc3E3VG s91rJyt7E/Ob+BBwd9kVk+wLGtU5uXSHnOhonnQC+tZf1pQ2r7Jx7Z9miy8OOnxXy7L1 biVJnxT+uUMauqZ9j5q1kT/CZ9Wi5zbbpjWeHF23qH8QvhG1oE7auYojGONTJxMHXU/n DbCzH4jYKBWaZ/uc3H98sTp7S0YK4aItTprlI0MaCSITKAEppeubiFygcHSj+Q6J8P9z om5NSoAdW79PrTq2ghMLOfF4bEMpe7HXenmXiyAsVb51zidPquZkcWwEUpXuTBrWS1dP InYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tWm7zBhXZlB3Fef0Xd9BIxYjeNWWcR2/JvQ8efVtxDY=; b=1O7b2ZMyu71852OcT6HS3xdrAC2D19/kVIu+eTrmSUYHmQXAXtngtr/GOuTOY+BQiE XnQE8WI/FS7GFelVUVTU9I2Yzwd9WxH1AJydM27TCS+YTGtJPF9w4yUWKSO9tlYhZMqC pgWoYiFevoJgmrdjIhd8pKKLVVV28BxURZMJVpAUFU2ou2HePAeGIML6JOsbOlbQptJj yp2Iq8rI9Cg9RODoUNQ1V1sJDv5yv3nLycKpOtavTY15cIhzmhd1bp5/bilPP/t2tNfR PG7xZadUiYghb6r38IqZKse8vl8WIkRfwFaVOO+G92ZZvZzIJfse6WgAw/wm+YnOXjYu jqpw== X-Gm-Message-State: AOAM533jBhhUP4Jw0rtxbQfyKhGISp+pR4sGdbN91+rBSAAWuDSj3rq+ zk7OqtpVg570GcP01/5nIVFE7wurmcZNzp0qtlw= X-Google-Smtp-Source: ABdhPJxzYCElm29m/I6eotQxlYtkUvQEdCQCcZC4EpVBmPkNPae3hOTpz6liHiGnf99PtlMwI1OMaa2Na3TF1ZHfg7Y= X-Received: by 2002:a67:5f86:: with SMTP id t128mr2629208vsb.10.1633063322959; Thu, 30 Sep 2021 21:42:02 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::e2b; envelope-from=hongyi.zhao@gmail.com; helo=mail-vs1-xe2b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133470 Archived-At: On Wed, Sep 29, 2021 at 11:47 PM Drew Adams wrote: > > > (if (not file) > > (message "no file name here.") > > (setq default-directory (file-name-directory > > (buffer-file-name)))))) > > (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? HZ