From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: doc-view functions inside with-current-buffer do not work Date: Mon, 03 Nov 2014 11:57:40 -0500 Message-ID: References: <87oaso8dj9.fsf@mailbox.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415033898 3322 80.91.229.3 (3 Nov 2014 16:58:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2014 16:58:18 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alexander Baier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 03 17:58:11 2014 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 1XlKxH-0002cK-30 for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 17:58:11 +0100 Original-Received: from localhost ([::1]:36143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlKxG-0001dc-HM for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 11:58:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlKwv-0001aA-9W for emacs-devel@gnu.org; Mon, 03 Nov 2014 11:57:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlKwn-0007uw-Qd for emacs-devel@gnu.org; Mon, 03 Nov 2014 11:57:49 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:45413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlKwn-0007uq-Mv for emacs-devel@gnu.org; Mon, 03 Nov 2014 11:57:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au4MAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+y1MEAgKBHBcBAXyEAwEBAwFWIwULCzQSFBgNJIhLCctyAQEBAQYBAQEBHpEIB4RLBYtkpjyBb4QWH4J6AQEB X-IPAS-Result: Au4MAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+y1MEAgKBHBcBAXyEAwEBAwFWIwULCzQSFBgNJIhLCctyAQEBAQYBAQEBHpEIB4RLBYtkpjyBb4QWH4J6AQEB X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="95855777" Original-Received: from 69-165-143-59.dsl.teksavvy.com (HELO pastel.home) ([69.165.143.59]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Nov 2014 11:57:40 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2AB428597; Mon, 3 Nov 2014 11:57:40 -0500 (EST) In-Reply-To: <87oaso8dj9.fsf@mailbox.org> (Alexander Baier's message of "Mon, 03 Nov 2014 17:16:58 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:176283 Archived-At: > Consider the following steps: > - Define this function: > #+BEGIN_SRC emacs-lisp > (defun my-doc-view-goto-page (n) > (with-current-buffer (get-buffer "test.pdf") > (doc-view-goto-page n))) > #+END_SRC Just like point and goto-char, the page displayed by doc-view can be different in different windows, so selecting the buffer is not enough for doc-view-goto-page to know which window should be affected. You need with-selected-window instead of with-current-buffer. Stefan