about summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
authorCase Duckworth2024-06-13 21:50:01 -0500
committerCase Duckworth2024-06-13 21:50:01 -0500
commitb30e3834ba64bf209848f7ef9bbf6dc707f0c73c (patch)
tree2d61d7274f1f0438521ca3ddb445939e6e21a8fd /emacs
parentAdd other programs (diff)
downloaddots-b30e3834ba64bf209848f7ef9bbf6dc707f0c73c.tar.gz
dots-b30e3834ba64bf209848f7ef9bbf6dc707f0c73c.zip
Emacs!
Diffstat (limited to 'emacs')
-rw-r--r--emacs86
1 files changed, 51 insertions, 35 deletions
diff --git a/emacs b/emacs index 7fe6e9b..f0f0eb9 100644 --- a/emacs +++ b/emacs
@@ -49,27 +49,36 @@
49;; Whitespace 49;; Whitespace
50(setopt whitespace-style '(face trailing tabs tab-mark)) 50(setopt whitespace-style '(face trailing tabs tab-mark))
51(setopt whitespace-global-modes '(not rcirc-mode jabber-chat-mode)) 51(setopt whitespace-global-modes '(not rcirc-mode jabber-chat-mode))
52(global-whitespace-mode) 52;; (global-whitespace-mode)
53(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line) 53(add-hook 'before-save-hook #'delete-trailing-whitespace-except-current-line)
54(add-hook 'after-init-hook
55 (lambda () (add-hook 'before-save-hook #'indent-buffer+)))
56(set-face-attribute 'whitespace-tab nil :background nil :foreground "#888") 54(set-face-attribute 'whitespace-tab nil :background nil :foreground "#888")
57(setf (alist-get 'tab-mark whitespace-display-mappings) 55(setf (alist-get 'tab-mark whitespace-display-mappings)
58 '(9 [?· 9] [?» 9] [?\\ 9])) 56 '(9 [?· 9] [?» 9] [?\\ 9]))
59 57
58(add-hook 'after-init-hook
59 (lambda () (add-hook 'before-save-hook #'indent-buffer+)))
60
60;;; UI stuff 61;;; UI stuff
61 62
62(setopt tab-bar-show 1) 63(setopt tab-bar-show 1)
63 64
65;; Elastic-modes
66(package-ensure 'dash) ; requirement for `elastic-modes'
67(package-ensure '(elastic-modes
68 :url "https://github.com/jyp/elastic-modes"
69 :main-file "elastic-pkg.el"))
70(require 'elastic-indent)
71(add-hook 'prog-mode-hook #'elastic-indent-mode)
72
64;; Fixed-pitch 73;; Fixed-pitch
65(package-ensure '(fixed-pitch-mode 74(package-ensure '(fixed-pitch-mode
66 :url "https://github.com/cstby/fixed-pitch-mode.git")) 75 :url "https://github.com/cstby/fixed-pitch-mode.git"))
67(require 'fixed-pitch) 76;; (require 'fixed-pitch)
68(setopt cursor-type 'bar) 77(setopt cursor-type 'bar)
69(setopt fixed-pitch-use-extended-default t) 78;; (setopt fixed-pitch-use-extended-default t)
70(add-to-list 'fixed-pitch-whitelist-hooks 'vc-dir-mode-hook) 79;; (add-to-list 'fixed-pitch-whitelist-hooks 'vc-dir-mode-hook)
71(hide-minor-mode 'buffer-face-mode) 80;; (hide-minor-mode 'buffer-face-mode)
72(add-hook 'fixed-pitch-mode-hook #'display-fill-column-indicator-mode) 81;; (add-hook 'fixed-pitch-mode-hook #'display-fill-column-indicator-mode)
73 82
74;;; Completions 83;;; Completions
75 84
@@ -244,7 +253,7 @@
244 253
245;;; Search 254;;; Search
246 255
247(setopt isearch-lazy-count t) 256(setopt isearch-lazy-count nil)
248(setopt isearch-regexp-lax-whitespace t) 257(setopt isearch-regexp-lax-whitespace t)
249(setopt isearch-wrap-pause 'no) 258(setopt isearch-wrap-pause 'no)
250(setopt search-whitespace-regexp "[ ]+") 259(setopt search-whitespace-regexp "[ ]+")
@@ -284,7 +293,6 @@
284(keymap-global-set "M-/" #'hippie-expand) 293(keymap-global-set "M-/" #'hippie-expand)
285(keymap-global-set "M-u" #'universal-argument) 294(keymap-global-set "M-u" #'universal-argument)
286(keymap-set universal-argument-map "M-u" #'universal-argument-more) 295(keymap-set universal-argument-map "M-u" #'universal-argument-more)
287(keymap-global-set "C-c s" #'eshell)
288 296
289(keymap-global-set "C-c d" 297(keymap-global-set "C-c d"
290 (defun insert-current-iso8601 () 298 (defun insert-current-iso8601 ()
@@ -356,10 +364,12 @@
356 css-mode) 364 css-mode)
357 "Modes to indent with spaces, not tabs.") 365 "Modes to indent with spaces, not tabs.")
358 366
359(add-hook 'prog-mode-hook 367;; (add-hook 'prog-mode-hook
360 (defun indent-tabs-mode-maybe () 368;; (defun indent-tabs-mode-maybe ()
361 (setq indent-tabs-mode 369;; (setq indent-tabs-mode
362 (if (apply #'derived-mode-p space-indent-modes) nil t)))) 370;; (if (apply #'derived-mode-p space-indent-modes) nil t))))
371
372(indent-tabs-mode -1)
363 373
364;; Elisp 374;; Elisp
365(keymap-set emacs-lisp-mode-map "C-c C-c" #'eval-defun) 375(keymap-set emacs-lisp-mode-map "C-c C-c" #'eval-defun)
@@ -423,7 +433,7 @@
423;;; Miscellaneous settings 433;;; Miscellaneous settings
424 434
425(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) 435(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
426(add-hook 'prog-mode-hook #'auto-fill-mode) 436;; (add-hook 'prog-mode-hook #'auto-fill-mode)
427(add-hook 'prog-mode-hook #'electric-pair-local-mode) 437(add-hook 'prog-mode-hook #'electric-pair-local-mode)
428(setopt x-underline-at-descent-line t) 438(setopt x-underline-at-descent-line t)
429(setopt scroll-conservatively 101) 439(setopt scroll-conservatively 101)
@@ -454,23 +464,6 @@
454 (hl-line-mode)))) 464 (hl-line-mode))))
455(add-hook 'dired-mode-hook #'hl-line-mode) 465(add-hook 'dired-mode-hook #'hl-line-mode)
456 466
457;;; RCIRC
458
459(setopt rcirc-kill-channel-buffers t)
460(setopt rcirc-display-server-buffer nil)
461
462(defun run-rcirc ()
463 (interactive)
464 (shell-command "chat up")
465 (call-interactively #'rcirc))
466
467(add-hook 'rcirc-mode-hook
468 (defun @rcirc ()
469 (rcirc-track-minor-mode)
470 (rcirc-omit-mode)
471 (visual-line-mode)
472 (setq default-directory (expand-file-name "~"))))
473
474;;; Jabber 467;;; Jabber
475 468
476(package-ensure 'jabber) 469(package-ensure 'jabber)
@@ -501,17 +494,40 @@
501;;; Eshell 494;;; Eshell
502 495
503(setopt eshell-banner-message 496(setopt eshell-banner-message
504 (format "%s\n\n" (mapconcat #'identity 497 (format "%s\n\n" (string-join (process-lines "fortune" "-s") "\n")))
505 (process-lines "fortune" "-s")
506 "\n")))
507(setopt eshell-prompt-function 498(setopt eshell-prompt-function
508 (defun @eshell-prompt () 499 (defun @eshell-prompt ()
509 (let ((rootp (zerop (user-uid)))) 500 (let ((rootp (zerop (user-uid))))
510 (concat "( " 501 (concat "( "
502 (unless (= 0 eshell-last-command-status)
503 (format "*%d " eshell-last-command-status))
511 (abbreviate-file-name (eshell/pwd)) 504 (abbreviate-file-name (eshell/pwd))
512 (if rootp ":root" "") 505 (if rootp ":root" "")
513 " ) ")))) 506 " ) "))))
514(setopt eshell-prompt-regexp "^(.*) ") 507(setopt eshell-prompt-regexp "^(.*) ")
508(setopt eshell-destroy-buffer-when-process-dies t)
509(setopt eshell-error-if-no-glob t)
510(setopt eshell-hist-ignoredups 'erase)
511(setopt eshell-kill-on-exit t)
512(setopt eshell-prefer-lisp-functions t)
513(setopt eshell-prefer-lisp-variables t)
514(setopt eshell-scroll-to-bottom-on-input 'this)
515(setopt eshell-history-size nil)
516
517(keymap-global-set "C-z"
518 (lambda (arg) (interactive "P")
519 (let ((dd default-directory))
520 (eshell arg)
521 (unless (equal dd default-directory)
522 (setq default-directory dd)
523 ;; Is this a good idea, really?
524 (eshell-bol)
525 (unless (eolp)
526 (insert "# "))
527 (eshell-send-input)))))
528(add-hook 'eshell-first-time-mode-hook
529 (defun @eshell-once ()
530 (keymap-set eshell-mode-map "C-z" #'quit-window)))
515 531
516;;; Browsing 532;;; Browsing
517 533