From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: call function in other window ? Date: Sun, 21 May 2017 03:58:25 +0200 Message-ID: References: <0F7D0254-9A80-42BF-82EB-E09007BE3A39@gmail.com> <38f43e30-eeb0-427a-a885-fbd30d0d0d97@default> <26D747C5-FD5A-4810-938E-77DD21C6D2F9@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495331952 13791 195.159.176.226 (21 May 2017 01:59:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 21 May 2017 01:59:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 21 03:59:04 2017 Return-path: Envelope-to: geh-help-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 1dCG9A-0003Qr-3G for geh-help-gnu-emacs@m.gmane.org; Sun, 21 May 2017 03:59:04 +0200 Original-Received: from localhost ([::1]:36000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCG9F-0007QV-Qb for geh-help-gnu-emacs@m.gmane.org; Sat, 20 May 2017 21:59:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCG8l-0007P7-If for help-gnu-emacs@gnu.org; Sat, 20 May 2017 21:58:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCG8i-0004mo-H0 for help-gnu-emacs@gnu.org; Sat, 20 May 2017 21:58:39 -0400 Original-Received: from [195.159.176.226] (port=47840 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCG8i-0004mS-AU for help-gnu-emacs@gnu.org; Sat, 20 May 2017 21:58:36 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dCG8Y-0002jr-Kg for help-gnu-emacs@gnu.org; Sun, 21 May 2017 03:58:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 39 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:ETd89MD4BonjtFN+bGEQL8wrVd4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:113095 Archived-At: Drew Adams wrote: > I don't know whether others will find such > a function useful. I haven't needed it. Look, I used it! Previously I had `other-window' in both kill functions. This is neater. (defun apply-in-other-window (fn &rest args) (let*((window (next-window)) (buffer (and window (window-buffer window)) )) (when buffer (with-current-buffer buffer (apply fn args) )))) (defun kill-path-other-window () (interactive) (apply-in-other-window #'kill-path) ) (defun kill-name-other-window () (interactive) (apply-in-other-window #'kill-name) ) > I imagine that most people who are going to > write Lisp code to act on a buffer will know > to use `with-current-buffer', and to get to > the buffer of another window they will use > `window-buffer'. Those are commonly used. Well, what should determine if something should be included or not is its usefulness. As for the difficulty implementing this particular function, I'd put it somewhere in the mid range. But again, that shouldn't influence. -- underground experts united http://user.it.uu.se/~embe8573