unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* wrong-type-argument for hash-table
@ 2024-09-15 19:10 Heime
  0 siblings, 0 replies; only message in thread
From: Heime @ 2024-09-15 19:10 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

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)))





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-15 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-15 19:10 wrong-type-argument for hash-table Heime

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).