Skip to content

Commit b61b153

Browse files
Merge pull request #34 from alexispurslane/develop
Fix evil layer, fix Quake update detection
2 parents cfdf2e6 + d9a2d14 commit b61b153

2 files changed

Lines changed: 69 additions & 59 deletions

File tree

evil-layer.el

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ qualifiers."
8282
8383
- `evil', the Emacs editor of choice
8484
- `evil-collection', to integrate Evil mode with everything else
85-
- `evil-cleverparens', to give you proper S-expr editing
86-
capabilities, since you'll be doing a lot of that
8785
- `evil-org-mode', for good org mode keybindings for Evil
8886
- `treemacs-evil', for good treemacs keybindings for Evil
8987
- `evil-god-state', to use god mode as an automatic leader key
@@ -184,11 +182,6 @@ qualifiers."
184182
:config
185183
(evil-collection-init))
186184

187-
(use-package evil-cleverparens
188-
:after (evil)
189-
:hook ((lisp-mode . evil-cleverparens-mode)
190-
(emacs-lisp-mode . evil-cleverparens-mode)))
191-
192185
(use-package treemacs-evil
193186
:after (treemacs evil)
194187
:ensure t)
@@ -231,7 +224,7 @@ qualifiers."
231224

232225
;; make "tree sitter expand region" a manipulable text object
233226
(evil-define-text-object evil-ts-text-obj-expand-region (count &optional beg end type)
234-
(evil-ts-expand-region))
227+
(evil-ts-expand-region))
235228

236229
;; bind it to "x"
237230
(define-key evil-outer-text-objects-map "x" 'evil-ts-text-obj-expand-region)

init.el

Lines changed: 68 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
(defvar quake--file-name-handler-alist file-name-handler-alist)
6666
(setq file-name-handler-alist nil)
6767
(add-hook 'emacs-startup-hook (lambda () (setq file-name-handler-alist quake--file-name-handler-alist)))
68-
68+
(autoload 'optional/evil-layer "~/.emacs.d/evil-layer.el")
6969
;; Print a little message to the user that we're loading packages if this is a fresh install
7070

7171
(when (let ((place (file-name-concat user-emacs-directory "elpa/")))
@@ -214,6 +214,7 @@ your user.el with every single update to Quake."
214214
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)) ; don't litter dammit
215215
delete-old-versions t ; delete excess backup files
216216
lisp-body-indent 4 ; four space tabs
217+
pgtk-wait-for-event-timeout nil ; make pgtk feel a bit faster
217218
vc-follow-symlinks t ; we'll always want to follow symlinks
218219
warning-minimum-level :emergency ; don't completely shit the bed on errors
219220
display-line-numbers 'relative ; whether you use evil or not, these are useful
@@ -230,6 +231,10 @@ your user.el with every single update to Quake."
230231
completion-ignore-case t) ; fucking ignore case in general!
231232
(setopt use-short-answers t) ; so you don't have to type out "yes" or "no" and hit enter
232233
(setq eldoc-idle-delay 1.0) ; w/ eldoc-box/an LSP, idle delay is by default too distracting
234+
(advice-add 'eldoc-display-message-no-interference-p
235+
:before-while (lambda () (not (help-at-pt-string)))) ; tell eldoc not to clobber help messages
236+
(help-at-pt-set-timer) ; display help messages via keyboard
237+
(setq help-at-pt-display-when-idle t)
233238
(setq display-line-numbers-width-start t) ; when you open a file, set the width of the linum gutter to be large enough for the whole file's line numbers
234239
(setq-default indent-tabs-mode nil) ; prefer spaces instead of tabs
235240
;;;;; Disabling ugly and largely unhelpful UI features
@@ -394,7 +399,7 @@ your user.el with every single update to Quake."
394399
(which-key--create-buffer-and-show
395400
nil (symbol-value keymap))))
396401
(which-key--hide-popup))))
397-
(custom-set-variables 'repeat-echo-function #'ignore))
402+
(customize-set-variable 'repeat-echo-function #'ignore))
398403
;;;; Better Emacs Lisp editing experience
399404

400405
(use-package elisp-def
@@ -428,9 +433,7 @@ your user.el with every single update to Quake."
428433
;;;; Better peformance using asynchronous processing with subordinate Emacs processes
429434
(use-package async
430435
:demand t
431-
:hook (dired-mode . dired-async-mode)
432-
:config
433-
(add-hook 'message-mode-hook (lambda () (require 'smtpmail-async))))
436+
:hook (dired-mode . dired-async-mode))
434437
;;;; Embark
435438
(use-package embark
436439
:commands (embark-act embark-dwim)
@@ -644,9 +647,10 @@ External Packages:
644647

645648
(add-hook 'overwrite-mode-hook #'quake-god-mode-toggle-on-overwrite)
646649

647-
(define-key god-local-mode-map (kbd ".") #'repeat)
648-
(define-key god-local-mode-map (kbd "i") #'god-local-mode)
649-
(global-set-key (kbd "<escape>") #'(lambda () (interactive) (god-local-mode 1))))
650+
(unless (member 'optional/evil-layer quake-enabled-layers)
651+
(define-key god-local-mode-map (kbd ".") #'repeat)
652+
(define-key god-local-mode-map (kbd "i") #'god-local-mode)
653+
(global-set-key (kbd "<escape>") #'(lambda () (interactive) (god-local-mode 1)))))
650654

651655
;;;;; Structural editing with Puni Mode
652656
;; Use puni-mode globally and disable it for term-mode.
@@ -717,6 +721,15 @@ External Packages:
717721
"C-x B" 'ibuffer
718722
;;;;;; Project.el
719723
"C-x p E" 'flymake-show-project-diagnostics
724+
"C-x p r" (defun project-rename-symbol (from to)
725+
"Replace a symbol throughout this project."
726+
(interactive
727+
(let ((query-replace-read-from-regexp-default 'find-tag-default-as-regexp))
728+
(pcase-let ((`(,from ,to)
729+
(query-replace-read-args "Query replace (regexp)" t t)))
730+
(list from to))))
731+
(project-query-replace-regexp (concat "\\_<" from "\\_>") to))
732+
"C-x p %" 'project-query-replace-regexp
720733
;;;;;; Eglot
721734
"C-c e" (cons "LSP Server..."
722735
(quake-emacs-create-keymap
@@ -761,13 +774,13 @@ External Packages:
761774
that rote boilerplate"
762775
;;;;; A basic programming mode using built in things
763776
(electric-pair-mode 1)
777+
(require 'hl-line)
764778
(add-hook 'prog-mode-hook (defun progify-mode ()
765779
(prettify-symbols-mode 1)
766780
(display-line-numbers-mode 1)
767781
(setq display-line-numbers 'relative)
768-
(hl-line-mode t)
769-
(eglot-ensure)
770-
(flymake-mode)))
782+
(flymake-mode)
783+
(hl-line-mode t)))
771784
(add-hook 'flymake-mode-hook (lambda ()
772785
(setq next-error-function 'flymake-goto-next-error)))
773786
;;;;; Version-control and project management
@@ -1003,6 +1016,8 @@ do not already have one."
10031016
(add-hook 'org-mode-hook (defun quake--org-mode-hooks ()
10041017
;; Cooperate with imenu. This should exist by default, dammit!
10051018
(imenu-add-to-menubar "Imenu")
1019+
;; Fix org-ctags bug
1020+
(setq org-open-link-functions nil)
10061021
;; Prettify
10071022
(quake--org-mode-pretty)
10081023
;; Add IDs to everything after save.
@@ -1039,6 +1054,7 @@ do not already have one."
10391054

10401055
(custom-set-faces
10411056
'(org-default ((t (:inherit variable-pitch :height 160))))
1057+
'(org-table ((t (:height 160 :inherit fixed-pitch))))
10421058
'(org-level-1 ((t (:height 2.0))))
10431059
'(org-level-2 ((t (:height 1.7))))
10441060
'(org-level-3 ((t (:height 1.4))))
@@ -1092,6 +1108,9 @@ do not already have one."
10921108
(mapcar #'string-trim)
10931109
(cl-remove-if (lambda (x) (string-empty-p x)))))
10941110
(defun quake-check-for-updates ()
1111+
"Check for new versions of Quake.
1112+
1113+
Does so by comparing the local git tag with the remote one."
10951114
(interactive)
10961115
(let* ((default-directory "~/.emacs.d/")
10971116
(buffer (generate-new-buffer "*git version check*"))
@@ -1110,12 +1129,13 @@ do not already have one."
11101129
('exit
11111130
(when-let* ((halves (mapcar #'get-lines (string-split (buffer-string) "---")))
11121131
(current-version (caar halves))
1113-
(remote-version-line (caadr halves))
1114-
(remote-version (save-match-data
1115-
(string-match
1116-
(rx (group "v" num "." num "." num (optional "-alpha." num)))
1117-
remote-version-line)
1118-
(match-string 1))))
1132+
(remote-version-line (car (last (cadr halves))))
1133+
(remote-version (with-temp-buffer
1134+
(insert remote-version-line)
1135+
(goto-char 0)
1136+
(zap-up-to-char 1 ?v)
1137+
(buffer-string))))
1138+
(message remote-version)
11191139
(if (not (string= remote-version current-version))
11201140
(message "There is an update available for Quake Emacs: %s"
11211141
(propertize (format "%s -> %s" current-version remote-version)
@@ -1166,7 +1186,35 @@ do not already have one."
11661186
;; Global settings (defaults)
11671187
(setq doom-themes-enable-bold t
11681188
doom-themes-enable-italic t)
1169-
(load-theme quake-color-theme t))
1189+
(load-theme quake-color-theme t)))
1190+
1191+
1192+
;;;; Optional Aesthetic Packages
1193+
(defun optional/bling-layer ()
1194+
"If you want your editor to wow the hipsters, or you just like
1195+
looking at the fancy pretty colors, you need some bling.
1196+
1197+
External Packages:
1198+
- `hl-todo', so you never miss those TODOs and FIXMEs
1199+
- `nerd-icons', `nerd-icons-completion', and `nerd-icons-corfu',
1200+
because there's really nothing better than a nice set of icons to
1201+
spice things up, and we want integration *everywhere*
1202+
- `ligature', because ligatures are cool"
1203+
;;;;; Tab Bar
1204+
(use-package tab-bar
1205+
:commands (tab-bar-new-tab tab-bar-mode)
1206+
:custom
1207+
(tab-bar-close-button-show nil)
1208+
(tab-bar-new-button-show nil)
1209+
(tab-bar-auto-width-max '((150) 20))
1210+
(tab-bar-auto-width-min '((150) 20))
1211+
:init
1212+
(advice-add 'tab-bar-mode :after
1213+
(lambda (&rest _r)
1214+
(custom-set-faces
1215+
`(tab-bar ((t (:background ,(face-attribute 'default :background) :foreground ,(face-attribute 'default :foreground) :height 1.0))))
1216+
`(tab-bar-tab ((t (:background ,(face-attribute 'hl-line :background) :foreground ,(face-attribute 'bold :foreground) :weight bold :height 0.95 :box (:line-width 4 :color ,(face-attribute 'hl-line :background)) :underline (:position -15)))))
1217+
`(tab-bar-tab-inactive ((t (:background ,(face-attribute 'default :background) :foreground ,(face-attribute 'default :foreground) :weight light :height .95 :box nil))))))))
11701218

11711219
;; Make things roomier and more minimal/austere
11721220
(use-package spacious-padding
@@ -1241,7 +1289,7 @@ do not already have one."
12411289
:config
12421290
(set-face-attribute 'eldoc-box-body nil :inherit 'variable-pitch :weight 'normal)
12431291
(set-face-foreground 'border (face-background 'mode-line))
1244-
:hook (eldoc-mode . eldoc-box-hover-at-point-mode))
1292+
(add-hook 'eldoc-mode-hook 'eldoc-box-hover-at-point-mode))
12451293

12461294
;; Pretty markdown formatting for eldoc-box
12471295
(use-package markdown-mode
@@ -1253,36 +1301,7 @@ do not already have one."
12531301
(markdown-fontify-code-blocks-natively t))
12541302

12551303
(use-package breadcrumb
1256-
:hook (eglot-managed-mode . breadcrumb-local-mode)))
1257-
1258-
;;;; Optional Aesthetic Packages
1259-
(defun optional/bling-layer ()
1260-
"If you want your editor to wow the hipsters, or you just like
1261-
looking at the fancy pretty colors, you need some bling.
1262-
1263-
External Packages:
1264-
- `hl-todo', so you never miss those TODOs and FIXMEs
1265-
- `nerd-icons', `nerd-icons-completion', and `nerd-icons-corfu',
1266-
because there's really nothing better than a nice set of icons to
1267-
spice things up, and we want integration *everywhere*
1268-
- `ligature', because ligatures are cool"
1269-
;;;;; Tab Bar
1270-
(use-package tab-bar
1271-
:commands (tab-bar-new-tab tab-bar-mode)
1272-
:init
1273-
(setq tab-bar-button-relief 0)
1274-
:config
1275-
(add-hook 'tab-bar-mode-hook
1276-
(lambda ()
1277-
(set-face-attribute 'tab-bar nil :inherit 'variable-pitch)
1278-
(set-face-attribute 'tab-bar-tab nil :box `(:line-width 5 :color ,(face-background 'tab-bar-tab) :style nil))
1279-
(set-face-attribute 'tab-bar-tab-inactive nil
1280-
:box `(:line-width 5 :color ,(face-background 'tab-bar-tab-inactive) :style nil))))
1281-
(setq tab-bar-auto-width t
1282-
tab-bar-auto-width-max '(200 20)
1283-
tab-bar-auto-width-min '(200 20))
1284-
(setq tab-bar-new-tab-choice "*enlight*")
1285-
(setq tab-bar-show t))
1304+
:hook (eglot-managed-mode . breadcrumb-local-mode))
12861305

12871306
;;;;; Highlight TODOs, FIXMEs, etc
12881307
(use-package hl-todo
@@ -1367,8 +1386,6 @@ spice things up, and we want integration *everywhere*
13671386
(display-buffer-at-bottom scratch '((window-height . 25)))
13681387
(other-window 1)))))
13691388

1370-
(autoload 'optional/evil-layer "~/.emacs.d/evil-layer.el")
1371-
13721389
;;; ======Load Layers======
13731390
;; Enable layers
13741391
(dolist (layer quake-enabled-layers)

0 commit comments

Comments
 (0)