From unknown Fri Aug 15 16:17:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#67953 <67953@debbugs.gnu.org> To: bug#67953 <67953@debbugs.gnu.org> Subject: Status: 30.0.50; ls-lisp messes up columns Reply-To: bug#67953 <67953@debbugs.gnu.org> Date: Fri, 15 Aug 2025 23:17:41 +0000 retitle 67953 30.0.50; ls-lisp messes up columns reassign 67953 emacs submitter 67953 Stefan Monnier severity 67953 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 09:36:24 2023 Received: (at submit) by debbugs.gnu.org; 21 Dec 2023 14:36:24 +0000 Received: from localhost ([127.0.0.1]:42727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGK9v-000700-NA for submit@debbugs.gnu.org; Thu, 21 Dec 2023 09:36:23 -0500 Received: from lists.gnu.org ([2001:470:142::17]:44194) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGK9t-0006zm-JR for submit@debbugs.gnu.org; Thu, 21 Dec 2023 09:36:22 -0500 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 1rGK9k-0007ux-8y for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 09:36:12 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGK9i-0000eI-DA for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 09:36:12 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D0A9710009E for ; Thu, 21 Dec 2023 09:36:08 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703169363; bh=SqkNGgKVxPIH1sJFN0wI8smy+lVE51yZxPtiTvMxbaQ=; h=From:To:Subject:Date:From; b=SgTJDYfyqOa+TMuT/m3VFi4OGCRYLX+lFqmD58v+BBlbNPI50PMsfpj8o20aQdyAG Ajf75dXlAaM3zloZQ4xaqftzxctk0Oa1FzKSR0s73y7WmrcMesbuso/AjaiWCjRsln GlGDMfkyqivjAGyYG/7MUfdFutKErV7UPTEwLziZsSmyh9QxQX3ExvNa3xx3Y6KAzy jbu8ydu3e7NHjm/WtwUnwR6C4HCa/pxTY/C9/+QQ04SmqyAoMueWz5jh/JuLerpaKR 23hD+meSeoaluK3wRPyndFulN0PqtuZCjvQgXuz+r8nZcpvXAkMKXxZ9hflFFk/JFW fgBbHfnX240zg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6844010001D for ; Thu, 21 Dec 2023 09:36:03 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 50E13120167 for ; Thu, 21 Dec 2023 09:36:03 -0500 (EST) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 30.0.50; ls-lisp messes up columns X-Debbugs-Cc: Date: Thu, 21 Dec 2023 09:35:55 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) 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: -1.0 (-) Package: Emacs Version: 30.0.50 After loading `ls-lisp`, I notice that with (setq ls-lisp-use-insert-directory-program t) I get the nice: C-x d /u*/s* RET =3D=3D> /: wildcard u*/s*/ drwxr-xr-x 2 root root 20480 10 d=E9c 11:24 usr/sbin/ drwxr-xr-x 404 root root 16384 2 d=E9c 15:05 usr/share/ drwxr-xr-x 4 root root 4096 22 f=E9v 2023 usr/src/ But with (setq ls-lisp-use-insert-directory-program nil) I get: C-x d /u*/s* RET =3D=3D> /: wildcard u*/s* drwxr-xr-x 2 root root 20480 12-10 11:24 usr/sbin drwxr-xr-x404 root root 16384 12-02 15:05 usr/share drwxr-xr-x 4 root root 4096 2023-02-22 usr/src Notice the weird extra space in front of the last line and the missing space between "x" and "404" in the penultimate line. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 22 04:01:44 2023 Received: (at 67953) by debbugs.gnu.org; 22 Dec 2023 09:01:45 +0000 Received: from localhost ([127.0.0.1]:46036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGbPc-0001bW-GI for submit@debbugs.gnu.org; Fri, 22 Dec 2023 04:01:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGbPZ-0001bJ-HJ for 67953@debbugs.gnu.org; Fri, 22 Dec 2023 04:01:42 -0500 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 1rGbPP-0002XQ-NE; Fri, 22 Dec 2023 04:01:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=i0Tm3XnL2kR68fQqDgwwjT3ChXL/ZVrVjwM+N70GVho=; b=l03+lgfo9pK/+Gbu33mw P8hCBe9d28G0ZsE5m4MStgcU3GkoklXSqPNtd9L8CwOu4vP+UUR08xFzSAFdnUGLfIYOaNRRNFt9b VQcon1BTBmtlx93kczDq7q0YYVUji++iCWufJWlKARIJ7nStfVn/7cCiNKuWfAEhw1MR9Aaexn4vU MpUBuyPObpjAm9TiUypV+zYz30+CyizQ2O1ZH4985w5WlyEGCPnfEgrXKAsx6QeA9YHAp2WXV9Kxo 4IClkYk2F7Iypzr6NVcQJkxLjrpOWkS8SIn5Mq1qhT2tr1O/oZ2hzNFWBtJtWnmI8oTv3VIYopEWt g+ueJxY7hHn6yw==; Date: Fri, 22 Dec 2023 11:01:18 +0200 Message-Id: <83jzp6fw69.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#67953: 30.0.50; ls-lisp messes up columns References: MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67953 Cc: 67953@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: -3.3 (---) > Date: Thu, 21 Dec 2023 09:35:55 -0500 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Package: Emacs > Version: 30.0.50 > > > After loading `ls-lisp`, I notice that with (setq > ls-lisp-use-insert-directory-program t) I get the nice: > > C-x d /u*/s* RET ==> > > /: > wildcard u*/s*/ > drwxr-xr-x 2 root root 20480 10 déc 11:24 usr/sbin/ > drwxr-xr-x 404 root root 16384 2 déc 15:05 usr/share/ > drwxr-xr-x 4 root root 4096 22 fév 2023 usr/src/ > > But with (setq ls-lisp-use-insert-directory-program nil) I get: > > C-x d /u*/s* RET ==> > > /: > wildcard u*/s* > drwxr-xr-x 2 root root 20480 12-10 11:24 usr/sbin > drwxr-xr-x404 root root 16384 12-02 15:05 usr/share > drwxr-xr-x 4 root root 4096 2023-02-22 usr/src > > Notice the weird extra space in front of the last line and the missing > space between "x" and "404" in the penultimate line. It's a bug in dired-align-file (it sounds like it was never tested with a version of 'ls' that doesn't support the --dired switch). Its algorithm breaks down if the entry of a file does not start with spaces. --dired guarantees that, but ls-lisp doesn't, and I wonder what other versions of 'ls' do. The simple kludge below, which simply prevents it from realigning the first column of data, seems to fix it here. WDYT? diff --git a/lisp/dired.el b/lisp/dired.el index cc548ba..3838368 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1572,14 +1572,16 @@ dired-align-file ;; the beginning or the end of the next field, depending on ;; whether this field is left or right aligned). (align-pt-offset - (save-excursion - (goto-char other) - (move-to-column curcol) - (when (looking-at - (concat - (if (eq (char-before) ?\s) " *" "[^ ]* *") - (if num-align "[0-9][^ ]*"))) - (- (match-end 0) (match-beginning 0))))) + (if (zerop curcol) + 0 + (save-excursion + (goto-char other) + (move-to-column curcol) + (when (looking-at + (concat + (if (eq (char-before) ?\s) " *" "[^ ]* *") + (if num-align "[0-9][^ ]*"))) + (- (match-end 0) (match-beginning 0)))))) ;; Now, the number of spaces to insert is align-pt-offset ;; minus the distance to the equivalent point on the ;; current line. From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 22 10:31:30 2023 Received: (at 67953) by debbugs.gnu.org; 22 Dec 2023 15:31:30 +0000 Received: from localhost ([127.0.0.1]:47625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGhUn-0004Tz-NV for submit@debbugs.gnu.org; Fri, 22 Dec 2023 10:31:30 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:25546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGhUi-0004Pl-3o for 67953@debbugs.gnu.org; Fri, 22 Dec 2023 10:31:28 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 24291100068; Fri, 22 Dec 2023 10:31:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1703259068; bh=c9WXl5Qz8LC7wpJjGvMHvBdfLdQQ9Mq3WaCOWFEa2MI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZeP7E1T99C+MdkTG2Ek5q4S7e4PsTofHSTpg62XpTmpjkXfOvTs6fkN6KFMaWsCW5 nSAHeuvcjTWWHqcUE77hupxgth0O5rLlE61gLqrn514NcByeJY8IEy/YlVpHRZMZya HYbl68GAKKTox/LgKogMIZtYTElW2gyDGzN5h+g1ScBGtfFJohzqtoCRFaDlbqlcX4 CC6y9JgpgXW4P3GefsZqvuAl6Bbn/u3fjIqh8cepRbyWcq3Ng6s2P+zOiXAYdTiJXw 1EfLhWItpnt0bKd4rpu0z32I1ad+h8WWbO0bVWCblh9fYlOm5PvxB6jhYfdZVthiTW r9g2WJtLitA6A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id AFD88100033; Fri, 22 Dec 2023 10:31:08 -0500 (EST) Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9560712023C; Fri, 22 Dec 2023 10:31:08 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#67953: 30.0.50; ls-lisp messes up columns In-Reply-To: <83jzp6fw69.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Dec 2023 11:01:18 +0200") Message-ID: References: <83jzp6fw69.fsf@gnu.org> Date: Fri, 22 Dec 2023 10:31:07 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.063 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67953 Cc: 67953@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: -3.3 (---) > The simple kludge below, which simply prevents it from realigning the > first column of data, seems to fix it here. WDYT? Looks OK to me. I'd recommend we add a comment about this (zerop curcol) test explaining why the other branch mishandles this case (or mentioning that we don't know why). Stefan > diff --git a/lisp/dired.el b/lisp/dired.el > index cc548ba..3838368 100644 > --- a/lisp/dired.el > +++ b/lisp/dired.el > @@ -1572,14 +1572,16 @@ dired-align-file > ;; the beginning or the end of the next field, depending on > ;; whether this field is left or right aligned). > (align-pt-offset > - (save-excursion > - (goto-char other) > - (move-to-column curcol) > - (when (looking-at > - (concat > - (if (eq (char-before) ?\s) " *" "[^ ]* *") > - (if num-align "[0-9][^ ]*"))) > - (- (match-end 0) (match-beginning 0))))) > + (if (zerop curcol) > + 0 > + (save-excursion > + (goto-char other) > + (move-to-column curcol) > + (when (looking-at > + (concat > + (if (eq (char-before) ?\s) " *" "[^ ]* *") > + (if num-align "[0-9][^ ]*"))) > + (- (match-end 0) (match-beginning 0)))))) > ;; Now, the number of spaces to insert is align-pt-offset > ;; minus the distance to the equivalent point on the > ;; current line. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 23 06:05:45 2023 Received: (at 67953-done) by debbugs.gnu.org; 23 Dec 2023 11:05:45 +0000 Received: from localhost ([127.0.0.1]:48697 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGzpB-0004Aw-Cg for submit@debbugs.gnu.org; Sat, 23 Dec 2023 06:05:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGzp9-0004Aj-Fn for 67953-done@debbugs.gnu.org; Sat, 23 Dec 2023 06:05:44 -0500 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 1rGzoy-00036i-Gr; Sat, 23 Dec 2023 06:05:32 -0500 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=LWONCZNqEJ2RSWlT6Y4wev5xqmbhjMSj81l93uySEmA=; b=a5iPUp1AZ9Uf g8y6yiUVvh8OuPGho71PCxUagYpFS17Siq0915JE/BV1drqELypV2iBQsBYMEAkud95fVCGLwDACt x2ndFoK8xM4PaSyGU/IZc6zpg0FjeMSjf0AR8UDKsl8429IFYDKndl5jry6pPfFB1A2ZWmJAeePQg 14QNtj0tAAuoqvUV27mBSm/SqVj2aQwa92mid3oZx4UMkER2RvKSNwzjefVOJS8bc1hNSIa93sd4f FmEU9p287BZ5dEbJW3Sz+dfkFhI+rLtXbbAaaBZ5YNoDdcnsEH9mdhenT/ZgbjoQlLMegFKx5KbcH AdrHG1gi3AvJD4c8t2fBmw==; Date: Sat, 23 Dec 2023 13:05:20 +0200 Message-Id: <834jg9dvrj.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 22 Dec 2023 10:31:07 -0500) Subject: Re: bug#67953: 30.0.50; ls-lisp messes up columns References: <83jzp6fw69.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67953-done Cc: 67953-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: -3.3 (---) > From: Stefan Monnier > Cc: 67953@debbugs.gnu.org > Date: Fri, 22 Dec 2023 10:31:07 -0500 > > > The simple kludge below, which simply prevents it from realigning the > > first column of data, seems to fix it here. WDYT? > > Looks OK to me. I'd recommend we add a comment about this (zerop > curcol) test explaining why the other branch mishandles this > case (or mentioning that we don't know why). Done. I decided to install this on master, since this is a very old problem (I can see it in Emacs 26), and the situations where it rears its ugly head are quite rare. Closing. From unknown Fri Aug 15 16:17:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 20 Jan 2024 12:24:14 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator