From unknown Sat Aug 16 21:23:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72132: Delete commented out code from fileio.c? Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Jul 2024 00:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72132 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 72132@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172108794626502 (code B ref -1); Tue, 16 Jul 2024 00:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jul 2024 23:59:06 +0000 Received: from localhost ([127.0.0.1]:60603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTVaz-0006tN-GB for submit@debbugs.gnu.org; Mon, 15 Jul 2024 19:59:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:53352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTVaw-0006tD-Ub for submit@debbugs.gnu.org; Mon, 15 Jul 2024 19:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTVau-0003f2-9e for bug-gnu-emacs@gnu.org; Mon, 15 Jul 2024 19:59:00 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTVas-0007t9-HO for bug-gnu-emacs@gnu.org; Mon, 15 Jul 2024 19:59:00 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-595856e2332so6415072a12.1 for ; Mon, 15 Jul 2024 16:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721087936; x=1721692736; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:from:to:cc:subject:date:message-id:reply-to; bh=TVPpsH5HJgpbgf59rXZOhSSolZ9DHSmhjkVS1u+mI2E=; b=jrzX3NiCtYw1AJMYaT7pX/GYfZVpRQKkjNcdOYqilFsHZXVBpvtDermnX9HN+pXMXa hmZjbDtL/46bmwSoaQoYvN7PBvkC07BCTcS2LM7nLz5pd1aWY7P0DXH9a//dofj+1DYk NEpMdx9xIwASZJBAlAuIEbc30+c/O/ox4vrT7wPTQCR3MIlJIT9RJB9g78vRSZeKB8aT cCLqmj/+bY2us6dAwF+f+hAioiqYE/VbQHBYeKri5gIA2jH8sqBkV1ixqCdb8O5VQPHx AURHPdHpThfMoUZU2e/3U16v/nA4CXVKLN6GvIuqpsMSg8wHw6jvM0wwl+VPXnWzYJ/7 /5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721087936; x=1721692736; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TVPpsH5HJgpbgf59rXZOhSSolZ9DHSmhjkVS1u+mI2E=; b=JwmFI2pEV76uk7RGGXatdg5EuXKIwfSrwiM/pRuovfeOf051PJLrNpM3uIKSKfmRVn 52nlsFymXH3xPZi/g6CVo4AkculVWIooBz5l+vGrMdnTzuG1vQ2Hf49+F86pbF/5ZSo2 MOjp/iKzMYUzQJidEAmrpaxZGZm1NmpnISDp9c+JYgzKz5kFUXMxYQDxU2vgNvivLnRI OrpdM36cr5ovqDW3wvTI31TCf84CJKgj2L680hu2oPY4rAMLCcKoCHIJjrsReGV03VIu lzp68TM16+lLp9KeVW6T3m+RZdbItc+8e3zOU7FI0Xa8D1NE9Ei7vB8QrssmwZ/tuLf0 ejxg== X-Gm-Message-State: AOJu0YwHDW0EJI9VU0tTVZT8K3mSsSVW1OnodKBS7Sm2ivLPN+kzLm/8 4d1GF8G3fUq4iWtCai6jKFjeOFRadcPc9K6dswxxHSqJB720hrwzF8+GBKUSyXhT0cXMqELHQg5 CM3B019gRODVyCt2Md9qrXGe07R1HSYAt X-Google-Smtp-Source: AGHT+IH9FBlbtshrpE2SQFlx+mkCrWu5hxaWNi+TSitQ9vctEZ7ZdRORLU0KU2cBBAcaL4aaqym39lxpKr/JycuNu58= X-Received: by 2002:a05:6402:5194:b0:57c:9ccd:c626 with SMTP id 4fb4d7f45d1cf-59ef0ccc489mr230633a12.39.1721087935724; Mon, 15 Jul 2024 16:58:55 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 15 Jul 2024 23:58:55 +0000 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 15 Jul 2024 23:58:55 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x532.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Severity: wishlist The below code was commented out since Emacs 10.31, and there's a commit from 2001 saying that it might still be useful. Maybe things have changed in 23 years, and it's less useful than it used to be. How about removing it now? diff --git a/src/fileio.c b/src/fileio.c index 7afe3e75737..3433f471182 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1758,166 +1758,6 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, return result; } -#if 0 -/* PLEASE DO NOT DELETE THIS COMMENTED-OUT VERSION! - This is the old version of expand-file-name, before it was thoroughly - rewritten for Emacs 10.31. We leave this version here commented-out, - because the code is very complex and likely to have subtle bugs. If - bugs _are_ found, it might be of interest to look at the old code and - see what did it do in the relevant situation. - - Don't remove this code: it's true that it will be accessible - from the repository, but a few years from deletion, people will - forget it is there. */ - -/* Changed this DEFUN to a DEAFUN, so as not to confuse `make-docfile'. *= / -DEAFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, - "Convert FILENAME to absolute, and canonicalize it.\n\ -Second arg DEFAULT is directory to start with if FILENAME is relative\n\ -\(does not start with slash); if DEFAULT is nil or missing,\n\ -the current buffer's value of default-directory is used.\n\ -Filenames containing `.' or `..' as components are simplified;\n\ -initial `~/' expands to your home directory.\n\ -See also the function `substitute-in-file-name'.") - (name, defalt) - Lisp_Object name, defalt; -{ - unsigned char *nm; - - register unsigned char *newdir, *p, *o; - ptrdiff_t tlen; - unsigned char *target; - struct passwd *pw; - - CHECK_STRING (name); - nm =3D SDATA (name); - - /* If nm is absolute, flush ...// and detect /./ and /../. - If no /./ or /../ we can return right away. */ - if (nm[0] =3D=3D '/') - { - bool lose =3D 0; - p =3D nm; - while (*p) - { - if (p[0] =3D=3D '/' && p[1] =3D=3D '/') - nm =3D p + 1; - if (p[0] =3D=3D '/' && p[1] =3D=3D '~') - nm =3D p + 1, lose =3D 1; - if (p[0] =3D=3D '/' && p[1] =3D=3D '.' - && (p[2] =3D=3D '/' || p[2] =3D=3D 0 - || (p[2] =3D=3D '.' && (p[3] =3D=3D '/' || p[3] =3D=3D 0)))) - lose =3D 1; - p++; - } - if (!lose) - { - if (nm =3D=3D SDATA (name)) - return name; - return build_string (nm); - } - } - - /* Now determine directory to start with and put it in NEWDIR. */ - - newdir =3D 0; - - if (nm[0] =3D=3D '~') /* prefix ~ */ - if (nm[1] =3D=3D '/' || nm[1] =3D=3D 0)/* ~/filename */ - { - if (!(newdir =3D (unsigned char *) egetenv ("HOME"))) - newdir =3D (unsigned char *) ""; - nm++; - } - else /* ~user/filename */ - { - /* Get past ~ to user. */ - unsigned char *user =3D nm + 1; - /* Find end of name. */ - unsigned char *ptr =3D (unsigned char *) strchr (user, '/'); - ptrdiff_t len =3D ptr ? ptr - user : strlen (user); - /* Copy the user name into temp storage. */ - o =3D alloca (len + 1); - memcpy (o, user, len); - o[len] =3D 0; - - /* Look up the user name. */ - block_input (); - pw =3D (struct passwd *) getpwnam (o + 1); - unblock_input (); - if (!pw) - error ("\"%s\" isn't a registered user", o + 1); - - newdir =3D (unsigned char *) pw->pw_dir; - - /* Discard the user name from NM. */ - nm +=3D len; - } - - if (nm[0] !=3D '/' && !newdir) - { - if (NILP (defalt)) - defalt =3D current_buffer->directory; - CHECK_STRING (defalt); - newdir =3D SDATA (defalt); - } - - /* Now concatenate the directory and name to new space in the stack frame. */ - - tlen =3D (newdir ? strlen (newdir) + 1 : 0) + strlen (nm) + 1; - target =3D alloca (tlen); - *target =3D 0; - - if (newdir) - { - if (nm[0] =3D=3D 0 || nm[0] =3D=3D '/') - strcpy (target, newdir); - else - file_name_as_directory (target, newdir); - } - - strcat (target, nm); - - /* Now canonicalize by removing /. and /foo/.. if they appear. */ - - p =3D target; - o =3D target; - - while (*p) - { - if (*p !=3D '/') - { - *o++ =3D *p++; - } - else if (!strncmp (p, "//", 2) - ) - { - o =3D target; - p++; - } - else if (p[0] =3D=3D '/' && p[1] =3D=3D '.' - && (p[2] =3D=3D '/' || p[2] =3D=3D 0)) - p +=3D 2; - else if (!strncmp (p, "/..", 3) - /* `/../' is the "superroot" on certain file systems. */ - && o !=3D target - && (p[3] =3D=3D '/' || p[3] =3D=3D 0)) - { - while (o !=3D target && *--o !=3D '/') - ; - if (o =3D=3D target && *o =3D=3D '/') - ++o; - p +=3D 3; - } - else - { - *o++ =3D *p++; - } - } - - return make_string (target, o - target); -} -#endif =0C /* Put into BUF the concatenation of DIR and FILE, with an intervening directory separator if needed. Return a pointer to the null byte From unknown Sat Aug 16 21:23:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#72132: Delete commented out code from fileio.c? Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Jul 2024 02:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72132 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 72132@debbugs.gnu.org Received: via spool by 72132-submit@debbugs.gnu.org id=B72132.17210971739687 (code B ref 72132); Tue, 16 Jul 2024 02:33:01 +0000 Received: (at 72132) by debbugs.gnu.org; 16 Jul 2024 02:32:53 +0000 Received: from localhost ([127.0.0.1]:60682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTXzp-0002WA-1L for submit@debbugs.gnu.org; Mon, 15 Jul 2024 22:32:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTXzn-0002Vx-O7 for 72132@debbugs.gnu.org; Mon, 15 Jul 2024 22:32:52 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTXxY-0005XB-Sv; Mon, 15 Jul 2024 22:30:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5KWsTOwTfAPKtnYVCh8cD5JgIdY3lUYhmi3eXFOvXGc=; b=lSCKQIax3fW6 WrNoXaIMHKHk2yOTYgND2v/2z4eSKlu38nkw0QQzcboOvO/KljwSqZHmWWbBTF4tZsQHVrvAygNl9 Ds0SdZ0mOJiin60vCQbaUXxrGI43dhzNLME5GUJlkb7VO5qsgscYUnx3pYSTzbrCa9VIisgmhx7uE piH5RTZ006OiTGFXPFmHrhd/OG0nrEFrRaK35cYUQTUGvm0xM5mW3CCK/OZyl9p8R+4P5m384k65F JMr29QXBVl6qh/JVtJsTyGF7shf3fHm97Kp7Jo9HVjk4p+dhBMB2iawUgPh2idqgYIsraPRSxepkE lZ/Fi5ZVkHRhTTgTSYzNsA==; Date: Tue, 16 Jul 2024 05:30:21 +0300 Message-Id: <86ed7uhxvm.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Stefan Kangas on Mon, 15 Jul 2024 23:58:55 +0000) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Mon, 15 Jul 2024 23:58:55 +0000 > > Severity: wishlist > > The below code was commented out since Emacs 10.31, and there's a commit > from 2001 saying that it might still be useful. Maybe things have > changed in 23 years, and it's less useful than it used to be. > > How about removing it now? I still find it useful to look at that old code from time to time. From unknown Sat Aug 16 21:23:17 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Kangas Subject: bug#72132: closed (Re: bug#72132: Delete commented out code from fileio.c?) Message-ID: References: X-Gnu-PR-Message: they-closed 72132 X-Gnu-PR-Package: emacs Reply-To: 72132@debbugs.gnu.org Date: Wed, 17 Jul 2024 21:50:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1721253002-20921-1" This is a multi-part message in MIME format... ------------=_1721253002-20921-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #72132: Delete commented out code from fileio.c? which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 72132@debbugs.gnu.org. --=20 72132: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D72132 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1721253002-20921-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 72132-done) by debbugs.gnu.org; 17 Jul 2024 21:49:21 +0000 Received: from localhost ([127.0.0.1]:36307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUCWX-0005QW-8l for submit@debbugs.gnu.org; Wed, 17 Jul 2024 17:49:21 -0400 Received: from mail-ed1-f50.google.com ([209.85.208.50]:53688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUCWV-0005QG-1T for 72132-done@debbugs.gnu.org; Wed, 17 Jul 2024 17:49:20 -0400 Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5a15c2dc569so60732a12.3 for <72132-done@debbugs.gnu.org>; Wed, 17 Jul 2024 14:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721252890; x=1721857690; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=I2m+DkWHRioOSOGzhjlr85yxY+uZr34RONE7j4Z86ew=; b=bnx80eGak3Fy3ic5kkS2VCiRrmn0yJbN7fyxLlfHMAyOo6YIMCNOxXto6ZHZanh/tY clUSAMCjF/2lLlvAwHCZBcVA1ehe3+z4ONPzQ7D+RuxI9CqR4DWF6JokvGPphbTp7MHa mQ2ddxBgH73tZ2IJmu9fhQIgVyUbuaHZT759Wz8WHBPPEUxpYXTf72zpikauRJoEVsB0 cAKAFubDvCNmlTRB25wYidLbnfBxcryc+UU9YZoAHLKyWUCedRDhTwjwRpy27UuIgyQ4 467e/tUHrJPdjnmEuys1XnYpIoue8JU6VLLKb9TrArxgliAnN0VJ1/mjB5Y6HcITphYX jnXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721252890; x=1721857690; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I2m+DkWHRioOSOGzhjlr85yxY+uZr34RONE7j4Z86ew=; b=IWd7NFc7AOdmuqHx5BH6FSJbU4/EAPW7BItq3ZcGNOElnbwlEwMj6PPSfwELvSFoE7 KR3K+rF2JgLf636tFNAEUcnOUGnTRQkU+4Wg3g1YvH8P46wsjdssk4tonWUf3CCL4R8i sTG7pAGf7jJxvf2LSK5vcFhGE/nQPai13xSspYLsxKz3yshsIPZWr9WODRCkXboxQGr0 ZH4pHOK4WJIo7vxHDCLTjIUOT+VN5NUgEevdxYfngKBNFwR2tTunBikNQR+aBgWAIwPj a+HY9VAZf/zvQgjo3tGoOILiA+v/vRgzZo+MRFVAZkiesTQ4Z47HfzTZlp2IBpWK0nR0 kQ3Q== X-Gm-Message-State: AOJu0YxrJcHiYIqRJYzlTIqoyFRcLhyyPlDs/t8x6qdX54WdUXCDnbCD 2tComl8KxPKXp1z9PHjW5s6kITLy7u6nlEn5kjGrHsSDPc8cJjsOFQLR2xqmKm3Uv4h1rI4bT1I 5CMS3oAdeTsOiHnq6iWNICC2FvzM= X-Google-Smtp-Source: AGHT+IFJg21GdJZ2E9okP1mXU2aItHDMxX41sUzzcRLZ7H5nnABLE/8dXbFJKpey86iYGpGTBfUDeIq9ju7GGn/j0yc= X-Received: by 2002:a50:d49e:0:b0:582:6eb6:2526 with SMTP id 4fb4d7f45d1cf-5a05cc25f80mr2565392a12.27.1721252889498; Wed, 17 Jul 2024 14:48:09 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 17 Jul 2024 14:48:08 -0700 From: Stefan Kangas In-Reply-To: <86ed7uhxvm.fsf@gnu.org> References: <86ed7uhxvm.fsf@gnu.org> MIME-Version: 1.0 Date: Wed, 17 Jul 2024 14:48:08 -0700 Message-ID: Subject: Re: bug#72132: Delete commented out code from fileio.c? To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72132-done Cc: 72132-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Kangas >> Date: Mon, 15 Jul 2024 23:58:55 +0000 >> >> Severity: wishlist >> >> The below code was commented out since Emacs 10.31, and there's a commit >> from 2001 saying that it might still be useful. Maybe things have >> changed in 23 years, and it's less useful than it used to be. >> >> How about removing it now? > > I still find it useful to look at that old code from time to time. OK, closing. ------------=_1721253002-20921-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Jul 2024 23:59:06 +0000 Received: from localhost ([127.0.0.1]:60603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTVaz-0006tN-GB for submit@debbugs.gnu.org; Mon, 15 Jul 2024 19:59:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:53352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sTVaw-0006tD-Ub for submit@debbugs.gnu.org; Mon, 15 Jul 2024 19:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTVau-0003f2-9e for bug-gnu-emacs@gnu.org; Mon, 15 Jul 2024 19:59:00 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTVas-0007t9-HO for bug-gnu-emacs@gnu.org; Mon, 15 Jul 2024 19:59:00 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-595856e2332so6415072a12.1 for ; Mon, 15 Jul 2024 16:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721087936; x=1721692736; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:from:to:cc:subject:date:message-id:reply-to; bh=TVPpsH5HJgpbgf59rXZOhSSolZ9DHSmhjkVS1u+mI2E=; b=jrzX3NiCtYw1AJMYaT7pX/GYfZVpRQKkjNcdOYqilFsHZXVBpvtDermnX9HN+pXMXa hmZjbDtL/46bmwSoaQoYvN7PBvkC07BCTcS2LM7nLz5pd1aWY7P0DXH9a//dofj+1DYk NEpMdx9xIwASZJBAlAuIEbc30+c/O/ox4vrT7wPTQCR3MIlJIT9RJB9g78vRSZeKB8aT cCLqmj/+bY2us6dAwF+f+hAioiqYE/VbQHBYeKri5gIA2jH8sqBkV1ixqCdb8O5VQPHx AURHPdHpThfMoUZU2e/3U16v/nA4CXVKLN6GvIuqpsMSg8wHw6jvM0wwl+VPXnWzYJ/7 /5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721087936; x=1721692736; h=content-transfer-encoding:to:subject:message-id:date:mime-version :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TVPpsH5HJgpbgf59rXZOhSSolZ9DHSmhjkVS1u+mI2E=; b=JwmFI2pEV76uk7RGGXatdg5EuXKIwfSrwiM/pRuovfeOf051PJLrNpM3uIKSKfmRVn 52nlsFymXH3xPZi/g6CVo4AkculVWIooBz5l+vGrMdnTzuG1vQ2Hf49+F86pbF/5ZSo2 MOjp/iKzMYUzQJidEAmrpaxZGZm1NmpnISDp9c+JYgzKz5kFUXMxYQDxU2vgNvivLnRI OrpdM36cr5ovqDW3wvTI31TCf84CJKgj2L680hu2oPY4rAMLCcKoCHIJjrsReGV03VIu lzp68TM16+lLp9KeVW6T3m+RZdbItc+8e3zOU7FI0Xa8D1NE9Ei7vB8QrssmwZ/tuLf0 ejxg== X-Gm-Message-State: AOJu0YwHDW0EJI9VU0tTVZT8K3mSsSVW1OnodKBS7Sm2ivLPN+kzLm/8 4d1GF8G3fUq4iWtCai6jKFjeOFRadcPc9K6dswxxHSqJB720hrwzF8+GBKUSyXhT0cXMqELHQg5 CM3B019gRODVyCt2Md9qrXGe07R1HSYAt X-Google-Smtp-Source: AGHT+IH9FBlbtshrpE2SQFlx+mkCrWu5hxaWNi+TSitQ9vctEZ7ZdRORLU0KU2cBBAcaL4aaqym39lxpKr/JycuNu58= X-Received: by 2002:a05:6402:5194:b0:57c:9ccd:c626 with SMTP id 4fb4d7f45d1cf-59ef0ccc489mr230633a12.39.1721087935724; Mon, 15 Jul 2024 16:58:55 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 15 Jul 2024 23:58:55 +0000 From: Stefan Kangas MIME-Version: 1.0 Date: Mon, 15 Jul 2024 23:58:55 +0000 Message-ID: Subject: Delete commented out code from fileio.c? To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x532.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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Severity: wishlist The below code was commented out since Emacs 10.31, and there's a commit from 2001 saying that it might still be useful. Maybe things have changed in 23 years, and it's less useful than it used to be. How about removing it now? diff --git a/src/fileio.c b/src/fileio.c index 7afe3e75737..3433f471182 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1758,166 +1758,6 @@ DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, return result; } -#if 0 -/* PLEASE DO NOT DELETE THIS COMMENTED-OUT VERSION! - This is the old version of expand-file-name, before it was thoroughly - rewritten for Emacs 10.31. We leave this version here commented-out, - because the code is very complex and likely to have subtle bugs. If - bugs _are_ found, it might be of interest to look at the old code and - see what did it do in the relevant situation. - - Don't remove this code: it's true that it will be accessible - from the repository, but a few years from deletion, people will - forget it is there. */ - -/* Changed this DEFUN to a DEAFUN, so as not to confuse `make-docfile'. *= / -DEAFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, - "Convert FILENAME to absolute, and canonicalize it.\n\ -Second arg DEFAULT is directory to start with if FILENAME is relative\n\ -\(does not start with slash); if DEFAULT is nil or missing,\n\ -the current buffer's value of default-directory is used.\n\ -Filenames containing `.' or `..' as components are simplified;\n\ -initial `~/' expands to your home directory.\n\ -See also the function `substitute-in-file-name'.") - (name, defalt) - Lisp_Object name, defalt; -{ - unsigned char *nm; - - register unsigned char *newdir, *p, *o; - ptrdiff_t tlen; - unsigned char *target; - struct passwd *pw; - - CHECK_STRING (name); - nm =3D SDATA (name); - - /* If nm is absolute, flush ...// and detect /./ and /../. - If no /./ or /../ we can return right away. */ - if (nm[0] =3D=3D '/') - { - bool lose =3D 0; - p =3D nm; - while (*p) - { - if (p[0] =3D=3D '/' && p[1] =3D=3D '/') - nm =3D p + 1; - if (p[0] =3D=3D '/' && p[1] =3D=3D '~') - nm =3D p + 1, lose =3D 1; - if (p[0] =3D=3D '/' && p[1] =3D=3D '.' - && (p[2] =3D=3D '/' || p[2] =3D=3D 0 - || (p[2] =3D=3D '.' && (p[3] =3D=3D '/' || p[3] =3D=3D 0)))) - lose =3D 1; - p++; - } - if (!lose) - { - if (nm =3D=3D SDATA (name)) - return name; - return build_string (nm); - } - } - - /* Now determine directory to start with and put it in NEWDIR. */ - - newdir =3D 0; - - if (nm[0] =3D=3D '~') /* prefix ~ */ - if (nm[1] =3D=3D '/' || nm[1] =3D=3D 0)/* ~/filename */ - { - if (!(newdir =3D (unsigned char *) egetenv ("HOME"))) - newdir =3D (unsigned char *) ""; - nm++; - } - else /* ~user/filename */ - { - /* Get past ~ to user. */ - unsigned char *user =3D nm + 1; - /* Find end of name. */ - unsigned char *ptr =3D (unsigned char *) strchr (user, '/'); - ptrdiff_t len =3D ptr ? ptr - user : strlen (user); - /* Copy the user name into temp storage. */ - o =3D alloca (len + 1); - memcpy (o, user, len); - o[len] =3D 0; - - /* Look up the user name. */ - block_input (); - pw =3D (struct passwd *) getpwnam (o + 1); - unblock_input (); - if (!pw) - error ("\"%s\" isn't a registered user", o + 1); - - newdir =3D (unsigned char *) pw->pw_dir; - - /* Discard the user name from NM. */ - nm +=3D len; - } - - if (nm[0] !=3D '/' && !newdir) - { - if (NILP (defalt)) - defalt =3D current_buffer->directory; - CHECK_STRING (defalt); - newdir =3D SDATA (defalt); - } - - /* Now concatenate the directory and name to new space in the stack frame. */ - - tlen =3D (newdir ? strlen (newdir) + 1 : 0) + strlen (nm) + 1; - target =3D alloca (tlen); - *target =3D 0; - - if (newdir) - { - if (nm[0] =3D=3D 0 || nm[0] =3D=3D '/') - strcpy (target, newdir); - else - file_name_as_directory (target, newdir); - } - - strcat (target, nm); - - /* Now canonicalize by removing /. and /foo/.. if they appear. */ - - p =3D target; - o =3D target; - - while (*p) - { - if (*p !=3D '/') - { - *o++ =3D *p++; - } - else if (!strncmp (p, "//", 2) - ) - { - o =3D target; - p++; - } - else if (p[0] =3D=3D '/' && p[1] =3D=3D '.' - && (p[2] =3D=3D '/' || p[2] =3D=3D 0)) - p +=3D 2; - else if (!strncmp (p, "/..", 3) - /* `/../' is the "superroot" on certain file systems. */ - && o !=3D target - && (p[3] =3D=3D '/' || p[3] =3D=3D 0)) - { - while (o !=3D target && *--o !=3D '/') - ; - if (o =3D=3D target && *o =3D=3D '/') - ++o; - p +=3D 3; - } - else - { - *o++ =3D *p++; - } - } - - return make_string (target, o - target); -} -#endif =0C /* Put into BUF the concatenation of DIR and FILE, with an intervening directory separator if needed. Return a pointer to the null byte ------------=_1721253002-20921-1--