about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2023-01-16 12:46:27 -0600
committerCase Duckworth2023-01-16 12:46:27 -0600
commitb4e6518f7eff38d57d2ce5500fb6292d90e000f6 (patch)
tree7dfef6643619a1c187f0230e4f5db51d1fe5d4cb /lisp
parentWhitespace etc. (diff)
downloademacs-b4e6518f7eff38d57d2ce5500fb6292d90e000f6.tar.gz
emacs-b4e6518f7eff38d57d2ce5500fb6292d90e000f6.zip
KEY SMASHSHHHH
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-shell0
-rw-r--r--lisp/acdw-shell.el141
-rw-r--r--lisp/acdw-web.el28
3 files changed, 169 insertions, 0 deletions
diff --git a/lisp/acdw-shell b/lisp/acdw-shell new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lisp/acdw-shell
diff --git a/lisp/acdw-shell.el b/lisp/acdw-shell.el new file mode 100644 index 0000000..7c542aa --- /dev/null +++ b/lisp/acdw-shell.el
@@ -0,0 +1,141 @@
1;;; acdw-shell.el ---Shell config -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defvar eshell-buffer-format "*eshell:%s*"
6 "Format for eshell buffer names.")
7
8(defun eshell-rename-pwd ()
9 (rename-buffer (format eshell-buffer-format default-directory) t))
10
11(defun eshell-last-dir ()
12 (goto-char (point-max))
13 (insert "cd -")
14 (eshell-send-input))
15
16(defun eshellp (buffer-or-name)
17 (with-current-buffer buffer-or-name
18 (derived-mode-p 'eshell-mode)))
19
20(defun +eshell (&optional new)
21 (interactive "P")
22 (let ((dir default-directory)
23 (bname (format eshell-buffer-format default-directory))
24 (display-comint-buffer-action 'pop-to-buffer))
25 (if-let ((buf (and (not new)
26 (or (get-buffer bname)
27 (seq-find #'eshellp
28 (reverse (buffer-list)))))))
29 (pop-to-buffer buf)
30 (eshell new))
31 (eshell-rename-pwd)
32 (unless (equal default-directory dir)
33 (eshell/cd dir)
34 (eshell-send-input)
35 (goto-char (point-max)))))
36
37(defun +eshell-quit (&optional choose)
38 (interactive "P")
39 (if choose
40 (let* ((bufs (mapcar #'buffer-name
41 (seq-filter #'eshellp
42 (buffer-list))))
43 (buf (get-buffer
44 (completing-read "Eshell: "
45 bufs nil t nil nil (car bufs)))))
46 (quit-window)
47 (pop-to-buffer buf))
48 (quit-window)))
49
50(defun acdw/eshell-prompt ()
51 "My custom eshell prompt."
52 (concat (if (= 0 eshell-last-command-status)
53 "^_^ "
54 ";_; ")
55 (abbreviate-file-name (eshell/pwd))
56 (if (= (user-uid) 0) " # " " $ ")))
57
58
59;;; Packages
60
61(use-package eshell
62 :init
63 (add-hook 'eshell-post-command-hook #'eshell-rename-pwd)
64 (setopt eshell-modules-list
65 '(eshell-alias
66 eshell-basic
67 eshell-cmpl
68 eshell-dirs
69 eshell-elecslash
70 eshell-hist
71 eshell-ls
72 eshell-prompt
73 eshell-smart
74 eshell-extpipe
75 eshell-glob
76 eshell-hist
77 eshell-ls
78 eshell-pred
79 eshell-prompt
80 eshell-script
81 eshell-term
82 eshell-unix))
83 :commands eshell
84 :bind (("C-z" . +eshell)
85 :map eshell-mode-map
86 ("C-z" . +eshell-quit)
87 ("C-o" . eshell-last-dir))
88 :config
89 (require 'esh-module)
90 (require 'em-smart)
91 (require 'em-tramp)
92 (setopt eshell-destroy-buffer-when-process-dies t
93 eshell-error-if-no-glob t
94 eshell-hist-ignoredups t
95 eshell-kill-on-exit t
96 eshell-prefer-lisp-functions t
97 eshell-prefer-lisp-variables t
98 eshell-scroll-to-bottom-on-input 'this
99 eshell-banner-message ""
100 eshell-hist-ignoredups 'erase
101 eshell-history-size 512
102 eshell-input-filter (lambda (input)
103 (or (eshell-input-filter-default input)
104 (eshell-input-filter-initial-space input)))
105 eshell-prompt-function #'acdw/eshell-prompt)
106 (add-hook 'eshell-mode-hook
107 (defun eshell-setup ()
108 (hungry-delete-mode -1)
109 (setq-local outline-regexp eshell-prompt-regexp
110 page-delimiter eshell-prompt-regexp
111 imenu-generic-expression
112 '(("Prompt" " $ \\(.*\\)" 1))
113 truncate-lines t)
114 (setenv "PAGER" "cat"))))
115
116(use-package eat
117 :ensure t
118 :hook (eshell-load-hook . eat-eshell-mode))
119
120(use-package exec-path-from-shell
121 :when (eq system-type 'gnu/linux)
122 :ensure t
123 :config
124 (add-to-list 'exec-path-from-shell-variables "SSH_AUTH_SOCK")
125 (add-to-list 'exec-path-from-shell-variables "SSH_AGENT_PID")
126 (add-to-list 'exec-path-from-shell-variables "GPG_AGENT_INFO")
127 (add-to-list 'exec-path-from-shell-variables "LANG")
128 (add-to-list 'exec-path-from-shell-variables "LC_CTYPE")
129 (add-to-list 'exec-path-from-shell-variables "XDG_CONFIG_HOME")
130 (add-to-list 'exec-path-from-shell-variables "XDG_CONFIG_DIRS")
131 (add-to-list 'exec-path-from-shell-variables "XDG_DATA_HOME")
132 (add-to-list 'exec-path-from-shell-variables "XDG_DATA_DIRS")
133 (add-to-list 'exec-path-from-shell-variables "XDG_CACHE_HOME")
134 (exec-path-from-shell-initialize))
135
136(use-package eshell-bookmark
137 :ensure t
138 :hook (eshell-mode-hook . eshell-bookmark-setup))
139
140(provide 'acdw-shell)
141;;; acdw-shell.el ends here
diff --git a/lisp/acdw-web.el b/lisp/acdw-web.el new file mode 100644 index 0000000..080cd9a --- /dev/null +++ b/lisp/acdw-web.el
@@ -0,0 +1,28 @@
1;;; acdw.web.el --- Web browsing and such -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defcustom +browse-url-other-safe-browser-functions nil
6 "Other safe browser functions."
7 :type '(repeat function))
8
9(defun +browse-url-browser-function-safe-p (f)
10 "Return t if F is a safe browser function."
11 (memq f (append +browse-url-other-safe-browser-functions
12 (mapcar (lambda (i)
13 (plist-get (cdr i) :value))
14 (seq-filter (lambda (i)
15 (eq (car i) 'function-item))
16 (cdr (get 'browse-url-browser-function
17 'custom-type)))))))
18
19
20;;; Packages
21
22(use-package browse-url
23 :config
24 (put 'browse-url-browser-function 'safe-local-variable
25 '+browse-url-browser-function-safe-p))
26
27(provide 'acdw-web)
28;;; acdw-web.el ends here