Skip to content

temporary fix for out-of-range error in leetcode--set-user-and-problems #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 31 additions & 30 deletions leetcode.el
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ USER-AND-PROBLEMS is an alist comes from
:tag "all"
:problems
(let* ((len .num_total)
(problems (make-vector len nil)))
(problems (make-vector (1+ len) nil)))
(dotimes (i len)
(let-alist (aref .stat_status_pairs i)
(aset problems (1- .stat.frontend_question_id)
Expand Down Expand Up @@ -459,35 +459,36 @@ Return a list of rows, each row is a vector:
(hard-tag "hard")
rows)
(dovec (p problems)
(setq rows
(cons
(vector
;; status
(if (equal (plist-get p :status) "ac")
(prog1 leetcode--checkmark
(put-text-property
0 (length leetcode--checkmark)
'font-lock-face 'leetcode-checkmark-face leetcode--checkmark))
" ")
;; id
(number-to-string (plist-get p :id))
;; title
(concat
(plist-get p :title)
" "
(if (eq (plist-get p :paid-only) t)
(prog1 leetcode--paid
(put-text-property
0 (length leetcode--paid)
'font-lock-face 'leetcode-paid-face leetcode--paid))
" "))
;; acceptance
(plist-get p :acceptance)
;; difficulty
(leetcode--stringify-difficulty (plist-get p :difficulty))
;; tags
(string-join (plist-get p :tags) ", "))
rows)))
(when p
(setq rows
(cons
(vector
;; status
(if (equal (plist-get p :status) "ac")
(prog1 leetcode--checkmark
(put-text-property
0 (length leetcode--checkmark)
'font-lock-face 'leetcode-checkmark-face leetcode--checkmark))
" ")
;; id
(number-to-string (plist-get p :id))
;; title
(concat
(plist-get p :title)
" "
(if (eq (plist-get p :paid-only) t)
(prog1 leetcode--paid
(put-text-property
0 (length leetcode--paid)
'font-lock-face 'leetcode-paid-face leetcode--paid))
" "))
;; acceptance
(plist-get p :acceptance)
;; difficulty
(leetcode--stringify-difficulty (plist-get p :difficulty))
;; tags
(string-join (plist-get p :tags) ", "))
rows))))
(reverse rows)))

(defun leetcode--row-tags (row)
Expand Down