From: Heime <heimeborgia@protonmail.com>
To: Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: wrong-type-argument for hash-table
Date: Sun, 15 Sep 2024 19:10:15 +0000 [thread overview]
Message-ID: <8CVY38wXnUXLoHkrVUauKiKseDKPxKPJliAWD5wkP5iHDYKY490SwFqX5RQXEHInHy9gNSUGzbsh4lDmorm-C4Rwt9WnxGi6tU-mlQ67zsk=@protonmail.com> (raw)
This function gives the error
Debugger entered--Lisp error: (wrong-type-argument hash-table-p (("GLXKS" . "~/Opstk/bin/xiakos") ("PROTL" . "~/Opstk/bin/xiakos...") ("SCHNR" . "~/Opstk/bin/xiakos...")))
maphash((closure ((anctr)) (waypt dirpath) (let* ((wptfail (gethash waypt anctr)) (start (point))) (insert (format " - %-8s" waypt)) (add-text-properties start (point) (list 'face (list ':foreground (if wptfail "red" "green")))) (insert (format "\n %s\n" dirpath)))) (("GLXKS" . "~/Opstk/bin/xiakos") ("PROTL" . "~/Opstk/bin/xiakos...") ("SCHNR" . "~/Opstk/bin/xiakos...")))
(if (hash-table-p fpln) (maphash #'(lambda (waypt dirp
---------------------
I cannot understand the reason.
(hash-table-p fpln) gives nil (fpln is an alist)
(hash-table-p anctr) also gives nil (anctr is an alist)
So it should go to the alist part of the conditional, but it does not.
---------------------
(defun torium-chart (fpln anctr &optional bfrn)
(let* ( (bfrname (or bfrn "torium F-Pln"))
(qbuffer (get-buffer-create (concat "𒆳 " bfrname))) )
(with-current-buffer qbuffer
(erase-buffer)
(face-remap-add-relative 'default :background "blue")
(insert bfrname " Waypoint Annunciator \n\n")
(insert (format "[Fpln] %s\n"
(if (hash-table-p fpln) "hash-table" "alist")))
(insert (format "[Anctr] %s\n"
(if (hash-table-p anctr) "hash-table" "alist")))
;; Print Waypoints and corresponding directory paths
(if (hash-table-p fpln)
;; HASH-TABLE PART
(maphash
(lambda (waypt dirpath)
(let* ( (wptfail (gethash waypt anctr))
(start (point)) )
;; Insert waypoint
(insert (format " - %-8s" waypt))
;; Insert validity text
(insert (format "\n %s\n" dirpath))) )
fpln)
;; ALIST PART
(dolist (entry fpln)
(let* ( (waypt (car entry))
(dirpath (questorium-fpln-waypt waypt fpln))
(wptfail (cdr (assoc waypt anctr)))
(start (point)) )
;; Insert waypoint
(insert (format " %-8s" waypt))
;; Insert validity text
(insert (format "\n %s\n" dirpath)))) )
;; Move to beginning of buffer
(goto-char (point-min)))
;; Display the buffer
(switch-to-buffer qbuffer)))
reply other threads:[~2024-09-15 19:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='8CVY38wXnUXLoHkrVUauKiKseDKPxKPJliAWD5wkP5iHDYKY490SwFqX5RQXEHInHy9gNSUGzbsh4lDmorm-C4Rwt9WnxGi6tU-mlQ67zsk=@protonmail.com' \
--to=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).