emac
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"caret_extra_top": 0,
|
||||
"caret_extra_width": 1,
|
||||
"font_size": 16,
|
||||
"color_scheme": "Monokai.sublime-color-scheme",
|
||||
"color_scheme": "Packages/User/massimo_custom.tmTheme",
|
||||
"translate_tabs_to_spaces": true,
|
||||
"tab_size": 4,
|
||||
"word_wrap": false,
|
||||
|
||||
473
.emacs.d/init.el
473
.emacs.d/init.el
@@ -15,6 +15,25 @@
|
||||
(require 'stupid-indent-mode)
|
||||
(require 'xah-find)
|
||||
(require 'multiple-cursors)
|
||||
(require 'ivy)
|
||||
(require 'counsel)
|
||||
(require 's)
|
||||
(require 'dash)
|
||||
(require 'popup)
|
||||
(require 'dumb-jump)
|
||||
(setq dumb-jump-force-searcher 'grep)
|
||||
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
|
||||
(setq xref-show-definitions-function #'xref-show-definitions-completing-read)
|
||||
|
||||
;; undo-tree for persistent undo/redo
|
||||
(require 'queue)
|
||||
(require 'undo-tree)
|
||||
(global-undo-tree-mode)
|
||||
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo-tree-history/")))
|
||||
(setq undo-tree-auto-save-history t)
|
||||
(ivy-mode 1)
|
||||
(setq ivy-use-virtual-buffers t)
|
||||
(setq ivy-count-format "(%d/%d) ")
|
||||
|
||||
;; default indentation settings
|
||||
(setq-default indent-tabs-mode t)
|
||||
@@ -52,8 +71,130 @@
|
||||
|
||||
;; general settings
|
||||
(setq-default inhibit-startup-screen t)
|
||||
(add-to-list 'default-frame-alist '(width . 200))
|
||||
(add-to-list 'default-frame-alist '(height . 75))
|
||||
|
||||
;; bottom panel settings (compilation, xref, etc.)
|
||||
(setq compilation-scroll-output t)
|
||||
|
||||
;; bottom panel buffer patterns
|
||||
(defvar my-bottom-panel-buffers '("\\*compilation\\*" "\\*xref\\*" "\\*terminal")
|
||||
"List of buffer name patterns for bottom panel.")
|
||||
|
||||
(defun my-bottom-panel-buffer-p (buf)
|
||||
"Check if BUF is a bottom panel buffer."
|
||||
(seq-some (lambda (pat) (string-match-p pat (buffer-name buf)))
|
||||
my-bottom-panel-buffers))
|
||||
|
||||
;; find existing bottom panel window
|
||||
(defun my-get-bottom-panel-window ()
|
||||
"Get existing bottom panel window if any."
|
||||
(seq-find (lambda (w)
|
||||
(and (window-at-side-p w 'bottom)
|
||||
(my-bottom-panel-buffer-p (window-buffer w))))
|
||||
(window-list)))
|
||||
|
||||
;; display function that reuses bottom panel
|
||||
(defun my-display-in-bottom-panel (buffer alist)
|
||||
"Display BUFFER in bottom panel, reusing existing panel window."
|
||||
(let ((window (my-get-bottom-panel-window)))
|
||||
(if window
|
||||
(progn
|
||||
(set-window-buffer window buffer)
|
||||
window)
|
||||
(let ((new-window (display-buffer-at-bottom buffer alist)))
|
||||
(when new-window
|
||||
(with-selected-window new-window
|
||||
(set-window-parameter new-window 'window-height 0.25)))
|
||||
new-window))))
|
||||
|
||||
;; use our custom display function for panel buffers
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\*compilation\\*" (my-display-in-bottom-panel) (window-height . 0.25)))
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\*xref\\*" (my-display-in-bottom-panel) (window-height . 0.25)))
|
||||
|
||||
;; tab line for bottom panel
|
||||
(defun my-bottom-panel-tab-line ()
|
||||
"Return tab line tabs for bottom panel buffers."
|
||||
(seq-filter #'my-bottom-panel-buffer-p (buffer-list)))
|
||||
|
||||
(defun my-enable-bottom-panel-tabs ()
|
||||
"Enable tab-line-mode for bottom panel buffers."
|
||||
(setq-local tab-line-tabs-function #'my-bottom-panel-tab-line)
|
||||
(tab-line-mode 1))
|
||||
|
||||
(add-hook 'compilation-mode-hook #'my-enable-bottom-panel-tabs)
|
||||
(add-hook 'xref--xref-buffer-mode-hook #'my-enable-bottom-panel-tabs)
|
||||
(add-hook 'term-mode-hook #'my-enable-bottom-panel-tabs)
|
||||
|
||||
(defvar my-terminal-counter 0 "Counter for terminal instances.")
|
||||
|
||||
(defun my-get-shell ()
|
||||
"Get the shell program for the current platform."
|
||||
(cond ((eq system-type 'darwin) "/bin/zsh")
|
||||
((eq system-type 'gnu/linux) "/bin/bash")
|
||||
((eq system-type 'windows-nt) "powershell")
|
||||
(t "/bin/sh")))
|
||||
|
||||
(defun my-open-terminal ()
|
||||
"Open first terminal in bottom panel, or create one if none exist."
|
||||
(interactive)
|
||||
(let ((existing (seq-find (lambda (buf)
|
||||
(string-match-p "\\*terminal" (buffer-name buf)))
|
||||
(buffer-list))))
|
||||
(if existing
|
||||
(let ((win (my-display-in-bottom-panel existing '((window-height . 0.25)))))
|
||||
(when win (select-window win)))
|
||||
(my-open-terminal-new))))
|
||||
|
||||
(defun my-open-terminal-new ()
|
||||
"Open a new terminal instance in bottom panel."
|
||||
(interactive)
|
||||
(let* ((default-directory (or (and (project-current)
|
||||
(project-root (project-current)))
|
||||
default-directory))
|
||||
(name (format "terminal-%d" (setq my-terminal-counter (1+ my-terminal-counter))))
|
||||
(buf (make-term name (my-get-shell))))
|
||||
(with-current-buffer buf
|
||||
(term-mode)
|
||||
(term-char-mode))
|
||||
(let ((win (my-display-in-bottom-panel buf '((window-height . 0.25)))))
|
||||
(when win (select-window win)))))
|
||||
|
||||
(defun my-bottom-panel-toggle ()
|
||||
"Toggle the bottom panel. Close if visible, open if hidden."
|
||||
(interactive)
|
||||
(let ((panel-window (my-get-bottom-panel-window)))
|
||||
(if panel-window
|
||||
(delete-window panel-window)
|
||||
(let ((matching-buffers (seq-filter
|
||||
(lambda (buf)
|
||||
(seq-some (lambda (pat) (string-match-p pat (buffer-name buf)))
|
||||
my-bottom-panel-buffers))
|
||||
(buffer-list))))
|
||||
(if matching-buffers
|
||||
(let ((win (my-display-in-bottom-panel (car matching-buffers) '((window-height . 0.25)))))
|
||||
(when (and win (string-match-p "\\*terminal" (buffer-name (car matching-buffers))))
|
||||
(select-window win)))
|
||||
(message "No bottom panel buffers open."))))))
|
||||
|
||||
(defun my-bottom-panel-next ()
|
||||
"Cycle to next bottom panel buffer in bottom window."
|
||||
(interactive)
|
||||
(let* ((matching-buffers (seq-filter
|
||||
(lambda (buf)
|
||||
(seq-some (lambda (pat) (string-match-p pat (buffer-name buf)))
|
||||
my-bottom-panel-buffers))
|
||||
(buffer-list)))
|
||||
(bottom-window (seq-find (lambda (w) (window-at-side-p w 'bottom)) (window-list)))
|
||||
(current (and bottom-window (window-buffer bottom-window)))
|
||||
(idx (and current (seq-position matching-buffers current))))
|
||||
(if (and matching-buffers bottom-window)
|
||||
(let ((next-buf (if idx
|
||||
(nth (mod (1+ idx) (length matching-buffers)) matching-buffers)
|
||||
(car matching-buffers))))
|
||||
(set-window-buffer bottom-window next-buf))
|
||||
(message "No bottom panel buffers open."))))
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
(show-paren-mode 1)
|
||||
(delete-selection-mode 1)
|
||||
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
|
||||
@@ -84,6 +225,7 @@
|
||||
(setq custom-file "~/.emacs.d/custom.el") ;; place custom in a separate file
|
||||
(setq-default require-final-newline t)
|
||||
(cua-mode t)
|
||||
(global-hl-line-mode -1)
|
||||
|
||||
;; backup and autosave settings
|
||||
(setq backup-by-copying t ; don't clobber symlinks
|
||||
@@ -96,22 +238,52 @@
|
||||
`((".*" "~/.emacs.d/saves/" t)))
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Recursively kill process and all descendants
|
||||
(defun my-kill-process-tree (pid)
|
||||
"Kill PID and all its descendant processes."
|
||||
(let ((children (split-string
|
||||
(shell-command-to-string
|
||||
(format "pgrep -P %d 2>/dev/null" pid))
|
||||
"\n" t)))
|
||||
(dolist (child children)
|
||||
(when (string-match "^[0-9]+$" child)
|
||||
(my-kill-process-tree (string-to-number child)))))
|
||||
(ignore-errors (call-process "kill" nil nil nil "-9" (number-to-string pid))))
|
||||
|
||||
;; Ensure all subprocesses (including grandchildren like DLV) are killed when Emacs exits
|
||||
(add-hook 'kill-emacs-hook
|
||||
(lambda ()
|
||||
(dolist (proc (process-list))
|
||||
(when (process-live-p proc)
|
||||
(let ((pid (process-id proc)))
|
||||
(when pid
|
||||
(my-kill-process-tree pid)))
|
||||
(set-process-query-on-exit-flag proc nil)
|
||||
(ignore-errors (delete-process proc))))))
|
||||
|
||||
;; Keybindings / Keybinds
|
||||
;; global
|
||||
(global-set-key (kbd "C-a") 'mark-whole-buffer)
|
||||
(global-set-key (kbd "C-n") (lambda () (interactive) (switch-to-buffer (generate-new-buffer "untitled"))))
|
||||
(global-set-key (kbd "S-<down-mouse-1>") #'my-mouse-start-rectangle)
|
||||
(global-set-key (kbd "<f5>") 'revert-buffer-quick)
|
||||
(global-set-key (kbd "<f5>") 'my-compile-last)
|
||||
(global-set-key (kbd "<C-S-f5>") 'my-compile-custom)
|
||||
(global-set-key (kbd "<f1>") 'my-bottom-panel-toggle)
|
||||
(global-set-key (kbd "<f2>") 'my-bottom-panel-next)
|
||||
(global-set-key (kbd "C-`") 'my-open-terminal)
|
||||
(global-set-key (kbd "C-~") 'my-open-terminal-new)
|
||||
(global-set-key (kbd "<f6>") 'my-file-manager-command)
|
||||
(global-set-key (kbd "<f7>") 'project-switch-project)
|
||||
(global-set-key (kbd "<C-f6>") 'my-terminal-emulator-command)
|
||||
(global-set-key [f8] 'goto-line)
|
||||
(global-set-key (kbd "C-\\") 'split-window-below)
|
||||
(global-set-key (kbd "C-|") 'split-window-right)
|
||||
(global-set-key (kbd "C-\\") 'delete-other-windows)
|
||||
(global-set-key (kbd "C-|") 'kill-all-buffers)
|
||||
(global-unset-key (kbd "C-x C-SPC"))
|
||||
(global-set-key (kbd "C-x C-SPC") 'rectangle-mark-mode)
|
||||
(global-set-key [C-return] 'save-buffer)
|
||||
(global-set-key [?\C-z] 'undo)
|
||||
(global-set-key (kbd "C-*") 'search-current-word)
|
||||
(global-set-key (kbd "C-;") 'comment-line)
|
||||
(global-set-key (kbd "C-/") 'comment-line)
|
||||
(global-set-key (kbd "M-<f4>") 'save-buffers-kill-terminal) ;; windows thing
|
||||
(global-set-key (kbd "C-y") 'clipboard-yank) ;; fix killring messing with system clipboard
|
||||
(global-set-key (kbd "C-w") 'delete-window)
|
||||
@@ -124,20 +296,64 @@
|
||||
(global-set-key (kbd "<end>") 'move-end-of-line)
|
||||
(setq mac-command-modifier 'control)
|
||||
(setq mac-control-modifier 'command)
|
||||
|
||||
;; Restore normal cmd/ctrl in terminal buffers on macOS
|
||||
(when (eq system-type 'darwin)
|
||||
(add-hook 'term-mode-hook
|
||||
(lambda ()
|
||||
(setq-local mac-command-modifier 'super)
|
||||
(setq-local mac-control-modifier 'control))))
|
||||
|
||||
;; Enable paste in terminal (Cmd-v on macOS, C-S-v elsewhere)
|
||||
(add-hook 'term-mode-hook
|
||||
(lambda ()
|
||||
(if (eq system-type 'darwin)
|
||||
(define-key term-raw-map (kbd "s-v") 'term-paste)
|
||||
(define-key term-raw-map (kbd "C-S-v") 'term-paste))))
|
||||
|
||||
;; F5 in terminal: Ctrl-C, rebuild, enter, r, enter, c, enter
|
||||
(defun my-term-rebuild ()
|
||||
"Send rebuild sequence to terminal."
|
||||
(interactive)
|
||||
(term-send-raw-string "\C-c")
|
||||
(sit-for 0.1)
|
||||
(term-send-raw-string "rebuild\r")
|
||||
(sit-for 0.1)
|
||||
(term-send-raw-string "r\r")
|
||||
(sit-for 0.1)
|
||||
(term-send-raw-string "c\r"))
|
||||
|
||||
(add-hook 'term-mode-hook
|
||||
(lambda ()
|
||||
(define-key term-raw-map (kbd "<f5>") 'my-term-rebuild)))
|
||||
|
||||
;; Kill terminal buffer when process exits
|
||||
(defun my-term-handle-exit (&optional process-name msg)
|
||||
"Kill terminal buffer when process exits."
|
||||
(when (buffer-live-p (current-buffer))
|
||||
(kill-buffer (current-buffer))))
|
||||
|
||||
(advice-add 'term-handle-exit :after #'my-term-handle-exit)
|
||||
(when (eq system-type 'darwin)
|
||||
(global-set-key (kbd "C-<left>") 'my-smart-home)
|
||||
(global-set-key (kbd "C-<right>") 'move-end-of-line))
|
||||
(global-set-key (kbd "C-f") 'my-isearch-forward)
|
||||
(global-set-key (kbd "C-S-f") 'xah-find-text)
|
||||
(global-set-key (kbd "C-S-f") 'my-project-find-text)
|
||||
(global-set-key (kbd "C-S-h") 'my-find-replace)
|
||||
(global-set-key (kbd "C-S-p") 'counsel-M-x)
|
||||
(global-set-key (kbd "C-p") 'project-find-file)
|
||||
(global-set-key (kbd "C-s") 'save-buffer)
|
||||
(global-set-key (kbd "<f3>") 'my-toggle-theme)
|
||||
(global-set-key (kbd "<f12>") (lambda () (interactive) (load-file user-init-file)))
|
||||
(global-set-key (kbd "<f3>") 'my-select-theme)
|
||||
(global-set-key (kbd "<f12>") 'xref-find-definitions)
|
||||
(global-set-key (kbd "<C-S-f12>") 'xref-pop-marker-stack)
|
||||
(global-set-key (kbd "C-q") 'save-buffers-kill-terminal)
|
||||
(global-set-key (kbd "C-l") 'my-select-line)
|
||||
(global-set-key (kbd "C-e") 'my-copy-path-with-line)
|
||||
(define-key minibuffer-local-filename-completion-map (kbd "C-2") 'my-find-file-right-pane)
|
||||
(define-key isearch-mode-map (kbd "<return>") 'isearch-repeat-forward)
|
||||
(define-key isearch-mode-map (kbd "S-<return>") 'isearch-repeat-backward)
|
||||
(define-key isearch-mode-map (kbd "<backspace>") 'isearch-del-char)
|
||||
(define-key isearch-mode-map (kbd "<escape>") 'isearch-exit)
|
||||
(setq isearch-wrap-pause 'no)
|
||||
|
||||
;; multiple cursors (vscode-style)
|
||||
@@ -151,6 +367,34 @@
|
||||
(define-key mc/keymap (kbd "<escape>") 'mc/keyboard-quit)
|
||||
(define-key mc/keymap (kbd "<return>") nil)
|
||||
|
||||
;; functions to get top panes (ignoring bottom compilation window)
|
||||
(defun my-get-top-windows ()
|
||||
"Get windows in the top portion of the frame (not bottom compilation)."
|
||||
(let ((windows '()))
|
||||
(walk-windows
|
||||
(lambda (w)
|
||||
(when (window-at-side-p w 'top)
|
||||
(push w windows))))
|
||||
(sort windows (lambda (a b) (< (car (window-edges a)) (car (window-edges b)))))))
|
||||
|
||||
(defun my-select-left-pane ()
|
||||
"Select the left pane of the top split."
|
||||
(interactive)
|
||||
(let ((top-windows (my-get-top-windows)))
|
||||
(when top-windows
|
||||
(select-window (car top-windows)))))
|
||||
|
||||
(defun my-select-right-pane ()
|
||||
"Select the right pane of the top split, creating it if needed."
|
||||
(interactive)
|
||||
(let ((top-windows (my-get-top-windows)))
|
||||
(if (>= (length top-windows) 2)
|
||||
(select-window (cadr top-windows))
|
||||
(when top-windows
|
||||
(select-window (car top-windows))
|
||||
(split-window-right)
|
||||
(other-window 1)))))
|
||||
|
||||
;; custom bind minor mode
|
||||
;; this allows binding keys that override all other modes
|
||||
(defvar my-keys-minor-mode-map
|
||||
@@ -158,11 +402,8 @@
|
||||
(define-key map (kbd "M-p") 'backward-paragraph)
|
||||
(define-key map (kbd "M-n") 'forward-paragraph)
|
||||
(define-key map (kbd "C-o") 'next-multiframe-window)
|
||||
(define-key map (kbd "C-1") (lambda () (interactive) (select-window (frame-first-window))))
|
||||
(define-key map (kbd "C-2") (lambda () (interactive)
|
||||
(if (one-window-p)
|
||||
(progn (split-window-right) (other-window 1))
|
||||
(other-window 1))))
|
||||
(define-key map (kbd "C-1") 'my-select-left-pane)
|
||||
(define-key map (kbd "C-2") 'my-select-right-pane)
|
||||
(define-key map (kbd "C-3") 'switch-to-buffer)
|
||||
(define-key map (kbd "C-4") 'find-file)
|
||||
(define-key map (kbd "C-j") 'dabbrev-expand)
|
||||
@@ -192,6 +433,91 @@
|
||||
(when (= orig-point (point))
|
||||
(move-beginning-of-line 1))))
|
||||
|
||||
;; project find text (literal search)
|
||||
(defun my-project-find-text ()
|
||||
"Search for literal text in project."
|
||||
(interactive)
|
||||
(let ((text (read-string "Search in project: ")))
|
||||
(project-find-regexp (regexp-quote text))))
|
||||
|
||||
(defun my-project-find-word-at-point ()
|
||||
"Search for word under cursor in project."
|
||||
(interactive)
|
||||
(let ($p1 $p2 word)
|
||||
(if (region-active-p)
|
||||
(setq $p1 (region-beginning) $p2 (region-end))
|
||||
(save-excursion
|
||||
(skip-chars-backward "-_A-Za-z0-9")
|
||||
(setq $p1 (point))
|
||||
(skip-chars-forward "-_A-Za-z0-9")
|
||||
(setq $p2 (point))))
|
||||
(setq word (buffer-substring-no-properties $p1 $p2))
|
||||
(when (> (length word) 0)
|
||||
(project-find-regexp (regexp-quote word)))))
|
||||
|
||||
;; compile custom command (persisted per-project)
|
||||
(defvar my-project-data-dir "~/.emacs.d/project-data/" "Directory to store per-project data.")
|
||||
|
||||
(defun my-project-data-file (filename)
|
||||
"Get path to FILENAME for current project in project-data dir."
|
||||
(let* ((root (project-root (project-current t)))
|
||||
(hash (md5 root))
|
||||
(dir (expand-file-name hash my-project-data-dir)))
|
||||
(unless (file-exists-p dir)
|
||||
(make-directory dir t))
|
||||
(expand-file-name filename dir)))
|
||||
|
||||
(defun my-compile-get-saved-command ()
|
||||
"Get saved compile command for current project."
|
||||
(let ((file (my-project-data-file "compile-command")))
|
||||
(when (file-exists-p file)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents file)
|
||||
(string-trim (buffer-string))))))
|
||||
|
||||
(defun my-compile-save-command (cmd)
|
||||
"Save compile command CMD for current project."
|
||||
(let ((file (my-project-data-file "compile-command")))
|
||||
(with-temp-file file
|
||||
(insert cmd))))
|
||||
|
||||
(defun my-compile-custom ()
|
||||
"Run a custom compile command in the project root."
|
||||
(interactive)
|
||||
(let* ((default-directory (project-root (project-current t)))
|
||||
(saved (my-compile-get-saved-command))
|
||||
(cmd (read-string "Command: " saved)))
|
||||
(my-compile-save-command cmd)
|
||||
(compile cmd)))
|
||||
|
||||
(defun my-compile-last ()
|
||||
"Run last compile command, or prompt for one if none has been run."
|
||||
(interactive)
|
||||
(let* ((default-directory (project-root (project-current t)))
|
||||
(cmd (my-compile-get-saved-command)))
|
||||
(if cmd
|
||||
(compile cmd)
|
||||
(my-compile-custom))))
|
||||
|
||||
;; find and replace with modes
|
||||
(defun my-find-replace ()
|
||||
"Find and replace with mode selection: project, file, or selection."
|
||||
(interactive)
|
||||
(let* ((mode (completing-read "Replace in: " '("file" "project" "selection") nil t))
|
||||
(search (read-string "Find: "))
|
||||
(replace (read-string (format "Replace '%s' with: " search))))
|
||||
(cond
|
||||
((string= mode "project")
|
||||
(project-query-replace-regexp (regexp-quote search) replace))
|
||||
((string= mode "file")
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(query-replace search replace)))
|
||||
((string= mode "selection")
|
||||
(if (use-region-p)
|
||||
(query-replace search replace nil (region-beginning) (region-end))
|
||||
(message "No region selected."))))))
|
||||
|
||||
;; isearch with selection (vscode-style)
|
||||
(defun my-isearch-forward ()
|
||||
"Start isearch, using selected text if region is active."
|
||||
@@ -236,37 +562,19 @@
|
||||
|
||||
(add-hook 'minibuffer-exit-hook 'my-find-file-right-pane-after)
|
||||
|
||||
;; theme toggle (dark/light)
|
||||
(defvar my-dark-theme-p t "Non-nil if dark theme is active.")
|
||||
;; theme selection
|
||||
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
|
||||
(defvar my-current-theme 'bedroom "Currently active theme.")
|
||||
|
||||
(defun my-set-dark-theme ()
|
||||
"Apply dark color theme."
|
||||
(set-face-attribute 'default nil :foreground "#d3b58d" :background "#181E2C")
|
||||
(set-face-attribute 'font-lock-comment-face nil :foreground "#bf9319")
|
||||
(set-face-attribute 'font-lock-string-face nil :foreground "#8fcddb")
|
||||
(set-face-attribute 'font-lock-keyword-face nil :foreground "white")
|
||||
(set-face-attribute 'font-lock-function-name-face nil :foreground "white")
|
||||
(set-face-attribute 'font-lock-variable-name-face nil :foreground "#c8d4ec")
|
||||
(set-face-attribute 'region nil :background "blue")
|
||||
(set-cursor-color "lightgreen"))
|
||||
|
||||
(defun my-set-light-theme ()
|
||||
"Apply light color theme."
|
||||
(set-face-attribute 'default nil :foreground "#2E3440" :background "honeydew")
|
||||
(set-face-attribute 'font-lock-comment-face nil :foreground "#8B7355")
|
||||
(set-face-attribute 'font-lock-string-face nil :foreground "#2E8B57")
|
||||
(set-face-attribute 'font-lock-keyword-face nil :foreground "#0000CD")
|
||||
(set-face-attribute 'font-lock-function-name-face nil :foreground "#8B0000")
|
||||
(set-face-attribute 'font-lock-variable-name-face nil :foreground "#483D8B")
|
||||
(set-face-attribute 'region nil :background "#ADD8E6")
|
||||
(set-cursor-color "black"))
|
||||
|
||||
(defun my-toggle-theme ()
|
||||
"Toggle between dark and light themes."
|
||||
(defun my-select-theme ()
|
||||
"Select and load a theme from all available themes."
|
||||
(interactive)
|
||||
(if my-dark-theme-p
|
||||
(progn (my-set-light-theme) (setq my-dark-theme-p nil))
|
||||
(my-set-dark-theme) (setq my-dark-theme-p t)))
|
||||
(let* ((themes (mapcar #'symbol-name (custom-available-themes)))
|
||||
(choice (completing-read "Theme: " themes nil t)))
|
||||
(when my-current-theme
|
||||
(disable-theme my-current-theme))
|
||||
(setq my-current-theme (intern choice))
|
||||
(load-theme my-current-theme t)))
|
||||
|
||||
;; global zoom (without resizing window)
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
@@ -290,6 +598,8 @@
|
||||
(global-unset-key (kbd "C-x C-="))
|
||||
(global-unset-key (kbd "C-x C--"))
|
||||
(global-unset-key (kbd "C-x C-0"))
|
||||
(global-set-key (kbd "C-<wheel-up>") 'ignore)
|
||||
(global-set-key (kbd "C-<wheel-down>") 'ignore)
|
||||
|
||||
;; test function
|
||||
(defun my-test ()
|
||||
@@ -319,6 +629,65 @@
|
||||
)
|
||||
(next-line arg))
|
||||
|
||||
;; kill all buffers except current and close other panes
|
||||
(defun kill-all-buffers ()
|
||||
"Kill all buffers except the current one and close other panes."
|
||||
(interactive)
|
||||
(let ((current (current-buffer)))
|
||||
(mapc (lambda (buf)
|
||||
(unless (eq buf current)
|
||||
(kill-buffer buf)))
|
||||
(buffer-list)))
|
||||
(delete-other-windows))
|
||||
|
||||
;; delete word without copying to kill ring
|
||||
(defun my-delete-word (arg)
|
||||
"Delete characters forward until encountering the end of a word.
|
||||
With argument ARG, do this that many times.
|
||||
Does not copy to kill ring."
|
||||
(interactive "p")
|
||||
(delete-region (point) (progn (forward-word arg) (point))))
|
||||
|
||||
(defun my-backward-delete-word (arg)
|
||||
"Delete characters backward until encountering the beginning of a word.
|
||||
With argument ARG, do this that many times.
|
||||
Does not copy to kill ring."
|
||||
(interactive "p")
|
||||
(my-delete-word (- arg)))
|
||||
|
||||
(global-set-key (kbd "M-<backspace>") 'my-backward-delete-word)
|
||||
(global-set-key (kbd "M-d") 'my-delete-word)
|
||||
(global-set-key (kbd "C-<backspace>") 'my-backward-delete-word)
|
||||
|
||||
;; copy current path with line number
|
||||
(defun my-copy-path-with-line ()
|
||||
"Copy the current file path with line number to clipboard."
|
||||
(interactive)
|
||||
(if buffer-file-name
|
||||
(let ((path-with-line (format "%s:%d" buffer-file-name (line-number-at-pos))))
|
||||
(kill-new path-with-line)
|
||||
(message "Copied: %s" path-with-line))
|
||||
(message "Buffer has no file.")))
|
||||
|
||||
;; scratch buffer with recent projects
|
||||
(defvar my-dashboard-image "~/.emacs.d/logo.jpg"
|
||||
"Path to dashboard image.")
|
||||
|
||||
(defun my-setup-scratch-buffer ()
|
||||
"Setup scratch buffer."
|
||||
(with-current-buffer (get-buffer-create "*scratch*")
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert "\n")
|
||||
;; Image
|
||||
(when (and (display-graphic-p)
|
||||
(file-exists-p (expand-file-name my-dashboard-image)))
|
||||
(insert-image (create-image (expand-file-name my-dashboard-image) nil nil :height 150))
|
||||
(insert "\n\n"))
|
||||
;; Message
|
||||
(insert "Agartha needs your help! You must write a new operating system from scratch to restore Agartha's defences!\n\nYou will need some food, water, and a funny hat to complete this mission!\n")
|
||||
(goto-char (point-min)))))
|
||||
|
||||
;; select rectangle with shift+mouse
|
||||
(defun my-mouse-start-rectangle (start-event)
|
||||
(interactive "e")
|
||||
@@ -410,18 +779,8 @@ Use in `isearch-mode-end-hook'."
|
||||
;; appearance
|
||||
;; (set-face-attribute 'default nil :font "Consolas-15")
|
||||
|
||||
;; non-theme-specific face customizations
|
||||
(custom-set-faces
|
||||
'(custom-group-tag-face ((t (:underline t :foreground "lightblue"))) t)
|
||||
'(custom-variable-tag-face ((t (:underline t :foreground "lightblue"))) t)
|
||||
'(font-lock-builtin-face ((t nil)))
|
||||
'(font-lock-warning-face ((t (:foreground "#504038"))))
|
||||
'(highlight ((t (:foreground "navyblue" :background "darkseagreen2"))))
|
||||
'(mode-line ((t (:inverse-video t))))
|
||||
'(widget-field-face ((t (:foreground "white"))) t)
|
||||
'(widget-single-line-field-face ((t (:background "darkgray"))) t))
|
||||
|
||||
(add-to-list 'default-frame-alist '(cursor-color . "lightgreen"))
|
||||
|
||||
(global-font-lock-mode 1)
|
||||
(my-set-dark-theme)
|
||||
(load-theme 'bedroom t)
|
||||
|
||||
;; setup scratch buffer with recent projects on startup
|
||||
(add-hook 'emacs-startup-hook 'my-setup-scratch-buffer)
|
||||
|
||||
130
.emacs.d/lisp/colir.el
Normal file
130
.emacs.d/lisp/colir.el
Normal file
@@ -0,0 +1,130 @@
|
||||
;;; colir.el --- Color blending library -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2015-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Oleh Krehel <ohwoeowho@gmail.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; This file 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.
|
||||
|
||||
;; For a full copy of the GNU General Public License
|
||||
;; see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This package solves the problem of adding a face with a background
|
||||
;; to text which may already have a background. In all conflicting
|
||||
;; areas, instead of choosing either the original or the new
|
||||
;; background face, their blended sum is used.
|
||||
;;
|
||||
;; The blend mode functions are taken from URL
|
||||
;; `https://en.wikipedia.org/wiki/Blend_modes'.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
|
||||
(eval-and-compile
|
||||
;; Autoloaded since Emacs 31.
|
||||
(unless (fboundp 'color-rgb-to-hex)
|
||||
(autoload 'color-rgb-to-hex "color")))
|
||||
|
||||
(defcustom colir-compose-method #'colir-compose-alpha
|
||||
"The method `colir-blend' uses to compose two color channels."
|
||||
:group 'ivy
|
||||
:type '(radio
|
||||
(function-item colir-compose-alpha)
|
||||
(function-item colir-compose-overlay)
|
||||
(function-item colir-compose-soft-light)))
|
||||
|
||||
(defun colir-compose-soft-light (a b)
|
||||
"Compose color channels A and B in Soft Light blend mode.
|
||||
See URL `https://en.wikipedia.org/wiki/Blend_modes#Soft_Light'."
|
||||
(if (< b 0.5)
|
||||
(+ (* 2 a b) (* a a (- 1 b b)))
|
||||
(+ (* 2 a (- 1 b)) (* (sqrt a) (+ b b -1)))))
|
||||
|
||||
(defun colir-compose-overlay (a b)
|
||||
"Compose color channels A and B in Overlay blend mode.
|
||||
See URL `https://en.wikipedia.org/wiki/Blend_modes#Overlay'."
|
||||
(if (< a 0.5)
|
||||
(* 2 a b)
|
||||
(- 1 (* 2 (- 1 a) (- 1 b)))))
|
||||
|
||||
;; Generalizes Emacs 31 `color-blend'.
|
||||
(defun colir-compose-alpha (a b &optional alpha gamma)
|
||||
"Compose color channels A and B using alpha blending.
|
||||
Optional argument ALPHA controls the influence of A on the result.
|
||||
It is a number between 0.0 and 1.0, inclusive (default 0.5).
|
||||
Optional argument GAMMA controls gamma correction (default 2.2)."
|
||||
(setq alpha (or alpha 0.5))
|
||||
(setq gamma (or gamma 2.2))
|
||||
(+ (* (expt a gamma) alpha) (* (expt b gamma) (- 1 alpha))))
|
||||
|
||||
(defun colir-blend (c1 c2)
|
||||
"Blend the two colors C1 and C2 using `colir-compose-method'.
|
||||
C1 and C2 are triples of floats in [0.0 1.0] range."
|
||||
(apply #'color-rgb-to-hex
|
||||
(cl-mapcar
|
||||
(if (eq (frame-parameter nil 'background-mode) 'dark)
|
||||
;; This method works nicely for dark themes.
|
||||
#'colir-compose-soft-light
|
||||
colir-compose-method)
|
||||
c1 c2)))
|
||||
|
||||
(defun colir-color-parse (color)
|
||||
"Convert string COLOR to triple of floats in [0.0 1.0]."
|
||||
(if (string-match "#\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)\\([[:xdigit:]]\\{2\\}\\)" color)
|
||||
(mapcar (lambda (v) (/ (string-to-number v 16) 255.0))
|
||||
(list (match-string 1 color) (match-string 2 color) (match-string 3 color)))
|
||||
;; does not work properly in terminal (maps color to nearest color
|
||||
;; from available color palette).
|
||||
(color-name-to-rgb color)))
|
||||
|
||||
(defun colir--blend-background (start next prevn face object)
|
||||
(let ((background-prev (face-background prevn)))
|
||||
(put-text-property
|
||||
start next 'face
|
||||
(if background-prev
|
||||
(cons `(background-color
|
||||
. ,(colir-blend
|
||||
(colir-color-parse background-prev)
|
||||
(colir-color-parse (face-background face nil t))))
|
||||
prevn)
|
||||
(list face prevn))
|
||||
object)))
|
||||
|
||||
(defun colir-blend-face-background (start end face &optional object)
|
||||
"Append to the face property of the text from START to END the face FACE.
|
||||
When the text already has a face with a non-plain background,
|
||||
blend it with the background of FACE.
|
||||
Optional argument OBJECT is the string or buffer containing the text.
|
||||
See also `font-lock-append-text-property'."
|
||||
(let (next prev prevn)
|
||||
(while (/= start end)
|
||||
(setq next (next-single-property-change start 'face object end))
|
||||
(setq prev (get-text-property start 'face object))
|
||||
(setq prevn (if (listp prev)
|
||||
(cl-find-if #'atom prev)
|
||||
prev))
|
||||
(cond
|
||||
((or (keywordp (car-safe prev)) (consp (car-safe prev)))
|
||||
(put-text-property start next 'face (cons face prev) object))
|
||||
((facep prevn)
|
||||
(colir--blend-background start next prevn face object))
|
||||
(t
|
||||
(put-text-property start next 'face face object)))
|
||||
(setq start next))))
|
||||
|
||||
(provide 'colir)
|
||||
|
||||
;;; colir.el ends here
|
||||
7398
.emacs.d/lisp/counsel.el
Normal file
7398
.emacs.d/lisp/counsel.el
Normal file
File diff suppressed because it is too large
Load Diff
4164
.emacs.d/lisp/dash.el
Normal file
4164
.emacs.d/lisp/dash.el
Normal file
File diff suppressed because it is too large
Load Diff
3331
.emacs.d/lisp/dumb-jump.el
Normal file
3331
.emacs.d/lisp/dumb-jump.el
Normal file
File diff suppressed because it is too large
Load Diff
145
.emacs.d/lisp/ivy-faces.el
Normal file
145
.emacs.d/lisp/ivy-faces.el
Normal file
@@ -0,0 +1,145 @@
|
||||
;;; ivy-faces.el --- Faces for Ivy -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Oleh Krehel <ohwoeowho@gmail.com>
|
||||
;; Keywords: convenience
|
||||
|
||||
;; 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 of the License, 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defgroup ivy-faces nil
|
||||
"Font-lock faces for `ivy'."
|
||||
:group 'ivy
|
||||
:group 'faces)
|
||||
|
||||
(defface ivy-cursor
|
||||
'((((class color) (background light))
|
||||
:background "black" :foreground "white")
|
||||
(((class color) (background dark))
|
||||
:background "white" :foreground "black"))
|
||||
"Cursor face for inline completion.")
|
||||
|
||||
(defface ivy-current-match
|
||||
'((((class color) (background light))
|
||||
:background "#1a4b77" :foreground "white" :extend t)
|
||||
(((class color) (background dark))
|
||||
:background "#65a7e2" :foreground "black" :extend t))
|
||||
"Face used by Ivy for highlighting the current match.")
|
||||
|
||||
(defface ivy-minibuffer-match-highlight
|
||||
'((t :inherit highlight))
|
||||
"Face used by Ivy for highlighting the match under the cursor.")
|
||||
|
||||
(defface ivy-minibuffer-match-face-1
|
||||
'((((class color) (background light))
|
||||
:background "#d3d3d3")
|
||||
(((class color) (background dark))
|
||||
:background "#555555"))
|
||||
"The background face for `ivy' minibuffer matches.")
|
||||
|
||||
(defface ivy-minibuffer-match-face-2
|
||||
'((((class color) (background light))
|
||||
:background "#e99ce8" :weight bold)
|
||||
(((class color) (background dark))
|
||||
:background "#777777" :weight bold))
|
||||
"Face for `ivy' minibuffer matches numbered 1 modulo 3.")
|
||||
|
||||
(defface ivy-minibuffer-match-face-3
|
||||
'((((class color) (background light))
|
||||
:background "#bbbbff" :weight bold)
|
||||
(((class color) (background dark))
|
||||
:background "#7777ff" :weight bold))
|
||||
"Face for `ivy' minibuffer matches numbered 2 modulo 3.")
|
||||
|
||||
(defface ivy-minibuffer-match-face-4
|
||||
'((((class color) (background light))
|
||||
:background "#ffbbff" :weight bold)
|
||||
(((class color) (background dark))
|
||||
:background "#8a498a" :weight bold))
|
||||
"Face for `ivy' minibuffer matches numbered 3 modulo 3.")
|
||||
|
||||
(defface ivy-confirm-face
|
||||
'((t :foreground "ForestGreen" :inherit minibuffer-prompt))
|
||||
"Face used by Ivy for a confirmation prompt.")
|
||||
|
||||
(defface ivy-match-required-face
|
||||
'((t :foreground "red" :inherit minibuffer-prompt))
|
||||
"Face used by Ivy for a match required prompt.")
|
||||
|
||||
(defface ivy-subdir
|
||||
'((t :inherit dired-directory))
|
||||
"Face used by Ivy for highlighting subdirs in the alternatives.")
|
||||
|
||||
(defface ivy-org
|
||||
'((t :inherit org-level-4))
|
||||
"Face used by Ivy for highlighting Org buffers in the alternatives.")
|
||||
|
||||
(defface ivy-modified-buffer
|
||||
'((t :inherit default))
|
||||
"Face used by Ivy for highlighting modified file visiting buffers.")
|
||||
|
||||
(defface ivy-modified-outside-buffer
|
||||
'((t :inherit default))
|
||||
"Face used by Ivy for highlighting file visiting buffers modified outside Emacs.")
|
||||
|
||||
(defface ivy-remote
|
||||
'((((class color) (background light))
|
||||
:foreground "#110099")
|
||||
(((class color) (background dark))
|
||||
:foreground "#7B6BFF"))
|
||||
"Face used by Ivy for highlighting remotes in the alternatives.")
|
||||
|
||||
(defface ivy-virtual
|
||||
'((t :inherit font-lock-builtin-face))
|
||||
"Face used by Ivy for matching virtual buffer names.")
|
||||
|
||||
(defface ivy-action
|
||||
'((t :inherit font-lock-builtin-face))
|
||||
"Face used by Ivy for displaying keys in `ivy-read-action'.")
|
||||
|
||||
(defface ivy-highlight-face
|
||||
'((t :inherit highlight))
|
||||
"Face used by Ivy to highlight certain candidates.")
|
||||
|
||||
(defface ivy-prompt-match
|
||||
'((t :inherit ivy-current-match))
|
||||
"Face used by Ivy for highlighting the selected prompt line.")
|
||||
|
||||
(defface ivy-separator
|
||||
'((t :inherit font-lock-doc-face))
|
||||
"Face for multiline source separator.")
|
||||
|
||||
(defface ivy-grep-info
|
||||
'((t :inherit compilation-info))
|
||||
"Face for highlighting grep information such as file names.")
|
||||
|
||||
(defface ivy-grep-line-number
|
||||
'((t :inherit compilation-line-number))
|
||||
"Face for displaying line numbers in grep messages.")
|
||||
|
||||
(defface ivy-completions-annotations
|
||||
'((t :inherit completions-annotations))
|
||||
"Face for displaying completion annotations.")
|
||||
|
||||
(defface ivy-yanked-word
|
||||
'((t :inherit highlight))
|
||||
"Face used to highlight yanked word.")
|
||||
|
||||
(provide 'ivy-faces)
|
||||
|
||||
;;; ivy-faces.el ends here
|
||||
176
.emacs.d/lisp/ivy-overlay.el
Normal file
176
.emacs.d/lisp/ivy-overlay.el
Normal file
@@ -0,0 +1,176 @@
|
||||
;;; ivy-overlay.el --- Overlay display functions for Ivy -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2016-2025 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Oleh Krehel <ohwoeowho@gmail.com>
|
||||
;; Keywords: convenience
|
||||
|
||||
;; 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 of the License, 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Normally, Ivy displays completion candidates and entered text in
|
||||
;; the minibuffer. This file enables in-buffer completion to be
|
||||
;; displayed at point instead.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib)
|
||||
(require 'subr-x))
|
||||
|
||||
(defvar ivy--old-cursor-type t)
|
||||
|
||||
(defvar ivy-overlay-at nil
|
||||
"Overlay variable for `ivy-display-function-overlay'.")
|
||||
|
||||
(declare-function ivy--truncate-string "ivy")
|
||||
|
||||
(defun ivy-left-pad (str width)
|
||||
"Return STR, but with each line indented by WIDTH spaces.
|
||||
Lines are truncated to the window width."
|
||||
(let ((padding (make-string width ?\s)))
|
||||
(mapconcat (lambda (x)
|
||||
(ivy--truncate-string (concat padding x)
|
||||
(1- (+ (window-width)
|
||||
(window-hscroll)))))
|
||||
(split-string str "\n")
|
||||
"\n")))
|
||||
|
||||
(defun ivy-overlay-cleanup ()
|
||||
"Clean up after `ivy-display-function-overlay'."
|
||||
(when (overlayp ivy-overlay-at)
|
||||
(delete-overlay ivy-overlay-at)
|
||||
(setq ivy-overlay-at nil))
|
||||
(unless cursor-type
|
||||
(setq cursor-type ivy--old-cursor-type))
|
||||
(when (fboundp 'company-abort)
|
||||
(company-abort)))
|
||||
|
||||
(defvar ivy-height)
|
||||
|
||||
(defun ivy-overlay-show-after (str)
|
||||
"Display STR in an overlay at point.
|
||||
|
||||
First, fill each line of STR with spaces to the current column.
|
||||
Then attach the overlay to the character before point."
|
||||
(if ivy-overlay-at
|
||||
(progn
|
||||
(move-overlay ivy-overlay-at (1- (point)) (line-end-position))
|
||||
(overlay-put ivy-overlay-at 'invisible nil))
|
||||
(let ((available-height (- (window-height) (count-lines (window-start) (point)) 1)))
|
||||
(unless (>= available-height ivy-height)
|
||||
(recenter (- (window-height) ivy-height 2))))
|
||||
(setq ivy-overlay-at (make-overlay (1- (point)) (line-end-position)))
|
||||
;; Specify face to avoid clashing with other overlays.
|
||||
(overlay-put ivy-overlay-at 'face 'default)
|
||||
(overlay-put ivy-overlay-at 'priority 9999))
|
||||
(overlay-put ivy-overlay-at 'display str)
|
||||
(overlay-put ivy-overlay-at 'after-string ""))
|
||||
|
||||
(declare-function org-current-level "org")
|
||||
(declare-function org-at-heading-p "org")
|
||||
(defvar org-indent-indentation-per-level)
|
||||
(defvar ivy-last)
|
||||
(defvar ivy-text)
|
||||
(defvar ivy-completion-beg)
|
||||
(declare-function ivy--get-window "ivy")
|
||||
(declare-function ivy-state-window "ivy" t t)
|
||||
|
||||
(defun ivy-overlay--current-column ()
|
||||
"Return `current-column', ignoring `ivy-overlay-at'.
|
||||
Temporarily make `ivy-overlay-at' invisible so that the
|
||||
`string-width' of its `display' property is not included in the
|
||||
`current-column' calculation by Emacs >= 29.
|
||||
See URL `https://bugs.gnu.org/53795'."
|
||||
(if (overlayp ivy-overlay-at)
|
||||
(cl-letf (((overlay-get ivy-overlay-at 'invisible) t))
|
||||
(1+ (current-column)))
|
||||
(current-column)))
|
||||
|
||||
(defun ivy-overlay-impossible-p (_str)
|
||||
(or
|
||||
(and (eq major-mode 'org-mode)
|
||||
;; If this breaks, an alternative is to call the canonical function
|
||||
;; `org-in-src-block-p', which is slower. Neither approach works
|
||||
;; in Org versions that shipped with Emacs < 26, however.
|
||||
(get-text-property (point) 'src-block))
|
||||
(<= (window-height) (+ ivy-height 2))
|
||||
(bobp)
|
||||
(< (- (+ (window-width) (window-hscroll))
|
||||
(ivy-overlay--current-column))
|
||||
30)))
|
||||
|
||||
(defun ivy-overlay--org-indent ()
|
||||
"Return `ivy-overlay-at' indentation due to `org-indent-mode'.
|
||||
That is, the additional number of columns needed under the mode."
|
||||
;; Emacs 28 includes the following fix for `https://bugs.gnu.org/49695':
|
||||
;;
|
||||
;; "Fix display of line/wrap-prefix when there's a display property at BOL"
|
||||
;; 662f91a795 2021-07-22 21:23:48 +0300
|
||||
;; `https://git.sv.gnu.org/cgit/emacs.git/commit/?id=662f91a795'
|
||||
;;
|
||||
;; This increasingly misindents `ivy-overlay-at' with each additional Org
|
||||
;; level. See also `https://github.com/abo-abo/swiper/commit/ee7f7f8c79'.
|
||||
;; FIXME: Is there a better way to work around this?
|
||||
(if (and (eq major-mode 'org-mode)
|
||||
(bound-and-true-p org-indent-mode)
|
||||
(< emacs-major-version 28))
|
||||
(let ((level (org-current-level)))
|
||||
(if (org-at-heading-p)
|
||||
(1- level)
|
||||
(* org-indent-indentation-per-level (or level 1))))
|
||||
0))
|
||||
|
||||
(defun ivy-display-function-overlay (str)
|
||||
"Called from the minibuffer, display STR in an overlay in Ivy window.
|
||||
Hide the minibuffer contents and cursor."
|
||||
(if (save-selected-window
|
||||
(select-window (ivy-state-window ivy-last))
|
||||
(ivy-overlay-impossible-p str))
|
||||
(let ((buffer-undo-list t))
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(insert str)))
|
||||
(add-face-text-property (minibuffer-prompt-end) (point-max)
|
||||
'(:foreground "white"))
|
||||
(setq cursor-type nil)
|
||||
(with-selected-window (ivy--get-window ivy-last)
|
||||
(when cursor-type
|
||||
(setq ivy--old-cursor-type cursor-type))
|
||||
(setq cursor-type nil)
|
||||
(let ((overlay-str
|
||||
(apply
|
||||
#'concat
|
||||
(buffer-substring (max (point-min) (1- (point))) (point))
|
||||
ivy-text
|
||||
(and (eolp) " ")
|
||||
(buffer-substring (point) (line-end-position))
|
||||
(and (> (length str) 0)
|
||||
(list "\n"
|
||||
(ivy-left-pad
|
||||
(string-remove-prefix "\n" str)
|
||||
(+ (ivy-overlay--org-indent)
|
||||
(save-excursion
|
||||
(when ivy-completion-beg
|
||||
(goto-char ivy-completion-beg))
|
||||
(ivy-overlay--current-column)))))))))
|
||||
(let ((cursor-offset (1+ (length ivy-text))))
|
||||
(add-face-text-property cursor-offset (1+ cursor-offset)
|
||||
'ivy-cursor t overlay-str))
|
||||
(ivy-overlay-show-after overlay-str)))))
|
||||
|
||||
(provide 'ivy-overlay)
|
||||
|
||||
;;; ivy-overlay.el ends here
|
||||
5558
.emacs.d/lisp/ivy.el
Normal file
5558
.emacs.d/lisp/ivy.el
Normal file
File diff suppressed because it is too large
Load Diff
1459
.emacs.d/lisp/popup.el
Normal file
1459
.emacs.d/lisp/popup.el
Normal file
File diff suppressed because it is too large
Load Diff
165
.emacs.d/lisp/queue.el
Normal file
165
.emacs.d/lisp/queue.el
Normal file
@@ -0,0 +1,165 @@
|
||||
;;; queue.el --- Queue data structure -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 1991-1995, 2008-2009, 2012, 2017 Free Software Foundation, Inc
|
||||
|
||||
;; Author: Inge Wallin <inge@lysator.liu.se>
|
||||
;; Toby Cubitt <toby-predictive@dr-qubit.org>
|
||||
;; Maintainer: Toby Cubitt <toby-predictive@dr-qubit.org>
|
||||
;; Version: 0.2
|
||||
;; Keywords: extensions, data structures, queue
|
||||
;; URL: http://www.dr-qubit.org/emacs.php
|
||||
;; Repository: http://www.dr-qubit.org/git/predictive.git
|
||||
|
||||
;; This file is part of Emacs.
|
||||
;;
|
||||
;; GNU Emacs 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 of the License, or (at your option)
|
||||
;; any later version.
|
||||
;;
|
||||
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; These queues can be used both as a first-in last-out (FILO) and as a
|
||||
;; first-in first-out (FIFO) stack, i.e. elements can be added to the front or
|
||||
;; back of the queue, and can be removed from the front. (This type of data
|
||||
;; structure is sometimes called an "output-restricted deque".)
|
||||
;;
|
||||
;; You create a queue using `make-queue', add an element to the end of the
|
||||
;; queue using `queue-enqueue', and push an element onto the front of the
|
||||
;; queue using `queue-prepend'. To remove the first element from a queue, use
|
||||
;; `queue-dequeue'. A number of other queue convenience functions are also
|
||||
;; provided, all starting with the prefix `queue-'. Functions with prefix
|
||||
;; `queue--' are for internal use only, and should never be used outside this
|
||||
;; package.
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-when-compile (require 'cl))
|
||||
|
||||
(defmacro queue--when-generators (then)
|
||||
"Evaluate THEN if `generator' library is available."
|
||||
(declare (debug t))
|
||||
(if (require 'generator nil 'noerror) then))
|
||||
|
||||
|
||||
(defstruct (queue
|
||||
;; A tagged list is the pre-defstruct representation.
|
||||
;; (:type list)
|
||||
:named
|
||||
(:constructor nil)
|
||||
(:constructor queue-create ())
|
||||
(:copier nil))
|
||||
head tail)
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'make-queue 'queue-create
|
||||
"Create an empty queue data structure.")
|
||||
|
||||
|
||||
(defun queue-enqueue (queue element)
|
||||
"Append an ELEMENT to the end of the QUEUE."
|
||||
(if (queue-head queue)
|
||||
(setcdr (queue-tail queue)
|
||||
(setf (queue-tail queue) (cons element nil)))
|
||||
(setf (queue-head queue)
|
||||
(setf (queue-tail queue) (cons element nil)))))
|
||||
|
||||
(defalias 'queue-append 'queue-enqueue)
|
||||
|
||||
|
||||
(defun queue-prepend (queue element)
|
||||
"Prepend an ELEMENT to the front of the QUEUE."
|
||||
(if (queue-head queue)
|
||||
(push element (queue-head queue))
|
||||
(setf (queue-head queue)
|
||||
(setf (queue-tail queue) (cons element nil)))))
|
||||
|
||||
|
||||
(defun queue-dequeue (queue)
|
||||
"Remove the first element of QUEUE and return it.
|
||||
Returns nil if the queue is empty."
|
||||
(unless (cdr (queue-head queue)) (setf (queue-tail queue) nil))
|
||||
(pop (queue-head queue)))
|
||||
|
||||
|
||||
(defun queue-empty (queue)
|
||||
"Return t if QUEUE is empty, otherwise return nil."
|
||||
(null (queue-head queue)))
|
||||
|
||||
|
||||
(defun queue-first (queue)
|
||||
"Return the first element of QUEUE or nil if it is empty,
|
||||
without removing it from the QUEUE."
|
||||
(car (queue-head queue)))
|
||||
|
||||
|
||||
(defun queue-nth (queue n)
|
||||
"Return the nth element of a queue, without removing it.
|
||||
If the length of the queue is less than N, return nil. The first
|
||||
element in the queue has index 0."
|
||||
(nth n (queue-head queue)))
|
||||
|
||||
|
||||
(defun queue-last (queue)
|
||||
"Return the last element of QUEUE, without removing it.
|
||||
Returns nil if the QUEUE is empty."
|
||||
(car (queue-tail queue)))
|
||||
|
||||
|
||||
(defun queue-all (queue)
|
||||
"Return a list of all elements of QUEUE or nil if it is empty.
|
||||
The oldest element in the queue is the first in the list."
|
||||
(queue-head queue))
|
||||
|
||||
|
||||
(defun queue-copy (queue)
|
||||
"Return a copy of QUEUE.
|
||||
The new queue contains the elements of QUEUE in the same
|
||||
order. The elements themselves are *not* copied."
|
||||
(let ((q (queue-create))
|
||||
(list (queue-head queue)))
|
||||
(when (queue-head queue)
|
||||
(setf (queue-head q) (cons (car (queue-head queue)) nil)
|
||||
(queue-tail q) (queue-head q))
|
||||
(while (setq list (cdr list))
|
||||
(setf (queue-tail q)
|
||||
(setcdr (queue-tail q) (cons (car list) nil)))))
|
||||
q))
|
||||
|
||||
|
||||
(defun queue-length (queue)
|
||||
"Return the number of elements in QUEUE."
|
||||
(length (queue-head queue)))
|
||||
|
||||
|
||||
(defun queue-clear (queue)
|
||||
"Remove all elements from QUEUE."
|
||||
(setf (queue-head queue) nil
|
||||
(queue-tail queue) nil))
|
||||
|
||||
|
||||
(queue--when-generators
|
||||
(iter-defun queue-iter (queue)
|
||||
"Return a queue iterator object.
|
||||
|
||||
Calling `iter-next' on this object will retrieve the next element
|
||||
from the queue. The queue itself is not modified."
|
||||
(let ((list (queue-head queue)))
|
||||
(while list (iter-yield (pop list))))))
|
||||
|
||||
|
||||
(provide 'queue)
|
||||
|
||||
|
||||
;;; queue.el ends here
|
||||
792
.emacs.d/lisp/s.el
Normal file
792
.emacs.d/lisp/s.el
Normal file
@@ -0,0 +1,792 @@
|
||||
;;; s.el --- The long lost Emacs string manipulation library. -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2012-2022 Magnar Sveen
|
||||
|
||||
;; Author: Magnar Sveen <magnars@gmail.com>
|
||||
;; Maintainer: Jason Milkins <jasonm23@gmail.com>
|
||||
;; Version: 1.13.1
|
||||
;; Keywords: strings
|
||||
|
||||
;; 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 of the License, 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; The long lost Emacs string manipulation library.
|
||||
;;
|
||||
;; See documentation on https://github.com/magnars/s.el#functions
|
||||
|
||||
;;; Code:
|
||||
|
||||
;; Silence byte-compiler
|
||||
(defvar ucs-normalize-combining-chars) ; Defined in `ucs-normalize'
|
||||
(autoload 'slot-value "eieio")
|
||||
|
||||
(defun s-trim-left (s)
|
||||
"Remove whitespace at the beginning of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(save-match-data
|
||||
(if (string-match "\\`[ \t\n\r]+" s)
|
||||
(replace-match "" t t s)
|
||||
s)))
|
||||
|
||||
(defun s-trim-right (s)
|
||||
"Remove whitespace at the end of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(save-match-data
|
||||
(if (string-match "[ \t\n\r]+\\'" s)
|
||||
(replace-match "" t t s)
|
||||
s)))
|
||||
|
||||
(defun s-trim (s)
|
||||
"Remove whitespace at the beginning and end of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(s-trim-left (s-trim-right s)))
|
||||
|
||||
(defun s-collapse-whitespace (s)
|
||||
"Convert all adjacent whitespace characters to a single space."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(replace-regexp-in-string "[ \t\n\r]+" " " s))
|
||||
|
||||
(defun s-unindent (s &optional bol)
|
||||
"Unindent S which has BOL (beginning of line) indicators.
|
||||
BOL will default to pipe. You can optionally supply your own."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((case-fold-search nil)
|
||||
(bol (or bol "|")))
|
||||
(s-replace-regexp (concat "^[[:space:]]*" (regexp-quote bol)) "" s)))
|
||||
|
||||
(defun s-split (separator s &optional omit-nulls)
|
||||
"Split S into substrings bounded by matches for regexp SEPARATOR.
|
||||
If OMIT-NULLS is non-nil, zero-length substrings are omitted.
|
||||
|
||||
This is a simple wrapper around the built-in `split-string'."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(split-string s separator omit-nulls)))
|
||||
|
||||
(defun s-split-up-to (separator s n &optional omit-nulls)
|
||||
"Split S up to N times into substrings bounded by matches for regexp SEPARATOR.
|
||||
|
||||
If OMIT-NULLS is non-nil, zero-length substrings are omitted.
|
||||
|
||||
See also `s-split'."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(let ((op 0)
|
||||
(r nil))
|
||||
(with-temp-buffer
|
||||
(insert s)
|
||||
(setq op (goto-char (point-min)))
|
||||
(while (and (re-search-forward separator nil t)
|
||||
(< 0 n))
|
||||
(let ((sub (buffer-substring op (match-beginning 0))))
|
||||
(unless (and omit-nulls
|
||||
(equal sub ""))
|
||||
(push sub r)))
|
||||
(setq op (goto-char (match-end 0)))
|
||||
(setq n (1- n)))
|
||||
(let ((sub (buffer-substring op (point-max))))
|
||||
(unless (and omit-nulls
|
||||
(equal sub ""))
|
||||
(push sub r))))
|
||||
(nreverse r))))
|
||||
|
||||
(defun s-lines (s)
|
||||
"Splits S into a list of strings on newline characters."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(s-split "\\(\r\n\\|[\n\r]\\)" s))
|
||||
|
||||
(defun s-join (separator strings)
|
||||
"Join all the strings in STRINGS with SEPARATOR in between."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(mapconcat 'identity strings separator))
|
||||
|
||||
(defun s-concat (&rest strings)
|
||||
"Join all the string arguments into one string."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(apply 'concat strings))
|
||||
|
||||
(defun s-prepend (prefix s)
|
||||
"Concatenate PREFIX and S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(concat prefix s))
|
||||
|
||||
(defun s-append (suffix s)
|
||||
"Concatenate S and SUFFIX."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(concat s suffix))
|
||||
|
||||
(defun s-splice (needle n s)
|
||||
"Splice NEEDLE into S at position N.
|
||||
0 is the beginning of the string, -1 is the end."
|
||||
(if (< n 0)
|
||||
(let ((left (substring s 0 (+ 1 n (length s))))
|
||||
(right (s-right (- -1 n) s)))
|
||||
(concat left needle right))
|
||||
(let ((left (s-left n s))
|
||||
(right (substring s n (length s))))
|
||||
(concat left needle right))))
|
||||
|
||||
|
||||
(defun s-repeat (num s)
|
||||
"Make a string of S repeated NUM times."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let (ss)
|
||||
(while (> num 0)
|
||||
(setq ss (cons s ss))
|
||||
(setq num (1- num)))
|
||||
(apply 'concat ss)))
|
||||
|
||||
(defun s-chop-suffix (suffix s)
|
||||
"Remove SUFFIX if it is at end of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((pos (- (length suffix))))
|
||||
(if (and (>= (length s) (length suffix))
|
||||
(string= suffix (substring s pos)))
|
||||
(substring s 0 pos)
|
||||
s)))
|
||||
|
||||
(defun s-chop-suffixes (suffixes s)
|
||||
"Remove SUFFIXES one by one in order, if they are at the end of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(while suffixes
|
||||
(setq s (s-chop-suffix (car suffixes) s))
|
||||
(setq suffixes (cdr suffixes)))
|
||||
s)
|
||||
|
||||
(defun s-chop-prefix (prefix s)
|
||||
"Remove PREFIX if it is at the start of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((pos (length prefix)))
|
||||
(if (and (>= (length s) (length prefix))
|
||||
(string= prefix (substring s 0 pos)))
|
||||
(substring s pos)
|
||||
s)))
|
||||
|
||||
(defun s-chop-prefixes (prefixes s)
|
||||
"Remove PREFIXES one by one in order, if they are at the start of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(while prefixes
|
||||
(setq s (s-chop-prefix (car prefixes) s))
|
||||
(setq prefixes (cdr prefixes)))
|
||||
s)
|
||||
|
||||
(defun s-shared-start (s1 s2)
|
||||
"Returns the longest prefix S1 and S2 have in common."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((cmp (compare-strings s1 0 (length s1) s2 0 (length s2))))
|
||||
(if (eq cmp t) s1 (substring s1 0 (1- (abs cmp))))))
|
||||
|
||||
(defun s-shared-end (s1 s2)
|
||||
"Returns the longest suffix S1 and S2 have in common."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let* ((l1 (length s1))
|
||||
(l2 (length s2))
|
||||
(search-length (min l1 l2))
|
||||
(i 0))
|
||||
(while (and (< i search-length)
|
||||
(= (aref s1 (- l1 i 1)) (aref s2 (- l2 i 1))))
|
||||
(setq i (1+ i)))
|
||||
;; If I is 0, then it means that there's no common suffix between
|
||||
;; S1 and S2.
|
||||
;;
|
||||
;; However, since (substring s (- 0)) will return the whole
|
||||
;; string, `s-shared-end' should simply return the empty string
|
||||
;; when I is 0.
|
||||
(if (zerop i)
|
||||
""
|
||||
(substring s1 (- i)))))
|
||||
|
||||
(defun s-chomp (s)
|
||||
"Remove one trailing `\\n`, `\\r` or `\\r\\n` from S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(s-chop-suffixes '("\n" "\r") s))
|
||||
|
||||
(defun s-truncate (len s &optional ellipsis)
|
||||
"If S is longer than LEN, cut it down and add ELLIPSIS to the end.
|
||||
|
||||
The resulting string, including ellipsis, will be LEN characters
|
||||
long.
|
||||
|
||||
When not specified, ELLIPSIS defaults to ‘...’."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(unless ellipsis
|
||||
(setq ellipsis "..."))
|
||||
(if (> (length s) len)
|
||||
(format "%s%s" (substring s 0 (- len (length ellipsis))) ellipsis)
|
||||
s))
|
||||
|
||||
(defun s-word-wrap (len s)
|
||||
"If S is longer than LEN, wrap the words with newlines."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(with-temp-buffer
|
||||
(insert s)
|
||||
(let ((fill-column len))
|
||||
(fill-region (point-min) (point-max)))
|
||||
(buffer-substring (point-min) (point-max)))))
|
||||
|
||||
(defun s-center (len s)
|
||||
"If S is shorter than LEN, pad it with spaces so it is centered."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((extra (max 0 (- len (length s)))))
|
||||
(concat
|
||||
(make-string (ceiling extra 2) ?\s)
|
||||
s
|
||||
(make-string (floor extra 2) ?\s))))
|
||||
|
||||
(defun s-pad-left (len padding s)
|
||||
"If S is shorter than LEN, pad it with PADDING on the left."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((extra (max 0 (- len (length s)))))
|
||||
(concat (make-string extra (string-to-char padding))
|
||||
s)))
|
||||
|
||||
(defun s-pad-right (len padding s)
|
||||
"If S is shorter than LEN, pad it with PADDING on the right."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((extra (max 0 (- len (length s)))))
|
||||
(concat s
|
||||
(make-string extra (string-to-char padding)))))
|
||||
|
||||
(defun s-left (len s)
|
||||
"Returns up to the LEN first chars of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(if (> (length s) len)
|
||||
(substring s 0 len)
|
||||
s))
|
||||
|
||||
(defun s-right (len s)
|
||||
"Returns up to the LEN last chars of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((l (length s)))
|
||||
(if (> l len)
|
||||
(substring s (- l len) l)
|
||||
s)))
|
||||
|
||||
(defun s-chop-left (len s)
|
||||
"Remove the first LEN chars from S."
|
||||
(let ((l (length s)))
|
||||
(if (> l len)
|
||||
(substring s len l)
|
||||
"")))
|
||||
|
||||
(defun s-chop-right (len s)
|
||||
"Remove the last LEN chars from S."
|
||||
(let ((l (length s)))
|
||||
(if (> l len)
|
||||
(substring s 0 (- l len))
|
||||
"")))
|
||||
|
||||
(defun s-ends-with? (suffix s &optional ignore-case)
|
||||
"Does S end with SUFFIX?
|
||||
|
||||
If IGNORE-CASE is non-nil, the comparison is done without paying
|
||||
attention to case differences.
|
||||
|
||||
Alias: `s-suffix?'"
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((start-pos (- (length s) (length suffix))))
|
||||
(and (>= start-pos 0)
|
||||
(eq t (compare-strings suffix nil nil
|
||||
s start-pos nil ignore-case)))))
|
||||
|
||||
(defun s-starts-with? (prefix s &optional ignore-case)
|
||||
"Does S start with PREFIX?
|
||||
|
||||
If IGNORE-CASE is non-nil, the comparison is done without paying
|
||||
attention to case differences.
|
||||
|
||||
Alias: `s-prefix?'. This is a simple wrapper around the built-in
|
||||
`string-prefix-p'."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(string-prefix-p prefix s ignore-case))
|
||||
|
||||
(defun s--truthy? (val)
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(not (null val)))
|
||||
|
||||
(defun s-contains? (needle s &optional ignore-case)
|
||||
"Does S contain NEEDLE?
|
||||
|
||||
If IGNORE-CASE is non-nil, the comparison is done without paying
|
||||
attention to case differences."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((case-fold-search ignore-case))
|
||||
(s--truthy? (string-match-p (regexp-quote needle) s))))
|
||||
|
||||
(defun s-equals? (s1 s2)
|
||||
"Is S1 equal to S2?
|
||||
|
||||
This is a simple wrapper around the built-in `string-equal'."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(string-equal s1 s2))
|
||||
|
||||
(defun s-less? (s1 s2)
|
||||
"Is S1 less than S2?
|
||||
|
||||
This is a simple wrapper around the built-in `string-lessp'."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(string-lessp s1 s2))
|
||||
|
||||
(defun s-matches? (regexp s &optional start)
|
||||
"Does REGEXP match S?
|
||||
If START is non-nil the search starts at that index.
|
||||
|
||||
This is a simple wrapper around the built-in `string-match-p'."
|
||||
(declare (side-effect-free t))
|
||||
(s--truthy? (string-match-p regexp s start)))
|
||||
|
||||
(defun s-blank? (s)
|
||||
"Is S nil or the empty string?"
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(or (null s) (string= "" s)))
|
||||
|
||||
(defun s-blank-str? (s)
|
||||
"Is S nil or the empty string or string only contains whitespace?"
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(or (s-blank? s) (s-blank? (s-trim s))))
|
||||
|
||||
(defun s-present? (s)
|
||||
"Is S anything but nil or the empty string?"
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(not (s-blank? s)))
|
||||
|
||||
(defun s-presence (s)
|
||||
"Return S if it's `s-present?', otherwise return nil."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(and (s-present? s) s))
|
||||
|
||||
(defun s-lowercase? (s)
|
||||
"Are all the letters in S in lower case?"
|
||||
(declare (side-effect-free t))
|
||||
(let ((case-fold-search nil))
|
||||
(not (string-match-p "[[:upper:]]" s))))
|
||||
|
||||
(defun s-uppercase? (s)
|
||||
"Are all the letters in S in upper case?"
|
||||
(declare (side-effect-free t))
|
||||
(let ((case-fold-search nil))
|
||||
(not (string-match-p "[[:lower:]]" s))))
|
||||
|
||||
(defun s-mixedcase? (s)
|
||||
"Are there both lower case and upper case letters in S?"
|
||||
(let ((case-fold-search nil))
|
||||
(s--truthy?
|
||||
(and (string-match-p "[[:lower:]]" s)
|
||||
(string-match-p "[[:upper:]]" s)))))
|
||||
|
||||
(defun s-capitalized? (s)
|
||||
"In S, is the first letter upper case, and all other letters lower case?"
|
||||
(declare (side-effect-free t))
|
||||
(let ((case-fold-search nil))
|
||||
(s--truthy?
|
||||
(string-match-p "^[[:upper:]][^[:upper:]]*$" s))))
|
||||
|
||||
(defun s-numeric? (s)
|
||||
"Is S a number?"
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(s--truthy?
|
||||
(string-match-p "^[0-9]+$" s)))
|
||||
|
||||
(defun s-replace (old new s)
|
||||
"Replaces OLD with NEW in S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(replace-regexp-in-string (regexp-quote old) new s t t))
|
||||
|
||||
(defalias 's-replace-regexp 'replace-regexp-in-string)
|
||||
|
||||
(defun s--aget (alist key)
|
||||
"Get the value of KEY in ALIST."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(cdr (assoc-string key alist)))
|
||||
|
||||
(defun s-replace-all (replacements s)
|
||||
"REPLACEMENTS is a list of cons-cells. Each `car` is replaced with `cdr` in S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((case-fold-search nil))
|
||||
(replace-regexp-in-string (regexp-opt (mapcar 'car replacements))
|
||||
(lambda (it) (s--aget replacements it))
|
||||
s t t)))
|
||||
|
||||
(defun s-downcase (s)
|
||||
"Convert S to lower case.
|
||||
|
||||
This is a simple wrapper around the built-in `downcase'."
|
||||
(declare (side-effect-free t))
|
||||
(downcase s))
|
||||
|
||||
(defun s-upcase (s)
|
||||
"Convert S to upper case.
|
||||
|
||||
This is a simple wrapper around the built-in `upcase'."
|
||||
(declare (side-effect-free t))
|
||||
(upcase s))
|
||||
|
||||
(defun s-capitalize (s)
|
||||
"Convert S first word's first character to upper and the rest to lower case."
|
||||
(declare (side-effect-free t))
|
||||
(concat (upcase (substring s 0 1)) (downcase (substring s 1))))
|
||||
|
||||
(defun s-titleize (s)
|
||||
"Convert in S each word's first character to upper and the rest to lower case.
|
||||
|
||||
This is a simple wrapper around the built-in `capitalize'."
|
||||
(declare (side-effect-free t))
|
||||
(capitalize s))
|
||||
|
||||
(defmacro s-with (s form &rest more)
|
||||
"Threads S through the forms. Inserts S as the last item
|
||||
in the first form, making a list of it if it is not a list
|
||||
already. If there are more forms, inserts the first form as the
|
||||
last item in second form, etc."
|
||||
(declare (debug (form &rest [&or (function &rest form) fboundp])))
|
||||
(if (null more)
|
||||
(if (listp form)
|
||||
`(,(car form) ,@(cdr form) ,s)
|
||||
(list form s))
|
||||
`(s-with (s-with ,s ,form) ,@more)))
|
||||
|
||||
(put 's-with 'lisp-indent-function 1)
|
||||
|
||||
(defun s-index-of (needle s &optional ignore-case)
|
||||
"Returns first index of NEEDLE in S, or nil.
|
||||
|
||||
If IGNORE-CASE is non-nil, the comparison is done without paying
|
||||
attention to case differences."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(let ((case-fold-search ignore-case))
|
||||
(string-match-p (regexp-quote needle) s)))
|
||||
|
||||
(defun s-reverse (s)
|
||||
"Return the reverse of S."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(save-match-data
|
||||
(if (multibyte-string-p s)
|
||||
(let ((input (string-to-list s))
|
||||
output)
|
||||
(require 'ucs-normalize)
|
||||
(while input
|
||||
;; Handle entire grapheme cluster as a single unit
|
||||
(let ((grapheme (list (pop input))))
|
||||
(while (memql (car input) ucs-normalize-combining-chars)
|
||||
(push (pop input) grapheme))
|
||||
(setq output (nconc (nreverse grapheme) output))))
|
||||
(concat output))
|
||||
(concat (nreverse (string-to-list s))))))
|
||||
|
||||
(defun s-match-strings-all (regex string)
|
||||
"Return a list of matches for REGEX in STRING.
|
||||
|
||||
Each element itself is a list of matches, as per
|
||||
`match-string'. Multiple matches at the same position will be
|
||||
ignored after the first."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(let ((all-strings ())
|
||||
(i 0))
|
||||
(while (and (< i (length string))
|
||||
(string-match regex string i))
|
||||
(setq i (1+ (match-beginning 0)))
|
||||
(let (strings
|
||||
(num-matches (/ (length (match-data)) 2))
|
||||
(match 0))
|
||||
(while (/= match num-matches)
|
||||
(push (match-string match string) strings)
|
||||
(setq match (1+ match)))
|
||||
(push (nreverse strings) all-strings)))
|
||||
(nreverse all-strings))))
|
||||
|
||||
(defun s-matched-positions-all (regexp string &optional subexp-depth)
|
||||
"Return a list of matched positions for REGEXP in STRING.
|
||||
SUBEXP-DEPTH is 0 by default."
|
||||
(declare (side-effect-free t))
|
||||
(if (null subexp-depth)
|
||||
(setq subexp-depth 0))
|
||||
(save-match-data
|
||||
(let ((pos 0) result)
|
||||
(while (and (string-match regexp string pos)
|
||||
(< pos (length string)))
|
||||
(push (cons (match-beginning subexp-depth) (match-end subexp-depth)) result)
|
||||
(setq pos (match-end 0)))
|
||||
(nreverse result))))
|
||||
|
||||
(defun s-match (regexp s &optional start)
|
||||
"When the given expression matches the string, this function returns a list
|
||||
of the whole matching string and a string for each matched subexpressions.
|
||||
Subexpressions that didn't match are represented by nil elements
|
||||
in the list, except that non-matching subexpressions at the end
|
||||
of REGEXP might not appear at all in the list. That is, the
|
||||
returned list can be shorter than the number of subexpressions in
|
||||
REGEXP plus one. If REGEXP did not match the returned value is
|
||||
an empty list (nil).
|
||||
|
||||
When START is non-nil the search will start at that index."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(if (string-match regexp s start)
|
||||
(let ((match-data-list (match-data))
|
||||
result)
|
||||
(while match-data-list
|
||||
(let* ((beg (car match-data-list))
|
||||
(end (cadr match-data-list))
|
||||
(subs (if (and beg end) (substring s beg end) nil)))
|
||||
(setq result (cons subs result))
|
||||
(setq match-data-list
|
||||
(cddr match-data-list))))
|
||||
(nreverse result)))))
|
||||
|
||||
(defun s-slice-at (regexp s)
|
||||
"Slices S up at every index matching REGEXP."
|
||||
(declare (side-effect-free t))
|
||||
(if (s-blank? s)
|
||||
(list s)
|
||||
(let (ss)
|
||||
(while (not (s-blank? s))
|
||||
(save-match-data
|
||||
(let ((i (string-match regexp s 1)))
|
||||
(if i
|
||||
(setq ss (cons (substring s 0 i) ss)
|
||||
s (substring s i))
|
||||
(setq ss (cons s ss)
|
||||
s "")))))
|
||||
(nreverse ss))))
|
||||
|
||||
(defun s-split-words (s)
|
||||
"Split S into list of words."
|
||||
(declare (side-effect-free t))
|
||||
(s-split
|
||||
"[^[:word:]0-9]+"
|
||||
(let ((case-fold-search nil))
|
||||
(replace-regexp-in-string
|
||||
"\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2"
|
||||
(replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" "\\1 \\2" s)))
|
||||
t))
|
||||
|
||||
(defun s--mapcar-head (fn-head fn-rest list)
|
||||
"Like MAPCAR, but applies a different function to the first element."
|
||||
(if list
|
||||
(cons (funcall fn-head (car list)) (mapcar fn-rest (cdr list)))))
|
||||
|
||||
(defun s-lower-camel-case (s)
|
||||
"Convert S to lowerCamelCase."
|
||||
(declare (side-effect-free t))
|
||||
(s-join "" (s--mapcar-head 'downcase 'capitalize (s-split-words s))))
|
||||
|
||||
(defun s-upper-camel-case (s)
|
||||
"Convert S to UpperCamelCase."
|
||||
(declare (side-effect-free t))
|
||||
(s-join "" (mapcar 'capitalize (s-split-words s))))
|
||||
|
||||
(defun s-snake-case (s)
|
||||
"Convert S to snake_case."
|
||||
(declare (side-effect-free t))
|
||||
(s-join "_" (mapcar 'downcase (s-split-words s))))
|
||||
|
||||
(defun s-dashed-words (s)
|
||||
"Convert S to dashed-words."
|
||||
(declare (side-effect-free t))
|
||||
(s-join "-" (mapcar 'downcase (s-split-words s))))
|
||||
|
||||
(defun s-spaced-words (s)
|
||||
"Convert S to spaced words."
|
||||
(declare (side-effect-free t))
|
||||
(s-join " " (s-split-words s)))
|
||||
|
||||
(defun s-capitalized-words (s)
|
||||
"Convert S to Capitalized words."
|
||||
(declare (side-effect-free t))
|
||||
(let ((words (s-split-words s)))
|
||||
(s-join " " (cons (capitalize (car words)) (mapcar 'downcase (cdr words))))))
|
||||
|
||||
(defun s-titleized-words (s)
|
||||
"Convert S to Titleized Words."
|
||||
(declare (side-effect-free t))
|
||||
(s-join " " (mapcar 's-titleize (s-split-words s))))
|
||||
|
||||
(defun s-word-initials (s)
|
||||
"Convert S to its initials."
|
||||
(declare (side-effect-free t))
|
||||
(s-join "" (mapcar (lambda (ss) (substring ss 0 1))
|
||||
(s-split-words s))))
|
||||
|
||||
;; Errors for s-format
|
||||
(progn
|
||||
(put 's-format-resolve
|
||||
'error-conditions
|
||||
'(error s-format s-format-resolve))
|
||||
(put 's-format-resolve
|
||||
'error-message
|
||||
"Cannot resolve a template to values"))
|
||||
|
||||
(defun s-format (template replacer &optional extra)
|
||||
"Format TEMPLATE with the function REPLACER.
|
||||
|
||||
REPLACER takes an argument of the format variable and optionally
|
||||
an extra argument which is the EXTRA value from the call to
|
||||
`s-format'.
|
||||
|
||||
Several standard `s-format' helper functions are recognized and
|
||||
adapted for this:
|
||||
|
||||
(s-format \"${name}\" \\='gethash hash-table)
|
||||
(s-format \"${name}\" \\='aget alist)
|
||||
(s-format \"$0\" \\='elt sequence)
|
||||
|
||||
The REPLACER function may be used to do any other kind of
|
||||
transformation."
|
||||
(let ((saved-match-data (match-data)))
|
||||
(unwind-protect
|
||||
(replace-regexp-in-string
|
||||
"\\$\\({\\([^}]+\\)}\\|[0-9]+\\)"
|
||||
(lambda (md)
|
||||
(let ((var
|
||||
(let ((m (match-string 2 md)))
|
||||
(if m m
|
||||
(string-to-number (match-string 1 md)))))
|
||||
(replacer-match-data (match-data)))
|
||||
(unwind-protect
|
||||
(let ((v
|
||||
(cond
|
||||
((eq replacer 'gethash)
|
||||
(funcall replacer var extra))
|
||||
((eq replacer 'aget)
|
||||
(funcall 's--aget extra var))
|
||||
((eq replacer 'elt)
|
||||
(funcall replacer extra var))
|
||||
((eq replacer 'oref)
|
||||
(funcall #'slot-value extra (intern var)))
|
||||
(t
|
||||
(set-match-data saved-match-data)
|
||||
(if extra
|
||||
(funcall replacer var extra)
|
||||
(funcall replacer var))))))
|
||||
(if v (format "%s" v) (signal 's-format-resolve md)))
|
||||
(set-match-data replacer-match-data))))
|
||||
template
|
||||
;; Need literal to make sure it works
|
||||
t t)
|
||||
(set-match-data saved-match-data))))
|
||||
|
||||
(defvar s-lex-value-as-lisp nil
|
||||
"If `t' interpolate lisp values as lisp.
|
||||
|
||||
`s-lex-format' inserts values with (format \"%S\").")
|
||||
|
||||
(defun s-lex-fmt|expand (fmt)
|
||||
"Expand FMT into lisp."
|
||||
(declare (side-effect-free t))
|
||||
(list 's-format fmt (quote 'aget)
|
||||
(append '(list)
|
||||
(mapcar
|
||||
(lambda (matches)
|
||||
(list
|
||||
'cons
|
||||
(cadr matches)
|
||||
`(format
|
||||
(if s-lex-value-as-lisp "%S" "%s")
|
||||
,(intern (cadr matches)))))
|
||||
(s-match-strings-all "${\\([^}]+\\)}" fmt)))))
|
||||
|
||||
(defmacro s-lex-format (format-str)
|
||||
"`s-format` with the current environment.
|
||||
|
||||
FORMAT-STR may use the `s-format' variable reference to refer to
|
||||
any variable:
|
||||
|
||||
(let ((x 1))
|
||||
(s-lex-format \"x is: ${x}\"))
|
||||
|
||||
The values of the variables are interpolated with \"%s\" unless
|
||||
the variable `s-lex-value-as-lisp' is `t' and then they are
|
||||
interpolated with \"%S\"."
|
||||
(declare (debug (form)))
|
||||
(s-lex-fmt|expand format-str))
|
||||
|
||||
(defun s-count-matches (regexp s &optional start end)
|
||||
"Count occurrences of `regexp' in `s'.
|
||||
|
||||
`start', inclusive, and `end', exclusive, delimit the part of `s' to
|
||||
match. `start' and `end' are both indexed starting at 1; the initial
|
||||
character in `s' is index 1.
|
||||
|
||||
This function starts looking for the next match from the end of the
|
||||
previous match. Hence, it ignores matches that overlap a previously
|
||||
found match. To count overlapping matches, use
|
||||
`s-count-matches-all'."
|
||||
(declare (side-effect-free t))
|
||||
(save-match-data
|
||||
(with-temp-buffer
|
||||
(insert s)
|
||||
(goto-char (point-min))
|
||||
(count-matches regexp (or start 1) (or end (point-max))))))
|
||||
|
||||
(defun s-count-matches-all (regexp s &optional start end)
|
||||
"Count occurrences of `regexp' in `s'.
|
||||
|
||||
`start', inclusive, and `end', exclusive, delimit the part of `s' to
|
||||
match. `start' and `end' are both indexed starting at 1; the initial
|
||||
character in `s' is index 1.
|
||||
|
||||
This function starts looking for the next match from the second
|
||||
character of the previous match. Hence, it counts matches that
|
||||
overlap a previously found match. To ignore matches that overlap a
|
||||
previously found match, use `s-count-matches'."
|
||||
(declare (side-effect-free t))
|
||||
(let* ((anchored-regexp (format "^%s" regexp))
|
||||
(match-count 0)
|
||||
(i 0)
|
||||
(narrowed-s (substring s (if start (1- start) 0)
|
||||
(when end (1- end)))))
|
||||
(save-match-data
|
||||
(while (< i (length narrowed-s))
|
||||
(when (s-matches? anchored-regexp (substring narrowed-s i))
|
||||
(setq match-count (1+ match-count)))
|
||||
(setq i (1+ i))))
|
||||
match-count))
|
||||
|
||||
(defun s-wrap (s prefix &optional suffix)
|
||||
"Wrap string S with PREFIX and optionally SUFFIX.
|
||||
|
||||
Return string S with PREFIX prepended. If SUFFIX is present, it
|
||||
is appended, otherwise PREFIX is used as both prefix and
|
||||
suffix."
|
||||
(declare (pure t) (side-effect-free t))
|
||||
(concat prefix s (or suffix prefix)))
|
||||
|
||||
|
||||
;;; Aliases
|
||||
|
||||
(defalias 's-blank-p 's-blank?)
|
||||
(defalias 's-blank-str-p 's-blank-str?)
|
||||
(defalias 's-capitalized-p 's-capitalized?)
|
||||
(defalias 's-contains-p 's-contains?)
|
||||
(defalias 's-ends-with-p 's-ends-with?)
|
||||
(defalias 's-equals-p 's-equals?)
|
||||
(defalias 's-less-p 's-less?)
|
||||
(defalias 's-lowercase-p 's-lowercase?)
|
||||
(defalias 's-matches-p 's-matches?)
|
||||
(defalias 's-mixedcase-p 's-mixedcase?)
|
||||
(defalias 's-numeric-p 's-numeric?)
|
||||
(defalias 's-prefix-p 's-starts-with?)
|
||||
(defalias 's-prefix? 's-starts-with?)
|
||||
(defalias 's-present-p 's-present?)
|
||||
(defalias 's-starts-with-p 's-starts-with?)
|
||||
(defalias 's-suffix-p 's-ends-with?)
|
||||
(defalias 's-suffix? 's-ends-with?)
|
||||
(defalias 's-uppercase-p 's-uppercase?)
|
||||
|
||||
|
||||
(provide 's)
|
||||
;;; s.el ends here
|
||||
1818
.emacs.d/lisp/swiper.el
Normal file
1818
.emacs.d/lisp/swiper.el
Normal file
File diff suppressed because it is too large
Load Diff
4767
.emacs.d/lisp/undo-tree.el
Normal file
4767
.emacs.d/lisp/undo-tree.el
Normal file
File diff suppressed because it is too large
Load Diff
BIN
.emacs.d/logo.jpg
Normal file
BIN
.emacs.d/logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
41
.emacs.d/themes/bedroom-theme.el
Normal file
41
.emacs.d/themes/bedroom-theme.el
Normal file
@@ -0,0 +1,41 @@
|
||||
;;; bedroom-theme.el --- Max's dark color theme -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; A dark color theme based on Max's personal color settings.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme bedroom
|
||||
"Max's dark color theme.")
|
||||
|
||||
(custom-theme-set-faces
|
||||
'bedroom
|
||||
;; Basic faces
|
||||
'(default ((t (:foreground "#DADEE5" :background "#141B2B"))))
|
||||
'(cursor ((t (:background "#FF69B4"))))
|
||||
'(region ((t (:background "#15285A"))))
|
||||
'(hl-line ((t (:background "#000000"))))
|
||||
'(highlight ((t (:background "#15285A"))))
|
||||
'(mode-line ((t (:background "#d3b58d" :foreground "#141B2B"))))
|
||||
'(mode-line-inactive ((t (:inverse-video t))))
|
||||
|
||||
;; Font lock faces
|
||||
'(font-lock-builtin-face ((t (:foreground "#DADEE5"))))
|
||||
'(font-lock-comment-face ((t (:foreground "#87919D"))))
|
||||
'(font-lock-string-face ((t (:foreground "#d3b58d"))))
|
||||
'(font-lock-keyword-face ((t (:foreground "#c47616"))))
|
||||
'(font-lock-function-name-face ((t (:foreground "#DADEE5"))))
|
||||
'(font-lock-variable-name-face ((t (:foreground "#DADEE5"))))
|
||||
'(font-lock-constant-face ((t (:foreground "#BBABC3"))))
|
||||
'(font-lock-type-face ((t (:foreground "#85B8DE"))))
|
||||
'(font-lock-warning-face ((t (:foreground "#FC2D07"))))
|
||||
|
||||
;; Custom/widget faces
|
||||
'(custom-group-tag ((t (:underline t :foreground "lightblue"))))
|
||||
'(custom-variable-tag ((t (:underline t :foreground "lightblue"))))
|
||||
'(widget-field ((t (:foreground "white"))))
|
||||
'(widget-single-line-field ((t (:background "darkgray")))))
|
||||
|
||||
(provide-theme 'bedroom)
|
||||
|
||||
;;; bedroom-theme.el ends here
|
||||
129
.emacs.d/themes/fleury-theme.el
Normal file
129
.emacs.d/themes/fleury-theme.el
Normal file
@@ -0,0 +1,129 @@
|
||||
;;; fleury-theme.el --- The fleury color theme
|
||||
|
||||
;; Copyright (C) 2025 Shams Parvez Arka
|
||||
;; See end of file for extended copyright information
|
||||
|
||||
;; Author : Shams Parvez Arka <parvez6826@gmail.com>
|
||||
;; URL : https://github.com/ShamsParvezArka/fleury-theme.el
|
||||
;; Version : 0.5
|
||||
;; Commentary: "Coming up with an original idea in 21st century
|
||||
;; is tough, even my dreams aren't original anymore!"
|
||||
|
||||
|
||||
(deftheme fleury "The fleury color theme")
|
||||
|
||||
;; Color palette
|
||||
(let ((rich-black "#020202")
|
||||
(light-bronze "#b99468")
|
||||
(charcoal-gray "#212121")
|
||||
(charcoal-gray-lite "#1e1e1e")
|
||||
(gunmetal-blue "#303040")
|
||||
(dark-slate "#222425")
|
||||
(amber-gold "#fcaa05")
|
||||
(medium-gray "#404040")
|
||||
(jet-black "#121212")
|
||||
(dim-gray "#666666")
|
||||
(goldenrod "#f0c674")
|
||||
(bright-orange "#ffaa00")
|
||||
(dusty-rose "#dc7575")
|
||||
(sunflower-yellow "#edb211")
|
||||
(burnt-orange "#de451f")
|
||||
(sky-blue "#2895c7")
|
||||
(sky-blue-lite "#2f2f38")
|
||||
(bright-red "#ff0000")
|
||||
(fresh-green "#66bc11")
|
||||
(lime-green "#003939")
|
||||
(vivid-vermilion "#f0500c")
|
||||
(golden-yellow "#f0bb0c")
|
||||
(pure-black "#000000")
|
||||
(aqua-ice "#8ffff2")
|
||||
(dusty-sage "#9ba290")
|
||||
(coffee-brown "#63523d")
|
||||
|
||||
(mode-line-foreground-active "#e7aa4d")
|
||||
(mode-line-background-active "#1a120b")
|
||||
(mode-line-border "#161616")
|
||||
)
|
||||
|
||||
(custom-theme-set-faces
|
||||
'fleury
|
||||
|
||||
;; UI Elements
|
||||
`(default ((t (:background ,rich-black :foreground ,light-bronze))))
|
||||
`(cursor ((t (:background ,fresh-green))))
|
||||
`(region ((t (:background ,lime-green))))
|
||||
`(highlight ((t (:background ,charcoal-gray-lite))))
|
||||
`(fringe ((t (:background ,dark-slate))))
|
||||
`(vertical-border ((t (:foreground ,dark-slate))))
|
||||
`(minibuffer-prompt ((t (:foreground ,amber-gold :weight bold))))
|
||||
|
||||
;; Line Numbers
|
||||
`(line-number ((t (:foreground ,medium-gray :background ,rich-black))))
|
||||
`(line-number-current-line ((t (:background ,charcoal-gray-lite :foreground ,light-bronze))))
|
||||
|
||||
;; Font Lock Faces
|
||||
`(font-lock-comment-face ((t (:foreground ,dim-gray))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,goldenrod))))
|
||||
`(font-lock-string-face ((t (:foreground ,bright-orange))))
|
||||
`(font-lock-constant-face ((t (:foreground ,bright-orange))))
|
||||
`(font-lock-builtin-face ((t (:foreground ,dusty-rose))))
|
||||
`(font-lock-preprocessor-face ((t (:foreground,dusty-rose))))
|
||||
`(font-lock-type-face ((t (:foreground ,sunflower-yellow))))
|
||||
`(font-lock-function-name-face ((t (:foreground ,burnt-orange))))
|
||||
`(font-lock-variable-name-face ((t (:foreground ,light-bronze))))
|
||||
`(font-lock-variable-use-face ((t (:foreground ,sky-blue))))
|
||||
`(font-lock-preprocessor-face ((t (:foreground ,dusty-rose))))
|
||||
`(font-lock-warning-face ((t (:foreground ,bright-red :weight bold))))
|
||||
`(font-lock-doc-face ((t (:foreground ,fresh-green))))
|
||||
|
||||
;; Mode Line
|
||||
`(mode-line ((t (:background ,mode-line-background-active :foreground ,mode-line-foreground-active :box (:line-width 1 :color ,mode-line-border :style nil)))))
|
||||
`(mode-line-inactive ((t (:background ,rich-black :foreground ,mode-line-foreground-active :box (:line-width 1 :color ,mode-line-border :style nil)))))
|
||||
|
||||
;; Search & String Matching
|
||||
`(match ((t (:background ,golden-yellow :foreground ,pure-black))))
|
||||
`(isearch ((t (:background ,vivid-vermilion :foreground ,pure-black))))
|
||||
`(lazy-highlight ((t (:background ,golden-yellow :foreground ,pure-black))))
|
||||
`(ido-first-match ((t (:foreground ,golden-yellow))))
|
||||
`(ido-only-match ((t (:foreground ,vivid-vermilion))))
|
||||
|
||||
;; Custom Elements
|
||||
`(show-paren-match ((t (:background ,sky-blue-lite))))
|
||||
`(show-paren-mismatch ((t (:background ,dusty-sage))))
|
||||
|
||||
;; Tooltip and Popup
|
||||
`(tooltip ((t (:background ,coffee-brown :foreground ,amber-gold))))
|
||||
|
||||
;; Compilation
|
||||
`(flycheck-error ((t (:underline (:color ,bright-red :style wave)))))
|
||||
`(compilation-error ((t (:foreground ,bright-red))))
|
||||
`(compilation-info ((t ,(list :foreground fresh-green :inherit 'unspecified))))
|
||||
`(compilation-warning ((t ,(list :foreground coffee-brown :bold t :inherit 'unspecified))))
|
||||
`(compilation-mode-line-fail ((t ,(list :foreground bright-red :weight 'bold :inherit 'unspecified))))
|
||||
`(compilation-mode-line-exit ((t ,(list :foreground fresh-green :weight 'bold :inherit 'unspecified))))
|
||||
))
|
||||
|
||||
(provide-theme 'fleury)
|
||||
|
||||
|
||||
;; MIT License
|
||||
|
||||
;; Copyright (c) 2025 Shams Parvez Arka
|
||||
|
||||
;; Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
;; of this software and associated documentation files (the "Software"), to deal
|
||||
;; in the Software without restriction, including without limitation the rights
|
||||
;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
;; copies of the Software, and to permit persons to whom the Software is
|
||||
;; furnished to do so, subject to the following conditions:
|
||||
|
||||
;; The above copyright notice and this permission notice shall be included in all
|
||||
;; copies or substantial portions of the Software.
|
||||
|
||||
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
;; SOFTWARE.
|
||||
425
.emacs.d/themes/gruber-darker-theme.el
Normal file
425
.emacs.d/themes/gruber-darker-theme.el
Normal file
@@ -0,0 +1,425 @@
|
||||
;;; gruber-darker-theme.el --- Gruber Darker color theme for Emacs 24.
|
||||
|
||||
;; Copyright (C) 2013-2016 Alexey Kutepov a.k.a rexim
|
||||
;; Copyright (C) 2009-2010 Jason R. Blevins
|
||||
|
||||
;; Author: Alexey Kutepov <reximkut@gmail.com>
|
||||
;; URL: http://github.com/rexim/gruber-darker-theme
|
||||
;; Version: 0.7
|
||||
|
||||
;; Permission is hereby granted, free of charge, to any person
|
||||
;; obtaining a copy of this software and associated documentation
|
||||
;; files (the "Software"), to deal in the Software without
|
||||
;; restriction, including without limitation the rights to use, copy,
|
||||
;; modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
;; of the Software, and to permit persons to whom the Software is
|
||||
;; furnished to do so, subject to the following conditions:
|
||||
|
||||
;; The above copyright notice and this permission notice shall be
|
||||
;; included in all copies or substantial portions of the Software.
|
||||
|
||||
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
;; SOFTWARE.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; Gruber Darker color theme for Emacs by Jason Blevins. A darker
|
||||
;; variant of the Gruber Dark theme for BBEdit by John Gruber. Adapted
|
||||
;; for deftheme and extended by Alexey Kutepov a.k.a. rexim.
|
||||
|
||||
|
||||
(deftheme gruber-darker
|
||||
"Gruber Darker color theme for Emacs 24")
|
||||
|
||||
;; Please, install rainbow-mode.
|
||||
;; Colors with +x are lighter. Colors with -x are darker.
|
||||
(let ((gruber-darker-fg "#e4e4ef")
|
||||
(gruber-darker-fg+1 "#f4f4ff")
|
||||
(gruber-darker-fg+2 "#f5f5f5")
|
||||
(gruber-darker-white "#ffffff")
|
||||
(gruber-darker-black "#000000")
|
||||
(gruber-darker-bg-1 "#101010")
|
||||
(gruber-darker-bg "#181818")
|
||||
(gruber-darker-bg+1 "#282828")
|
||||
(gruber-darker-bg+2 "#453d41")
|
||||
(gruber-darker-bg+3 "#484848")
|
||||
(gruber-darker-bg+4 "#52494e")
|
||||
(gruber-darker-red-1 "#c73c3f")
|
||||
(gruber-darker-red "#f43841")
|
||||
(gruber-darker-red+1 "#ff4f58")
|
||||
(gruber-darker-green "#73c936")
|
||||
(gruber-darker-yellow "#ffdd33")
|
||||
(gruber-darker-brown "#cc8c3c")
|
||||
(gruber-darker-quartz "#95a99f")
|
||||
(gruber-darker-niagara-2 "#303540")
|
||||
(gruber-darker-niagara-1 "#565f73")
|
||||
(gruber-darker-niagara "#96a6c8")
|
||||
(gruber-darker-wisteria "#9e95c7")
|
||||
)
|
||||
(custom-theme-set-variables
|
||||
'gruber-darker
|
||||
'(frame-brackground-mode (quote dark)))
|
||||
|
||||
(custom-theme-set-faces
|
||||
'gruber-darker
|
||||
|
||||
;; Agda2
|
||||
`(agda2-highlight-datatype-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(agda2-highlight-primitive-type-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(agda2-highlight-function-face ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(agda2-highlight-keyword-face ((t ,(list :foreground gruber-darker-yellow
|
||||
:bold t))))
|
||||
`(agda2-highlight-inductive-constructor-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(agda2-highlight-number-face ((t (:foreground ,gruber-darker-wisteria))))
|
||||
|
||||
;; AUCTeX
|
||||
`(font-latex-bold-face ((t (:foreground ,gruber-darker-quartz :bold t))))
|
||||
`(font-latex-italic-face ((t (:foreground ,gruber-darker-quartz :italic t))))
|
||||
`(font-latex-math-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(font-latex-sectioning-5-face ((t ,(list :foreground gruber-darker-niagara
|
||||
:bold t))))
|
||||
`(font-latex-slide-title-face ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(font-latex-string-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(font-latex-warning-face ((t (:foreground ,gruber-darker-red))))
|
||||
|
||||
;; Basic Coloring (or Uncategorized)
|
||||
`(border ((t ,(list :background gruber-darker-bg-1
|
||||
:foreground gruber-darker-bg+2))))
|
||||
`(cursor ((t (:background ,gruber-darker-yellow))))
|
||||
`(default ((t ,(list :foreground gruber-darker-fg
|
||||
:background gruber-darker-bg))))
|
||||
`(fringe ((t ,(list :background nil
|
||||
:foreground gruber-darker-bg+2))))
|
||||
`(vertical-border ((t ,(list :foreground gruber-darker-bg+2))))
|
||||
`(link ((t (:foreground ,gruber-darker-niagara :underline t))))
|
||||
`(link-visited ((t (:foreground ,gruber-darker-wisteria :underline t))))
|
||||
`(match ((t (:background ,gruber-darker-bg+4))))
|
||||
`(shadow ((t (:foreground ,gruber-darker-bg+4))))
|
||||
`(minibuffer-prompt ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(region ((t (:background ,gruber-darker-bg+3 :foreground nil))))
|
||||
`(secondary-selection ((t ,(list :background gruber-darker-bg+3
|
||||
:foreground nil))))
|
||||
`(trailing-whitespace ((t ,(list :foreground gruber-darker-black
|
||||
:background gruber-darker-red))))
|
||||
`(tooltip ((t ,(list :background gruber-darker-bg+4
|
||||
:foreground gruber-darker-white))))
|
||||
|
||||
;; Calendar
|
||||
`(holiday-face ((t (:foreground ,gruber-darker-red))))
|
||||
|
||||
;; Compilation
|
||||
`(compilation-info ((t ,(list :foreground gruber-darker-green
|
||||
:inherit 'unspecified))))
|
||||
`(compilation-warning ((t ,(list :foreground gruber-darker-brown
|
||||
:bold t
|
||||
:inherit 'unspecified))))
|
||||
`(compilation-error ((t (:foreground ,gruber-darker-red+1))))
|
||||
`(compilation-mode-line-fail ((t ,(list :foreground gruber-darker-red
|
||||
:weight 'bold
|
||||
:inherit 'unspecified))))
|
||||
`(compilation-mode-line-exit ((t ,(list :foreground gruber-darker-green
|
||||
:weight 'bold
|
||||
:inherit 'unspecified))))
|
||||
|
||||
;; Completion
|
||||
`(completions-annotations ((t (:inherit 'shadow))))
|
||||
|
||||
;; Custom
|
||||
`(custom-state ((t (:foreground ,gruber-darker-green))))
|
||||
|
||||
;; Diff
|
||||
`(diff-removed ((t ,(list :foreground gruber-darker-red+1
|
||||
:background nil))))
|
||||
`(diff-added ((t ,(list :foreground gruber-darker-green
|
||||
:background nil))))
|
||||
|
||||
;; Dired
|
||||
`(dired-directory ((t (:foreground ,gruber-darker-niagara :weight bold))))
|
||||
`(dired-ignored ((t ,(list :foreground gruber-darker-quartz
|
||||
:inherit 'unspecified))))
|
||||
|
||||
;; Ebrowse
|
||||
`(ebrowse-root-class ((t (:foreground ,gruber-darker-niagara :weight bold))))
|
||||
`(ebrowse-progress ((t (:background ,gruber-darker-niagara))))
|
||||
|
||||
;; Egg
|
||||
`(egg-branch ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(egg-branch-mono ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(egg-diff-add ((t (:foreground ,gruber-darker-green))))
|
||||
`(egg-diff-del ((t (:foreground ,gruber-darker-red))))
|
||||
`(egg-diff-file-header ((t (:foreground ,gruber-darker-wisteria))))
|
||||
`(egg-help-header-1 ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(egg-help-header-2 ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(egg-log-HEAD-name ((t (:box (:color ,gruber-darker-fg)))))
|
||||
`(egg-reflog-mono ((t (:foreground ,gruber-darker-niagara-1))))
|
||||
`(egg-section-title ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(egg-text-base ((t (:foreground ,gruber-darker-fg))))
|
||||
`(egg-term ((t (:foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; ERC
|
||||
`(erc-notice-face ((t (:foreground ,gruber-darker-wisteria))))
|
||||
`(erc-timestamp-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(erc-input-face ((t (:foreground ,gruber-darker-red+1))))
|
||||
`(erc-my-nick-face ((t (:foreground ,gruber-darker-red+1))))
|
||||
|
||||
;; EShell
|
||||
`(eshell-ls-backup ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(eshell-ls-directory ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(eshell-ls-executable ((t (:foreground ,gruber-darker-green))))
|
||||
`(eshell-ls-symlink ((t (:foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; Font Lock
|
||||
`(font-lock-builtin-face ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(font-lock-comment-face ((t (:foreground ,gruber-darker-brown))))
|
||||
`(font-lock-comment-delimiter-face ((t (:foreground ,gruber-darker-brown))))
|
||||
`(font-lock-constant-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(font-lock-doc-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(font-lock-doc-string-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(font-lock-function-name-face ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,gruber-darker-yellow :bold t))))
|
||||
`(font-lock-preprocessor-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(font-lock-reference-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(font-lock-string-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(font-lock-type-face ((t (:foreground ,gruber-darker-quartz))))
|
||||
`(font-lock-variable-name-face ((t (:foreground ,gruber-darker-fg+1))))
|
||||
`(font-lock-warning-face ((t (:foreground ,gruber-darker-red))))
|
||||
|
||||
;; Flymake
|
||||
`(flymake-errline
|
||||
((((supports :underline (:style wave)))
|
||||
(:underline (:style wave :color ,gruber-darker-red)
|
||||
:foreground unspecified
|
||||
:background unspecified
|
||||
:inherit unspecified))
|
||||
(t (:foreground ,gruber-darker-red :weight bold :underline t))))
|
||||
`(flymake-warnline
|
||||
((((supports :underline (:style wave)))
|
||||
(:underline (:style wave :color ,gruber-darker-yellow)
|
||||
:foreground unspecified
|
||||
:background unspecified
|
||||
:inherit unspecified))
|
||||
(t (:forground ,gruber-darker-yellow :weight bold :underline t))))
|
||||
`(flymake-infoline
|
||||
((((supports :underline (:style wave)))
|
||||
(:underline (:style wave :color ,gruber-darker-green)
|
||||
:foreground unspecified
|
||||
:background unspecified
|
||||
:inherit unspecified))
|
||||
(t (:forground ,gruber-darker-green :weight bold :underline t))))
|
||||
|
||||
;; Flyspell
|
||||
`(flyspell-incorrect
|
||||
((((supports :underline (:style wave)))
|
||||
(:underline (:style wave :color ,gruber-darker-red) :inherit unspecified))
|
||||
(t (:foreground ,gruber-darker-red :weight bold :underline t))))
|
||||
`(flyspell-duplicate
|
||||
((((supports :underline (:style wave)))
|
||||
(:underline (:style wave :color ,gruber-darker-yellow) :inherit unspecified))
|
||||
(t (:foreground ,gruber-darker-yellow :weight bold :underline t))))
|
||||
|
||||
;; Helm
|
||||
`(helm-candidate-number ((t ,(list :background gruber-darker-bg+2
|
||||
:foreground gruber-darker-yellow
|
||||
:bold t))))
|
||||
`(helm-ff-directory ((t ,(list :foreground gruber-darker-niagara
|
||||
:background gruber-darker-bg
|
||||
:bold t))))
|
||||
`(helm-ff-executable ((t (:foreground ,gruber-darker-green))))
|
||||
`(helm-ff-file ((t (:foreground ,gruber-darker-fg :inherit unspecified))))
|
||||
`(helm-ff-invalid-symlink ((t ,(list :foreground gruber-darker-bg
|
||||
:background gruber-darker-red))))
|
||||
`(helm-ff-symlink ((t (:foreground ,gruber-darker-yellow :bold t))))
|
||||
`(helm-selection-line ((t (:background ,gruber-darker-bg+1))))
|
||||
`(helm-selection ((t (:background ,gruber-darker-bg+1 :underline nil))))
|
||||
`(helm-source-header ((t ,(list :foreground gruber-darker-yellow
|
||||
:background gruber-darker-bg
|
||||
:box (list :line-width -1
|
||||
:style 'released-button)))))
|
||||
|
||||
;; Ido
|
||||
`(ido-first-match ((t (:foreground ,gruber-darker-yellow :bold nil))))
|
||||
`(ido-only-match ((t (:foreground ,gruber-darker-brown :weight bold))))
|
||||
`(ido-subdir ((t (:foreground ,gruber-darker-niagara :weight bold))))
|
||||
|
||||
;; Info
|
||||
`(info-xref ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(info-visited ((t (:foreground ,gruber-darker-wisteria))))
|
||||
|
||||
;; Jabber
|
||||
`(jabber-chat-prompt-foreign ((t ,(list :foreground gruber-darker-quartz
|
||||
:bold nil))))
|
||||
`(jabber-chat-prompt-local ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(jabber-chat-prompt-system ((t (:foreground ,gruber-darker-green))))
|
||||
`(jabber-rare-time-face ((t (:foreground ,gruber-darker-green))))
|
||||
`(jabber-roster-user-online ((t (:foreground ,gruber-darker-green))))
|
||||
`(jabber-activity-face ((t (:foreground ,gruber-darker-red))))
|
||||
`(jabber-activity-personal-face ((t (:foreground ,gruber-darker-yellow :bold t))))
|
||||
|
||||
;; Line Highlighting
|
||||
`(highlight ((t (:background ,gruber-darker-bg+1 :foreground nil))))
|
||||
`(highlight-current-line-face ((t ,(list :background gruber-darker-bg+1
|
||||
:foreground nil))))
|
||||
|
||||
;; line numbers
|
||||
`(line-number ((t (:inherit default :foreground ,gruber-darker-bg+4))))
|
||||
`(line-number-current-line ((t (:inherit line-number :foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; Linum
|
||||
`(linum ((t `(list :foreground gruber-darker-quartz
|
||||
:background gruber-darker-bg))))
|
||||
|
||||
;; Magit
|
||||
`(magit-branch ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(magit-diff-hunk-header ((t (:background ,gruber-darker-bg+2))))
|
||||
`(magit-diff-file-header ((t (:background ,gruber-darker-bg+4))))
|
||||
`(magit-log-sha1 ((t (:foreground ,gruber-darker-red+1))))
|
||||
`(magit-log-author ((t (:foreground ,gruber-darker-brown))))
|
||||
`(magit-log-head-label-remote ((t ,(list :foreground gruber-darker-green
|
||||
:background gruber-darker-bg+1))))
|
||||
`(magit-log-head-label-local ((t ,(list :foreground gruber-darker-niagara
|
||||
:background gruber-darker-bg+1))))
|
||||
`(magit-log-head-label-tags ((t ,(list :foreground gruber-darker-yellow
|
||||
:background gruber-darker-bg+1))))
|
||||
`(magit-log-head-label-head ((t ,(list :foreground gruber-darker-fg
|
||||
:background gruber-darker-bg+1))))
|
||||
`(magit-item-highlight ((t (:background ,gruber-darker-bg+1))))
|
||||
`(magit-tag ((t ,(list :foreground gruber-darker-yellow
|
||||
:background gruber-darker-bg))))
|
||||
`(magit-blame-heading ((t ,(list :background gruber-darker-bg+1
|
||||
:foreground gruber-darker-fg))))
|
||||
|
||||
;; Message
|
||||
`(message-header-name ((t (:foreground ,gruber-darker-green))))
|
||||
|
||||
;; Mode Line
|
||||
`(mode-line ((t ,(list :background gruber-darker-bg+1
|
||||
:foreground gruber-darker-white))))
|
||||
`(mode-line-buffer-id ((t ,(list :background gruber-darker-bg+1
|
||||
:foreground gruber-darker-white))))
|
||||
`(mode-line-inactive ((t ,(list :background gruber-darker-bg+1
|
||||
:foreground gruber-darker-quartz))))
|
||||
|
||||
;; Neo Dir
|
||||
`(neo-dir-link-face ((t (:foreground ,gruber-darker-niagara))))
|
||||
|
||||
;; Org Mode
|
||||
`(org-agenda-structure ((t (:foreground ,gruber-darker-niagara))))
|
||||
`(org-column ((t (:background ,gruber-darker-bg-1))))
|
||||
`(org-column-title ((t (:background ,gruber-darker-bg-1 :underline t :weight bold))))
|
||||
`(org-done ((t (:foreground ,gruber-darker-green))))
|
||||
`(org-todo ((t (:foreground ,gruber-darker-red-1))))
|
||||
`(org-upcoming-deadline ((t (:foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; Search
|
||||
`(isearch ((t ,(list :foreground gruber-darker-black
|
||||
:background gruber-darker-fg+2))))
|
||||
`(isearch-fail ((t ,(list :foreground gruber-darker-black
|
||||
:background gruber-darker-red))))
|
||||
`(isearch-lazy-highlight-face ((t ,(list
|
||||
:foreground gruber-darker-fg+1
|
||||
:background gruber-darker-niagara-1))))
|
||||
|
||||
;; Sh
|
||||
`(sh-quoted-exec ((t (:foreground ,gruber-darker-red+1))))
|
||||
|
||||
;; Show Paren
|
||||
`(show-paren-match-face ((t (:background ,gruber-darker-bg+4))))
|
||||
`(show-paren-mismatch-face ((t (:background ,gruber-darker-red-1))))
|
||||
|
||||
;; Slime
|
||||
`(slime-repl-inputed-output-face ((t (:foreground ,gruber-darker-red))))
|
||||
|
||||
;; Tuareg
|
||||
`(tuareg-font-lock-governing-face ((t (:foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; Speedbar
|
||||
`(speedbar-directory-face ((t ,(list :foreground gruber-darker-niagara
|
||||
:weight 'bold))))
|
||||
`(speedbar-file-face ((t (:foreground ,gruber-darker-fg))))
|
||||
`(speedbar-highlight-face ((t (:background ,gruber-darker-bg+1))))
|
||||
`(speedbar-selected-face ((t (:foreground ,gruber-darker-red))))
|
||||
`(speedbar-tag-face ((t (:foreground ,gruber-darker-yellow))))
|
||||
|
||||
;; Which Function
|
||||
`(which-func ((t (:foreground ,gruber-darker-wisteria))))
|
||||
|
||||
;; Whitespace
|
||||
`(whitespace-space ((t ,(list :background gruber-darker-bg
|
||||
:foreground gruber-darker-bg+1))))
|
||||
`(whitespace-tab ((t ,(list :background gruber-darker-bg
|
||||
:foreground gruber-darker-bg+1))))
|
||||
`(whitespace-hspace ((t ,(list :background gruber-darker-bg
|
||||
:foreground gruber-darker-bg+2))))
|
||||
`(whitespace-line ((t ,(list :background gruber-darker-bg+2
|
||||
:foreground gruber-darker-red+1))))
|
||||
`(whitespace-newline ((t ,(list :background gruber-darker-bg
|
||||
:foreground gruber-darker-bg+2))))
|
||||
`(whitespace-trailing ((t ,(list :background gruber-darker-red
|
||||
:foreground gruber-darker-red))))
|
||||
`(whitespace-empty ((t ,(list :background gruber-darker-yellow
|
||||
:foreground gruber-darker-yellow))))
|
||||
`(whitespace-indentation ((t ,(list :background gruber-darker-yellow
|
||||
:foreground gruber-darker-red))))
|
||||
`(whitespace-space-after-tab ((t ,(list :background gruber-darker-yellow
|
||||
:foreground gruber-darker-yellow))))
|
||||
`(whitespace-space-before-tab ((t ,(list :background gruber-darker-brown
|
||||
:foreground gruber-darker-brown))))
|
||||
|
||||
;; tab-bar
|
||||
`(tab-bar ((t (:background ,gruber-darker-bg+1 :foreground ,gruber-darker-bg+4))))
|
||||
`(tab-bar-tab ((t (:background nil :foreground ,gruber-darker-yellow :weight bold))))
|
||||
`(tab-bar-tab-inactive ((t (:background nil))))
|
||||
|
||||
;; vterm / ansi-term
|
||||
`(term-color-black ((t (:foreground ,gruber-darker-bg+3 :background ,gruber-darker-bg+4))))
|
||||
`(term-color-red ((t (:foreground ,gruber-darker-red-1 :background ,gruber-darker-red-1))))
|
||||
`(term-color-green ((t (:foreground ,gruber-darker-green :background ,gruber-darker-green))))
|
||||
`(term-color-blue ((t (:foreground ,gruber-darker-niagara :background ,gruber-darker-niagara))))
|
||||
`(term-color-yellow ((t (:foreground ,gruber-darker-yellow :background ,gruber-darker-yellow))))
|
||||
`(term-color-magenta ((t (:foreground ,gruber-darker-wisteria :background ,gruber-darker-wisteria))))
|
||||
`(term-color-cyan ((t (:foreground ,gruber-darker-quartz :background ,gruber-darker-quartz))))
|
||||
`(term-color-white ((t (:foreground ,gruber-darker-fg :background ,gruber-darker-white))))
|
||||
|
||||
;; company-mode
|
||||
`(company-tooltip ((t (:foreground ,gruber-darker-fg :background ,gruber-darker-bg+1))))
|
||||
`(company-tooltip-annotation ((t (:foreground ,gruber-darker-brown :background ,gruber-darker-bg+1))))
|
||||
`(company-tooltip-annotation-selection ((t (:foreground ,gruber-darker-brown :background ,gruber-darker-bg-1))))
|
||||
`(company-tooltip-selection ((t (:foreground ,gruber-darker-fg :background ,gruber-darker-bg-1))))
|
||||
`(company-tooltip-mouse ((t (:background ,gruber-darker-bg-1))))
|
||||
`(company-tooltip-common ((t (:foreground ,gruber-darker-green))))
|
||||
`(company-tooltip-common-selection ((t (:foreground ,gruber-darker-green))))
|
||||
`(company-scrollbar-fg ((t (:background ,gruber-darker-bg-1))))
|
||||
`(company-scrollbar-bg ((t (:background ,gruber-darker-bg+2))))
|
||||
`(company-preview ((t (:background ,gruber-darker-green))))
|
||||
`(company-preview-common ((t (:foreground ,gruber-darker-green :background ,gruber-darker-bg-1))))
|
||||
|
||||
;; Proof General
|
||||
`(proof-locked-face ((t (:background ,gruber-darker-niagara-2))))
|
||||
|
||||
;; Orderless
|
||||
`(orderless-match-face-0 ((t (:foreground ,gruber-darker-yellow))))
|
||||
`(orderless-match-face-1 ((t (:foreground ,gruber-darker-green))))
|
||||
`(orderless-match-face-2 ((t (:foreground ,gruber-darker-brown))))
|
||||
`(orderless-match-face-3 ((t (:foreground ,gruber-darker-quartz))))
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
(when load-file-name
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(file-name-as-directory (file-name-directory load-file-name))))
|
||||
|
||||
(provide-theme 'gruber-darker)
|
||||
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; indent-tabs-mode: nil
|
||||
;; eval: (when (fboundp 'rainbow-mode) (rainbow-mode +1))
|
||||
;; End:
|
||||
|
||||
;;; gruber-darker-theme.el ends here.
|
||||
71
.emacs.d/themes/handmade-theme.el
Normal file
71
.emacs.d/themes/handmade-theme.el
Normal file
@@ -0,0 +1,71 @@
|
||||
;;; handmade-theme.el --- A Handmade theme -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2022 Niko Pavlinek
|
||||
|
||||
;; This is free and unencumbered software released into the public domain.
|
||||
|
||||
;; Anyone is free to copy, modify, publish, use, compile, sell, or distribute
|
||||
;; this software, either in source code form or as a compiled binary, for any
|
||||
;; purpose, commercial or non-commercial, and by any means.
|
||||
|
||||
;; In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
;; software dedicate any and all copyright interest in the software to the
|
||||
;; public domain. We make this dedication for the benefit of the public at large
|
||||
;; and to the detriment of our heirs and successors. We intend this dedication
|
||||
;; to be an overt act of relinquishment in perpetuity of all present and future
|
||||
;; rights to this software under copyright law.
|
||||
|
||||
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR
|
||||
;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
;; AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
;; ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM, OUT OF OR IN CONNECTION
|
||||
;; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
;; For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
(deftheme handmade
|
||||
"A port of the Emacs theme used by Casey Muratori on the Handmade Hero series.")
|
||||
|
||||
(defface handmade-important-face nil "")
|
||||
(defface handmade-note-face nil "")
|
||||
(defface handmade-todo-face nil "")
|
||||
|
||||
(mapc (lambda (mode)
|
||||
(font-lock-add-keywords mode '(("\\<\\(IMPORTANT\\)" 1 'handmade-important-face t)
|
||||
("\\<\\(NOTE\\)" 1 'handmade-note-face t)
|
||||
("\\<\\(STUDY\\)" 1 'handmade-important-face t)
|
||||
("\\<\\(TODO\\)" 1 'handmade-todo-face t)
|
||||
("\\<\\(XXX\\)" 1 'handmade-todo-face t))))
|
||||
'(c-mode c++-mode emacs-lisp-mode))
|
||||
|
||||
(let ((handmade-beige "burlywood3")
|
||||
(handmade-dark-blue "midnight blue")
|
||||
(handmade-dark-gray "#161616")
|
||||
(handmade-dark-green "DarkGreen")
|
||||
(handmade-gold "DarkGoldenrod3")
|
||||
(handmade-light-beige "#dab98f")
|
||||
(handmade-light-gray "gray50")
|
||||
(handmade-light-green "#40ff40")
|
||||
(handmade-olive "olive drab")
|
||||
(handmade-red "Red")
|
||||
(handmade-yellow "Yellow"))
|
||||
(custom-theme-set-faces
|
||||
'handmade
|
||||
`(cursor ((t (:background ,handmade-light-green))))
|
||||
`(default ((t (:background ,handmade-dark-gray :foreground ,handmade-beige))))
|
||||
`(font-lock-builtin-face ((t (:foreground ,handmade-light-beige))))
|
||||
`(font-lock-comment-face ((t (:foreground ,handmade-light-gray))))
|
||||
`(font-lock-constant-face ((t (:foreground ,handmade-olive))))
|
||||
`(font-lock-doc-face ((t (:foreground ,handmade-light-gray))))
|
||||
`(font-lock-function-name-face ((t (:foreground ,handmade-beige))))
|
||||
`(font-lock-keyword-face ((t (:foreground ,handmade-gold))))
|
||||
`(font-lock-string-face ((t (:foreground ,handmade-olive))))
|
||||
`(font-lock-type-face ((t (:foreground ,handmade-beige))))
|
||||
`(font-lock-variable-name-face ((t (:foreground ,handmade-beige))))
|
||||
`(handmade-important-face ((t (:foreground ,handmade-yellow :weight bold :underline t))))
|
||||
`(handmade-note-face ((t (:foreground ,handmade-dark-green :weight bold :underline t))))
|
||||
`(handmade-todo-face ((t (:foreground ,handmade-red :weight bold :underline t))))
|
||||
`(hl-line ((t (:background ,handmade-dark-blue))))))
|
||||
|
||||
(provide-theme 'handmade)
|
||||
37
.emacs.d/themes/witness-theme.el
Normal file
37
.emacs.d/themes/witness-theme.el
Normal file
@@ -0,0 +1,37 @@
|
||||
;;; witness-theme.el --- Witness color theme -*- lexical-binding: t; -*-
|
||||
|
||||
;;; Commentary:
|
||||
;; A dark teal color theme.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme witness
|
||||
"Witness color theme - dark teal with green accents.")
|
||||
|
||||
(custom-theme-set-faces
|
||||
'witness
|
||||
;; Basic faces
|
||||
'(default ((t (:foreground "#d3b58d" :background "#072626"))))
|
||||
'(cursor ((t (:background "lightgreen"))))
|
||||
'(region ((t (:background "blue"))))
|
||||
'(highlight ((t (:foreground "navyblue" :background "darkseagreen2"))))
|
||||
'(mode-line ((t (:inverse-video t))))
|
||||
|
||||
;; Font lock faces
|
||||
'(font-lock-builtin-face ((t (:foreground "lightgreen"))))
|
||||
'(font-lock-comment-face ((t (:foreground "#3fdf1f"))))
|
||||
'(font-lock-string-face ((t (:foreground "#0fdfaf"))))
|
||||
'(font-lock-keyword-face ((t (:foreground "white"))))
|
||||
'(font-lock-function-name-face ((t (:foreground "white"))))
|
||||
'(font-lock-variable-name-face ((t (:foreground "#c8d4ec"))))
|
||||
'(font-lock-warning-face ((t (:foreground "#504038"))))
|
||||
|
||||
;; Custom/widget faces
|
||||
'(custom-group-tag ((t (:underline t :foreground "lightblue"))))
|
||||
'(custom-variable-tag ((t (:underline t :foreground "lightblue"))))
|
||||
'(widget-field ((t (:foreground "white"))))
|
||||
'(widget-single-line-field ((t (:background "darkgray")))))
|
||||
|
||||
(provide-theme 'witness)
|
||||
|
||||
;;; witness-theme.el ends here
|
||||
Reference in New Issue
Block a user