From bd71f8d95aade1d84dff9161f1cf5dcf8cfb0031 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Wed, 19 Mar 2025 21:10:56 +0100 Subject: [PATCH] working again --- custom.el | 19 ++++++++++++++- init.el | 3 +-- lisp/init-git.el | 60 ++--------------------------------------------- lisp/init-god.el | 14 +++++++++++ lisp/init-look.el | 5 +++- 5 files changed, 39 insertions(+), 62 deletions(-) create mode 100644 lisp/init-god.el diff --git a/custom.el b/custom.el index b2680a7..1944b73 100644 --- a/custom.el +++ b/custom.el @@ -3,7 +3,24 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(package-selected-packages nil)) + '(package-selected-packages + '(aggressive-indent anzu auto-compile avy browse-kill-ring cask-mode + catppuccin-theme corfu default-text-scale + diff-hl diminish dimmer dirvish disable-mouse + dotenv-mode elisp-slime-nav embark-consult + envrc exec-path-from-shell flycheck-relint gcmh + git-link git-modes git-timemachine gnuplot + god-mode highlight-escape-sequences + highlight-quoted ibuffer-projectile ibuffer-vc + immortal-scratch ipretty list-unicode-display + macrostep magit-todos marginalia move-dup + multiple-cursors orderless org-bullets + org-cliplink org-pomodoro origami + package-lint-flymake page-break-lines paredit + puni rainbow-delimiters rainbow-mode sudo-edit + symbol-overlay tldr unfill vertico vterm-toggle + whitespace-cleanup-mode whole-line-or-region + writeroom-mode))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/init.el b/init.el index fe5a7c8..b2550b5 100644 --- a/init.el +++ b/init.el @@ -43,6 +43,7 @@ (require-package 'diminish) ;; Packages ;;(require 'init-meow) +(require 'init-god) (require 'init-gui-frames) (require 'init-dired) @@ -50,8 +51,6 @@ (require 'init-look) (require 'init-isearch) (require 'init-uniquify) -;; (require 'init-flymake) -;;(require 'init-flycheck) (require 'init-recentf) (require 'init-minibuffer) (require 'init-ibuffer) diff --git a/lisp/init-git.el b/lisp/init-git.el index fc40ee6..24336a6 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -1,18 +1,12 @@ ;;; init-git.el --- Git SCM support -*- lexical-binding: t -*- ;;; Commentary: - -;; See also init-github.el. - ;;; Code: -;; TODO: link commits from vc-log to magit-show-commit -;; TODO: smerge-mode (require-package 'git-modes) + (when (maybe-require-package 'git-timemachine) (global-set-key (kbd "C-x v t") 'git-timemachine-toggle)) -(require-package 'git-link) - (when (maybe-require-package 'magit) (setq-default magit-diff-refine-hunk 'all) @@ -23,24 +17,8 @@ (global-set-key [(meta f12)] 'magit-status) (global-set-key (kbd "C-x g") 'magit-status) (global-set-key (kbd "C-x M-g") 'magit-dispatch) - ;; Tell magit to automatically put us in vi-insert-mode when committing a change. - (add-hook 'with-editor-mode-hook #'evil-insert-state) + ) - (defun sanityinc/magit-or-vc-log-file (&optional prompt) - (interactive "P") - (if (and (buffer-file-name) - (eq 'Git (vc-backend (buffer-file-name)))) - (if prompt - (magit-log-buffer-file-popup) - (magit-log-buffer-file t)) - (vc-print-log))) - - (with-eval-after-load 'vc - (define-key vc-prefix-map (kbd "l") 'sanityinc/magit-or-vc-log-file))) - - -(with-eval-after-load 'magit - (define-key magit-status-mode-map (kbd "C-M-") 'magit-section-up)) (maybe-require-package 'magit-todos) @@ -54,40 +32,6 @@ -;;; git-svn support - -;; (when (maybe-require-package 'magit-svn) -;; (require-package 'magit-svn) -;; (autoload 'magit-svn-enabled "magit-svn") -;; (defun sanityinc/maybe-enable-magit-svn-mode () -;; (when (magit-svn-enabled) -;; (magit-svn-mode))) -;; (add-hook 'magit-status-mode-hook #'sanityinc/maybe-enable-magit-svn-mode)) - -(with-eval-after-load 'compile - (dolist (defn (list '(git-svn-updated "^\t[A-Z]\t\\(.*\\)$" 1 nil nil 0 1) - '(git-svn-needs-update "^\\(.*\\): needs update$" 1 nil nil 2 1))) - (add-to-list 'compilation-error-regexp-alist-alist defn) - (add-to-list 'compilation-error-regexp-alist (car defn)))) - -(defvar git-svn--available-commands nil "Cached list of git svn subcommands") -(defun git-svn--available-commands () - (or git-svn--available-commands - (setq git-svn--available-commands - (sanityinc/string-all-matches - "^ \\([a-z\\-]+\\) +" - (shell-command-to-string "git svn help") 1)))) - -(autoload 'vc-git-root "vc-git") - -(defun git-svn (dir command) - "Run a git svn subcommand in DIR." - (interactive (list (read-directory-name "Directory: ") - (completing-read "git-svn command: " (git-svn--available-commands) nil t nil nil (git-svn--available-commands)))) - (let* ((default-directory (vc-git-root dir)) - (compilation-buffer-name-function (lambda (major-mode-name) "*git-svn*"))) - (compile (concat "git svn " command)))) - (provide 'init-git) ;;; init-git.el ends here diff --git a/lisp/init-god.el b/lisp/init-god.el new file mode 100644 index 0000000..2169a18 --- /dev/null +++ b/lisp/init-god.el @@ -0,0 +1,14 @@ +;;; init-god.el --- make emacs usable -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: + +(require-package 'god-mode) +(god-mode) +(global-set-key (kbd "") #'god-local-mode) + +(defun my-god-mode-update-cursor-type () + (setq cursor-type (if (or god-local-mode buffer-read-only) 'box 'bar))) + +(add-hook 'post-command-hook #'my-god-mode-update-cursor-type) + +(define-key god-local-mode-map (kbd ".") #'repeat) diff --git a/lisp/init-look.el b/lisp/init-look.el index 052b75d..c1c387d 100644 --- a/lisp/init-look.el +++ b/lisp/init-look.el @@ -1,3 +1,6 @@ +;;; init-look.el --- making emacs look decent. -*- lexical-binding: t -*- +;;; Commentary: +;;; Code: ;;; Line spacing, can be 0 for code and 1 or 2 for text ;;; ------------------------------------------------------------------- (setq-default line-spacing 0) @@ -12,7 +15,7 @@ ;;; ------------------------------------------------------------------- ;;; Highlight current line ;;; ------------------------------------------------------------------- -(global-hl-line-mode +1) +(global-hl-line-mode -1) ;;; No sound ;;; -------------------------------------------------------------------