From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: cl-assertion error in doc-view Date: Thu, 20 Sep 2012 19:25:50 +0200 Message-ID: <505B519E.8060403@gmx.at> References: <87obl1yk0q.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1348161932 4031 80.91.229.3 (20 Sep 2012 17:25:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Sep 2012 17:25:32 +0000 (UTC) To: emacs-devel@gnu.org, Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 20 19:25:36 2012 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 1TEkVL-0002t4-LG for ged-emacs-devel@m.gmane.org; Thu, 20 Sep 2012 19:25:35 +0200 Original-Received: from localhost ([::1]:50463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEkVH-0002w3-7i for ged-emacs-devel@m.gmane.org; Thu, 20 Sep 2012 13:25:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEkVF-0002vv-6r for emacs-devel@gnu.org; Thu, 20 Sep 2012 13:25:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEkVE-0002p2-1g for emacs-devel@gnu.org; Thu, 20 Sep 2012 13:25:29 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:51141) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TEkVD-0002ok-OB for emacs-devel@gnu.org; Thu, 20 Sep 2012 13:25:27 -0400 Original-Received: (qmail invoked by alias); 20 Sep 2012 17:25:25 -0000 Original-Received: from 62-47-58-200.adsl.highway.telekom.at (EHLO [62.47.58.200]) [62.47.58.200] by mail.gmx.net (mp034) with SMTP; 20 Sep 2012 19:25:25 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19jEWI56HZj1eJ9AtIKNW7XthviCumYnqocQPHoGf Xy9pWSxotdeHi8 In-Reply-To: <87obl1yk0q.fsf@thinkpad.tsdh.de> X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.22 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:153404 Archived-At: > Before that change, when I find some foo.pdf file with emacs -Q, the > cl-assert triggers because the foo.pdf buffer isn't already displayed > thus `get-buffer-window-list' returns nil, and `selected-window' returns > the window I'm in when doing the `C-x C-f foo.pdf'. > > Is the change sensible? At least, it fixes the bug, but the multiple > windows on the same doc stuff is yours, so feel free to correct it as > seems fit. Maybe the bug is somewhere else, though, at least it > suprises me that when finding a file and the major mode function runs > the buffer isn't already displayed. I think it used to be different... I'd use something like the below instead. martin === modified file 'lisp/doc-view.el' --- lisp/doc-view.el 2012-09-19 17:54:59 +0000 +++ lisp/doc-view.el 2012-09-20 17:18:44 +0000 @@ -1169,15 +1169,16 @@ If FORCE is non-nil, start viewing even if the document does not have the page we want to view." (with-current-buffer buffer - (let ((prev-pages doc-view-current-files)) + (let ((prev-pages doc-view-current-files) + (windows (get-buffer-window-list buffer nil t))) (setq doc-view-current-files (sort (directory-files (doc-view-current-cache-dir) t "page-[0-9]+\\.png" t) 'doc-view-sort)) - (dolist (win (or (get-buffer-window-list buffer nil t) - (list (let ((w (selected-window))) - (set-window-buffer w buffer) - w)))) + (unless windows + (switch-to-buffer buffer) + (setq windows (get-buffer-window-list buffer nil t))) + (dolist (win windows) (let* ((page (doc-view-current-page win)) (pagefile (expand-file-name (format "page-%d.png" page) (doc-view-current-cache-dir))))