From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ingo Lohmar Newsgroups: gmane.emacs.devel Subject: [PATCH] ls-lisp.el ls-lisp-insert-directory fix empty dir bug Date: Sat, 27 Apr 2013 12:31:56 +0000 (UTC) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1367066114 30655 80.91.229.3 (27 Apr 2013 12:35:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Apr 2013 12:35:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 27 14:35:18 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UW4LS-0005rB-Ep for ged-emacs-devel@m.gmane.org; Sat, 27 Apr 2013 14:35:14 +0200 Original-Received: from localhost ([::1]:38092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW4LR-0001eM-El for ged-emacs-devel@m.gmane.org; Sat, 27 Apr 2013 08:35:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW4LO-0001df-H3 for emacs-devel@gnu.org; Sat, 27 Apr 2013 08:35:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW4LN-0006LE-M7 for emacs-devel@gnu.org; Sat, 27 Apr 2013 08:35:10 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW4LN-0006L0-FO for emacs-devel@gnu.org; Sat, 27 Apr 2013 08:35:09 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UW4LH-0005eF-RB for emacs-devel@gnu.org; Sat, 27 Apr 2013 14:35:03 +0200 Original-Received: from koln-5d8138e0.pool.mediaWays.net ([93.129.56.224]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 27 Apr 2013 14:35:03 +0200 Original-Received: from i.lohmar by koln-5d8138e0.pool.mediaWays.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 27 Apr 2013 14:35:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 93.129.56.224 (Mozilla/5.0 (X11; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0 Iceweasel/21.0) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159181 Archived-At: 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 +++ # @@ -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