From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: 2QdxY4RzWzUUiLuE@potatochowder.com Newsgroups: gmane.emacs.help Subject: Re: Messages - Avoiding newlines Date: Tue, 8 Dec 2020 07:47:28 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24285"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 08 14:50:14 2020 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 1kmdNe-0006D8-3O for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 14:50:14 +0100 Original-Received: from localhost ([::1]:41280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmdNd-0007GG-3t for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 08:50:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45312) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <2QdxY4RzWzUUiLuE@potatochowder.com>) id 1kmdLA-0006Tz-SY for help-gnu-emacs@gnu.org; Tue, 08 Dec 2020 08:47:42 -0500 Original-Received: from www458.your-server.de ([136.243.165.62]:57704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <2QdxY4RzWzUUiLuE@potatochowder.com>) id 1kmdL8-0001jN-I6 for help-gnu-emacs@gnu.org; Tue, 08 Dec 2020 08:47:40 -0500 Original-Received: from sslproxy02.your-server.de ([78.47.166.47]) by www458.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from <2QdxY4RzWzUUiLuE@potatochowder.com>) id 1kmdL0-000FfT-Jq for help-gnu-emacs@gnu.org; Tue, 08 Dec 2020 14:47:31 +0100 Original-Received: from [172.58.143.92] (helo=localhost) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <2QdxY4RzWzUUiLuE@potatochowder.com>) id 1kmdL0-000Mi2-1E for help-gnu-emacs@gnu.org; Tue, 08 Dec 2020 14:47:30 +0100 Mail-Followup-To: help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: X-Authenticated-Sender: 2QdxY4RzWzUUiLuE@potatochowder.com X-Virus-Scanned: Clear (ClamAV 0.102.4/26011/Mon Dec 7 15:37:03 2020) Received-SPF: pass client-ip=136.243.165.62; envelope-from=2QdxY4RzWzUUiLuE@potatochowder.com; helo=www458.your-server.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.23 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" Xref: news.gmane.io gmane.emacs.help:126178 Archived-At: On 2020-12-08 at 14:29:20 +0100, Stefan Möding wrote: > pietru@caramail.com writes: > > > I would like to print some values but I am getting a new-line > > after (pp bounds). Haw may I avoid it? > > You could remove the trailing newlines returned by pp: > > (message "Bounds: %s [%s, %s]" > (replace-regexp-in-string "\n+$" "" (pp bounds)) $ma $mb) A regular expression is a heavyweight solution to this problem. Try a substring containing all but the trailing newline: (substring (pp bounds t) 0 -1) > pp (Pretty Print) is meant to be used interactively so the newline > make sense when showing the output on a terminal. Note also that by passing a second argument to pp, you can suppress pp's output and make it just return the string. HTH, Dan