* patch for dired-format-columns-of-files
@ 2008-04-30 17:50 Toru TSUNEYOSHI
2008-05-01 14:35 ` Toru TSUNEYOSHI
0 siblings, 1 reply; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-04-30 17:50 UTC (permalink / raw)
To: bug-gnu-emacs
I found a bug when I do (dired-do-delete).
I will send the patch for correcting it.
--- lisp/dired.el.orig 2008-03-17 01:27:10.000000000 +0900
+++ lisp/dired.el 2008-05-01 02:33:21.297046400 +0900
@@ -2639,9 +2639,9 @@
(defun dired-format-columns-of-files (files)
;; Files should be in forward order for this loop.
;; i.e., (car files) = first file in buffer.
;; Returns the number of lines used.
- (let* ((maxlen (+ 2 (apply 'max (mapcar 'length files))))
+ (let* ((maxlen (+ 2 (apply 'max (mapcar 'string-width files))))
(width (- (window-width (selected-window)) 2))
(columns (max 1 (/ width maxlen)))
(nfiles (length files))
(rows (+ (/ nfiles columns)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: patch for dired-format-columns-of-files
2008-04-30 17:50 patch for dired-format-columns-of-files Toru TSUNEYOSHI
@ 2008-05-01 14:35 ` Toru TSUNEYOSHI
2008-05-02 17:39 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-05-01 14:35 UTC (permalink / raw)
To: bug-gnu-emacs
(Sorry, I didn't write about the bug as I thought it is clear that what
is it. But, I should have written it.
In accordance with auto reply e-mail, I have already sent to
171@emacsbugs.donarmstrong.com. But just to make sure, I will send to
bug-gnu-emacs@gnu.org again.)
For example, I find the bug after I do (dired-do-flagged-delete), if
`FILES' list includes Japanse file name. The bug is that each file name
doesn't separate properly in "*Deletions*" buffer.
Because (dired-format-columns-of-files) uses `length' function not
`string-width' function. So, I corrected it.
example:
d:/test:
total used in directory 0 available 1024
drwxrwxrwx 1 user root 0 05-01 12:22 .
drwxrwxrwx 1 user root 0 1970-01-01 ..
D -rw-rw-rw- 1 user root 0 05-01 12:22 test.txt
D -rw-rw-rw- 1 user root 0 05-01 12:22 テスト.txt
D -rw-rw-rw- 1 user root 0 05-01 12:22 テスト2.txt
D -rw-rw-rw- 1 user root 0 05-01 12:22 テスト3.txt
(dired-do-flagged-delete)
=> (in "*Deletions*" buffer)
test.txt テスト.txtテスト2.txtテスト3.txt
----- Original Message -----
From: "Toru TSUNEYOSHI" <t_tuneyosi@hotmail.com>
To: <bug-gnu-emacs@gnu.org>
Sent: Thursday, May 01, 2008 2:50 AM
Subject: patch for dired-format-columns-of-files
> I found a bug when I do (dired-do-delete).
> I will send the patch for correcting it.
>
> --- lisp/dired.el.orig 2008-03-17 01:27:10.000000000 +0900
> +++ lisp/dired.el 2008-05-01 02:33:21.297046400 +0900
> @@ -2639,9 +2639,9 @@
> (defun dired-format-columns-of-files (files)
> ;; Files should be in forward order for this loop.
> ;; i.e., (car files) = first file in buffer.
> ;; Returns the number of lines used.
> - (let* ((maxlen (+ 2 (apply 'max (mapcar 'length files))))
> + (let* ((maxlen (+ 2 (apply 'max (mapcar 'string-width files))))
> (width (- (window-width (selected-window)) 2))
> (columns (max 1 (/ width maxlen)))
> (nfiles (length files))
> (rows (+ (/ nfiles columns)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: patch for dired-format-columns-of-files
2008-05-01 14:35 ` Toru TSUNEYOSHI
@ 2008-05-02 17:39 ` Stefan Monnier
2008-05-03 2:29 ` Toru TSUNEYOSHI
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-05-02 17:39 UTC (permalink / raw)
To: Toru TSUNEYOSHI; +Cc: bug-gnu-emacs
> (Sorry, I didn't write about the bug as I thought it is clear that what
> is it. But, I should have written it.
> In accordance with auto reply e-mail, I have already sent to
> 171@emacsbugs.donarmstrong.com. But just to make sure, I will send to
> bug-gnu-emacs@gnu.org again.)
> For example, I find the bug after I do (dired-do-flagged-delete), if
> `FILES' list includes Japanse file name. The bug is that each file name
> doesn't separate properly in "*Deletions*" buffer.
> Because (dired-format-columns-of-files) uses `length' function not
> `string-width' function. So, I corrected it.
Thanks. I've installed a similar fix to completion--insert-strings and
made dired use that function.
Stefan
--- dired.el.~1.392.~ 2008-05-02 13:19:10.000000000 -0400
+++ dired.el 2008-05-02 13:35:06.000000000 -0400
@@ -2708,31 +2708,9 @@
(apply function args))))
(defun dired-format-columns-of-files (files)
- ;; Files should be in forward order for this loop.
- ;; i.e., (car files) = first file in buffer.
- ;; Returns the number of lines used.
- (let* ((maxlen (+ 2 (apply 'max (mapcar 'length files))))
- (width (- (window-width (selected-window)) 2))
- (columns (max 1 (/ width maxlen)))
- (nfiles (length files))
- (rows (+ (/ nfiles columns)
- (if (zerop (% nfiles columns)) 0 1)))
- (i 0)
- (j 0))
- (setq files (nconc (copy-sequence files) ; fill up with empty fns
- (make-list (- (* columns rows) nfiles) "")))
- (setcdr (nthcdr (1- (length files)) files) files) ; make circular
- (while (< j rows)
- (while (< i columns)
- (indent-to (* i maxlen))
- (insert (car files))
- (setq files (nthcdr rows files)
- i (1+ i)))
- (insert "\n")
- (setq i 0
- j (1+ j)
- files (cdr files)))
- rows))
+ (let ((beg (point)))
+ (completion--insert-strings files)
+ (put-text-property pos (point) 'mouse-face nil)))
\f
;; Commands to mark or flag file(s) at or near current line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: patch for dired-format-columns-of-files
2008-05-02 17:39 ` Stefan Monnier
@ 2008-05-03 2:29 ` Toru TSUNEYOSHI
0 siblings, 0 replies; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-05-03 2:29 UTC (permalink / raw)
To: bug-gnu-emacs
Thanks.
This change looks smart.
(I don't know that completion--insert-strings function exists.)
----- Original Message -----
From: "Stefan Monnier" <monnier@iro.umontreal.ca>
To: "Toru TSUNEYOSHI" <t_tuneyosi@hotmail.com>
Cc: <bug-gnu-emacs@gnu.org>
Sent: Saturday, May 03, 2008 2:39 AM
Subject: Re: patch for dired-format-columns-of-files
> > (Sorry, I didn't write about the bug as I thought it is clear that what
> > is it. But, I should have written it.
> > In accordance with auto reply e-mail, I have already sent to
> > 171@emacsbugs.donarmstrong.com. But just to make sure, I will send to
> > bug-gnu-emacs@gnu.org again.)
>
> > For example, I find the bug after I do (dired-do-flagged-delete), if
> > `FILES' list includes Japanse file name. The bug is that each file name
> > doesn't separate properly in "*Deletions*" buffer.
> > Because (dired-format-columns-of-files) uses `length' function not
> > `string-width' function. So, I corrected it.
>
> Thanks. I've installed a similar fix to completion--insert-strings and
> made dired use that function.
>
>
> Stefan
>
>
> --- dired.el.~1.392.~ 2008-05-02 13:19:10.000000000 -0400
> +++ dired.el 2008-05-02 13:35:06.000000000 -0400
> @@ -2708,31 +2708,9 @@
> (apply function args))))
>
> (defun dired-format-columns-of-files (files)
> - ;; Files should be in forward order for this loop.
> - ;; i.e., (car files) = first file in buffer.
> - ;; Returns the number of lines used.
> - (let* ((maxlen (+ 2 (apply 'max (mapcar 'length files))))
> - (width (- (window-width (selected-window)) 2))
> - (columns (max 1 (/ width maxlen)))
> - (nfiles (length files))
> - (rows (+ (/ nfiles columns)
> - (if (zerop (% nfiles columns)) 0 1)))
> - (i 0)
> - (j 0))
> - (setq files (nconc (copy-sequence files) ; fill up with empty fns
> - (make-list (- (* columns rows) nfiles) "")))
> - (setcdr (nthcdr (1- (length files)) files) files) ; make circular
> - (while (< j rows)
> - (while (< i columns)
> - (indent-to (* i maxlen))
> - (insert (car files))
> - (setq files (nthcdr rows files)
> - i (1+ i)))
> - (insert "\n")
> - (setq i 0
> - j (1+ j)
> - files (cdr files)))
> - rows))
> + (let ((beg (point)))
> + (completion--insert-strings files)
> + (put-text-property pos (point) 'mouse-face nil)))
>
> ;; Commands to mark or flag file(s) at or near current line.
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-03 2:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30 17:50 patch for dired-format-columns-of-files Toru TSUNEYOSHI
2008-05-01 14:35 ` Toru TSUNEYOSHI
2008-05-02 17:39 ` Stefan Monnier
2008-05-03 2:29 ` Toru TSUNEYOSHI
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).