From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jenia.ivlev@gmail.com (jenia.ivlev) Newsgroups: gmane.emacs.help Subject: set-window-buffer bugs Date: Sat, 05 Dec 2015 15:52:12 -0500 Message-ID: <87fuzgboub.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1449348780 1681 80.91.229.3 (5 Dec 2015 20:53:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Dec 2015 20:53:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 05 21:52:51 2015 Return-path: Envelope-to: geh-help-gnu-emacs@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 1a5Jp5-0005qe-1H for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Dec 2015 21:52:51 +0100 Original-Received: from localhost ([::1]:47730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5Jp4-0007Gc-IU for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Dec 2015 15:52:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5Jou-0007GX-7L for help-gnu-emacs@gnu.org; Sat, 05 Dec 2015 15:52:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a5Jor-0000In-1I for help-gnu-emacs@gnu.org; Sat, 05 Dec 2015 15:52:40 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:37311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a5Joq-0000Ib-QC for help-gnu-emacs@gnu.org; Sat, 05 Dec 2015 15:52:36 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a5Joo-0005Jf-Co for help-gnu-emacs@gnu.org; Sat, 05 Dec 2015 21:52:34 +0100 Original-Received: from modemcable053.124-162-184.mc.videotron.ca ([184.162.124.53]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Dec 2015 21:52:34 +0100 Original-Received: from jenia.ivlev by modemcable053.124-162-184.mc.videotron.ca with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Dec 2015 21:52:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 56 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: modemcable053.124-162-184.mc.videotron.ca User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:GOZDUjneJ+cUA0KtG91vGuy1G1c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108307 Archived-At: Hello. Using dired, I want find-buffer-other-window to open in the exact same window. So I made this little program: (define-key dired-mode-map "o" 'dired-find-file-other-opened-window) (defun dired-find-file-other-opened-window () (interactive) (set-window-buffer (frame-first-window) (dired-get-filename 'no-dir)) (dired-find-file-other-window)) It turns out that you needed to have visited that file already for this to work. Here is the backtrace for when it doesnt work: Debugger entered--entering a function: * #(# "String.h" nil) * apply(# (# "String.h")) * set-window-buffer(# "String.h") dired-find-file-other-opened-window() dired-fnd-fl-otr-opn-wnd-keep-cursor() call-interactively(dired-fnd-fl-otr-opn-wnd-keep-cursor nil nil) command-execute(dired-fnd-fl-otr-opn-wnd-keep-cursor) After pressing `d` again, I get: * command-error-default-function((wrong-type-argument bufferp nil) "" apply) And here is a backtrace where it does work (the file has been previous visited): Debugger entered--entering a function: * window-buffer(#) * linum-after-scroll(# 1) * #(# "String.c" nil) * apply(# (# "String.c")) * set-window-buffer(# "String.c") dired-find-file-other-opened-window() dired-fnd-fl-otr-opn-wnd-keep-cursor() call-interactively(dired-fnd-fl-otr-opn-wnd-keep-cursor nil nil) command-execute(dired-fnd-fl-otr-opn-wnd-keep-cursor) I mean, I don't get it. Why do I need to have visited the file before? And in any case, how do I fix this? I just want it to open in the (frame-first-window) that's all. Thanks