Value or symbol handler with max argument error fix
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <e0WdrT80cPQ6LvZQbNv7Emak111bP-xlVyr53sDjjHJti2ymrb6lx8NahjvnD5X4hg4U8cvofvs8rmqhT63-TsyPGRDk7DXzxtXhTYLd5qk=@protonmail.com> |
I want to pass either a symbol or the value to lana-du-fpln.
(lana-du-fpln myplist)
(lana-du-fpln 'myplist)
I am getting Lisp error: (wrong-number-of-arguments #<subr max> 0)
max()
apply(max nil)
(max 5 (apply #'max kl))
for this function
(defun lana-du-fpln (datenstruk)
"Display HASH-TABLE contents in a dedicated buffer."
(let* ( (bfr (get-buffer-create (or bname "Lana DU")))
(dtnm (if (symbolp datenstruk) (symbol-name datenstruk) "Anonymous"))
(dtvl (if (symbolp datenstruk) (symbol-value datenstruk) datenstruk))
;; Display width using key lengths
(kl (map-apply
(lambda (key _value) (length (format "%s" key)))
dtvl))
(wl (max 5 (apply #'max kl)))
(gwidth 2)
(fmt-str (format "%%-%ds | %%-%ds | %%s\n" gwidth kwmax)) )
(with-current-buffer bfr
(read-only-mode 0)
(erase-buffer)
(map-do
;; 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))))
;; MAP Data Structure (HASH-TABLE/PLIST/ALIST)
dtvl)
(goto-char (point-min)))
(pop-to-buffer bfr)))