From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: v88m@posteo.net Newsgroups: gmane.emacs.bugs Subject: bug#33458: 27.0.50; dired loses position when reverted from outside place Date: Thu, 13 Dec 2018 10:39:14 +0300 Message-ID: <87tvjhri3h@posteo.net> References: <87k1l6f9li@posteo.net> <5C063BD6.5020707@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1544686817 4013 195.159.176.226 (13 Dec 2018 07:40:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Dec 2018 07:40:17 +0000 (UTC) To: martin rudalics , 33458@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 13 08:40:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXLbQ-0000wb-Jt for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Dec 2018 08:40:12 +0100 Original-Received: from localhost ([::1]:51009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXLdW-0000Vg-Ua for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Dec 2018 02:42:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXLdQ-0000VQ-OA for bug-gnu-emacs@gnu.org; Thu, 13 Dec 2018 02:42:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXLdK-0003Hb-P3 for bug-gnu-emacs@gnu.org; Thu, 13 Dec 2018 02:42:15 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41496) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gXLdD-0003Da-LX for bug-gnu-emacs@gnu.org; Thu, 13 Dec 2018 02:42:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gXLdC-0004Gi-4O for bug-gnu-emacs@gnu.org; Thu, 13 Dec 2018 02:42:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: v88m@posteo.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Dec 2018 07:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33458 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33458-submit@debbugs.gnu.org id=B33458.154468686216338 (code B ref 33458); Thu, 13 Dec 2018 07:42:02 +0000 Original-Received: (at 33458) by debbugs.gnu.org; 13 Dec 2018 07:41:02 +0000 Original-Received: from localhost ([127.0.0.1]:45754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXLcD-0004FE-Jx for submit@debbugs.gnu.org; Thu, 13 Dec 2018 02:41:02 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:44163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXLcB-0004En-DX for 33458@debbugs.gnu.org; Thu, 13 Dec 2018 02:41:00 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 2E7F32400FB for <33458@debbugs.gnu.org>; Thu, 13 Dec 2018 08:40:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1544686853; bh=DBmpSyH84jvtXZ0vwROAZrGyf+f4J4TSKBny8h1fDkI=; h=From:To:Subject:Date:From; b=c9CPOseYNMhxA+TVI4Pqv9JVwNPGNMguNi0q7XTSp2OxQ2htBW+LNezUCQCNRG/ph gWS9LcEZ07dLFE2Tem636gVbbKRvzFirNJy9cYbXZKQuAiCs6FEdR0g/0fGFUISCh3 8G7M+7/PybIO5kW6GDsRzc4G1Y+lCMGrAplIB1LjIwq9dfVyu4sIjNV2pbjDbECBwf wLWd1cUFOngVXegDwqHwGKtWBihAXXRY5NrTfOHRSLDkIZpr6Q8R8xsFzfiuxbVX3z AEaiCLxqp+qcKdQhuGJkCvKRYTlOeUXKHWIJC81VyZr3hxWz4xcckuUkapKwW1SGcC i5H9swTgt8jVg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 43FlwN3HjYz9rxM; Thu, 13 Dec 2018 08:40:52 +0100 (CET) In-Reply-To: <5C063BD6.5020707@gmx.at> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:153395 Archived-At: Playing with patched dired.el I can see error message in some cases while buffer creating, deleting and selecting: "wrong-type-argument stringp nil" Quickfix: --- /usr/share/emacs/27.0.50/lisp/dired.el 2018-12-12 10:46:49.000000000 +0300 +++ /tmp/dired.el 2018-12-13 09:52:24.102587567 +0300 @@ -1531,7 +1531,8 @@ (when (and (markerp point) (eq (marker-buffer point) buffer)) (unless (and (nth 1 prev) - (dired-goto-file (nth 1 prev))) + (ignore-errors + (dired-goto-file (nth 1 prev)))) (goto-char (point-min)) (forward-line (1- (nth 2 prev)))) (dired-move-to-filename) May be we need same treatment for other `dired-goto-file' lines or make more general check for `prev's structure? On Tue, Dec 04 2018, martin rudalics wrote: > diff --git a/lisp/dired.el b/lisp/dired.el > index cbd85fe..e5dc862 100644 > --- a/lisp/dired.el > +++ b/lisp/dired.el > @@ -1478,12 +1478,36 @@ dired-save-positions > (list w > (dired-get-filename nil t) > (line-number-at-pos (window-point w))))) > - (get-buffer-window-list nil 0 t)))) > + (get-buffer-window-list nil 0 t)) > + ;; For each window that showed the current buffer before, scan its > + ;; list of previous buffers. For each association thus found save > + ;; a triple where 'point' is that window's > + ;; window-point marker stored in the window's list of previous > + ;; buffers, 'name' is the filename at the position of 'point' and > + ;; 'line' is the line number at the position of 'point'. > + (let ((buffer (current-buffer)) > + prevs) > + (walk-windows > + (lambda (window) > + (let ((prev (assq buffer (window-prev-buffers window)))) > + (when prev > + (with-current-buffer buffer > + (save-excursion > + (goto-char (nth 2 prev)) > + (setq prevs > + (cons > + (list (nth 2 prev) > + (dired-get-filename nil t) > + (line-number-at-pos (point))) > + prevs))))))) > + 'nomini t) > + prevs))) > > (defun dired-restore-positions (positions) > "Restore POSITIONS saved with `dired-save-positions'." > (let* ((buf-file-pos (nth 0 positions)) > - (buffer (nth 0 buf-file-pos))) > + (buffer (nth 0 buf-file-pos)) > + (prevs (nth 2 positions))) > (unless (and (nth 1 buf-file-pos) > (dired-goto-file (nth 1 buf-file-pos))) > (goto-char (point-min)) > @@ -1497,7 +1521,21 @@ dired-restore-positions > (dired-goto-file (nth 1 win-file-pos))) > (goto-char (point-min)) > (forward-line (1- (nth 2 win-file-pos))) > - (dired-move-to-filename))))))) > + (dired-move-to-filename))))) > + (when prevs > + (with-current-buffer buffer > + (save-excursion > + (dolist (prev prevs) > + (let ((point (nth 0 prev))) > + ;; Sanity check of the point marker. > + (when (and (markerp point) > + (eq (marker-buffer point) buffer)) > + (unless (and (nth 0 prev) > + (dired-goto-file (nth 1 prev))) > + (goto-char (point-min)) > + (forward-line (1- (nth 2 prev)))) > + (dired-move-to-filename) > + (move-marker point (point) buffer))))))))) > > (defun dired-remember-marks (beg end) > "Return alist of files and their marks, from BEG to END." -- WBR, Yuri