From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Print value of selected-window in some info buffer Date: Wed, 15 May 2024 12:25:22 +0700 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="22037"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Heime via Users list for the GNU Emacs text editor To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 15 07:26:18 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 1s779d-0005WH-Eg for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 May 2024 07:26:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7791-0004CD-WC; Wed, 15 May 2024 01:25:40 -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 1s778z-0004Bv-EZ for help-gnu-emacs@gnu.org; Wed, 15 May 2024 01:25:38 -0400 Original-Received: from mail-ua1-x929.google.com ([2607:f8b0:4864:20::929]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s778x-0004n1-UZ for help-gnu-emacs@gnu.org; Wed, 15 May 2024 01:25:37 -0400 Original-Received: by mail-ua1-x929.google.com with SMTP id a1e0cc1a2514c-7ef2a623958so1823384241.1 for ; Tue, 14 May 2024 22:25:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715750734; x=1716355534; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7kOlqfTjxbVxcf9g4qqaXHzLUu/0BmiqglaLpfwFwMw=; b=IB5UOg0riAfxZGxOUeSrNMWInF0/aS5iCIxQAaIF86D8/FnZYKrbi38h8r35DAq6GW o8Iii57vYQqKCDCs0A5sCpN566VqoInE+LkSMghNy0VR2tfhlktMd10MDWVginGTAhqw QqGNwjuGS/3f5ikU6AFJzh00IYWJJOls42r9P5jaS1NHjNXpzSLO/8FDZBsCbCKskk+Y 8nCnwpBVJVw13whAn4+PV09268mlBWcBYDGtzok0ZaudKMB6KnMAueRp4PlJx/mivEAk PjLR3qWMsrTMtasRsMmtWhhSUVw+loFMUZZrwoFhSLHBK6PGNlr3rz0IsyToo3vHg5DO Qilg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715750734; x=1716355534; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7kOlqfTjxbVxcf9g4qqaXHzLUu/0BmiqglaLpfwFwMw=; b=SOnb053BEOiN4p8HMBk5MGQJGv5h1+86lBS1Um7IZg5cMxuteV15tsuVT/Za1+RfX4 95VffRf+3rtxHJ5VNMn2zbF3MsoY+oAOFSWlw5IRCjS5NDOecGxp+cJ1BrIRuMoK4vLJ 2iWZuC5xx+CwEwAtm6PYehz0NW7XRoayaE4j4eDN5XjK9PSaHWYyfV+idN54bo0TtmXL XX5WpUjQ+QHpZjRxcOVl8fPPxqcdsd9esWtzrghb7hk1c8r9dQrWdD1pVE3DgJzb+BP4 sdNAeG1GnudQ4etFZJW7nsN/iQ0LpfNu1yb2gNKBK88aBF6xuUQmCFuAm+YYUjGOAW3y zgvw== X-Gm-Message-State: AOJu0YzC5SweSCJFjE+VkcTZBInn9OrYrJTyzQopmhRcUZIvfI2EHh6k rO66l/ay21yYw7Z380B/Vz9TwU4wZbzmSGBUgJsN9Nvz0o3cEaC1DqaPFvzmPqbXv1/Q/b1hxDj Iu1LZeI9O55YrlpPaNi/UiDOatkqWUQ== X-Google-Smtp-Source: AGHT+IFW4XlETfPDk4lkJ/Nd/8wsp1HTqbjd1rb8IVcS4+cvQNY3zWm3K0hX/6NKubWf9q3vYgwzI75KKScnppzifh0= X-Received: by 2002:a05:6102:c8e:b0:47e:eeab:622f with SMTP id ada2fe7eead31-48077de52f0mr14491480137.8.1715750733948; Tue, 14 May 2024 22:25:33 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::929; envelope-from=yurivkhan@gmail.com; helo=mail-ua1-x929.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:146750 Archived-At: On Wed, 15 May 2024 at 04:26, Heime wrote: > > How can the value of selected-window be printed in some info buffer ? > > Because I get a failure with (bdrive-insert (selected-window)) You are passing a window here=E2=80=A6 > (defun bdrive-insert (objekt) > "TODO" > > (with-current-buffer (get-buffer-create bfname) > > (cond > ((stringp objekt) =E2=80=A6 but here you test objekt for being a string, and if not, you skip the insertion. > (insert (concat objekt "\n" ))) ))) 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 test and use: (insert (format "%s\n" objekt)) 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 int= o =E2=80=98format=E2=80=99. Provide placeholders in the format string for each value you print. 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 defini= tion, type =E2=80=98C-u C-M-x=E2=80=99. This instruments your function to invoke the d= ebugger 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, echo = area showing its value. Type =E2=80=98n=E2=80=99 for =E2=80=98next=E2=80=99. Poi= nt 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(s= tringp objekt)=E2=80=99 (showing =E2=80=98nil=E2=80=99). At this point, you can see that a window i= s not a string.