all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug
@ 2013-04-27 12:31 Ingo Lohmar
  2013-04-27 12:58 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Lohmar @ 2013-04-27 12:31 UTC (permalink / raw)
  To: emacs-devel

Hi all,

I noticed a bug with ls-lisp's insert-directory when the list of files is
empty.  Since point is at the beginning of the buffer before inserting the
total-line, save-excursion does not work like it does when there are files
(ie, buffer content) already: point afterwards is still before the text,
and dired-insert-directory does not correctly indent the content then.

Below is a one-line patch (so no FSF assignment necessary, which is still
on my TODOs...) to correct this whenever the list of files was empty.  I
do not use the repository but a recent snapshot, apologies for any necessary
reformatting.  HTH.

Best,
Ingo



--- /usr/share/emacs/24.3.50/lisp/ls-lisp.el.gz
+++ #<buffer ls-lisp.el.gz>
@@ -404,6 +404,7 @@
 		;; the wildcard; let's say something similar.
 		(insert "(No match)\n"))
 	    (insert (format "total %.0f\n" (fceiling (/ sum 1024.0))))))
+          (unless files (goto-char (point-max)))
 	(if (memq ?R switches)
 	    ;; List the contents of all directories recursively.
 	    ;; cadr of each element of `file-alist' is t for





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

* Re: [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug
  2013-04-27 12:31 [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug Ingo Lohmar
@ 2013-04-27 12:58 ` Eli Zaretskii
  2013-04-27 13:56   ` Ingo Lohmar
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2013-04-27 12:58 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-devel

> From: Ingo Lohmar <i.lohmar@gmail.com>
> Date: Sat, 27 Apr 2013 12:31:56 +0000 (UTC)
> 
> I noticed a bug with ls-lisp's insert-directory when the list of files is
> empty.  Since point is at the beginning of the buffer before inserting the
> total-line, save-excursion does not work like it does when there are files
> (ie, buffer content) already: point afterwards is still before the text,
> and dired-insert-directory does not correctly indent the content then.
> 
> Below is a one-line patch (so no FSF assignment necessary, which is still
> on my TODOs...) to correct this whenever the list of files was empty.  I
> do not use the repository but a recent snapshot, apologies for any necessary
> reformatting.  HTH.

Thanks.

Can you show a simple recipe for reproducing the problem?



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

* Re: [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug
  2013-04-27 12:58 ` Eli Zaretskii
@ 2013-04-27 13:56   ` Ingo Lohmar
  2013-04-27 16:56     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Lohmar @ 2013-04-27 13:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Sat, Apr 27 2013 14:58 (+0200), Eli Zaretskii wrote:

>> From: Ingo Lohmar <i.lohmar@gmail.com>
>> Date: Sat, 27 Apr 2013 12:31:56 +0000 (UTC)
>>
>> I noticed a bug with ls-lisp's insert-directory when the list of files is
>> empty.  Since point is at the beginning of the buffer before inserting the
>> total-line, save-excursion does not work like it does when there are files
>> (ie, buffer content) already: point afterwards is still before the text,
>> and dired-insert-directory does not correctly indent the content then.
>>
>> Below is a one-line patch (so no FSF assignment necessary, which is still
>> on my TODOs...) to correct this whenever the list of files was empty.  I
>> do not use the repository but a recent snapshot, apologies for any necessary
>> reformatting.  HTH.
>
> Thanks.
>
> Can you show a simple recipe for reproducing the problem?

Hi Eli,

Glad you asked, I now noticed that the problem only occurs when removing
the dot entries via dired-listing-switches (so when the local files
variable is really nil before populating the buffer):

(require 'ls-lisp)
(setq ls-lisp-use-insert-directory-program nil)

;; only occurs if we do not have "." and ".."
(setq dired-listing-switches "-l -h")

;; now create some empty dir, and do
(dired "my-empty-dir")

;; notice that last two lines are not indented, get wrong text
;; properties due to that...

Regards,
Ingo



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

* Re: [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug
  2013-04-27 13:56   ` Ingo Lohmar
@ 2013-04-27 16:56     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2013-04-27 16:56 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-devel

> From: Ingo Lohmar <i.lohmar@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Sat, 27 Apr 2013 15:56:27 +0200
> 
> Glad you asked, I now noticed that the problem only occurs when removing
> the dot entries via dired-listing-switches (so when the local files
> variable is really nil before populating the buffer):
> 
> (require 'ls-lisp)
> (setq ls-lisp-use-insert-directory-program nil)
> 
> ;; only occurs if we do not have "." and ".."
> (setq dired-listing-switches "-l -h")
> 
> ;; now create some empty dir, and do
> (dired "my-empty-dir")
> 
> ;; notice that last two lines are not indented, get wrong text
> ;; properties due to that...

Thanks, I installed your change.



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

end of thread, other threads:[~2013-04-27 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27 12:31 [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug Ingo Lohmar
2013-04-27 12:58 ` Eli Zaretskii
2013-04-27 13:56   ` Ingo Lohmar
2013-04-27 16:56     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.