Re: Print key-value pairs from both plist and alist

Heime <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <SuT_lkGpT9yLvQ20AIKd6Gm8XCTMxkS2OiCDcEoqamzOlC9ufDzO8twzYlDEcPS-xbxe0uZm5DCOym-697S0vdzlJwCW9WZvUzVx3Z97ha0=@protonmail.com>
On Saturday, April 11th, 2026 at 9:51 AM, [email protected] <[email protected]> wrote:

> Heime <[email protected]> writes:
> 
> > On Saturday, April 11th, 2026 at 2:44 AM, Heime <[email protected]> wrote:
> >
> >> I want to print key-value pairs using a function to which I can
> >> pass either a plist or an alist as argument.
> >>
> >> Have seen different constructs to do so, but is there a clause
> >> that will apply for both a plist and an alist?
> >
> > For hash tables I can use maphash to get key-value pairs.  Is there
> > some map equivalent for reading key-value pairs for both plists and
> > alists?
> >
> 
> C-h P map:
> 
>    "map.el provides generic map-manipulation functions that work on
>     alists, plists, hash-tables, and arrays.  All functions are
>     prefixed with "map-"."
> 
> Some of the functions in this library:
> 
> mapp
>   Function: Return non-nil if MAP is a map (alist/plist, hash-table, array,...).
> 
> map-keys
>   Function: Return the list of keys in MAP.
> 
> map-values
>   Function: Return the list of values in MAP.
> 
> map-do
>   Function: Apply FUNCTION to each element of MAP and return nil.

"C-h f map-do" did not give me anything
 
I need to adapt this to plists and alists

            (maphash
               ;; FUNCITON
               (lambda (key value)
                 (let* ( (fkey  (format "%s" key))
                         (fval  (format "%s" value))
			 (sgnl  (if (file-directory-p fval)
                                      (propertize " " 'face lmps)
                                  (propertize " " 'face lmpw)))
                         (pkey  (if (file-directory-p fval)
                                      (propertize fkey 'face gjsf)
                                  (propertize fkey 'face gjwf))) )
                   (insert (format fmt-str sgnl pkey fval))))
              ;; TABLE
              datenstruk)





> map-elt
>   Function: Look up KEY in MAP and return its associated value.
> 
> These functions appear not to be documented in an ‘info’
> manual so you should use C-h f to read their docstrings.
> 
> --
> The lyf so short, the craft so long to lerne.
> - Geoffrey Chaucer, The Parliament of Birds.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.