From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Re: Print value of selected-window in some info buffer Date: Wed, 15 May 2024 11:52:23 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30504"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 15 13:53:09 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s7DC0-0007jE-IM for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 May 2024 13:53:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7DBU-0007je-IA; Wed, 15 May 2024 07:52:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7DBP-0007hd-QN for help-gnu-emacs@gnu.org; Wed, 15 May 2024 07:52:32 -0400 Original-Received: from mail-4325.protonmail.ch ([185.70.43.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7DBN-0000LC-Dz for help-gnu-emacs@gnu.org; Wed, 15 May 2024 07:52:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1715773946; x=1716033146; bh=XDqleQHbYNdUsVWbjZ2Y0bBgcvFHMnpKWDlDVunkHYU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=hzYc3ABP6HkVA2TObqrYztP8gZpbPIJNELrvK4LbWaqQdmnb11scvOR+gZ5DdLcry n489JGZ0jyYKm69AkFdMXjn9UgmFhdDFFfGLRebs8TnJreUvFJ6KHSob93Hl/9EfBN OQMREVD1hvIaKcq4K6l6tJpf5LShWIDm0Mt7PS6I0tJjfd1UcxpmEkuQxmVUUPPEIR XPfI4eQ98PnE3FRN4CcRqwGhc/6OAt+qdBVyAUMYSbPKLJtI5s6RT1ONIc8/M9eTKG fjxwN0EwFJe7wTYRn3lzN1Sqk74Q57gD8FToLTSIpCzK+db0fBUReuMswx7USJ/t30 FUKArGDEqcZ7A== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: ce56ae638e4add85f5f612e2991ccb8de1f93b0f Received-SPF: pass client-ip=185.70.43.25; envelope-from=heimeborgia@protonmail.com; helo=mail-4325.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146754 Archived-At: On Wednesday, May 15th, 2024 at 5:25 PM, Yuri Khan = wrote: > On Wed, 15 May 2024 at 04:26, Heime heimeborgia@protonmail.com wrote: >=20 > > How can the value of selected-window be printed in some info buffer ? > >=20 > > Because I get a failure with (bdrive-insert (selected-window)) >=20 >=20 > You are passing a window here=E2=80=A6 >=20 > > (defun bdrive-insert (objekt) > > "TODO" > >=20 > > (with-current-buffer (get-buffer-create bfname) > >=20 > > (cond > > ((stringp objekt) >=20 >=20 > =E2=80=A6 but here you test objekt for being a string, and if not, you sk= ip > the insertion. >=20 > > (insert (concat objekt "\n" ))) ))) >=20 >=20 > If you want to print the window object=E2=80=99s default string > representation, like =E2=80=98#=E2=80=99, remove t= he stringp >=20 > test and use: >=20 > (insert (format "%s\n" objekt)) I want to print the string representation. The function will perform something for a string, something else for an integer, ... How can one capture a window such as (selected-window) with a cond ? =20 > If you want to print specific properties of the window, extract those > with the appropriate =E2=80=98window-*=E2=80=99 functions and pass them i= nto =E2=80=98format=E2=80=99. > Provide placeholders in the format string for each value you print. >=20 >=20 > Also, learn to use the debugger so you can solve this and similar > issues yourself. Anywhere within the =E2=80=98bdrive-insert=E2=80=99 defi= nition, type > =E2=80=98C-u C-M-x=E2=80=99. This instruments your function to invoke the= debugger > when called. Next, evaluate your =E2=80=98(bdrive-insert (selected-window= ))=E2=80=99 > form. You get a window showing the function source, with point on the > first subexpression to be evaluated, likely =E2=80=98bfname=E2=80=99, ech= o area > showing its value. Type =E2=80=98n=E2=80=99 for =E2=80=98next=E2=80=99. P= oint moves to the next > expression in evaluation order. Do this until you get to =E2=80=98objekt= =E2=80=99 > (showing =E2=80=98#=E2=80=99) and then =E2=80= =98(stringp objekt)=E2=80=99 >=20 > (showing =E2=80=98nil=E2=80=99). At this point, you can see that a window= is not a > string.