[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Printing alist pairs to a dedicated buffur
From: |
Yuri Khan |
Subject: |
Re: Printing alist pairs to a dedicated buffur |
Date: |
Sun, 21 Apr 2024 03:48:40 +0700 |
On Sun, 21 Apr 2024 at 00:24, Heime <heimeborgia@protonmail.com> wrote:
> Have come up with the following solution using an intermediate function that
> passes the alist as argument. Can I do this in a more straightforward manner
> ?
>
> (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")
…do whatever using the local ‘lugar’ variable…)))
- Printing alist pairs to a dedicated buffur, Heime, 2024/04/19
- RE: [External] : Re: Printing alist pairs to a dedicated buffur, Drew Adams, 2024/04/25
- RE: [External] : Re: Printing alist pairs to a dedicated buffur, Heime, 2024/04/25
- Re: [External] : Re: Printing alist pairs to a dedicated buffur, Emanuel Berg, 2024/04/25
- Re: [External] : Re: Printing alist pairs to a dedicated buffur, Emanuel Berg, 2024/04/25
- RE: [External] : Re: Printing alist pairs to a dedicated buffur, Drew Adams, 2024/04/25
- Re: [External] : Re: Printing alist pairs to a dedicated buffur, Emanuel Berg, 2024/04/26
- RE: [External] : Re: Printing alist pairs to a dedicated buffur, Drew Adams, 2024/04/26