(setq project-directory "~/Development/love/debris-dawn/")
(setq initial-buffer-choice project-directory)

;; goal transition to straight from package.el
;; https://github.com/radian-software/straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        (or (bound-and-true-p straight-base-dir)
            user-emacs-directory)))
      (bootstrap-version 7))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'yaml-mode)
(straight-use-package 'image-dired)
(straight-use-package 'org-present)
(straight-use-package 'visual-fill-column)
(straight-use-package 'dashboard)
(straight-use-package 'image-dired)
(straight-use-package 'jinx)
(straight-use-package 'lua-mode)
(straight-use-package 'web-mode)
(straight-use-package 'cmake-mode)
(straight-use-package 'org)
(straight-use-package 'use-package)
(straight-use-package 'ivy)
(straight-use-package 'counsel)
(straight-use-package 'company)
(straight-use-package 'ag)
(straight-use-package 'js2-mode)
(straight-use-package 'json-mode)
(straight-use-package 'markdown-mode)
(straight-use-package 'emojify)
(straight-use-package 'magit)
(straight-use-package 'nord-theme)
(straight-use-package 'doom-themes)
(straight-use-package 'openwith)
(straight-use-package 'projectile)
(straight-use-package 'simple-httpd)
(straight-use-package 'lua-mode)
(straight-use-package 'lv)
(straight-use-package 'ibuffer-vc)
(straight-use-package 'glsl-mode)
(straight-use-package 'htmlize)
(straight-use-package 'all-the-icons)

(use-package all-the-icons
  :if (display-graphic-p))

;; (require 'package)
;; (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; (package-initialize)
;; (eval-when-compile (require 'use-package))

;;
(defvar-local outline--two-stroke-state 'show-all) ;; buffer-local
(defun outline-two-stroke-cycle ()
  (interactive)
  (cond ((eq outline--two-stroke-state 'show-all)
         (progn
           (setq outline--two-stroke-state 'show-headings)
           (outline-show-only-headings)))
        ((eq outline--two-stroke-state 'show-headings)
         (progn
           (setq outline--two-stroke-state 'show-all)
           (outline-show-all)))))



(global-set-key (kbd "C-x C-O") 'previous-window-any-frame)

(windmove-default-keybindings)
(defalias 'yes-or-no-p 'y-or-n-p)
(setq auto-save-list-file-prefix "~/.emacs.d/autosaves/.saves-")
(setq auto-save-interval 100)
(setq backup-directory-alist '(("." .  "~/.emacs.d/.cache/backup/")))
(setq delete-by-moving-to-trash nil)
(setq version-control t)
(setq kept-old-versions 10)
(setq kept-new-versions 20)
(setq delete-old-versions t)
(setq backup-by-copying t)
(blink-cursor-mode -1)
(show-paren-mode 1)
(menu-bar-mode -1)
(set-fringe-style -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq inhibit-startup-message t)
(setq initial-scratch-message "")
(setq visible-bell nil)
(setq ring-bell-function
      (lambda ()
        (invert-face 'mode-line)
        (run-with-timer 0.1 nil 'invert-face 'mode-line)))
(delete-selection-mode)
(electric-pair-mode t)
(put 'narrow-to-region 'disabled nil)
(setq enable-local-variables t)

(setq-default indent-tabs-mode nil)
(global-auto-revert-mode 1)
(add-hook 'dired-mode-hook 'auto-revert-mode)
(add-hook 'dired-mode-hook 'dired-hide-details-mode)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-to-list 'comint-output-filter-functions 'ansi-color-process-output)

(use-package counsel
  :bind
  (("M-x" . counsel-M-x)
   ("C-x b" . ivy-switch-buffer)
   ("M-s" . counsel-ag)
   ("C-x C-f" . counsel-find-file)
   ("C-x C-b" . ibuffer)
   ("M-g M-i" . counsel-imenu)
   ))

(global-set-key (kbd "M-s") 'counsel-ag)
(global-set-key (kbd "C-x C-j") 'dired-jump-other-window)

(require 'ibuf-ext)
(add-to-list 'ibuffer-never-show-predicates "^\\*")
(setq ibuffer-display-summary nil)

(defadvice ibuffer-update-title-and-summary (after remove-column-titles)
  (with-current-buffer "*Ibuffer*"
      (read-only-mode 0)
      (goto-char 1)
      (search-forward "-\n" nil t)
      (delete-region 1 (point))
      (let ((window-min-height 1)) 
        ;; save a little screen estate
        (shrink-window-if-larger-than-buffer))
      (read-only-mode)
      ))
  
(ad-activate 'ibuffer-update-title-and-summary)

(require 'ibuffer-vc)
(add-hook 'ibuffer-hook
          (lambda ()
            (ibuffer-vc-set-filter-groups-by-vc-root)
            (unless (eq ibuffer-sorting-mode 'alphabetic)
              (ibuffer-do-sort-by-alphabetic))))

(use-package company
  :bind
  (("M-/" . company-manual-begin))
  :custom
  ((company-mode-idle-delay  1)
   (company-minimum-prefix-legnth  4))
  :init
  (global-company-mode))

(use-package ag)

;; Markdown Mode Setup
(defun markdown-hook-fn ()
  (flyspell-buffer)
  (flyspell-mode)
  (visual-line-mode))
(add-hook 'markdown-mode-hook #'markdown-hook-fn)

;; these keys are way too close to the arrow keys on the xps
(global-set-key (kbd "<prior>") 'ignore)
(global-set-key (kbd "<next>") 'ignore)

;;scpaste
(add-to-list 'load-path "~/Github/scpaste/")
(autoload 'scpaste "scpaste" nil t)
(autoload 'scpaste-region "scpaste" nil t)

(require 'scpaste-stylize)

(setq scpaste-http-destination "https://paste.alexjgriffith.com"
      scpaste-scp-destination "paste.alexjgriffith.com:~/nginx/paste/")

(setq scpaste-user-name "alexjgriffith"
      scpaste-user-address "https://alexjgriffith.com/")
(autoload 'scpaste-stylize "scpaste-stylize")
(autoload 'scpaste-stylize "scpaste-stylize-region")
(autoload 'scpaste-stylize "scpaste-stylize-css")

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))

(require 'json-mode)
;; (add-hook 'json-mode-hook #'lsp)
(add-to-list 'auto-mode-alist '("\\.json\\'" . js-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . js-mode))

(require 'openwith)
(setq openwith-associations '(("\\.aseprite\\'" "aseprite" (file))))
(openwith-mode t)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-faces-vector
   [default bold shadow italic underline bold bold-italic bold])
 '(ansi-color-names-vector
   (vector "#424242" "#d54e53" "#b9ca4a" "#e7c547" "#7aa6da" "#c397d8" "#70c0b1" "#eaeaea"))
 '(custom-safe-themes
   '("8d3ef5ff6273f2a552152c7febc40eabca26bae05bd12bc85062e2dc224cde9a" "cdc2a7ba4ecf0910f13ba207cce7080b58d9ed2234032113b8846a4e44597e41" "b60b55ecd22db6cf1072d72532cbc87174edd81c18419962deb4b8ba48f6b49d" default))
 '(ispell-dictionary nil)
 '(package-selected-packages
   '(skewer-mode json-mode js2-mode dap-mode impatient-mode magit projectile-ripgrep ripgrep projectile yaml-mode nord-theme openwith typescript-mode tree-sitter-langs dumb-jump command-log-mode htmlize markdown-preview-mode ess web-mode ## ibuffer-vc lua-mode lsp-mode zig-mode markdown-mode nginx-mode ag company use-package counsel))
 '(safe-local-variable-values
   '((fennel-repl--buffer-name . "*LOVEJS REPL*")
     (fennel-repl--buffer-name . "*Fennel Example REPL*")
     (fennel-repl--buffer-name . "Fennel Example REPL")
     (love2d-fennel-no-love quote t)
     (fennel-repl--buffer-name . "*Fennel Server*")
     (fennel-repl--buffer-name . "*Fennel SERVER*"))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

(defun make-frame-callback (frame)
  (modify-frame-parameters frame
                           '((left-fringe . 0)
                             (right-fringe . 0)
                             (vertical-scroll-bars . nil)
                             (horizontal-scroll-bars . nil)
                             (alpha . (95 . 95)))))

(add-hook 'after-make-frame-functions 'make-frame-callback)

(load "server")
(unless (server-running-p) (server-start))

;;; My Functions
(load-file "~/.emacs.d/lisp/scripts/layout.el")
(load-file "~/.emacs.d/lisp/scripts/brave.el")

(load-file "~/.emacs.d/lisp/scripts/fennel.el")
;; (load-file "~/.emacs.d/lisp/scripts/my-org-present.el")

;; tool to help reset default-dir when using zioxide
;; specific to the design of you PS1
(defun shell-cd-reset-directory ()
  (interactive)
  (save-excursion
    (let* ((start (re-search-backward "alexjgriffith:" nil 't))
          (slen (length "alexjgriffith:"))
          (end (re-search-forward "[(\n]" nil 't))
          (elen 2)
          (dir (buffer-substring-no-properties (+ start slen) (- end elen))))
      (shell-cd (concat (expand-file-name dir) "/")))))


;; depends on layout.el
(small-font)
(set-dark-theme)
(transparent)
(global-set-key (kbd "C-z") (lambda () (interactive) (message "Don't quit on me baby!")))
(global-set-key (kbd "C-x C-z") (lambda () (interactive) (message "Don't quit on me baby!")))

Generated by alexjgriffith using scpaste at Sun Jun 8 16:34:21 2025. EDT. (original)