From b30e3834ba64bf209848f7ef9bbf6dc707f0c73c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 13 Jun 2024 21:50:01 -0500 Subject: Emacs! --- emacs | 86 ++++++++++++++++++++++++++++-------------------- emacs.d/brianna-theme.el | 2 ++ emacs.d/eshell/alias | 28 ++++++++-------- 3 files changed, 67 insertions(+), 49 deletions(-) diff --git a/emacs b/emacs index 7fe6e9b..f0f0eb9 100644 --- a/emacs +++ b/emacs @@ -49,27 +49,36 @@ ;; Whitespace (setopt whitespace-style '(face trailing tabs tab-mark)) (setopt whitespace-global-modes '(not rcirc-mode jabber-chat-mode)) -(global-whitespace-mode) +;; (global-whitespace-mode) (add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line) -(add-hook 'after-init-hook - (lambda () (add-hook 'before-save-hook #'indent-buffer+))) (set-face-attribute 'whitespace-tab nil :background nil :foreground "#888") (setf (alist-get 'tab-mark whitespace-display-mappings) '(9 [?· 9] [?» 9] [?\\ 9])) +(add-hook 'after-init-hook + (lambda () (add-hook 'before-save-hook #'indent-buffer+))) + ;;; UI stuff (setopt tab-bar-show 1) +;; Elastic-modes +(package-ensure 'dash) ; requirement for `elastic-modes' +(package-ensure '(elastic-modes + :url "https://github.com/jyp/elastic-modes" + :main-file "elastic-pkg.el")) +(require 'elastic-indent) +(add-hook 'prog-mode-hook #'elastic-indent-mode) + ;; Fixed-pitch (package-ensure '(fixed-pitch-mode :url "https://github.com/cstby/fixed-pitch-mode.git")) -(require 'fixed-pitch) +;; (require 'fixed-pitch) (setopt cursor-type 'bar) -(setopt fixed-pitch-use-extended-default t) -(add-to-list 'fixed-pitch-whitelist-hooks 'vc-dir-mode-hook) -(hide-minor-mode 'buffer-face-mode) -(add-hook 'fixed-pitch-mode-hook #'display-fill-column-indicator-mode) +;; (setopt fixed-pitch-use-extended-default t) +;; (add-to-list 'fixed-pitch-whitelist-hooks 'vc-dir-mode-hook) +;; (hide-minor-mode 'buffer-face-mode) +;; (add-hook 'fixed-pitch-mode-hook #'display-fill-column-indicator-mode) ;;; Completions @@ -244,7 +253,7 @@ ;;; Search -(setopt isearch-lazy-count t) +(setopt isearch-lazy-count nil) (setopt isearch-regexp-lax-whitespace t) (setopt isearch-wrap-pause 'no) (setopt search-whitespace-regexp "[ ]+") @@ -284,7 +293,6 @@ (keymap-global-set "M-/" #'hippie-expand) (keymap-global-set "M-u" #'universal-argument) (keymap-set universal-argument-map "M-u" #'universal-argument-more) -(keymap-global-set "C-c s" #'eshell) (keymap-global-set "C-c d" (defun insert-current-iso8601 () @@ -356,10 +364,12 @@ css-mode) "Modes to indent with spaces, not tabs.") -(add-hook 'prog-mode-hook - (defun indent-tabs-mode-maybe () - (setq indent-tabs-mode - (if (apply #'derived-mode-p space-indent-modes) nil t)))) +;; (add-hook 'prog-mode-hook +;; (defun indent-tabs-mode-maybe () +;; (setq indent-tabs-mode +;; (if (apply #'derived-mode-p space-indent-modes) nil t)))) + +(indent-tabs-mode -1) ;; Elisp (keymap-set emacs-lisp-mode-map "C-c C-c" #'eval-defun) @@ -423,7 +433,7 @@ ;;; Miscellaneous settings (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) -(add-hook 'prog-mode-hook #'auto-fill-mode) +;; (add-hook 'prog-mode-hook #'auto-fill-mode) (add-hook 'prog-mode-hook #'electric-pair-local-mode) (setopt x-underline-at-descent-line t) (setopt scroll-conservatively 101) @@ -454,23 +464,6 @@ (hl-line-mode)))) (add-hook 'dired-mode-hook #'hl-line-mode) -;;; RCIRC - -(setopt rcirc-kill-channel-buffers t) -(setopt rcirc-display-server-buffer nil) - -(defun run-rcirc () - (interactive) - (shell-command "chat up") - (call-interactively #'rcirc)) - -(add-hook 'rcirc-mode-hook - (defun @rcirc () - (rcirc-track-minor-mode) - (rcirc-omit-mode) - (visual-line-mode) - (setq default-directory (expand-file-name "~")))) - ;;; Jabber (package-ensure 'jabber) @@ -501,17 +494,40 @@ ;;; Eshell (setopt eshell-banner-message - (format "%s\n\n" (mapconcat #'identity - (process-lines "fortune" "-s") - "\n"))) + (format "%s\n\n" (string-join (process-lines "fortune" "-s") "\n"))) (setopt eshell-prompt-function (defun @eshell-prompt () (let ((rootp (zerop (user-uid)))) (concat "( " + (unless (= 0 eshell-last-command-status) + (format "*%d " eshell-last-command-status)) (abbreviate-file-name (eshell/pwd)) (if rootp ":root" "") " ) ")))) (setopt eshell-prompt-regexp "^(.*) ") +(setopt eshell-destroy-buffer-when-process-dies t) +(setopt eshell-error-if-no-glob t) +(setopt eshell-hist-ignoredups 'erase) +(setopt eshell-kill-on-exit t) +(setopt eshell-prefer-lisp-functions t) +(setopt eshell-prefer-lisp-variables t) +(setopt eshell-scroll-to-bottom-on-input 'this) +(setopt eshell-history-size nil) + +(keymap-global-set "C-z" + (lambda (arg) (interactive "P") + (let ((dd default-directory)) + (eshell arg) + (unless (equal dd default-directory) + (setq default-directory dd) + ;; Is this a good idea, really? + (eshell-bol) + (unless (eolp) + (insert "# ")) + (eshell-send-input))))) +(add-hook 'eshell-first-time-mode-hook + (defun @eshell-once () + (keymap-set eshell-mode-map "C-z" #'quit-window))) ;;; Browsing diff --git a/emacs.d/brianna-theme.el b/emacs.d/brianna-theme.el index 2860d37..0b16a41 100644 --- a/emacs.d/brianna-theme.el +++ b/emacs.d/brianna-theme.el @@ -107,6 +107,8 @@ ;;; Specific modes &c ;; Dired '(dired-header ((t (:underline t :extend t)))) + ;; Elastic indent + '(elastic-indent ((t ()))) ;; Eshell '(eshell-prompt ((t (:inherit brianna-prompt)))) ;; Eww diff --git a/emacs.d/eshell/alias b/emacs.d/eshell/alias index f015e86..9b06a3e 100644 --- a/emacs.d/eshell/alias +++ b/emacs.d/eshell/alias @@ -1,16 +1,16 @@ -alias ls ls -F $* alias vi find-file $1 -alias zzz $SUDO zzz -alias ZZZ $SUDO ZZZ -alias shutdown $SUDO shutdown $* -alias reboot $SUDO reboot $* -alias halt $SUDO halt $* -alias mount $SUDO mount $* -alias umount $SUDO umount $* -alias poweroff $SUDO poweroff $* -alias apk $SUDO apk $* -alias view view-file $1 -alias less view-file $1 -alias edit find-file $1 -alias v view-file $1 alias e find-file $1 +alias v view-file $1 +alias edit find-file $1 +alias less view-file $1 +alias view view-file $1 +alias apk $SUDO apk $* +alias poweroff $SUDO poweroff $* +alias umount $SUDO umount $* +alias mount $SUDO mount $* +alias halt $SUDO halt $* +alias reboot $SUDO reboot $* +alias shutdown $SUDO shutdown $* +alias ZZZ $SUDO ZZZ +alias zzz $SUDO zzz +alias ls ls -F1 $* -- cgit 1.4.1-21-gabe81