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: Printing alist pairs to a dedicated buffur Date: Sun, 21 Apr 2024 03:48:40 +0700 Message-ID: References: <87bk65fpsz.fsf@ledu-giraud.fr> <87plukbbod.fsf@ledu-giraud.fr> 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="3608"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Manuel Giraud , 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 Sat Apr 20 22:49:42 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 1ryHeX-0000kK-Ua for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 20 Apr 2024 22:49:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryHdo-0003Mm-8l; Sat, 20 Apr 2024 16:48:56 -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 1ryHdn-0003Me-Cu for help-gnu-emacs@gnu.org; Sat, 20 Apr 2024 16:48:55 -0400 Original-Received: from mail-vk1-xa2e.google.com ([2607:f8b0:4864:20::a2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ryHdl-0001Dn-QU for help-gnu-emacs@gnu.org; Sat, 20 Apr 2024 16:48:55 -0400 Original-Received: by mail-vk1-xa2e.google.com with SMTP id 71dfb90a1353d-4de8d12481bso220566e0c.0 for ; Sat, 20 Apr 2024 13:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713646132; x=1714250932; 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=gcyhLZPqusgdj7ZRjEmssmK2sxrf8Gya3GZrzBpf8zM=; b=IuUoTkVoedp5nceCv675WzOcWZEi78kakLIn81uRvTyUwLfxdHhUVGOgFEGyZh9hym 78iTNP7Zs4Z37x95D94hKhoGFDiWNXZT3ZYUM3cy9Lz9SzoHG7KUdktnYdIXrfxlX+bV hjofvsofhjRJVUCnnYwwx3tFq0QpPYXYlgNCfUkoy2gs0FoPuIySVyje4qPIgYWoKRA/ spVhSoVmH/SvVf9H0dH+LkGb+diEsHcAd8xqd0u1ockeOWDLSVvBZPrGUAI1H93EcM2f mxzbQpPFQHK1zGTq85Mc3cVl2r/Xd7R8eG95Qc8a50VFIWlhY1eJ3D8hWdUVDr49sELv N3tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713646132; x=1714250932; 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=gcyhLZPqusgdj7ZRjEmssmK2sxrf8Gya3GZrzBpf8zM=; b=bvsb+emAhcOrTSTxEwneMKQGRnJtIMwhDfy0IExdh1oyQDVVrYDIC0Y8clZrqKo25y OI9A54l8ANch9zndB7SLi0CXiBM9tqcDP+JHLQBtQ+a8dcVrxoTQUbWvG5sm6bmJgrmN QUL3FJ7Pwm3ytcAAwkDAHwAe6YVuT0MIF7+l4FTZT+x1SXO5BPlSCp6hIrRxOGYYuLZJ T3xHIgRVsVTqWkc4Vu11W6LOZfilvg8z7WO1o1jrUQZujaEe+09sW8eWRU9nyUwfZ9dl LYhOk3Fh0CZwY5+KxTMTe75r4aWmHLm2Ph/BQWUf054OORvYJNC8FBqqcVo5b72Acmrg +gEw== X-Forwarded-Encrypted: i=1; AJvYcCU19z27ljzTUa28poekIz3oxHlmIABcVyP8lca+VooCv6Al7TAlYNvLNLI2GhHMa3t5QPPCDYmXz3Uk1K+cfnuUXGFh9yPf X-Gm-Message-State: AOJu0YxICJSto1BaFH80ik+OvGNNaksCIeKeL9nVc0ecUJJaot/GHX0Q jZ6uHE6HIFhX5SEvk4TbiQsw3u1mlQEC+6goGkzya7azsBo5xdSqUrlKN+ui5H87pfKjel5gEiv /nhoPWueRmbVsJxoYmE10IMh6OtI= X-Google-Smtp-Source: AGHT+IG91UaPHpkIlhzlfA+lJo3utqGTxXckWHYzc3EssKE+KNXsEQiKy5VhVKgoyZ//9kP2g/HQM1oRMUPH4U7pO0Y= X-Received: by 2002:a05:6102:1612:b0:47a:4582:f9c8 with SMTP id cu18-20020a056102161200b0047a4582f9c8mr7338850vsb.13.1713646131993; Sat, 20 Apr 2024 13:48:51 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::a2e; envelope-from=yurivkhan@gmail.com; helo=mail-vk1-xa2e.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:146409 Archived-At: On Sun, 21 Apr 2024 at 00:24, Heime wrote: > Have come up with the following solution using an intermediate function t= hat > passes the alist as argument. Can I do this in a more straightforward ma= nner ? > > (defun tema-catapult (lugar) > "Display the content of the association list LUGAR to the tema > buffer. Because `tema-lugar' was defined with `defvar-local'." > > (with-current-buffer (get-buffer-create "tema") > (insert (format "%s\n" "tema-lugar:")) > (dolist (pair lugar) > (insert (format "%s %d\n" (car pair) (cdr pair))))) ) > > (defun tema-alist () > "Display the content of the association list tema-lugar." > (interactive) > (tema-catapult tema-lugar)) Works? Good enough. You might want to name the helper function as a private one, with a double dash somewhere in the name. Alternatively, you can replace a helper function with a let: (defun tema-alist () (interactive) (let ((lugar tema-lugar)) (with-current-buffer (get-buffer-create "tema") =E2=80=A6do whatever using the local =E2=80=98lugar=E2=80=99 vari= able=E2=80=A6)))