Skip to content

Commit

Permalink
bqn-mode.el assimilates bqn-glyph-mode.el
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonTorres committed Sep 10, 2024
1 parent 7107e14 commit 91d9544
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 71 deletions.
71 changes: 0 additions & 71 deletions bqn-glyph-mode.el

This file was deleted.

52 changes: 52 additions & 0 deletions bqn-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,58 @@ bqn-comint-process-session and echoes the result."
(read-only-mode 1)
(setq truncate-lines t))

(defvar bqn-glyph-mode-reference
"┌───┬────────────────┬──────────────┬───┬──────────────────┬────────────────┐
│ @ │ Monadic │ Dyadic │ @ │ Monadic │ Dyadic │
├───┼────────────────┼──────────────┼───┼──────────────────┼────────────────┤
│ + │ Conjugate │ Add │ ⥊ │ Deshape │ Reshape │
│ ─ │ Negate │ Subtract │ ∾ │ Join │ Join to │
│ × │ Sign │ Multiply │ ≍ │ Solo │ Couple │
│ ÷ │ Reciprocal │ Divide │ ⋈ │ Enlist │ Pair │
│ ⋆ │ Exponential │ Power │ ↑ │ Prefixes │ Take │
│ √ │ Square Root │ Root │ ↓ │ Suffixes │ Drop │
│ ⌊ │ Floor │ Minimum │ ↕ │ Range │ Windows │
│ ⌈ │ Ceiling │ Maximum │ » │ Nudge │ Shift Before │
│ ∧ │ Sort Up │ And │ « │ Nudge Back │ Shift After │
│ ∨ │ Sort Down │ Or │ ⌽ │ Reverse │ Rotate │
│ ¬ │ Not │ Span │ ⍉ │ Transpose │ Reorder Axes │
│ │ │ Absolute Value │ Modulus │ / │ Indices │ Replicate │
│ ≤ │ │ No More Than │ ⍋ │ Grade Up │ Bins Up │
│ < │ Enclose │ Less Than │ ⍒ │ Grade Down │ Bins Down │
│ > │ Merge │ Greater Than │ ⊏ │ First Cell │ Select │
│ ≥ │ │ No Less Than │ ⊑ │ First │ Pick │
│ = │ Rank │ Equals │ ⊐ │ Classify │ Index of │
│ ≠ │ Length │ Not Equals │ ⊒ │ Occurrence Count │ Progressive ⊐ │
│ ≡ │ Depth │ Match │ ∊ │ Mark Firsts │ Member of │
│ ≢ │ Shape │ Not Match │ ⍷ │ Deduplicate │ Find │
│ ⊣ │ Identity │ Left │ ⊔ │ Group Indices │ Group │
│ ⊢ │ Identity │ Right │ ! │ Assert │ Assert Message │
└───┴────────────────┴──────────────┴───┴──────────────────┴────────────────┘"
"Glyph Lookup Table for BQN.")

(defvar bqn-glyph-mode-*buffer-name* "*BQN Glyphs*")

(defun bqn-glyph-mode-show-glyphs ()
"Display a table of BQN glyphs."
(interactive)
(let ((glyph-buffer (get-buffer bqn-glyph-mode-*buffer-name*)))
(unless (and glyph-buffer (get-buffer-window glyph-buffer))
;; The buffer is not displayed.
(let* ((buffer (get-buffer-create bqn-glyph-mode-*buffer-name*))
(window (split-window nil)))
(with-current-buffer buffer
(insert bqn-glyph-mode-reference)
(goto-char (point-min))
(bqn-glyph-mode))
(set-window-buffer window buffer)
(fit-window-to-buffer window)))))

(define-derived-mode bqn-glyph-mode special-mode "BQN-Glyphs"
"Major mode for displaying the BQN Glyph help."
(buffer-face-set 'bqn-default)
(read-only-mode 1)
(setq truncate-lines t))

(provide 'bqn-mode)

;;; bqn-mode.el ends here

0 comments on commit 91d9544

Please sign in to comment.