X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/blobdiff_plain/7d1b2f9ae4bacd453401c2cca174a2a5f85fe0ad..5a96c38883409f1e2844e78ba8f9f3942244eceb:/init.org diff --git a/init.org b/init.org index 7c12ad5..36bcc59 100644 --- a/init.org +++ b/init.org @@ -419,6 +419,24 @@ Font stack with better unicode support, around =Ubuntu Mono= and (setq text-scale-mode-step 1.05) #+end_src +** Focus follows mouse + +I’d like focus to follow the mouse when I move the cursor from one +window to the next. + +#+begin_src emacs-lisp +(setq mouse-autoselect-window t) +#+end_src + +Let’s define a function to conveniently disable this for certain +buffers and/or modes. + +#+begin_src emacs-lisp +(defun amin--no-mouse-autoselect-window () + (make-local-variable 'mouse-autoselect-window) + (setq mouse-autoselect-window nil)) +#+end_src + ** Libraries #+begin_src emacs-lisp @@ -998,7 +1016,10 @@ Not just how I do git, but /the/ way to do git. #+begin_src emacs-lisp (use-package magit :defer 1 - :general (amin--leader-keys "g s" 'magit-status) + :general + (amin--leader-keys + "g s" 'magit-status + "g l" 'magit-log-buffer-file) :bind ("s-g" . magit-status) :config (magit-add-section-hook 'magit-status-sections-hook @@ -1991,7 +2012,47 @@ Also see [[https://www.emacswiki.org/emacs/rebox2][rebox2]]. :hook (text-mode . typo-mode)) #+end_src -** slack +** hl-todo + +#+begin_src emacs-lisp +(use-package hl-todo + :defer 4 + :config + (global-hl-todo-mode)) +#+end_src + +** shrink-path + +#+begin_src emacs-lisp +(use-package shrink-path + :after eshell + :config + (setq eshell-prompt-regexp "\\(.*\n\\)*λ " + eshell-prompt-function #'+eshell/prompt) + + (defun +eshell/prompt () + (let ((base/dir (shrink-path-prompt default-directory))) + (concat (propertize (car base/dir) + 'face 'font-lock-comment-face) + (propertize (cdr base/dir) + 'face 'font-lock-constant-face) + (propertize (+eshell--current-git-branch) + 'face 'font-lock-function-name-face) + "\n" + (propertize "λ" 'face 'eshell-prompt-face) + ;; needed for the input text to not have prompt face + (propertize " " 'face 'default)))) + + (defun +eshell--current-git-branch () + (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n") + when (string-match "^\*" match) + collect match)))) + (if (not (eq branch nil)) + (concat " " (substring branch 2)) + "")))) +#+end_src + +** COMMENT slack :ARCHIVE: Hopefully temporary. @@ -2056,47 +2117,7 @@ Hopefully temporary. (setq alert-default-style 'notifier)) #+end_src -** hl-todo - -#+begin_src emacs-lisp -(use-package hl-todo - :defer 4 - :config - (global-hl-todo-mode)) -#+end_src - -** shrink-path - -#+begin_src emacs-lisp -(use-package shrink-path - :after eshell - :config - (setq eshell-prompt-regexp "\\(.*\n\\)*λ " - eshell-prompt-function #'+eshell/prompt) - - (defun +eshell/prompt () - (let ((base/dir (shrink-path-prompt default-directory))) - (concat (propertize (car base/dir) - 'face 'font-lock-comment-face) - (propertize (cdr base/dir) - 'face 'font-lock-constant-face) - (propertize (+eshell--current-git-branch) - 'face 'font-lock-function-name-face) - "\n" - (propertize "λ" 'face 'eshell-prompt-face) - ;; needed for the input text to not have prompt face - (propertize " " 'face 'default)))) - - (defun +eshell--current-git-branch () - (let ((branch (car (loop for match in (split-string (shell-command-to-string "git branch") "\n") - when (string-match "^\*" match) - collect match)))) - (if (not (eq branch nil)) - (concat " " (substring branch 2)) - "")))) -#+end_src - -** magithub +** COMMENT magithub :ARCHIVE: For when I /have to/ use GH. @@ -2243,7 +2264,8 @@ For when I /have to/ use GH. :map gnus-summary-mode-map ("r" . gnus-summary-reply-with-original) ("R" . gnus-summary-wide-reply-with-original) - ("M-L" . org-store-link))) + ("M-L" . org-store-link)) + :hook (gnus-summary-mode . amin--no-mouse-autoselect-window)) (use-package gnus-msg :config