summaryrefslogtreecommitdiff
path: root/.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-12 02:46:27 -0600
committerCraig Jennings <c@cjennings.net>2025-11-12 02:46:27 -0600
commit84eef1d3b1b0195a2f8fbf5b141ba5e58004c28d (patch)
treeaad0dbb75a31d333454b8a6a6afc21d386be5006 /.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el
parent8aa0eb544a8365ad99a9c11bd74969ebbbed1524 (diff)
perf: Merge performance branch - org-agenda cache, tests, and inbox zero
This squash merge combines 4 commits from the performance branch: ## Performance Improvements - **org-agenda cache**: Cache org-agenda file list to reduce rebuild time - Eliminates redundant file system scans on each agenda view - Added tests for cache invalidation and updates - **org-refile cache**: Optimize org-refile target building (15-20s → instant) - Cache eliminates bottleneck when capturing tasks ## Test Suite Improvements - Fixed all 18 failing tests → 0 failures (107 test files passing) - Deleted 9 orphaned test files (filesystem lib, dwim-shell-security, org-gcal-mock) - Fixed missing dependencies (cj/custom-keymap, user-constants) - Fixed duplicate test definitions and wrong variable names - Adjusted benchmark timing thresholds for environment variance - Added comprehensive tests for org-agenda cache functionality ## Documentation & Organization - **todo.org recovery**: Restored 1,176 lines lost in truncation - Recovered Methods 4, 5, 6 + Resolved + Inbox sections - Removed 3 duplicate TODO entries - **Inbox zero**: Triaged 12 inbox items → 0 items - Completed: 3 tasks marked DONE (tests, transcription) - Relocated: 4 tasks to appropriate V2MOM Methods - Deleted: 4 duplicates/vague tasks - Merged: 1 task as subtask ## Files Changed - 58 files changed, 29,316 insertions(+), 2,104 deletions(-) - Tests: All 107 test files passing - Codebase: Cleaner, better organized, fully tested 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to '.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el')
-rw-r--r--.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el285
1 files changed, 285 insertions, 0 deletions
diff --git a/.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el b/.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el
new file mode 100644
index 00000000..3cde7837
--- /dev/null
+++ b/.cask/30.2/bootstrap/ansi-20230306.1823/ansi.el
@@ -0,0 +1,285 @@
+;;; ansi.el --- Turn string into ansi strings -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2010-2013 Johan Andersson
+
+;; Author: Johan Andersson <johan.rejeep@gmail.com>
+;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
+;; Package-Version: 20230306.1823
+;; Package-Revision: c79806eacdf9
+;; Keywords: terminals color ansi
+;; URL: http://github.com/rejeep/ansi
+;; Package-Requires: ((emacs "24.1") (cl-lib "0.6"))
+
+;; This file is NOT part of GNU Emacs.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; Turns simple strings to ansi strings.
+
+;; Turning a string into an ansi string can be to add color to a
+;; text, add color in the background of a text or adding a style,
+;; such as bold, underscore or italic.
+
+;;; Code:
+
+(require 'cl-lib)
+
+(defgroup ansi nil
+ "Turn string into ansi strings."
+ :group 'lisp)
+
+(defcustom ansi-inhibit-ansi nil
+ "If non-nil, no apply ANSI code.
+This variable affects `with-ansi', `with-ansi-princ'."
+ :group 'ansi
+ :type 'boolean)
+
+
+
+(defconst ansi-colors
+ '((black . 30)
+ (red . 31)
+ (green . 32)
+ (yellow . 33)
+ (blue . 34)
+ (magenta . 35)
+ (cyan . 36)
+ (white . 37))
+ "List of text colors.")
+
+(defconst ansi-bright-colors
+ '((bright-black . 90)
+ (bright-red . 91)
+ (bright-green . 92)
+ (bright-yellow . 93)
+ (bright-blue . 94)
+ (bright-magenta . 95)
+ (bright-cyan . 96)
+ (bright-white . 97))
+ "List of text colors.")
+
+(defconst ansi-on-colors
+ '((on-black . 40)
+ (on-red . 41)
+ (on-green . 42)
+ (on-yellow . 43)
+ (on-blue . 44)
+ (on-magenta . 45)
+ (on-cyan . 46)
+ (on-white . 47))
+ "List of colors to draw text on.")
+
+(defconst ansi-on-bright-colors
+ '((on-bright-black . 100)
+ (on-bright-red . 101)
+ (on-bright-green . 102)
+ (on-bright-yellow . 103)
+ (on-bright-blue . 104)
+ (on-bright-magenta . 105)
+ (on-bright-cyan . 106)
+ (on-bright-white . 107))
+ "List of colors to draw text on.")
+
+(defconst ansi-styles
+ '((bold . 1)
+ (dark . 2)
+ (italic . 3)
+ (underscore . 4)
+ (blink . 5)
+ (rapid . 6)
+ (contrary . 7)
+ (concealed . 8)
+ (strike . 9))
+ "List of styles.")
+
+(defvar ansi-csis
+ '((up . "A")
+ (down . "B")
+ (forward . "C")
+ (backward . "D")
+ (next-line . "E")
+ (previous-line . "F")
+ (column . "G")
+ (kill . "K"))
+ "CSI (Control Sequence Introducer) sequences")
+
+(defconst ansi-reset 0 "Ansi code for reset.")
+
+
+
+(defun ansi--concat (&rest sequences)
+ "Concat string elements in SEQUENCES."
+ (apply #'concat (cl-remove-if-not 'stringp sequences)))
+
+(defun ansi--code (effect)
+ "Return code for EFFECT."
+ (or
+ (cdr (assoc effect ansi-colors))
+ (cdr (assoc effect ansi-bright-colors))
+ (cdr (assoc effect ansi-on-colors))
+ (cdr (assoc effect ansi-on-bright-colors))
+ (cdr (assoc effect ansi-styles))))
+
+(defun ansi--is-alias (effect)
+ "Return non-nil if EFFECT is available in DSL."
+ (or
+ (car (assoc effect ansi-colors))
+ (car (assoc effect ansi-bright-colors))
+ (car (assoc effect ansi-on-colors))
+ (car (assoc effect ansi-on-bright-colors))
+ (car (assoc effect ansi-styles))
+ (car (assoc effect ansi-csis))))
+
+(defun ansi--char (effect)
+ "Return char for EFFECT."
+ (cdr (assoc effect ansi-csis)))
+
+(defmacro ansi--define (effect)
+ "Define ansi function with EFFECT."
+ (let ((fn-name (intern (format "ansi-%s" (symbol-name effect)))))
+ `(defun ,fn-name (format-string &rest objects)
+ ,(format "Add '%s' ansi effect to text." effect)
+ (apply 'ansi-apply ',effect format-string objects))))
+
+(cl-eval-when (compile eval load)
+ (defun ansi--substitute (body)
+ (if (listp body)
+ (if (ansi--is-alias (car body))
+ `(,(intern (format "ansi-%s" (symbol-name (car body))))
+ ,@(mapcar (lambda (x) (ansi--substitute x)) (cdr body)))
+ (mapcar (lambda (x) (ansi--substitute x)) body))
+ body)))
+
+(defmacro with-ansi (&rest body)
+ "Shortcut names (without ansi- prefix) can be used in this BODY."
+ `(ansi--concat ,@(ansi--substitute (mapcar #'macroexpand-all body))))
+
+(defmacro with-ansi-princ (&rest body)
+ "Shortcut names (without ansi- prefix) can be used in this BODY and princ."
+ `(princ (with-ansi ,@body)))
+
+(defun ansi-apply (effect-or-code format-string &rest objects)
+ "Apply EFFECT-OR-CODE to text.
+FORMAT-STRING and OBJECTS are processed same as `apply'."
+ (let ((code (if (numberp effect-or-code)
+ effect-or-code
+ (ansi--code effect-or-code)))
+ (text (apply 'format format-string objects)))
+ (if ansi-inhibit-ansi
+ text
+ (format "\e[%dm%s\e[%sm" code text ansi-reset))))
+
+(defun ansi-csi-apply (effect-or-char &optional reps)
+ "Apply EFFECT-OR-CHAR REPS (1 default) number of times."
+ (if ansi-inhibit-ansi ""
+ (let ((char (if (symbolp effect-or-char)
+ (ansi--char effect-or-char)
+ effect-or-char)))
+ (format "\u001b[%d%s" (or reps 1) char))))
+
+(defun ansi-up (&optional n)
+ "Move N steps (1 step default) up."
+ (ansi-csi-apply 'up n))
+
+(defun ansi-down (&optional n)
+ "Move N steps (1 step default) down."
+ (ansi-csi-apply 'down n))
+
+(defun ansi-forward (&optional n)
+ "Move N steps (1 step default) forward."
+ (ansi-csi-apply 'forward n))
+
+(defun ansi-backward (&optional n)
+ "Move N steps (1 step default) backward."
+ (ansi-csi-apply 'backward n))
+
+(defun ansi-next-line (&optional n)
+ "Moves cursor to beginning of the line N (default 1) lines down."
+ (ansi-csi-apply 'next-line n))
+
+(defun ansi-previous-line (&optional n)
+ "Moves cursor to beginning of the line N (default 1) lines up."
+ (ansi-csi-apply 'previous-line n))
+
+(defun ansi-column (&optional n)
+ "Moves the cursor to column N (default 1)"
+ (ansi-csi-apply 'column n))
+
+(defun ansi-kill (&optional n)
+ "Erase part of the line.
+
+If N is 0 (or missing), clear from cursor to the end of the line.
+
+If N is 1, clear from cursor to beginning of the line.
+
+If N is 2, clear entire line. Cursor position does not change."
+ (ansi-csi-apply 'kill n))
+
+
+
+(ansi--define black)
+(ansi--define red)
+(ansi--define green)
+(ansi--define yellow)
+(ansi--define blue)
+(ansi--define magenta)
+(ansi--define cyan)
+(ansi--define white)
+
+(ansi--define bright-black)
+(ansi--define bright-red)
+(ansi--define bright-green)
+(ansi--define bright-yellow)
+(ansi--define bright-blue)
+(ansi--define bright-magenta)
+(ansi--define bright-cyan)
+(ansi--define bright-white)
+
+(ansi--define on-black)
+(ansi--define on-red)
+(ansi--define on-green)
+(ansi--define on-yellow)
+(ansi--define on-blue)
+(ansi--define on-magenta)
+(ansi--define on-cyan)
+(ansi--define on-white)
+
+(ansi--define on-bright-black)
+(ansi--define on-bright-red)
+(ansi--define on-bright-green)
+(ansi--define on-bright-yellow)
+(ansi--define on-bright-blue)
+(ansi--define on-bright-magenta)
+(ansi--define on-bright-cyan)
+(ansi--define on-bright-white)
+
+(ansi--define bold)
+(ansi--define dark)
+(ansi--define italic)
+(ansi--define underscore)
+(ansi--define blink)
+(ansi--define rapid)
+(ansi--define contrary)
+(ansi--define concealed)
+(ansi--define strike)
+
+(provide 'ansi)
+
+;;; ansi.el ends here