From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 18 23:22:21 2017 Received: (at submit) by debbugs.gnu.org; 19 Jul 2017 03:22:21 +0000 Received: from localhost ([127.0.0.1]:47057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXfZ6-0000J6-UR for submit@debbugs.gnu.org; Tue, 18 Jul 2017 23:22:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33748) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXfZ5-0000Is-9Y for submit@debbugs.gnu.org; Tue, 18 Jul 2017 23:22:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXfYy-0005Vx-SW for submit@debbugs.gnu.org; Tue, 18 Jul 2017 23:22:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46155) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXfYy-0005Vt-Oo for submit@debbugs.gnu.org; Tue, 18 Jul 2017 23:22:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXfYw-0007lk-QB for bug-gnu-emacs@gnu.org; Tue, 18 Jul 2017 23:22:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXfYr-0005Ue-QP for bug-gnu-emacs@gnu.org; Tue, 18 Jul 2017 23:22:10 -0400 Received: from mail-pf0-x230.google.com ([2607:f8b0:400e:c00::230]:36277) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXfYr-0005UO-Hl for bug-gnu-emacs@gnu.org; Tue, 18 Jul 2017 23:22:05 -0400 Received: by mail-pf0-x230.google.com with SMTP id o88so14175845pfk.3 for ; Tue, 18 Jul 2017 20:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=ejOD8HItn4bfS3mgjFXlWyEVlsxRHcOuS2S//W8bplg=; b=VQ2199OUpFIHetpHsy3a9q6FxmwNbx8v3Kx+mzNMmWewxAQM4ZlJ5P5uSXYD7WBcQH qlbXHvs9CMFcWVJXgAJEwqGN8jT4Yd1oRUbI3JXd4RUgSTqQtbCBzBILv/wyYsJ+MUK1 4qMfbap5JW5GVdcb1wgor+tmQos6F1xdm53sYfPBoGKTG8ZbmhLp5Njvvaj8Reyexjt0 Zih0//n4YP2IgvbXDMTtuoFC6RX72o1OnOOlok7BGO4jPXowbA3G+q35izldwCdHM9BE F4gNsYRpOLKyNzvUJ9/alBHAI/H1ixf1h/bmTmg4qCTpfH2uSv7zZh9i+GKsPvVlNm73 frWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=ejOD8HItn4bfS3mgjFXlWyEVlsxRHcOuS2S//W8bplg=; b=QqrU5uXXPXDaBCmdn7a37FIOxh4FrPIDGr3vkkg/1pBrlBUqT65QPL5qXbi5ZXeNKe IsFnX/O/zS3ycfMehatZS2t55aeI8asJ24ADZYbQoBXFjLSoqmNmHHRD8IvmsaFgkMTv uHuHBqYBXiMOSwGExQldDDs1PgEz0iBBkmtmTqrvl3OUoMxEERzNwT+gMoVUp2kHp9nC RQvDD83OaqPC/a5/j7pn5yfshMt7yckwGmQR653CJueS1CtHc2ABfNrf8dLKIYnaRRl1 7tb2ucOt3lC6EmazD8qM7YRavf6GFAyqQQvZxTfElHuj9P5LXfDwR1RkrPOY+73Lh1xH abgw== X-Gm-Message-State: AIVw113V/qmHWjuzQY5DXqzEmIo/gy5Wb2XqAFsV8ZzBfAZhWTzcbC/B Ai6Gm1R+3bkpEk40 X-Received: by 10.99.175.12 with SMTP id w12mr846760pge.250.1500434522660; Tue, 18 Jul 2017 20:22:02 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id v17sm10054542pgn.4.2017.07.18.20.22.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jul 2017 20:22:02 -0700 (PDT) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 26.0.50; ls-lisp: misalignment when dired-directory is a cons Date: Wed, 19 Jul 2017 12:21:58 +0900 Message-ID: <87wp75yuuh.fsf@calancha-pc> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.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: -4.0 (----) There are some misalignment on Dired buffers when using 'ls-lisp' and 'dired-directory' is a cons. I) emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)' Eval this form: (let* ((dir source-directory) (default-directory dir) (files (mapcar (lambda (f) (concat "src/" f)) (directory-files (expand-file-name "src") nil "\\.*\\.c\\'")))) (dired (nconc (list dir) files))) ;; Note some lines have an additional space in front; the space must ;; be added in the size column. The first patch solves this problem. II) Now suppose we want to list the same files _but_ we want that "cyge32.c" appears the first. emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)' Eval this form: (let* ((dir source-directory) (default-directory dir) (files (mapcar (lambda (f) (concat "src/" f)) (cons "cygw32.c" (delete "cygw32.c" (directory-files (expand-file-name "src") nil "\\.*\\.c\\'")))))) (dired (nconc (list dir) files))) ;; Note how the first file looks misaligned. --8<-----------------------------cut here---------------start------------->8--- commit b1889776b4fc808036da259b588365e85cf52324 Author: Tino Calancha Date: Wed Jul 19 11:16:13 2017 +0900 * lisp/dired.el (dired-align-file): Add the spaces in size column. diff --git a/lisp/dired.el b/lisp/dired.el index 4fb4fe78f8..f4941e0d91 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1153,7 +1153,14 @@ dired-align-file (setq file-col (+ spaces file-col)) (if (> file-col other-col) (setq spaces (- spaces (- file-col other-col)))) - (insert-char ?\s spaces) + ;; Add the spaces in front of the file size. + (when (search-forward-regexp directory-listing-before-filename-regexp nil t) + (goto-char (match-beginning 0)) + ;; If size is in human readable units, then we should skip + ;; '.' and letters (units) as well. + (search-backward-regexp "[[:space:]]" nil t) + (skip-chars-forward "[:space:]") + (insert-char ?\s spaces)) ;; Let's just make really sure we did not mess up. (unless (save-excursion (eq (dired-move-to-filename) (marker-position file))) commit 16baaf7df330309be6490b115c513371c0660aef Author: Tino Calancha Date: Wed Jul 19 11:52:30 2017 +0900 ls-lisp: Fix dired format when dired-directory is a cons * lisp/ls-lisp.el (ls-lisp-obtain-formats): New defun extracted from ls-lisp-insert-directory. * lisp/dired.el (dired-readin-insert): Call it if 'dired-directory' is a cons and we are using ls-lisp. (ls-lisp-use-insert-directory-program): Move declaration before use this var. diff --git a/lisp/dired.el b/lisp/dired.el index f4941e0d91..95f438e912 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1035,15 +1035,20 @@ dired-readin ;; Subroutines of dired-readin +(defvar ls-lisp-use-insert-directory-program) +(declare-function ls-lisp-obtain-formats "ls-lisp" (alist file-list switches)) (defun dired-readin-insert () ;; Insert listing for the specified dir (and maybe file list) ;; already in dired-directory, assuming a clean buffer. (let (dir file-list) - (if (consp dired-directory) + (cond ((consp dired-directory) + (when (and (featurep 'ls-lisp) + (null ls-lisp-use-insert-directory-program)) + (ls-lisp-obtain-formats nil (cdr dired-directory) nil)) (setq dir (car dired-directory) - file-list (cdr dired-directory)) - (setq dir dired-directory - file-list nil)) + file-list (cdr dired-directory))) + (t (setq dir dired-directory + file-list nil))) (setq dir (expand-file-name dir)) (if (and (equal "" (file-name-nondirectory dir)) (not file-list)) @@ -1171,7 +1176,6 @@ dired-align-file (set-marker file nil))))) -(defvar ls-lisp-use-insert-directory-program) (defun dired-check-switches (switches short &optional long) "Return non-nil if the string SWITCHES matches LONG or SHORT format." diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index b368efbbc9..391afd16bd 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el @@ -338,6 +338,46 @@ ls-lisp--insert-directory (insert " available " available))))))))) (advice-add 'insert-directory :around #'ls-lisp--insert-directory) +(defun ls-lisp-obtain-formats (alist file-list switches) + (let ((file-alist (or alist + (mapcar (lambda (f) + (nconc (list f) (file-attributes f))) file-list))) + (sum 0) + (max-uid-len 0) + (max-gid-len 0) + (max-file-size 0) + ;; do all bindings here for speed + total-line files elt short file-size attr + fuid fgid uid-len gid-len) + (dolist (elt file-alist) + (setq attr (cdr elt) + fuid (nth 2 attr) + uid-len (if (stringp fuid) (string-width fuid) + (length (format "%d" fuid))) + fgid (nth 3 attr) + gid-len (if (stringp fgid) (string-width fgid) + (length (format "%d" fgid))) + file-size (nth 7 attr)) + (if (> uid-len max-uid-len) + (setq max-uid-len uid-len)) + (if (> gid-len max-gid-len) + (setq max-gid-len gid-len)) + (if (> file-size max-file-size) + (setq max-file-size file-size))) + (setq ls-lisp-uid-d-fmt (format " %%-%dd" max-uid-len)) + (setq ls-lisp-uid-s-fmt (format " %%-%ds" max-uid-len)) + (setq ls-lisp-gid-d-fmt (format " %%-%dd" max-gid-len)) + (setq ls-lisp-gid-s-fmt (format " %%-%ds" max-gid-len)) + (setq ls-lisp-filesize-d-fmt + (format " %%%dd" (length (format "%.0f" max-file-size)))) + (setq ls-lisp-filesize-f-fmt + (format " %%%d.0f" (length (format "%.0f" max-file-size)))) + (if (memq ?s switches) + (setq ls-lisp-filesize-b-fmt + (format "%%%d.0f " + (length (format "%.0f" + (fceiling + (/ max-file-size 1024.0))))))))) (defun ls-lisp-insert-directory (file switches time-index wildcard-regexp full-directory-p) "Insert directory listing for FILE, formatted according to SWITCHES. @@ -381,35 +421,7 @@ ls-lisp-insert-directory ;; Find the appropriate format for displaying uid, gid, and ;; file size, by finding the longest strings among all the ;; files we are about to display. - (dolist (elt file-alist) - (setq attr (cdr elt) - fuid (nth 2 attr) - uid-len (if (stringp fuid) (string-width fuid) - (length (format "%d" fuid))) - fgid (nth 3 attr) - gid-len (if (stringp fgid) (string-width fgid) - (length (format "%d" fgid))) - file-size (nth 7 attr)) - (if (> uid-len max-uid-len) - (setq max-uid-len uid-len)) - (if (> gid-len max-gid-len) - (setq max-gid-len gid-len)) - (if (> file-size max-file-size) - (setq max-file-size file-size))) - (setq ls-lisp-uid-d-fmt (format " %%-%dd" max-uid-len)) - (setq ls-lisp-uid-s-fmt (format " %%-%ds" max-uid-len)) - (setq ls-lisp-gid-d-fmt (format " %%-%dd" max-gid-len)) - (setq ls-lisp-gid-s-fmt (format " %%-%ds" max-gid-len)) - (setq ls-lisp-filesize-d-fmt - (format " %%%dd" (length (format "%.0f" max-file-size)))) - (setq ls-lisp-filesize-f-fmt - (format " %%%d.0f" (length (format "%.0f" max-file-size)))) - (if (memq ?s switches) - (setq ls-lisp-filesize-b-fmt - (format "%%%d.0f " - (length (format "%.0f" - (fceiling - (/ max-file-size 1024.0))))))) + (ls-lisp-obtain-formats file-alist nil switches) (setq files file-alist) (while files ; long (-l) format (setq elt (car files) --8<-----------------------------cut here---------------end--------------->8--- The second patch seems to fix this problem. In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-07-18 Repository revision: be79366410703a788c3c8ce7951e89bc9dfdac88 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 13:04:58 2017 Received: (at 27762) by debbugs.gnu.org; 19 Jul 2017 17:04:58 +0000 Received: from localhost ([127.0.0.1]:48049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXsPB-0007Ys-VZ for submit@debbugs.gnu.org; Wed, 19 Jul 2017 13:04:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45505) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXsP9-0007Ye-Uo for 27762@debbugs.gnu.org; Wed, 19 Jul 2017 13:04:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXsP0-0001GP-1s for 27762@debbugs.gnu.org; Wed, 19 Jul 2017 13:04:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXsOz-0001GJ-VK; Wed, 19 Jul 2017 13:04:45 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2207 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dXsOz-0003hx-8F; Wed, 19 Jul 2017 13:04:45 -0400 Date: Wed, 19 Jul 2017 20:04:33 +0300 Message-Id: <83vamobboe.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: <87wp75yuuh.fsf@calancha-pc> (message from Tino Calancha on Wed, 19 Jul 2017 12:21:58 +0900) Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Date: Wed, 19 Jul 2017 12:21:58 +0900 > > > There are some misalignment on Dired buffers when using 'ls-lisp' > and 'dired-directory' is a cons. > > > I) > emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)' > Eval this form: > (let* ((dir source-directory) > (default-directory dir) > (files (mapcar (lambda (f) (concat "src/" f)) > (directory-files (expand-file-name "src") nil "\\.*\\.c\\'")))) > (dired (nconc (list dir) files))) > ;; Note some lines have an additional space in front; the space must > ;; be added in the size column. > > The first patch solves this problem. > > II) Now suppose we want to list the same files _but_ we want that > "cyge32.c" appears the first. > emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)' > Eval this form: > > (let* ((dir source-directory) > (default-directory dir) > (files (mapcar (lambda (f) (concat "src/" f)) > (cons "cygw32.c" > (delete "cygw32.c" > (directory-files (expand-file-name "src") nil "\\.*\\.c\\'")))))) > (dired (nconc (list dir) files))) > ;; Note how the first file looks misaligned. Thanks, but I'd prefer to keep the ls-lisp related stuff confined to ls-lisp.el. Is it possible to rewrite the patch such that dired.el code doesn't need to call ls-lisp functions directly (and thus the need for (featurep 'ls-lisp) etc. would be avoided)? Also, what exactly is the source of the differences between ls-lisp and the 'ls' command, and are you sure the differences aren't specific to GNU 'ls'? From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 19 23:45:35 2017 Received: (at 27762) by debbugs.gnu.org; 20 Jul 2017 03:45:35 +0000 Received: from localhost ([127.0.0.1]:48395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dY2P9-0000tW-6H for submit@debbugs.gnu.org; Wed, 19 Jul 2017 23:45:35 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36640) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dY2P7-0000tJ-7r for 27762@debbugs.gnu.org; Wed, 19 Jul 2017 23:45:33 -0400 Received: by mail-pf0-f179.google.com with SMTP id o88so7274840pfk.3 for <27762@debbugs.gnu.org>; Wed, 19 Jul 2017 20:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=haryvu8tTCthIh8ZI8ZS1KPM6IKU6iiGOYuxmX4whCY=; b=mU7O5TnqnODkHlEXqvBIHsYYo2uoCynX4XksQS9tAzOubFjTKurb30m73qJeHfJOu8 BDW8od9OzeKDaeR3KuddVWBvtre+OuDTfA2d7xsVx0XsAqgHV5EBN0TP18MCMg8bKlgH g0xFGqkGj1UULKX9t6YFetjtMUNXmdLg8VmcretUweFXn9O0cdZMp7nQs5yoDguLa7vb I7//LCcvPR1RzQwLP/Sr+OVxgrYDatmYeEB2p4pU9ShVC8kHEdceqMStaBupte3WloF6 FRYJ2+k4p1veyJl79VNPC7Wy3l7jiMXFdHJ5eCnkcAIis08MqhCIRaOtxXSWAtLN+XQd SClA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=haryvu8tTCthIh8ZI8ZS1KPM6IKU6iiGOYuxmX4whCY=; b=GHVLfMcK1ffiuXDnk/PosyexUKcGAx0BZZHfO/9jB8Xkce/dwO7R+4V4koqzJ0gUiX 9Sg3x9yrDjLz4nw7A+sioOpmjo4jxoGAdbGLumAchp+jnys+8J4nI5jP7auAdhzBmLx6 KPP9pQ94ysh4/1OkQ8WHJNdmT2ZfLSCaKkPJwlnIiL0R3BV87o6RQY83kzcm5aAt9sgL yQZ4t+0J2QkOthJDCi/F2o9rsRdRECEFoWOfK0gGy6vMtBhZMMARTz5NiRTjqSwDp4Sc jY1NSrXocz+fmEsYz9qmieYpJP2JvqRK3mP0e1vX/2i3QBxhzb2o72HLp7Bc3l/A+Br9 MhbA== X-Gm-Message-State: AIVw112HcLgI46TpIGq/PQ+oHGmaDgZ+htqbrs1xNTKflMvmbjKpy0+c QucoHXAkd1oDXS4K X-Received: by 10.84.233.207 with SMTP id m15mr2520853pln.334.1500522327115; Wed, 19 Jul 2017 20:45:27 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id t186sm2021740pgc.28.2017.07.19.20.45.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Jul 2017 20:45:26 -0700 (PDT) From: Tino Calancha To: Eli Zaretskii Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> Date: Thu, 20 Jul 2017 12:45:22 +0900 In-Reply-To: <83vamobboe.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Jul 2017 20:04:33 +0300") Message-ID: <87lgnjzs8d.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: -2.3 (--) Eli Zaretskii writes: >> II) Now suppose we want to list the same files _but_ we want that >> "cyge32.c" appears the first. >> emacs -Q -l ls-lisp -eval '(setq ls-lisp-use-insert-directory-program nil)' >> Eval this form: >> >> (let* ((dir source-directory) >> (default-directory dir) >> (files (mapcar (lambda (f) (concat "src/" f)) >> (cons "cygw32.c" >> (delete "cygw32.c" >> (directory-files (expand-file-name "src") nil "\\.*\\.c\\'")))))) >> (dired (nconc (list dir) files))) >> ;; Note how the first file looks misaligned. > > Thanks, but I'd prefer to keep the ls-lisp related stuff confined to > ls-lisp.el. Is it possible to rewrite the patch such that dired.el > code doesn't need to call ls-lisp functions directly (and thus the > need for (featurep 'ls-lisp) etc. would be avoided)? Thanks. Yes, that sounds better. > Also, what exactly is the source of the differences between ls-lisp > and the 'ls' command, and are you sure the differences aren't specific > to GNU 'ls'? I think II) above is not specific of ls-lisp: the same happen with GNU ls. With emacs -Q: (let* ((dir (expand-file-name "src" source-directory)) (default-directory dir)) (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) ; Wrong aligment. ;; Following just fix the first file, but xdisp.c keeps misaligned. (dired-goto-file (expand-file-name "cygw32.c")) (forward-line 0) (let ((inhibit-read-only t)) (dired-align-file (point) (point-max)))) Note that when i eval the previous form GNU 'ls' is used, and i see misalignment. I would expect `dired-align-file' fix this problem, but i doesn't. *) Since this is not specific of `ls-lisp', one alternative fix could be to run `dired-align-file' at the end of `dired-internal-noselect' when `dired-directory' is a cons. **) First, we must fix `dired-lign-file', which is not doing its job in the snippet above. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 21 00:55:51 2017 Received: (at 27762) by debbugs.gnu.org; 21 Jul 2017 04:55:51 +0000 Received: from localhost ([127.0.0.1]:50258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYPyf-0005ph-Vw for submit@debbugs.gnu.org; Fri, 21 Jul 2017 00:55:50 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:37942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYPyd-0005pU-U1 for 27762@debbugs.gnu.org; Fri, 21 Jul 2017 00:55:48 -0400 Received: by mail-pg0-f41.google.com with SMTP id s4so23617950pgr.5 for <27762@debbugs.gnu.org>; Thu, 20 Jul 2017 21:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ghOo81Df2Jc/o7yXhlT8F8IrLnd9TwYpiNbxpT59u3w=; b=hPhJevQWqzWud7lpGrvDAhzjsD2v/3y8MvcD12+1yYyzI2sD7FuAhsPhC0cvVWeWkp 4j1yXdzCQ4Y2JInvU/7y0rnBotGfD9pltNuN1Qa63X4kxQzci5Uyf8ynrzFLnaie/1So dit156qNRjm0i+zoG0+jc7T2wVwQFT3UyRWIS5BKFeKn4LChiSTJzIu6PnFfUPHUC1H5 uBnS0vQAnkApSbDk1RzoKuNKR+XRiyCMZKrP3ldz9wP5k47EDxd5Po58rAZ53oLpndA7 L10bXSZ0eMqlde9bQpzPa69s4oz/yPDXQpQ15Fi4HgyaxCrcA64QMrZgSj2Z8boAotsF T90g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ghOo81Df2Jc/o7yXhlT8F8IrLnd9TwYpiNbxpT59u3w=; b=LkCQp8kN1odJyhb9UFZ2kV71zX0x8gvmC2ro3HRUtiUcffAyOYvyjDNK6ySmQfL4QI owHcm9Ox7W9TVMXus6A+mhDKU2JNMFYMOo5c1W/tRYmeGHKzuzJh8zfUOtNgSmOEP/9w O5RJn6w/xkgTmh3yZo/755Sdw2oWO8txxtGH2+JrdC2ln8PM9fZ85izy8ULeat2sVms6 RYZtqIqbNb/9pMyEwo5IoIA5NDzlaEJXubnwwAJgBvvenm3TyPKeZ8EomF8Ptdj5DXCw J2dPZOwTjdahYhFamqvacnwgtcVyuoiAIpz8FY8WLFZ/imQms7w0oh2dlXBLVB/MDE/H Kd4A== X-Gm-Message-State: AIVw112m7Gi9FberpaWtApbJ+Zdj6fHGrtGm1ay94UOmphGEDAqjWe87 4OXVjmtWPF7a7ylZ X-Received: by 10.98.33.148 with SMTP id o20mr6069995pfj.89.1500612941526; Thu, 20 Jul 2017 21:55:41 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id q79sm6302731pfi.99.2017.07.20.21.55.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jul 2017 21:55:40 -0700 (PDT) From: Tino Calancha To: Eli Zaretskii Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> Date: Fri, 21 Jul 2017 13:55:26 +0900 In-Reply-To: <87lgnjzs8d.fsf@calancha-pc> (Tino Calancha's message of "Thu, 20 Jul 2017 12:45:22 +0900") Message-ID: <87d18uz8w1.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: 0.5 (/) > With emacs -Q: > > (let* ((dir (expand-file-name "src" source-directory)) > (default-directory dir)) > (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) ; Wrong aligment. > ;; Following just fix the first file, but xdisp.c keeps misaligned. > (dired-goto-file (expand-file-name "cygw32.c")) > (forward-line 0) > (let ((inhibit-read-only t)) > (dired-align-file (point) (point-max)))) > > > Note that when i eval the previous form GNU 'ls' is used, and i see misalignment. > I would expect `dired-align-file' fix this problem, but i doesn't. > > *) Since this is not specific of `ls-lisp', one alternative fix could > be to run `dired-align-file' at the end of `dired-internal-noselect' > when `dired-directory' is a cons. > > **) First, we must fix `dired-lign-file', which is not doing its job > in the snippet above. Eli, how do you think about following patch? --8<-----------------------------cut here---------------start------------->8--- commit 458fe93358594cf7338180b6feb54eb37d28ed21 Author: Tino Calancha Date: Fri Jul 21 13:50:56 2017 +0900 Fix misalignment in Dired when dired-directory is a cons * lisp/dired.el (dired--need-align-p, dired--align-all-files): New defuns. (dired-internal-noselect): Call dired--align-all-files when dired-directory is a cons (Bug#27762). * test/lisp/dired-tests.el (dired-test-bug27762): Test should pass. diff --git a/lisp/dired.el b/lisp/dired.el index 9d500a9f52..371af15f79 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -34,6 +34,7 @@ ;;; Code: +(eval-when-compile (require 'subr-x)) ;; When bootstrapping dired-loaddefs has not been generated. (require 'dired-loaddefs nil t) @@ -871,6 +872,46 @@ dired-auto-revert-buffer :group 'dired :version "23.2") +(defun dired--need-align-p () + "Return non-nil if some file names are misaligned. +The return value is the target column for the file names." + (save-excursion + (goto-char (point-min)) + (dired-goto-next-file) + ;; Use point difference instead of `current-column', because + ;; the former works when `dired-hide-details-mode' is enabled. + (let* ((first (- (point) (point-at-bol))) + (target first)) + (while (and (not (eobp)) + (progn + (forward-line) + (dired-move-to-filename))) + (when-let* ((col-diff (- (point) (point-at-bol))) + (higher (> col-diff target))) + (setq target col-diff))) + (and (/= first target) target)))) + +(defun dired--align-all-files () + "Align all files adding spaces in front of the size column." + (let ((target (dired--need-align-p)) + (regexp directory-listing-before-filename-regexp)) + (when target + (save-excursion + (goto-char (point-min)) + (dired-goto-next-file) + (while (dired-move-to-filename) + (let ((col-diff (- target (- (point) (point-at-bol)))) + (inhibit-read-only t) + props) + (unless (zerop col-diff) + (re-search-backward regexp nil t) + (goto-char (match-beginning 0)) + (search-backward-regexp "[[:space:]]" nil t) + (setq props (text-properties-at (1- (point)))) + (skip-chars-forward "[:space:]") + (insert (apply #'propertize (make-string col-diff ?\s) props))) + (forward-line))))))) + (defun dired-internal-noselect (dir-or-list &optional switches mode) ;; If DIR-OR-LIST is a string and there is an existing dired buffer ;; for it, just leave buffer as it is (don't even call dired-revert). @@ -939,6 +980,8 @@ dired-internal-noselect (if failed (kill-buffer buffer)))) (goto-char (point-min)) (dired-initial-position dirname)) + (when (consp dired-directory) + (dired--align-all-files)) (set-buffer old-buf) buffer)) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index bd1816172e..d5f999aab6 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -147,7 +147,6 @@ (ert-deftest dired-test-bug27762 () "Test for http://debbugs.gnu.org/27762 ." - :expected-result :failed (let* ((dir source-directory) (default-directory dir) (files (mapcar (lambda (f) (concat "src/" f)) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-07-21 Repository revision: 1d559e384b467b3f74e8b78695f124b561c884d9 From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 29 04:09:29 2017 Received: (at 27762) by debbugs.gnu.org; 29 Jul 2017 08:09:29 +0000 Received: from localhost ([127.0.0.1]:60549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbMoT-00080p-6s for submit@debbugs.gnu.org; Sat, 29 Jul 2017 04:09:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbMoR-00080a-7s for 27762@debbugs.gnu.org; Sat, 29 Jul 2017 04:09:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbMoI-0002Gd-OC for 27762@debbugs.gnu.org; Sat, 29 Jul 2017 04:09:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbMoI-0002GU-Ko; Sat, 29 Jul 2017 04:09:18 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4187 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dbMoH-00078V-B0; Sat, 29 Jul 2017 04:09:17 -0400 Date: Sat, 29 Jul 2017 11:09:07 +0300 Message-Id: <83shhf3brw.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: <87d18uz8w1.fsf@calancha-pc> (message from Tino Calancha on Fri, 21 Jul 2017 13:55:26 +0900) Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> <87d18uz8w1.fsf@calancha-pc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Cc: 27762@debbugs.gnu.org > Date: Fri, 21 Jul 2017 13:55:26 +0900 > > > > With emacs -Q: > > > > (let* ((dir (expand-file-name "src" source-directory)) > > (default-directory dir)) > > (dired (list dir "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) ; Wrong aligment. > > ;; Following just fix the first file, but xdisp.c keeps misaligned. > > (dired-goto-file (expand-file-name "cygw32.c")) > > (forward-line 0) > > (let ((inhibit-read-only t)) > > (dired-align-file (point) (point-max)))) > > > > > > Note that when i eval the previous form GNU 'ls' is used, and i see misalignment. > > I would expect `dired-align-file' fix this problem, but i doesn't. > > > > *) Since this is not specific of `ls-lisp', one alternative fix could > > be to run `dired-align-file' at the end of `dired-internal-noselect' > > when `dired-directory' is a cons. > > > > **) First, we must fix `dired-lign-file', which is not doing its job > > in the snippet above. > Eli, how do you think about following patch? Looks OK, but why this complicated code: > + (when-let* ((col-diff (- (point) (point-at-bol))) > + (higher (> col-diff target))) > + (setq target col-diff))) > + (and (/= first target) target)))) Doesn't current-column do its job in this case? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 01 03:01:29 2017 Received: (at 27762) by debbugs.gnu.org; 1 Aug 2017 07:01:29 +0000 Received: from localhost ([127.0.0.1]:36019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcRBJ-00034B-9F for submit@debbugs.gnu.org; Tue, 01 Aug 2017 03:01:29 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:34048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcRBI-000340-At for 27762@debbugs.gnu.org; Tue, 01 Aug 2017 03:01:28 -0400 Received: by mail-pf0-f177.google.com with SMTP id o86so846944pfj.1 for <27762@debbugs.gnu.org>; Tue, 01 Aug 2017 00:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=T5vn3Onqdb0SAoQgz8Fk1QMZrL9CuuIsK1lgwNj6jfk=; b=AkORiwjA35P8tI3YqmWQ7pmCuyovLjSR5hpu1cRQcvKRB0sSRVkOGK84zAQpPBbdyr evTrJF5KChshWIi+kAXF1GRZdfe34yFT2isNmbhQr4OY6zr5VsXHKzaskPfREedSwGxW rzmRVZMQdVTsxRNUTvLmwd8WSaheoBbRLGhClfgJVx8YUzv8sMjK9+llWVGgS8NUniez g/3S+4tg602kSJ5M/eScQjN5o/u6GQgbcDBQPh4hVtsrUm62W0Hq4/8NQihRhLDp3JqN 8YdaxneRkUpt4mIf/LiRcPqIK0GU/Pq+suWi5Pckfw4EGrfoWGcYhlHNOZc/+gYdeGfa uVbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=T5vn3Onqdb0SAoQgz8Fk1QMZrL9CuuIsK1lgwNj6jfk=; b=dzdJiS/+8BTACMWaBtd7sw4jGHc3bDd7KcaReL0Gto+XUZN9UHT2IiQCpirtFoCGwa AQtuuv7UPt3W7vPEYLz7+9l46EQEA2pGy9lnN8o5sZIUWJ7yncw0cf33zPrh4KOmnS2B V87qyRgElC8h+MBz1IHzbANiiDQoRefHafZ2d/GEBME16WL0Cl1Kc83EhDoQq3Gbaktp TmS66WEQ9pmaLw0TcMNMY4xKdyjIuLeS01zPQI6dvlBJ0yNNTiBUolcPH45ZMZIEutQJ spDbI95H4Xgtp/oUiSJ1rLP+n4T6ej4HzUtY5V3+CO0G6JdUC7118MDLKJ5yqsWMs3q/ wxbQ== X-Gm-Message-State: AIVw113aNF7970FIOqmuxgtQnBdKZ/7ebcSJUQpggEIwgZZ/MrsXhfHE bAOK/Ty9qUTkeIBK X-Received: by 10.98.138.204 with SMTP id o73mr18354488pfk.5.1501570882133; Tue, 01 Aug 2017 00:01:22 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id 4sm45340298pfe.88.2017.08.01.00.01.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Aug 2017 00:01:21 -0700 (PDT) From: Tino Calancha To: Eli Zaretskii Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> <87d18uz8w1.fsf@calancha-pc> <83shhf3brw.fsf@gnu.org> Date: Tue, 01 Aug 2017 16:01:17 +0900 In-Reply-To: <83shhf3brw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 29 Jul 2017 11:09:07 +0300") Message-ID: <87a83jkc02.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: -2.3 (--) Eli Zaretskii writes: > Looks OK, but why this complicated code: > >> + (when-let* ((col-diff (- (point) (point-at-bol))) >> + (higher (> col-diff target))) >> + (setq target col-diff))) >> + (and (/= first target) target)))) > > Doesn't current-column do its job in this case? That is to work regardless on the `dired-hide-details-mode' value. If we use `current-column' we are in trouble. Consider the following: ;; Definition uses `current-column'. (defun dired--need-align-p () "Return non-nil if some file names are misaligned. The return value is the target column for the file names." (save-excursion (goto-char (point-min)) (dired-goto-next-file) ;; Use point difference instead of `current-column', because ;; the former works when `dired-hide-details-mode' is enabled. (let* ((first (current-column)) (target first)) (while (and (not (eobp)) (progn (forward-line) (dired-move-to-filename))) (when (> (current-column) target) (setq target (current-column)))) (and (/= first target) target)))) ;; Eval following form: (let* ((dir (expand-file-name "src" source-directory)) (default-directory dir)) (dired (list dir "alloc.c" "w32xfns.c" "xdisp.c")) ; Wrong aligment. ;; Following just fix the first file, but xdisp.c keeps misaligned. (dired-goto-file (expand-file-name "cygw32.c")) (forward-line 0) (let ((inhibit-read-only t)) (dired-align-file (point) (point-max)))) M-: (dired--need-align-p) RET => t ( ; toggle dired-hide-details-mode M-: (dired--need-align-p) RET => nil ( ; Toggle again: the files still are misaligned. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 01 09:46:24 2017 Received: (at 27762) by debbugs.gnu.org; 1 Aug 2017 13:46:24 +0000 Received: from localhost ([127.0.0.1]:36269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcXV9-0005uk-W7 for submit@debbugs.gnu.org; Tue, 01 Aug 2017 09:46:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcXV9-0005uZ-1W for 27762@debbugs.gnu.org; Tue, 01 Aug 2017 09:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcXUx-0001sE-5i for 27762@debbugs.gnu.org; Tue, 01 Aug 2017 09:46:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcXUx-0001ru-2n; Tue, 01 Aug 2017 09:46:11 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4661 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dcXUv-0004EY-Ia; Tue, 01 Aug 2017 09:46:10 -0400 Date: Tue, 01 Aug 2017 16:46:02 +0300 Message-Id: <834ltr1jvp.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: <87a83jkc02.fsf@calancha-pc> (message from Tino Calancha on Tue, 01 Aug 2017 16:01:17 +0900) Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> <87d18uz8w1.fsf@calancha-pc> <83shhf3brw.fsf@gnu.org> <87a83jkc02.fsf@calancha-pc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Cc: 27762@debbugs.gnu.org > Date: Tue, 01 Aug 2017 16:01:17 +0900 > > Eli Zaretskii writes: > > > Looks OK, but why this complicated code: > > > >> + (when-let* ((col-diff (- (point) (point-at-bol))) > >> + (higher (> col-diff target))) > >> + (setq target col-diff))) > >> + (and (/= first target) target)))) > > > > Doesn't current-column do its job in this case? > That is to work regardless on the `dired-hide-details-mode' value. > If we use `current-column' we are in trouble. Then (a) please mention this issue in a comment before this fragment, and (b) please don't call the variable "column", because it's confusing. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 01 11:08:14 2017 Received: (at 27762-done) by debbugs.gnu.org; 1 Aug 2017 15:08:14 +0000 Received: from localhost ([127.0.0.1]:37072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcYmM-0007xY-6k for submit@debbugs.gnu.org; Tue, 01 Aug 2017 11:08:14 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcYmK-0007xJ-TJ for 27762-done@debbugs.gnu.org; Tue, 01 Aug 2017 11:08:13 -0400 Received: by mail-pf0-f181.google.com with SMTP id d67so9017600pfc.0 for <27762-done@debbugs.gnu.org>; Tue, 01 Aug 2017 08:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=LABZzaCY53JOEioAEXj+GrBgpaE6/XO7hoSWgxij0FQ=; b=tFJ52asiZCdBcrJWbdIoAMhoTenvf7/49hzCPiAUCD2Zg49eZ3zZ+PYsmdrwKPdRI3 N/tLS6THNxJR4xMMWUbAeTq+Q3ywrNL5s4GAWbBYAavys2txWvPfU6xhnVrIWmzEWTQq ctLSkVLkJOSsqcTAE3lrPwZXqhsw/SrPPxkVL0qkMCXJ9b9gv1FVqWJW8RQdRGn4ctQ1 9yZWY2GRsunPFm1v7jRljEjT04MdZ8qFbH5gdaciJoPZLhCdmDU8V7RC/51Hr/dw+/9f iXb+s25T8JTqn3htSEdigIfD2VwUKDIH4IUeU8Va7q1gwYDYVBQEBjNjOXIzoiifsFqm JDew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=LABZzaCY53JOEioAEXj+GrBgpaE6/XO7hoSWgxij0FQ=; b=ca0iyEfxeVjvjP97qPAQnWMdw/aI4fNUtFtrfkQxT8Gv9JigPD7rk8YTpAeWoZop9Z OF+xCTUy9DQaQlLO5kplQqmdXHMDlus/uYWDDKeM68IYGBUCN6SjtFoPIEGDqaiTZsIf Ka6GLWvbfmpuwvqnDQX6WYaHKyXHx6MApOa/irXMawUpeOHqgPnB0fKkOgDeu6JE8hmb jyXGMBlpzD/ihYnE8MmB6T3/6i129/NwfbvqNkQBhf7ZWMw9x0lDBO9Mmkg41cw4KNtK La5LwuhiItHK3a7ljC7hXoZqmi5LaznYpA5591dJyBYihGTn3L2+97SS+K4o8DZxv+MQ 4trA== X-Gm-Message-State: AIVw111Hfiz0m73RL9ZOO+F5LhKKiEBNsK419uhLgeIA941nSwzmyz+7 CBufYntfD3SvhoAV X-Received: by 10.99.146.2 with SMTP id o2mr15432827pgd.54.1501600086699; Tue, 01 Aug 2017 08:08:06 -0700 (PDT) Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id k26sm58104964pfb.145.2017.08.01.08.08.04 for <27762-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Aug 2017 08:08:05 -0700 (PDT) From: Tino Calancha To: 27762-done@debbugs.gnu.org Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> <87d18uz8w1.fsf@calancha-pc> <83shhf3brw.fsf@gnu.org> <87a83jkc02.fsf@calancha-pc> <834ltr1jvp.fsf@gnu.org> Date: Wed, 02 Aug 2017 00:08:02 +0900 In-Reply-To: <834ltr1jvp.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 01 Aug 2017 16:46:02 +0300") Message-ID: <87vam78gx9.fsf@calancha-pc> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 27762-done 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.8 (--) Eli Zaretskii writes: >> From: Tino Calancha >> Cc: 27762@debbugs.gnu.org >> Date: Tue, 01 Aug 2017 16:01:17 +0900 >> >> Eli Zaretskii writes: >> >> > Looks OK, but why this complicated code: >> > >> >> + (when-let* ((col-diff (- (point) (point-at-bol))) >> >> + (higher (> col-diff target))) >> >> + (setq target col-diff))) >> >> + (and (/= first target) target)))) >> > >> > Doesn't current-column do its job in this case? >> That is to work regardless on the `dired-hide-details-mode' value. >> If we use `current-column' we are in trouble. > > Then (a) please mention this issue in a comment before this fragment, > and (b) please don't call the variable "column", because it's > confusing. a) The comment is right before the while loop. b) Done. Pushed into master as commit f74164a845eff579635da0a1267514ef9d040ad2 From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 01 11:43:28 2017 Received: (at 27762) by debbugs.gnu.org; 1 Aug 2017 15:43:28 +0000 Received: from localhost ([127.0.0.1]:37118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcZKS-0002DD-9X for submit@debbugs.gnu.org; Tue, 01 Aug 2017 11:43:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dcZKR-0002D1-1V for 27762@debbugs.gnu.org; Tue, 01 Aug 2017 11:43:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZKI-0005aE-Ob for 27762@debbugs.gnu.org; Tue, 01 Aug 2017 11:43:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZKI-0005a5-Lk; Tue, 01 Aug 2017 11:43:18 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4858 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dcZKH-0001wf-Kd; Tue, 01 Aug 2017 11:43:18 -0400 Date: Tue, 01 Aug 2017 18:43:12 +0300 Message-Id: <83vam7z433.fsf@gnu.org> From: Eli Zaretskii To: Tino Calancha In-reply-to: <87vam78gx9.fsf@calancha-pc> (message from Tino Calancha on Wed, 02 Aug 2017 00:08:02 +0900) Subject: Re: bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons References: <87wp75yuuh.fsf@calancha-pc> <83vamobboe.fsf@gnu.org> <87lgnjzs8d.fsf@calancha-pc> <87d18uz8w1.fsf@calancha-pc> <83shhf3brw.fsf@gnu.org> <87a83jkc02.fsf@calancha-pc> <834ltr1jvp.fsf@gnu.org> <87vam78gx9.fsf@calancha-pc> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 27762 Cc: 27762@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Tino Calancha > Date: Wed, 02 Aug 2017 00:08:02 +0900 > > > Then (a) please mention this issue in a comment before this fragment, > > and (b) please don't call the variable "column", because it's > > confusing. > a) The comment is right before the while loop. > b) Done. > Pushed into master as commit f74164a845eff579635da0a1267514ef9d040ad2 Thanks. From unknown Tue Jun 17 01:44:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 30 Aug 2017 11:24:04 +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