From 91d95440e6c18d1fa1f092407c5832b356250d75 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 10 Sep 2024 19:46:51 -0300 Subject: [PATCH] bqn-mode.el assimilates bqn-glyph-mode.el --- bqn-glyph-mode.el | 71 ----------------------------------------------- bqn-mode.el | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 71 deletions(-) delete mode 100644 bqn-glyph-mode.el diff --git a/bqn-glyph-mode.el b/bqn-glyph-mode.el deleted file mode 100644 index 7331631..0000000 --- a/bqn-glyph-mode.el +++ /dev/null @@ -1,71 +0,0 @@ -;;; bqn-glyph-mode.el --- BQN glyph reference - -;; Author: Marshall Lochbaum -;; Version: 0.1.0 -;; URL: https://github.com/museoa/bqn-mode -;; SPDX-License-Identifier: GPL-3.0-or-later - -;;; Commentary: - -;; This package provides a major mode to show a BQN glyphs lookup table -;; reference. - -;;; Code: - -(require 'bqn-mode) - -(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-glyph-mode) - -;;; bqn-glyph-mode.el ends here diff --git a/bqn-mode.el b/bqn-mode.el index 5b92404..24d738d 100644 --- a/bqn-mode.el +++ b/bqn-mode.el @@ -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