Compare commits

...

10 commits

Author SHA1 Message Date
Joe Ardent
e55bdb1944 add lsp-mode, rustic, blackout 2025-01-03 10:53:13 -08:00
Joe Ardent
2bab24ec08 mostly works 2025-01-03 10:53:10 -08:00
Joe Ardent
4f7e9c5797 tweak 2025-01-03 10:51:49 -08:00
Vedang Manerikar
c39d768c68 Set num:nil to fix Github link jumping 2025-01-03 22:11:20 +05:30
Vedang Manerikar
6465f82b90 Ask consult-imenu to start from the thing-at-point symbol 2025-01-03 21:46:43 +05:30
Vedang Manerikar
6e0f5e7730 Add ox-gfm for publishing org-mode to markdown
`ox-gfm` is part of my pipeline for publishing my Denote notes to my
website. I will write about this sometime soon and publish the Denote
side code for it as well.
2025-01-03 21:45:44 +05:30
Vedang Manerikar
153541e842 Only enable treesit for modes where treesit-ready-p is true 2024-12-30 11:49:03 +05:30
Vedang Manerikar
d6fcc00bd4 Improve the explanation for toc-org-mode 2024-12-30 11:38:34 +05:30
Vedang Manerikar
62e52f2aab Add a Local Variables section to load toc-org-mode in unravel-emacs 2024-12-30 11:28:54 +05:30
Vedang Manerikar
65c884db6c Add noccur-dired for multi-occur in dired buffers 2024-12-29 21:32:04 +05:30
17 changed files with 1455 additions and 2606 deletions

View file

@ -0,0 +1,17 @@
;; stand-in
(global-set-key [C-tab] #'other-window)
(global-set-key [C-S-tab] #'sother-window)
(global-set-key [C-iso-lefttab] #'sother-window)
(global-set-key [f4] #'nebkor/kill-buffer)
(global-set-key [f7] 'revert-buffer)
(setq-default auto-fill-function 'do-auto-fill)
(setq-default fill-column 100)
(turn-on-auto-fill)
(add-hook 'prog-mode-hook (lambda () (auto-fill-mode -1)))
(define-key icomplete-fido-mode-map (kbd "SPC") 'self-insert-command)
(add-hook 'before-save-hook #'delete-trailing-whitespace)
(fset 'yes-or-no-p 'y-or-n-p)
(provide 'nebkor-personal)

View file

@ -1,394 +0,0 @@
;;; Personal Basic settings
(use-package emacs
:ensure nil
:config
(setq user-mail-address "vedang@unravel.tech"))
(use-package org
:ensure nil
:config
(setq org-default-notes-file
(expand-file-name "brain/daily.org" org-directory))
(setq org-blogpost-file
(expand-file-name "brain/projects/blogposts.org" org-directory))
(setq org-crm-file
(expand-file-name "brain/projects/crm.org" org-directory))
(setq org-sales-file
(expand-file-name "brain/projects/sales.org" org-directory))
(setq org-company-file
(expand-file-name "brain/daily.org" org-directory))
(setq org-agenda-files
(append (list org-default-notes-file
(expand-file-name "brain/projects" org-directory)
(expand-file-name "brain/areas/prm.org" org-directory)))))
;;;; org-capture
(use-package org-capture
:ensure nil
:config
;;; Default definitions for variables used in capture templates
(when (not (boundp 'org-blogpost-file))
(defvar org-blogpost-file org-default-notes-file
"File in which blogposts and microblogposts are stored."))
(when (not (boundp 'org-company-file))
(defvar org-company-file org-default-notes-file
"File in which company documentation is stored."))
;;; *CRITICAL NOTE* Read before modifying the push stack below:
;; Pushing to capture templates is a stack. What goes in first shows
;; up at the bottom of the capture templates list.
;;; Templates for thinking tools
(push '("T" "Templates for Helping Me Think") org-capture-templates)
;; Capture a decision that you've taken, for review and reflection later.
(push `("Td" "Decision Journal" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.decision.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Create a Current Reality Tree for a problem
(push `("Tc" "Current Reality Tree" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.crt.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Create an Evaporating Cloud for a problem
(push `("Te" "Evaporating Cloud" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.ec.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Create a Future Reality Tree for a problem
(push `("Tf" "Future Reality Tree" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.frt.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Create a Prerequisite Tree for a problem
(push `("Tp" "Prerequisite Tree" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.prt.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Create a Transition Tree for a problem
(push `("Tt" "Transition Tree" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/thinking.trt.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Capture a new Business idea for sketching out / thinking through
(push `("Tb" "Business Canvas" entry
(file+headline org-default-notes-file "Helping Me Think")
(file ,(expand-file-name "capture-templates/business.canvas.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Capture a customer persona, note that this is always captured in
;; the current clocking task, and is something I should do under the
;; business canvas.
(push `("TP" "Customer Persona (under Business Canvas)" entry
(clock)
(file ,(expand-file-name "capture-templates/business.customer.persona.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Capture a customer journey through your product, note that this is
;; always captured in the current clocking task
(push `("Tj" "Customer Journey (under Business Canvas)" entry
(clock)
(file ,(expand-file-name "capture-templates/business.customer.journey.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;;; Templates for capturing data about myself on a day-to-day basis
(push '("d" "Templates for Capturing Data (personal)") org-capture-templates)
;; Capture weight / food. This seems hard to get into a laptop habit.
;; This is the kind of quantitative life that a mobile solution would
;; have helped with.
(push `("dw" "Weight Tracking" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/bodylog.weight.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t
:empty-lines 1)
org-capture-templates)
(push `("df" "Food Tracking" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/bodylog.food.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t
:empty-lines 1)
org-capture-templates)
(push `("dd" "Downtime Tracking" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/bodylog.dt.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t
:empty-lines 1)
org-capture-templates)
;;; Templates for capturing build in public ideas
(push '("b" "Templates for Capturing Build in Public") org-capture-templates)
;; Capture Micro-blogging
(push `("bm" "New Microblogging entry" entry
(file+olp+datetree org-blogpost-file "Microblogging")
(file ,(expand-file-name "capture-templates/microblog.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; New blogpost idea
(push `("bb" "New Blogpost entry" entry
(file+headline org-blogpost-file "Meta: Blogposts to write")
(file ,(expand-file-name "capture-templates/todo.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;;; Templates for when I want to capture specific feedback about something
(push '("f" "Templates for Feedback, Reflection, Journaling") org-capture-templates)
;; Capture feedback for people I am working with
(push `("fp" "Feedback for People I'm working with" item
(file+headline org-company-file "Feedback")
(file ,(expand-file-name "capture-templates/feedback.others.org" user-emacs-directory))
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; The monthly newsletter to send to investors, friends and mentors
(push `("fn" "Company Newsletters" entry
(file+headline org-company-file "Company Newsletters")
(file ,(expand-file-name "capture-templates/business.updates.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;; Capture suggestions / ideas from other people, which can be
;; expanded into actual projects later.
(push `("fs" "Ideas and Suggestions" entry
(file+headline org-company-file "Ideas and Suggestions")
(file ,(expand-file-name "capture-templates/suggestion.org" user-emacs-directory))
:prepend t
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;;; Templates for planning on a day-to-day basis
(push '("p" "Templates for Planning") org-capture-templates)
;; Deliberately plan out and make a routine out of start of day and
;; end of day activities.
(push `("ps" "The Start of Day Planning Routine" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/workday.start.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
(push `("pe" "The End of Day Reflection Routine" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/workday.end.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
(push `("pn" "The Next Day Intentions Routine" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/workday.next.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
;;; Templates for capturing meetings, events, something happening at this time
(push '("m" "Templates for Capturing Meetings or Events") org-capture-templates)
;; Capture an upcoming meeting or one that has already happened
(push `("mp" "Meeting some other day" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/meeting.org" user-emacs-directory))
:prepend t
:clock-in t
:clock-resume t
:time-prompt t)
org-capture-templates)
;; Capture notes for an ongoing meeting or a meeting that's already
;; happened.
(push `("mn" "Meeting today" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/meeting.org" user-emacs-directory))
:prepend t
:clock-in t
:clock-resume t)
org-capture-templates)
;;; Templates for Capturing Tasks
(push '("t" "Templates for Capturing Tasks") org-capture-templates)
;; Set up a new habit for tracking. This should be refiled to the
;; correct location later.
(push `("th" "Habit" entry
(file+headline org-default-notes-file "My Habit Tracker")
(file ,(expand-file-name "capture-templates/habit.org" user-emacs-directory)))
org-capture-templates)
;; One-click Capture for replying to emails from notmuch. Creates a
;; task to remind you that you need to reply to this email.
(push `("tr" "Respond to email" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/reply.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t)
org-capture-templates)
;; One-click capture of links from the clipboard. Used in conjunction
;; with `org-protocol', or as a stand-alone to capture links.
(push `("tw" "Website Link Immediate Capture" entry
(file+olp org-default-notes-file "Links Captured from the Browser")
(file ,(expand-file-name "capture-templates/website.org" user-emacs-directory))
:immediate-finish t)
org-capture-templates)
;; A more nuanced capture for browser links, which I use for cleaning
;; out my browser 2/3 times a week.
(push `("tl" "Website Link Pinboard Capture" entry
(file+olp org-default-notes-file "Links Captured from the Browser")
(file ,(expand-file-name "capture-templates/pinboard.capture.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t)
org-capture-templates)
;; Capture a task where someone expects me to communicate when it's done
(push `("tj" "Jira or External-facing Task" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/jira.org" user-emacs-directory))
:clock-in t
:clock-resume t)
org-capture-templates)
;; One-click Capture for Tasks. Captures the task immediately and gets
;; out of your way.
(push `("ti" "Simple Task Immediate Finish" entry
(file+olp+datetree org-default-notes-file)
(file ,(expand-file-name "capture-templates/todo.org" user-emacs-directory))
:clock-in t
:clock-resume t
:immediate-finish t)
org-capture-templates))
;;;; Sales and CRM capture templates
(use-package org-capture
:ensure nil
:config
;;; Default definitions for variables used in capture templates
(when (not (boundp 'org-crm-file))
(defvar org-crm-file org-default-notes-file
"File in which CRM data is stored."))
(when (not (boundp 'org-sales-file))
(defvar org-sales-file org-default-notes-file
"File in which Sales Deal data is stored."))
;;; *CRITICAL NOTE* Read before modifying the push stack below:
;; Pushing to capture templates is a stack. What goes in first shows
;; up at the bottom of the capture templates list.
(push '("s" "Sales and CRM templates") org-capture-templates)
(push `("sl" "New Sales Lead" entry
(file+headline org-sales-file "Leads to be Refiled")
(file ,(expand-file-name "capture-templates/sales.newlead.org" user-emacs-directory))
:prepend t
:kill-buffer t
:empty-lines-after 1
:clock-in t
:clock-resume t)
org-capture-templates)
(push `("sc" "New Company in CRM" entry
(file org-crm-file)
(file ,(expand-file-name "capture-templates/crm.newcompany.org" user-emacs-directory))
:prepend t
:clock-in t
:clock-resume t
:kill-buffer t
:empty-lines-after 1)
org-capture-templates)
(push `("sp" "New Person in CRM" entry
(file+headline org-crm-file "CRM to be Refiled")
(file ,(expand-file-name "capture-templates/crm.newperson.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates)
(push `("sm" "Sales Related Meeting" entry
(file+headline org-sales-file "Sales to be Refiled")
(file ,(expand-file-name "capture-templates/sales.newmeeting.org" user-emacs-directory))
:prepend nil
:clock-in t
:clock-resume t
:empty-lines 1)
org-capture-templates))
;;; Ledger for personal finance management, plain-text accounting
(use-package ledger-mode
:ensure t)
(provide 'vedang-personal)

42
init.el
View file

@ -1,12 +1,14 @@
;; init.el -*- lexical-binding: t; -*-
;; Make native compilation silent and prune its cache.
(when (native-comp-available-p)
(setq native-comp-async-report-warnings-errors 'silent) ; Emacs 28 with native compilation
(setq native-compile-prune-cache t)) ; Emacs 29
(set-language-environment "UTF-8")
;; Make native compilation silent and prune its cache.
(setq native-compile-prune-cache t)
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
;; Disable custom.el by making it disposable.
(setq custom-file (make-temp-file "emacs-custom-"))
;; (setq custom-file (make-temp-file "emacs-custom-"))
;; Enable these commands which have been disabled by default
(mapc
@ -23,7 +25,7 @@
(mapc
(lambda (string)
(add-to-list 'load-path (locate-user-emacs-file string)))
'("unravel-modules" "custom-lisp"))
'("nebkor-modules" "custom-lisp"))
;;; Install Elpaca
@ -110,24 +112,20 @@ making an abbreviation to a function."
(seq-split definitions 2)))
(error "%s is not an abbrev table" ,table)))
(require 'unravel-theme)
(require 'unravel-essentials)
(require 'unravel-completion)
(require 'unravel-search)
(require 'unravel-dired)
(require 'unravel-window)
(require 'unravel-git)
(require 'unravel-org)
(require 'unravel-shell)
(require 'unravel-langs)
(require 'unravel-study)
(require 'nebkor-theme)
(require 'nebkor-essentials)
(require 'nebkor-functions)
(require 'nebkor-completion)
(require 'nebkor-search)
(require 'nebkor-dired)
(require 'nebkor-window)
(require 'nebkor-git)
(require 'nebkor-org)
(require 'nebkor-langs)
(require 'nebkor-study)
;;; Comment this next line if you don't want to use my personal
;;; settings (like specific directories or org variables)
(require 'vedang-personal)
;; Name the default frame
;; You can select a frame with M-x select-frame-by-name
(add-hook 'elpaca-after-init-hook (lambda () (set-frame-name "unravel/emacs")))
(require 'nebkor-personal)
;; Local Variables:
;; no-byte-compile: t

File diff suppressed because it is too large Load diff

View file

@ -91,51 +91,49 @@
:ensure nil
:hook (elpaca-after-init . minibuffer-depth-indicate-mode)
:config
(setq read-minibuffer-restore-windows nil) ; Emacs 28
(setq enable-recursive-minibuffers t))
(use-package minibuf-eldef
:ensure nil
:hook (elpaca-after-init . minibuffer-electric-default-mode)
:config
(setq minibuffer-default-prompt-format " [%s]")) ; Emacs 29
;; (use-package minibuf-eldef
;; :ensure nil
;; :config
;; (setq minibuffer-default-prompt-format " [%s]")) ; Emacs 29
(use-package rfn-eshadow
:ensure nil
:hook (minibuffer-setup . cursor-intangible-mode)
:config
;; Not everything here comes from rfn-eshadow.el, but this is fine.
;; (use-package rfn-eshadow
;; :ensure nil
;; :hook (minibuffer-setup . cursor-intangible-mode)
;; :config
;; ;; Not everything here comes from rfn-eshadow.el, but this is fine.
(setq resize-mini-windows t)
(setq read-answer-short t) ; also check `use-short-answers' for Emacs28
(setq echo-keystrokes 0.25)
(setq kill-ring-max 60) ; Keep it small
;; (setq resize-mini-windows t)
;; (setq read-answer-short t) ; also check `use-short-answers' for Emacs28
;; (setq echo-keystrokes 0.25)
;; (setq kill-ring-max 60) ; Keep it small
;; Do not allow the cursor to move inside the minibuffer prompt. I
;; got this from the documentation of Daniel Mendler's Vertico
;; package: <https://github.com/minad/vertico>.
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
;; ;; Do not allow the cursor to move inside the minibuffer prompt. I
;; ;; got this from the documentation of Daniel Mendler's Vertico
;; ;; package: <https://github.com/minad/vertico>.
;; (setq minibuffer-prompt-properties
;; '(read-only t cursor-intangible t face minibuffer-prompt))
;; Add prompt indicator to `completing-read-multiple'. We display
;; [`completing-read-multiple': <separator>], e.g.,
;; [`completing-read-multiple': ,] if the separator is a comma. This
;; is adapted from the README of the `vertico' package by Daniel
;; Mendler. I made some small tweaks to propertize the segments of
;; the prompt.
(defun crm-indicator (args)
(cons (format "[`completing-read-multiple': %s] %s"
(propertize
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
'face 'error)
(car args))
(cdr args)))
;; ;; Add prompt indicator to `completing-read-multiple'. We display
;; ;; [`completing-read-multiple': <separator>], e.g.,
;; ;; [`completing-read-multiple': ,] if the separator is a comma. This
;; ;; is adapted from the README of the `vertico' package by Daniel
;; ;; Mendler. I made some small tweaks to propertize the segments of
;; ;; the prompt.
;; (defun crm-indicator (args)
;; (cons (format "[`completing-read-multiple': %s] %s"
;; (propertize
;; (replace-regexp-in-string
;; "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
;; crm-separator)
;; 'face 'error)
;; (car args))
;; (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; (advice-add #'completing-read-multiple :filter-args #'crm-indicator)
(file-name-shadow-mode 1))
;; (file-name-shadow-mode 1))
(use-package minibuffer
:ensure nil
@ -147,7 +145,7 @@
(setq completion-auto-select nil)
(setq completions-detailed t)
(setq completion-show-inline-help nil)
(setq completions-max-height 6)
(setq completions-max-height 10)
(setq completions-header-format (propertize "%s candidates:\n" 'face 'bold-italic))
(setq completions-highlight-face 'completions-highlight)
(setq minibuffer-completion-auto-choose t)
@ -276,6 +274,7 @@
(setq consult-preview-key 'any)
;; the `imenu' extension is in its own file
(require 'consult-imenu)
(consult-customize consult-imenu :initial (thing-at-point 'symbol))
(dolist (clj '(clojure-mode clojure-ts-mode))
(add-to-list 'consult-imenu-config
`(,clj :toplevel "Functions"
@ -287,84 +286,6 @@
(?v "Variables" font-lock-variable-name-face)))))
(add-to-list 'consult-mode-histories '(vc-git-log-edit-mode . log-edit-comment-ring)))
;;; Extended minibuffer actions and more (embark.el and prot-embark.el)
(use-package embark
:ensure t
:defer 1
:config
(setq embark-confirm-act-all nil)
(setq embark-mixed-indicator-both nil)
(setq embark-mixed-indicator-delay 1.0)
(setq embark-indicators '(embark-mixed-indicator embark-highlight-indicator))
(setq embark-verbose-indicator-nested nil) ; I think I don't have them, but I do not want them either
(setq embark-verbose-indicator-buffer-sections '(bindings))
(setq embark-verbose-indicator-excluded-actions
'(embark-cycle embark-act-all embark-collect embark-export embark-insert))
;; I never cycle and want to disable the damn thing. Normally, a
;; nil value disables a key binding but here that value is
;; interpreted as the binding for `embark-act'. So I just add
;; some obscure key that I do not have. I absolutely do not want
;; to cycle!
(setq embark-cycle-key "<XF86Travel>")
;; I do not want `embark-org' and am not sure what is loading it.
;; So I just unsert all the keymaps... This is the nuclear option
;; but here we are.
(with-eval-after-load 'embark-org
(defvar prot/embark-org-keymaps
'(embark-org-table-cell-map
embark-org-table-map
embark-org-link-copy-map
embark-org-link-map
embark-org-src-block-map
embark-org-item-map
embark-org-plain-list-map
embark-org-export-in-place-map)
"List of Embark keymaps for Org.")
;; Reset `prot/embark-org-keymaps'.
(seq-do
(lambda (keymap)
(set keymap (make-sparse-keymap)))
prot/embark-org-keymaps)))
;; I define my own keymaps because I only use a few functions in a
;; limited number of contexts.
(use-package prot-embark
:ensure nil
:after embark
:bind
( :map global-map
("C-," . prot-embark-act-no-quit)
("C-." . prot-embark-act-quit)
:map embark-collect-mode-map
("C-," . prot-embark-act-no-quit)
("C-." . prot-embark-act-quit)
:map minibuffer-local-filename-completion-map
("C-," . prot-embark-act-no-quit)
("C-." . prot-embark-act-quit))
:config
(setq embark-keymap-alist
'((buffer prot-embark-buffer-map)
(command prot-embark-command-map)
(expression prot-embark-expression-map)
(file prot-embark-file-map)
(function prot-embark-function-map)
(identifier prot-embark-identifier-map)
(package prot-embark-package-map)
(region prot-embark-region-map)
(symbol prot-embark-symbol-map)
(url prot-embark-url-map)
(variable prot-embark-variable-map)
(t embark-general-map))))
;; Needed for correct exporting while using Embark with Consult
;; commands.
(use-package embark-consult
:ensure t
:after (embark consult))
;;; Detailed completion annotations (marginalia.el)
(use-package marginalia
:ensure t
@ -378,16 +299,17 @@
:hook (elpaca-after-init . vertico-mode)
:config
(setq vertico-scroll-margin 0)
(setq vertico-count 5)
(setq vertico-count 8)
(setq vertico-resize t)
(setq vertico-cycle t)
(with-eval-after-load 'rfn-eshadow
;; This works with `file-name-shadow-mode' enabled. When you are in
;; a sub-directory and use, say, `find-file' to go to your home '~/'
;; or root '/' directory, Vertico will clear the old path to keep
;; only your current input.
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)))
;; (with-eval-after-load 'rfn-eshadow
;; ;; This works with `file-name-shadow-mode' enabled. When you are in
;; ;; a sub-directory and use, say, `find-file' to go to your home '~/'
;; ;; or root '/' directory, Vertico will clear the old path to keep
;; ;; only your current input.
;; (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy))
)
(use-package vertico-repeat
:after vertico
@ -398,11 +320,11 @@
("M-P" . vertico-repeat-previous))
:hook (minibuffer-setup . vertico-repeat-save))
(use-package vertico-suspend
:after vertico
;; Note: `enable-recursive-minibuffers' must be t
:bind ( :map global-map
("M-S" . vertico-suspend)
("C-x c b" . vertico-suspend)))
;; (use-package vertico-suspend
;; :after vertico
;; ;; Note: `enable-recursive-minibuffers' must be t
;; :bind ( :map global-map
;; ("M-S" . vertico-suspend)
;; ("C-x c b" . vertico-suspend)))
(provide 'unravel-completion)
(provide 'nebkor-completion)

View file

@ -12,7 +12,7 @@
:commands (dired)
:config
(setq insert-directory-program
(or (executable-find "gls") "/opt/homebrew/bin/gls"))
(or (executable-find "ls") "/opt/homebrew/bin/gls"))
(setq dired-listing-switches
"-AGFhlv --group-directories-first --time-style=long-iso"))
@ -39,6 +39,19 @@
;; problem as j calls `dired-goto-file', which I often use.
(define-key dired-jump-map (kbd "j") nil))
;;; Multi-occur in project and dired!
(use-package dired
:ensure nil
:bind
( :map dired-mode-map
("M-s a m" . noccur-dired))
:config
(defun noccur-dired (regexp &optional nlines)
"Perform `multi-occur' with REGEXP in all dired marked files.
When called with a prefix argument NLINES, display NLINES lines before and after."
(interactive (occur-read-primary-args))
(multi-occur (mapcar #'find-file (dired-get-marked-files)) regexp nlines)))
(use-package dired-aux
:ensure nil
:after dired
@ -97,4 +110,4 @@
(setq trashed-sort-key '("Date deleted" . t))
(setq trashed-date-format "%Y-%m-%d %H:%M:%S"))
(provide 'unravel-dired)
(provide 'nebkor-dired)

View file

@ -112,51 +112,36 @@
("M-w" . easy-kill)) ; re-map kill-ring-save
;;; Install and use tree-sitter major modes where possible
(when (treesit-available-p)
(use-package treesit-auto
:ensure t
:config
(setq treesit-auto-install 'prompt)
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode)))
(treesit-auto-add-to-auto-mode-alist)
(global-treesit-auto-mode))
;;; Mark syntactic constructs efficiently if tree-sitter is available (expreg)
(when (and (fboundp 'treesit-available-p)
(treesit-available-p))
(use-package expreg
:ensure t
:functions (prot/expreg-expand prot/expreg-expand-dwim)
:bind ("C-M-SPC" . prot/expreg-expand-dwim) ; overrides `mark-sexp'
:config
(defun prot/expreg-expand (n)
"Expand to N syntactic units, defaulting to 1 if none is provided interactively."
(interactive "p")
(dotimes (_ n)
(expreg-expand)))
(use-package expreg
:ensure t
:functions (prot/expreg-expand prot/expreg-expand-dwim)
:bind ("C-M-SPC" . prot/expreg-expand-dwim) ; overrides `mark-sexp'
:config
(defun prot/expreg-expand (n)
"Expand to N syntactic units, defaulting to 1 if none is provided interactively."
(interactive "p")
(dotimes (_ n)
(expreg-expand)))
(defun prot/expreg-expand-dwim ()
"Do-What-I-Mean `expreg-expand' to start with symbol or word.
(defun prot/expreg-expand-dwim ()
"Do-What-I-Mean `expreg-expand' to start with symbol or word.
If over a real symbol, mark that directly, else start with a
word. Fall back to regular `expreg-expand'."
(interactive)
(let ((symbol (bounds-of-thing-at-point 'symbol)))
(cond
((equal (bounds-of-thing-at-point 'word) symbol)
(prot/expreg-expand 1))
(symbol (prot/expreg-expand 2))
(t (expreg-expand)))))))
;;;; Show battery status on the mode line (battery.el)
(use-package battery
:ensure nil
:hook (elpaca-after-init . display-battery-mode)
:config
(setq battery-mode-line-format
(cond
((eq battery-status-function #'battery-linux-proc-acpi)
"⏻ %b%p%%,%d°C ")
(battery-status-function
"⏻ %b%p%% "))))
(interactive)
(let ((symbol (bounds-of-thing-at-point 'symbol)))
(cond
((equal (bounds-of-thing-at-point 'word) symbol)
(prot/expreg-expand 1))
(symbol (prot/expreg-expand 2))
(t (expreg-expand))))))
;;;; Configuration on Mac OS X machine
(when (eq system-type 'darwin)
@ -183,15 +168,10 @@ word. Fall back to regular `expreg-expand'."
(setq system-name (car (split-string system-name "\\.")))
;;; Binaries
(setq vc-git-program (or (executable-find "git") "/usr/local/bin/git"))
(setq epg-gpg-program (or (executable-find "gpg") "/usr/local/bin/gpg"))
;;; Source dirs
;; Note: These are hard-coded to my machine.
(setq source-directory (expand-file-name "~/src/emacs/src/"))
(setq find-function-C-source-directory (expand-file-name "~/src/emacs/src/"))))
(setq epg-gpg-program (or (executable-find "gpg") "/usr/local/bin/gpg"))))
(defun vedang/backward-kill-word-or-kill-region (&optional arg)
"Rebind `C-w' to work differently based on whether a region is active.
"fancy C-w.
If the region is selected, retain the original behaviour, otherwise call
`backward-kill-word' instead. ARG is passed to `backward-kill-word'."
(interactive "p")
@ -218,4 +198,36 @@ If the region is selected, retain the original behaviour, otherwise call
(use-package helpful
:ensure t)
(provide 'unravel-essentials)
(use-package indent-tools
:ensure t)
(use-package key-chord
:ensure t
:config
(key-chord-mode +1)
(setq key-chord-one-key-delay 0.185) ; e.g. "jj", default 0.2
(setq key-chord-two-keys-delay 0.1) ; e.g. "jk", default 0.1
(setq key-chord-safety-interval-backward 0.2) ; default 0.1 is too close to key delays
(setq key-chord-safety-interval-forward 0.3) ; default 0.35 causes laggy experience
(key-chord-define-global "VV" 'split-window-right)
(key-chord-define-global "HH" 'split-window-below)
(key-chord-define-global "BB" 'switch-to-buffer)
(key-chord-define-global "CC" 'recenter)
(key-chord-define-global "00" 'delete-window)
(key-chord-define-global "11" 'delete-other-windows)
(key-chord-define-global "WW" 'rotate-windows)
)
(use-package which-key
:ensure t
:config
(which-key-mode t)
(setq which-key-idle-delay 0.5)
(setq which-key-sort-order 'which-key-description-order))
(use-package blackout
:ensure t
:demand t)
(provide 'nebkor-essentials)

View file

@ -0,0 +1,74 @@
(defun diff-and-set-modified-p ()
"Diff the current buffer with its associated file and set buffer modified status."
(let* ((tmpfile (diff-file-local-copy (current-buffer)))
(cmd (format "diff -q '%s' '%s'" (buffer-file-name) tmpfile))
(result (call-process-shell-command cmd nil nil)))
(set-buffer-modified-p (not (zerop result)))))
(defun nebkor/kill-buffer ()
(interactive)
(diff-and-set-modified-p)
(kill-buffer (current-buffer))
)
(defun sother-window ()
"shift-other-window"
(interactive)
(other-window -1)
)
;;; From:
;;; https://fluca1978.github.io/2022/04/13/EmacsPgFormatter.html, with
;;; minor modifications to add the function to a `before-save-hook`
(defun pgformatter-on-region ()
"A function to invoke pg_format as an external program."
(interactive)
(let ((b (if mark-active (min (point) (mark)) (point-min)))
(e (if mark-active (max (point) (mark)) (point-max)))
(pgfrm (executable-find "pg_format")))
(when pgfrm
(let ((p (point)))
(progn
(shell-command-on-region b e pgfrm (current-buffer) 1)
(goto-char p)
))
)
)
)
(defun sql-format-buffer-on-save ()
"When saving an SQL buffer, format it with pg_format."
(add-hook 'before-save-hook #'pgformatter-on-region -10 t))
(defun nebkor-ksuidgen-p (orig-fn id)
"Check if an ID is a valid ksuid, and if not, return whatever ORIG-FN does."
(or (string-match (rx bol (= 27 alnum) eol) id)
(orig-fn id)))
(defun nebkor-julid-p (orig-fn id)
"Check if an ID is a valid Julid, and if not, return whatever ORIG-FN does."
(or (string-match (rx bol (= 26 alnum) eol) id)
(orig-fn id)))
(defun rotate-windows (arg)
"Rotate your windows; use the prefix argument to rotate the other direction"
(interactive "P")
(if (not (> (count-windows) 1))
(message "You can't rotate a single window!")
(let* ((rotate-times (prefix-numeric-value arg))
(direction (if (or (< rotate-times 0) (equal arg '(4)))
'reverse 'identity)))
(dotimes (_ (abs rotate-times))
(dotimes (i (- (count-windows) 1))
(let* ((w1 (elt (funcall direction (window-list)) i))
(w2 (elt (funcall direction (window-list)) (+ i 1)))
(b1 (window-buffer w1))
(b2 (window-buffer w2))
(s1 (window-start w1))
(s2 (window-start w2))
(p1 (window-point w1))
(p2 (window-point w2)))
(set-window-buffer-start-and-point w1 b2 s2 p2)
(set-window-buffer-start-and-point w2 b1 s1 p1)))))))
(provide 'nebkor-functions)

View file

@ -74,4 +74,4 @@
(setq magit-repository-directories
'(("~/src/prototypes" . 1))))
(provide 'unravel-git)
(provide 'nebkor-git)

View file

@ -149,10 +149,15 @@
(use-package apheleia
:ensure t
:demand t
:after blackout
:config
(apheleia-global-mode +1)
(with-eval-after-load 'apheleia-formatters
(push '(zprint . ("zprint")) apheleia-formatters)))
(push '(zprint . ("zprint")) apheleia-formatters))
:hook
(apheleia-mode . (lambda () (blackout 'apheleia-mode)))
;;:blackout
)
(use-package multiple-cursors
:ensure t
@ -161,6 +166,81 @@
("C-<" . mc/mark-previous-like-this)
("C-c C->" . mc/mark-all-like-this))
(use-package lsp-mode
:ensure t
:demand t
:commands lsp
:init
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(flex))) ;; Configure flex
:bind (("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c q" . lsp-workspace-restart))
:config
(setq lsp-rust-all-targets nil
lsp-rust-analyzer-cargo-all-targets nil
lsp-log-io nil
lsp-semgrep-server-command nil
lsp-completion-provider :none
lsp-inlay-hint-enable t
lsp-modeline-diagnostics-enable nil
lsp-rust-analyzer-import-merge-behaviour "full"
lsp-rust-analyzer-completion-auto-import-enable t
lsp-rust-rustfmt-path "/home/ardent/.cargo/bin/rustfmt"
lsp-rust-unstable-features t
lsp-semantic-tokens-enable t
lsp-semantic-tokens-warn-on-missing-face nil
lsp-treemacs-error-list-current-project-only t
lsp-ui-sideline-delay 0.1
lsp-ui-sideline-diagnostic-max-line-length 50
lsp-ui-sideline-enable nil
lsp-ui-sideline-show-code-actions t
lsp-ui-sideline-update-mode 'line
lsp-eldoc-render-all t
lsp-idle-delay 0.2
lsp-enable-snippet t
;; enable / disable the hints as you prefer:
lsp-rust-analyzer-cargo-watch-command "clippy"
lsp-rust-analyzer-server-display-inlay-hints t
lsp-rust-analyzer-call-info-full t
lsp-rust-analyzer-proc-macro-enable t
lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial"
lsp-rust-analyzer-display-chaining-hints t
lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t
lsp-rust-analyzer-display-closure-return-type-hints t
lsp-rust-analyzer-display-parameter-hints nil
lsp-rust-analyzer-display-reborrow-hints t)
:hook
(
(lsp-mode . lsp-enable-which-key-integration)
(lsp-mode . subword-mode)
(lsp-completion-mode . my/lsp-mode-setup-completion)
;;(before-save . lsp-format-buffer)
))
(use-package cargo
:ensure t)
(use-package rustic
:ensure t
:bind (:map rustic-mode-map
("M-?" . lsp-find-references)
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c l" . flycheck-list-errors)
("C-c C-c s" . lsp-rust-analyzer-status))
:hook rust-ts-mode
:custom
(rustic-format-on-save t)
:config
(setq rustic-format-on-save t
rust-indent-method-chain t
rustic-format-trigger 'on-save
rustic-lsp-format t
rustic-lsp-client 'lsp)
(setq-local buffer-save-without-query t)
(setq-local lsp-semantic-tokens-enable t))
;;;; Configuration for Python Programming
(use-package python
@ -280,4 +360,4 @@ NS is the namespace information passed into the function by cider."
( :map ielm-map
("C-j" . newline-and-indent)))
(provide 'unravel-langs)
(provide 'nebkor-langs)

View file

@ -615,4 +615,4 @@ If WEEK-NUM is not provided, use the current week."
(setq org-habit-preceding-days 9)
(setq org-habit-show-all-today t))
(provide 'unravel-org)
(provide 'nebkor-org)

View file

@ -82,8 +82,8 @@
(setq grep-program executable)
(setq grep-template
(if rgp
"/usr/bin/rg -nH --null -e <R> <F>"
"/usr/bin/grep <X> <C> -nH --null -e <R> <F>"))
"rg -nH --null -e <R> <F>"
"grep <X> <C> -nH --null -e <R> <F>"))
(setq xref-search-program (if rgp 'ripgrep 'grep))))
;;; wgrep (writable grep)
@ -137,4 +137,4 @@
(setf (alist-get ?. avy-dispatch-alist) 'avy-action-embark)))
(provide 'unravel-search)
(provide 'nebkor-search)

View file

@ -287,4 +287,4 @@ modifications."
:bind-keymap
("C-c o" . org-board-keymap))
(provide 'unravel-study)
(provide 'nebkor-study)

View file

@ -1,34 +1,6 @@
;;; Everything related to the look of Emacs
;;; The Ef (εὖ) themes
;; The themes are customisable. Read the manual:
;; <https://protesilaos.com/emacs/ef-themes>.
(use-package ef-themes
:ensure t
:demand t
:bind
(("<f5>" . ef-themes-rotate)
("C-<f5>" . ef-themes-select))
:config
(setq ef-themes-to-toggle '(ef-elea-light ef-elea-dark))
(setq ef-themes-variable-pitch-ui t)
(setq ef-themes-mixed-fonts t)
(setq ef-themes-rotate ef-themes-items)
(setq ef-themes-headings ; read the manual's entry of the doc string
'((0 . (variable-pitch light 1.9))
(1 . (variable-pitch light 1.8))
(2 . (variable-pitch regular 1.7))
(3 . (variable-pitch regular 1.6))
(4 . (variable-pitch regular 1.5))
(5 . (variable-pitch 1.4)) ; absence of weight means `bold'
(6 . (variable-pitch 1.3))
(7 . (variable-pitch 1.2))
(agenda-date . (semilight 1.5))
(agenda-structure . (variable-pitch light 1.9))
(t . (variable-pitch 1.1))))
(setq ef-themes-disable-other-themes t)
(mapc #'disable-theme custom-enabled-themes))
(add-to-list 'default-frame-alist '(background-color . "snow"))
;;;; Lin
;; Read the lin manual: <https://protesilaos.com/emacs/lin>.
@ -38,28 +10,6 @@
:config
(setopt lin-face 'lin-cyan))
;;;; Increase padding of windows/frames
;; <https://protesilaos.com/codelog/2023-06-03-emacs-spacious-padding/>.
(use-package spacious-padding
:ensure t
:if (display-graphic-p)
:hook (elpaca-after-init . spacious-padding-mode)
:init
;; These are the defaults, but I keep it here for visiibility.
(setq spacious-padding-widths
'(:internal-border-width 30
:header-line-width 4
:mode-line-width 6
:tab-width 4
:right-divider-width 30
:scroll-bar-width 8
:left-fringe-width 20
:right-fringe-width 20))
;; Read the doc string of `spacious-padding-subtle-mode-line' as
;; it is very flexible.
(setq spacious-padding-subtle-mode-line t))
;;;; Rainbow mode for colour previewing (rainbow-mode.el)
(use-package rainbow-mode
:ensure t
@ -117,37 +67,17 @@
:cursor-type box
:cursor-in-non-selected-windows hollow
:blink-cursor-mode 1
:blink-cursor-blinks 10
:blink-cursor-blinks 5
:blink-cursor-interval 0.2
:blink-cursor-delay 0.2)))
;; I am using the default values of `cursory-latest-state-file'.
;; Set last preset or fall back to desired style from `cursory-presets'.
(cursory-set-preset (or (cursory-restore-latest-preset) 'box))
(cursory-set-preset (or (cursory-restore-latest-preset) 'box-no-blink))
(cursory-mode 1))
;;;; Theme buffet
;; <https://git.sr.ht/~bboal/theme-buffet>
(use-package theme-buffet
:ensure t
:after (:any modus-themes ef-themes)
:config
(let ((modus-themes-p (featurep 'modus-themes))
(ef-themes-p (featurep 'ef-themes)))
(setq theme-buffet-menu 'end-user)
(setq theme-buffet-time-offset 0)
(setq theme-buffet-end-user
'( :night (ef-dark ef-winter ef-autumn ef-night ef-duo-dark ef-symbiosis ef-owl)
:morning (ef-light ef-cyprus ef-spring ef-frost ef-duo-light ef-eagle)
:afternoon (ef-arbutus ef-day ef-kassio ef-summer ef-elea-light ef-maris-light ef-melissa-light ef-trio-light ef-reverie)
:evening (ef-rosa ef-elea-dark ef-maris-dark ef-melissa-dark ef-trio-dark ef-dream)))
(when (or modus-themes-p ef-themes-p)
(theme-buffet-timer-hours 2)
(theme-buffet-a-la-carte))))
;;;; Fontaine (font configurations)
;; Read the manual: <https://protesilaos.com/emacs/fontaine>
(use-package fontaine
@ -160,25 +90,21 @@
(elpaca-after-init . (lambda ()
;; Set last preset or fall back to desired style from `fontaine-presets'.
(fontaine-set-preset (or (fontaine-restore-latest-preset) 'regular))))
(enable-theme-functions . fontaine-apply-current-preset)
(ef-themes-post-load . fontaine-apply-current-preset))
(enable-theme-functions . fontaine-apply-current-preset))
:config
;; This is defined in Emacs C code: it belongs to font settings.
(setq x-underline-at-descent-line nil)
;; And this is for Emacs28.
(setq-default text-scale-remap-header-line t)
;; This is the default value. Just including it here for
;; completeness.
(setq fontaine-latest-state-file (locate-user-emacs-file "fontaine-latest-state.eld"))
(setq fontaine-presets
'((small
:default-family "Iosevka"
:default-family "Noto Sans"
:default-height 130)
(regular
:default-height 150)
:default-height 130)
(medium
:default-weight semilight
:default-height 170
@ -196,7 +122,7 @@
;; I keep all properties for didactic purposes, but most can be
;; omitted. See the fontaine manual for the technicalities:
;; <https://protesilaos.com/emacs/fontaine>.
:default-family "Iosevka"
:default-family "Noto Sans"
:default-weight regular
:default-slant normal
:default-width normal
@ -301,7 +227,7 @@ x×X .,·°;:¡!¿?`' ÄAÃÀ TODO
;; NOTE 2022-11-20: This may not cover every case, though it works
;; fine in my workflow. I am still undecided by EWW.
(defun prot/enable-variable-pitch ()
(unless (derived-mode-p 'mhtml-mode 'nxml-mode 'yaml-mode)
(unless (derived-mode-p 'mhtml-mode 'nxml-mode 'yaml-mode 'prog-mode)
(variable-pitch-mode 1)))
;;;;; Resize keys with global effect
:bind
@ -313,4 +239,4 @@ x×X .,·°;:¡!¿?`' ÄAÃÀ TODO
("C-x C-+" . global-text-scale-adjust)
("C-x C-0" . global-text-scale-adjust)))
(provide 'unravel-theme)
(provide 'nebkor-theme)

View file

@ -0,0 +1,75 @@
;;; General window and buffer configurations
(use-package uniquify
:ensure nil
:config
;;;; `uniquify' (unique names for buffers)
(setq uniquify-buffer-name-style 'forward)
(setq uniquify-strip-common-suffix t)
(setq uniquify-after-kill-buffer-p t))
(use-package window
:ensure nil
:config
(setq display-buffer-reuse-frames t)
(setq recenter-positions '(top middle bottom)))
;;; Frame-isolated buffers
;; Another package of mine. Read the manual:
;; <https://protesilaos.com/emacs/beframe>.
(use-package beframe
:ensure t
:hook (elpaca-after-init . beframe-mode)
:bind
("C-x f" . other-frame-prefix)
("C-c b" . beframe-prefix-map)
;; Replace the generic `buffer-menu'. With a prefix argument, this
;; commands prompts for a frame. Call the `buffer-menu' via M-x if
;; you absolutely need the global list of buffers.
("C-x C-b" . beframe-buffer-menu)
("C-x b" . beframe-switch-buffer)
("C-x B" . select-frame-by-name)
:config
(setq beframe-functions-in-frames '(project-prompt-project-dir))
(defvar consult-buffer-sources)
(declare-function consult--buffer-state "consult")
(with-eval-after-load 'consult
(defface beframe-buffer
'((t :inherit font-lock-string-face))
"Face for `consult' framed buffers.")
(defun my-beframe-buffer-names-sorted (&optional frame)
"Return the list of buffers from `beframe-buffer-names' sorted by visibility.
With optional argument FRAME, return the list of buffers of FRAME."
(beframe-buffer-names frame :sort #'beframe-buffer-sort-visibility))
(defvar beframe-consult-source
`( :name "Frame-specific buffers (current frame)"
:narrow ?F
:category buffer
:face beframe-buffer
:history beframe-history
:items ,#'my-beframe-buffer-names-sorted
:action ,#'switch-to-buffer
:state ,#'consult--buffer-state))
(add-to-list 'consult-buffer-sources 'beframe-consult-source)))
;;; Header line context of symbol/heading (breadcrumb.el)
(use-package breadcrumb
:ensure t
:functions (prot/breadcrumb-local-mode)
:hook ((text-mode prog-mode) . prot/breadcrumb-local-mode)
:config
(setq breadcrumb-project-max-length 0.5)
(setq breadcrumb-project-crumb-separator "/")
(setq breadcrumb-imenu-max-length 1.0)
(setq breadcrumb-imenu-crumb-separator " > ")
(defun prot/breadcrumb-local-mode ()
"Enable `breadcrumb-local-mode' if the buffer is visiting a file."
(when buffer-file-name
(breadcrumb-local-mode 1))))
(provide 'nebkor-window)

View file

@ -1,35 +0,0 @@
;;;; Vterm
(use-package vterm
:ensure t
:bind
("C-x m" . vterm)
:config
(setq vterm-shell (or (executable-find "fish") "/opt/homebrew/bin/fish")))
;;; Enrich zoxide db based on everything I open in Emacs
(when (executable-find "zoxide")
(use-package zoxide
:ensure t
:hook
(consult-after-jump . zoxide-add)
(find-file . zoxide-add)
(dired-mode . zoxide-add)))
;; Mode to read/write fish functions and files
(use-package fish-mode
:ensure t)
(use-package dwim-shell-command
:ensure t
:bind
( :map global-map
([remap shell-command] . dwim-shell-command)
:map dired-mode-map
([remap dired-do-async-shell-command] . dwim-shell-command)
([remap dired-do-shell-command] . dwim-shell-command)
([remap dired-smart-shell-command] . dwim-shell-command))
:config
;; Also make available all the utility functions provided by Xenodium
(require 'dwim-shell-commands))
(provide 'unravel-shell)

View file

@ -1,173 +0,0 @@
;;; General window and buffer configurations
(use-package uniquify
:ensure nil
:config
;;;; `uniquify' (unique names for buffers)
(setq uniquify-buffer-name-style 'forward)
(setq uniquify-strip-common-suffix t)
(setq uniquify-after-kill-buffer-p t))
;;;; `window', `display-buffer-alist', and related
(use-package prot-window
:ensure nil
:demand t
:config
;; NOTE 2023-03-17: Remember that I am using development versions of
;; Emacs. Some of my `display-buffer-alist' contents are for Emacs
;; 29+.
(setq display-buffer-alist
`(;; no window
("\\`\\*Async Shell Command\\*\\'"
(display-buffer-no-window))
("\\`\\*\\(Warnings\\|Compile-Log\\|Org Links\\)\\*\\'"
(display-buffer-no-window)
(allow-no-window . t))
;; bottom side window
("\\*Org \\(Select\\|Note\\)\\*" ; the `org-capture' key selection and `org-add-log-note'
(display-buffer-in-side-window)
(dedicated . t)
(side . bottom)
(slot . 0)
(window-parameters . ((mode-line-format . none))))
;; bottom buffer (NOT side window)
((or . ((derived-mode . flymake-diagnostics-buffer-mode)
(derived-mode . flymake-project-diagnostics-mode)
(derived-mode . messages-buffer-mode)
(derived-mode . backtrace-mode)))
(display-buffer-reuse-mode-window display-buffer-at-bottom)
(window-height . 0.3)
(dedicated . t)
(preserve-size . (t . t)))
("\\*Embark Actions\\*"
(display-buffer-reuse-mode-window display-buffer-below-selected)
(window-height . fit-window-to-buffer)
(window-parameters . ((no-other-window . t)
(mode-line-format . none))))
("\\*\\(Output\\|Register Preview\\).*"
(display-buffer-reuse-mode-window display-buffer-at-bottom))
;; below current window
("\\(\\*Capture\\*\\|CAPTURE-.*\\)"
(display-buffer-reuse-mode-window display-buffer-below-selected))
("\\*\\vc-\\(incoming\\|outgoing\\|git : \\).*"
(display-buffer-reuse-mode-window display-buffer-below-selected)
(window-height . 0.1)
(dedicated . t)
(preserve-size . (t . t)))
((derived-mode . reb-mode) ; M-x re-builder
(display-buffer-reuse-mode-window display-buffer-below-selected)
(window-height . 4) ; note this is literal lines, not relative
(dedicated . t)
(preserve-size . (t . t)))
((or . ((derived-mode . occur-mode)
(derived-mode . grep-mode)
(derived-mode . Buffer-menu-mode)
(derived-mode . log-view-mode)
(derived-mode . help-mode) ; See the hooks for `visual-line-mode'
"\\*\\(|Buffer List\\|Occur\\|vc-change-log\\|eldoc.*\\).*"
prot-window-shell-or-term-p
;; ,world-clock-buffer-name
))
(prot-window-display-buffer-below-or-pop)
(body-function . prot-window-select-fit-size))
("\\*\\(Calendar\\|Bookmark Annotation\\|ert\\).*"
(display-buffer-reuse-mode-window display-buffer-below-selected)
(dedicated . t)
(window-height . fit-window-to-buffer))
;; same window
;; NOTE 2023-02-17: `man' does not fully obey the
;; `display-buffer-alist'. It works for new frames and for
;; `display-buffer-below-selected', but otherwise is
;; unpredictable. See `Man-notify-method'.
((or . ((derived-mode . Man-mode)
(derived-mode . woman-mode)
"\\*\\(Man\\|woman\\).*"))
(display-buffer-same-window)))))
(use-package prot-window
:ensure nil
:demand t
:config
(setq window-combination-resize t)
(setq even-window-sizes 'height-only)
(setq window-sides-vertical nil)
(setq switch-to-buffer-in-dedicated-window 'pop)
(setq split-height-threshold 80)
(setq split-width-threshold 125)
(setq window-min-height 3)
(setq window-min-width 30))
(use-package window
:ensure nil
:config
(setq display-buffer-reuse-frames t)
(setq recenter-positions '(top middle bottom)))
;;; Frame-isolated buffers
;; Another package of mine. Read the manual:
;; <https://protesilaos.com/emacs/beframe>.
(use-package beframe
:ensure t
:hook (elpaca-after-init . beframe-mode)
:bind
("C-x f" . other-frame-prefix)
("C-c b" . beframe-prefix-map)
;; Replace the generic `buffer-menu'. With a prefix argument, this
;; commands prompts for a frame. Call the `buffer-menu' via M-x if
;; you absolutely need the global list of buffers.
("C-x C-b" . beframe-buffer-menu)
("C-x b" . beframe-switch-buffer)
("C-x B" . select-frame-by-name)
:config
(setq beframe-functions-in-frames '(project-prompt-project-dir))
(defvar consult-buffer-sources)
(declare-function consult--buffer-state "consult")
(with-eval-after-load 'consult
(defface beframe-buffer
'((t :inherit font-lock-string-face))
"Face for `consult' framed buffers.")
(defun my-beframe-buffer-names-sorted (&optional frame)
"Return the list of buffers from `beframe-buffer-names' sorted by visibility.
With optional argument FRAME, return the list of buffers of FRAME."
(beframe-buffer-names frame :sort #'beframe-buffer-sort-visibility))
(defvar beframe-consult-source
`( :name "Frame-specific buffers (current frame)"
:narrow ?F
:category buffer
:face beframe-buffer
:history beframe-history
:items ,#'my-beframe-buffer-names-sorted
:action ,#'switch-to-buffer
:state ,#'consult--buffer-state))
(add-to-list 'consult-buffer-sources 'beframe-consult-source)))
;;; Frame history (undelete-frame-mode)
(use-package frame
:ensure nil
:bind ("C-x u" . undelete-frame) ; I use only C-/ for `undo'
:hook (elpaca-after-init . undelete-frame-mode))
;;; Window history (winner-mode)
(use-package winner
:ensure nil
:hook (elpaca-after-init . winner-mode)
:bind
(("C-x <right>" . winner-redo)
("C-x <left>" . winner-undo)))
(use-package zone
:ensure nil
:config
(zone-when-idle 300))
(use-package time
:ensure nil
:config
(setq display-time-day-and-date t)
(display-time))
(provide 'unravel-window)