From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Adding an `or condition without changing code Date: Mon, 13 Jan 2020 09:55:17 -0900 Message-ID: <78686b71-fbfc-a95c-2177-66f0c7fa98d4@akwebsoft.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="193731"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 13 19:56:51 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ir4sX-000gtE-IY for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 13 Jan 2020 19:55:58 +0100 Original-Received: from localhost ([::1]:54474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ir4sV-0004cv-Tw for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 13 Jan 2020 13:55:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ir4ry-0004WS-DL for help-gnu-emacs@gnu.org; Mon, 13 Jan 2020 13:55:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ir4rw-0005m3-S8 for help-gnu-emacs@gnu.org; Mon, 13 Jan 2020 13:55:22 -0500 Original-Received: from gateway22.websitewelcome.com ([192.185.46.152]:49432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ir4rw-0005kI-C0 for help-gnu-emacs@gnu.org; Mon, 13 Jan 2020 13:55:20 -0500 Original-Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 6C5F513B6E for ; Mon, 13 Jan 2020 12:55:19 -0600 (CST) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id r4ruiSOPm32Adr4rviddJp; Mon, 13 Jan 2020 12:55:19 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tj49.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0dttSXPRzTlnM/yFisre+SKx2MLlTgpPSdXSNQBS43Y=; b=NUIPUvwMmOwF70LR1U+QiKyULi 7iRHGmdztoYLgaOt4uEFBbsNsnVgjZnFWyoMHfI4DVfhs3RtZX21yZfMz/BXVbpsQsk8RABYs91YH SQWXuVqomNpawGX/XTRVKRU5f; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:33110 helo=[192.168.1.6]) by host2075.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1ir4ru-0020uF-Lk for help-gnu-emacs@gnu.org; Mon, 13 Jan 2020 11:55:18 -0700 In-Reply-To: Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2075.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - akwebsoft.com X-BWhitelist: no X-Source-IP: 64.4.232.191 X-Source-L: No X-Exim-ID: 1ir4ru-0020uF-Lk X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:33110 X-Source-Auth: tim@tj49.com X-Email-Count: 1 X-Source-Cap: bW9sZG92YXM7bW9sZG92YXM7aG9zdDIwNzUuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.46.152 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.org gmane.emacs.help:122218 Archived-At: On 1/13/20 5:37 AM, Stefan Monnier wrote: >> I'm implementing dired-single-buffer >> >> The function of the same name has the following `let initialization >> >> (let ((name (or default-dirname (dired-get-filename nil t)))) ;; >> default-dirname is an optional argument to dired-single-buffer >> >> The two conditions to `or are not sufficient if I call dired-single-bu= ffer >> from an unvisited buffer. The result is that `name is nil and a string= -p, >> nil error is thrown. >> >> A simple hack is to add a third condition to `or >> >> (let ((name (or default-dirname (dired-get-filename nil t) "~/")))=C2=A0= ;; >> fall-back to /home/user > I guess using `default-directory` rather than "~" would be more > generally useful. > >> But, it IS a hack and means I have altered some good citizen's code. > Indeed. Luckily Emacs does make it possible to do that. > >> How can that be resolved? Might the solution be a customization of dir= ed? > I think it should be considered as a bug in `dired-single-buffer`. > >> From the documentation of dired-get-filename I don't grok a solution.= ... > You can only meaningfully use `dired-get-filename` inside > a dired buffer, so the problem is in that function. Thanks for those insights. I'm going with Drew Adams' dired+ instead. dired+ easily takes care of multiple buffer issues. cheers --=20 Tim tj49.com