unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
@ 2017-07-19  3:21 Tino Calancha
  2017-07-19 17:04 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2017-07-19  3:21 UTC (permalink / raw)
  To: 27762


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 <tino.calancha@gmail.com>
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 <tino.calancha@gmail.com>
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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-07-19  3:21 bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons Tino Calancha
@ 2017-07-19 17:04 ` Eli Zaretskii
  2017-07-20  3:45   ` Tino Calancha
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-07-19 17:04 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 27762

> From: Tino Calancha <tino.calancha@gmail.com>
> 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'?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-07-19 17:04 ` Eli Zaretskii
@ 2017-07-20  3:45   ` Tino Calancha
  2017-07-21  4:55     ` Tino Calancha
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2017-07-20  3:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27762

Eli Zaretskii <eliz@gnu.org> 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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-07-20  3:45   ` Tino Calancha
@ 2017-07-21  4:55     ` Tino Calancha
  2017-07-29  8:09       ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2017-07-21  4:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27762


> 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 <tino.calancha@gmail.com>
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






^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-07-21  4:55     ` Tino Calancha
@ 2017-07-29  8:09       ` Eli Zaretskii
  2017-08-01  7:01         ` Tino Calancha
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-07-29  8:09 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 27762

> From: Tino Calancha <tino.calancha@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-07-29  8:09       ` Eli Zaretskii
@ 2017-08-01  7:01         ` Tino Calancha
  2017-08-01 13:46           ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2017-08-01  7:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27762

Eli Zaretskii <eliz@gnu.org> 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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-08-01  7:01         ` Tino Calancha
@ 2017-08-01 13:46           ` Eli Zaretskii
  2017-08-01 15:08             ` Tino Calancha
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-08-01 13:46 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 27762

> From: Tino Calancha <tino.calancha@gmail.com>
> Cc: 27762@debbugs.gnu.org
> Date: Tue, 01 Aug 2017 16:01:17 +0900
> 
> Eli Zaretskii <eliz@gnu.org> 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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-08-01 13:46           ` Eli Zaretskii
@ 2017-08-01 15:08             ` Tino Calancha
  2017-08-01 15:43               ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Tino Calancha @ 2017-08-01 15:08 UTC (permalink / raw)
  To: 27762-done

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Tino Calancha <tino.calancha@gmail.com>
>> Cc: 27762@debbugs.gnu.org
>> Date: Tue, 01 Aug 2017 16:01:17 +0900
>> 
>> Eli Zaretskii <eliz@gnu.org> 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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons
  2017-08-01 15:08             ` Tino Calancha
@ 2017-08-01 15:43               ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2017-08-01 15:43 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 27762

> From: Tino Calancha <tino.calancha@gmail.com>
> 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.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-08-01 15:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19  3:21 bug#27762: 26.0.50; ls-lisp: misalignment when dired-directory is a cons Tino Calancha
2017-07-19 17:04 ` Eli Zaretskii
2017-07-20  3:45   ` Tino Calancha
2017-07-21  4:55     ` Tino Calancha
2017-07-29  8:09       ` Eli Zaretskii
2017-08-01  7:01         ` Tino Calancha
2017-08-01 13:46           ` Eli Zaretskii
2017-08-01 15:08             ` Tino Calancha
2017-08-01 15:43               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).