From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alexander Baier Newsgroups: gmane.emacs.devel Subject: Re: doc-view functions inside with-current-buffer do not work Date: Mon, 03 Nov 2014 18:28:41 +0100 Message-ID: <87egtk8a7q.fsf@mailbox.org> References: <87oaso8dj9.fsf@mailbox.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415035800 4768 80.91.229.3 (3 Nov 2014 17:30:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2014 17:30:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 03 18:29:53 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 1XlLRx-000309-Db for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 18:29:53 +0100 Original-Received: from localhost ([::1]:36451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlLRw-0007ig-Vn for ged-emacs-devel@m.gmane.org; Mon, 03 Nov 2014 12:29:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlLRc-0007hS-F7 for emacs-devel@gnu.org; Mon, 03 Nov 2014 12:29:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlLRU-0000VL-NU for emacs-devel@gnu.org; Mon, 03 Nov 2014 12:29:32 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:44587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlLRU-0000VH-Gd for emacs-devel@gnu.org; Mon, 03 Nov 2014 12:29:24 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XlLRS-0002kH-HH for emacs-devel@gnu.org; Mon, 03 Nov 2014 18:29:22 +0100 Original-Received: from nat-wh-wh36.rz.uni-karlsruhe.de ([141.70.81.154]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 03 Nov 2014 18:29:22 +0100 Original-Received: from alexander.baier by nat-wh-wh36.rz.uni-karlsruhe.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 03 Nov 2014 18:29:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 21 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nat-wh-wh36.rz.uni-karlsruhe.de User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:VYfv0KekM/Ip0wofzOdS0mTckXI= 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:176287 Archived-At: On 2014-11-03 17:57 Stefan Monnier wrote: >> 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. This works like a charm, thank you! Regards, -- Alexander Baier