about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.org344
1 files changed, 0 insertions, 344 deletions
diff --git a/config.org b/config.org index f3cea78..f1c5cff 100644 --- a/config.org +++ b/config.org
@@ -569,173 +569,6 @@ I want the git version.
569 (minions-mode +1) 569 (minions-mode +1)
570#+end_src 570#+end_src
571 571
572**** COMMENT Simple modeline :package:
573
574After trying =doom-mode-line= and =smart-mode-line=, I think I've finally
575landed on a good one: =simple-modeline=.
576
577#+begin_src emacs-lisp :noweb-ref packages
578 (straight-use-package 'simple-modeline)
579#+end_src
580
581#+begin_src emacs-lisp :noweb-ref settings
582 (setq-default simple-modeline-segments
583 '(;; left side
584 (acdw/modeline/modified
585 simple-modeline-segment-buffer-name
586 acdw/modeline/vc-status
587 acdw/modeline/position)
588 ;; right side
589 (simple-modeline-segment-minor-modes
590 simple-modeline-segment-input-method
591 simple-modeline-segment-misc-info
592 simple-modeline-segment-process
593 acdw/modeline/acdw-minions
594 simple-modeline-segment-major-mode)))
595#+end_src
596
597#+begin_src emacs-lisp :noweb-ref modes
598 (simple-modeline-mode +1)
599#+end_src
600
601***** Simple modeline custom segments
602
603****** COMMENT Functions to figure out what window is focused
604
605How is this not built into Emacs? Oh well, I have [[https://github.com/jamesnvc/dotfiles/blob/master/emacs.d/modules/cogent-modeline.el][Cogent]] to thank.
606
607#+begin_src emacs-lisp :noweb-ref variables
608 (defvar cogent-line-selected-window (frame-selected-window))
609#+end_src
610
611#+begin_src emacs-lisp :noweb-ref functions
612 (defun cogent-line-set-selected-window (&rest _args)
613 (when (not (minibuffer-window-active-p (frame-selected-window)))
614 (setq cogent-line-selected-window (frame-selected-window))
615 (force-mode-line-update)))
616
617 (defun cogent-line-unset-selected-window ()
618 (setq cogent-line-selected-window nil)
619 (force-mode-line-update))
620
621 (defun cogent-line-selected-window-active-p ()
622 (eq cogent-line-selected-window (selected-window)))
623#+end_src
624
625#+begin_src emacs-lisp :noweb-ref hooks
626 (add-hook 'window-configuration-change-hook #'cogent-line-set-selected-window)
627 (add-hook 'focus-in-hook #'cogent-line-set-selected-window)
628 (add-hook 'focus-out-hook #'cogent-line-unset-selected-window)
629 (advice-add 'handle-switch-frame :after #'cogent-line-set-selected-window)
630 (advice-add 'select-window :after #'cogent-line-set-selected-window)
631#+end_src
632
633****** Tweak =simple-modeline-segment-modified=
634
635#+begin_src emacs-lisp :noweb-ref functions
636 (defun acdw/modeline/modified ()
637 "Show the modified/readonly state in the modeline.
638 See `simple-modeline-status-modified'."
639 (if (not (string-match-p "\\*.*\\*" (buffer-name)))
640 (let* ((read-only (and buffer-read-only (buffer-file-name)))
641 (modified (buffer-modified-p)))
642 (propertize
643 (if read-only " ×" (if modified " ●" " ○"))
644 'face `(:inherit
645 ,(if modified 'simple-modeline-status-modified
646 (if read-only 'simple-modeline-status-error
647 'simple-modeline-unimportant)))
648 'help-echo (format
649 "Buffer is %s and %smodified\nmouse-1: Toggle read-only status."
650 (if read-only "read-only" "writable")
651 (if modified "" "not "))
652 'local-map (purecopy (simple-modeline-make-mouse-map
653 'mouse-1
654 (lambda (event)
655 (interactive "e")
656 (with-selected-window (posn-window (event-start event))
657 (read-only-mode 'toggle)))))
658 'mouse-face 'mode-line-highlight))
659 "_"))
660#+end_src
661
662****** Easier minor-modes
663
664#+begin_src emacs-lisp :noweb-ref functions
665 (defun acdw/modeline/acdw-minions ()
666 "Show `acdw/mode' icon as a button to enable `minions-minor-modes-menu'.
667
668 This enables me to `blackout' all global minor-mode
669 lighters (including `acdw/mode'), and hide them behind a button,
670 saving space in the mode line."
671 (propertize " ⱷ"
672 'help-echo "Minor modes"
673 'local-map (purecopy (simple-modeline-make-mouse-map
674 'mouse-1
675 (lambda (event)
676 (interactive "e")
677 (with-selected-window (posn-window
678 (event-start event))
679 (minions-minor-modes-menu)))))
680 'mouse-face 'mode-line-highlight))
681#+end_src
682
683****** Shorter VC-mode segment
684
685#+begin_src emacs-lisp :noweb-ref functions
686 (defun acdw/modeline/vc-status ()
687 "Displays the VC status in the modeline."
688 '(vc-mode (:eval
689 (let ((branch-name (replace-regexp-in-string
690 (format "^\s*%s:?-?"
691 (vc-backend buffer-file-name))
692 "" vc-mode))
693 (f (cond ((string= "up-to-date"
694 (vc-state buffer-file-name))
695 '((:slant normal)))
696 (t
697 '((:slant italic))))))
698 (propertize (concat " " branch-name)
699 'face f
700 'help-echo (format
701 "%s: %s\nmouse-1: Run magit-status"
702 vc-mode
703 (vc-state buffer-file-name))
704 'local-map (purecopy
705 (simple-modeline-make-mouse-map
706 'mouse-1
707 (lambda (ev)
708 (interactive "e")
709 (with-selected-window
710 (posn-window
711 (event-start ev))
712 (magit-status-setup-buffer
713 (file-name-directory
714 buffer-file-name))))))
715 'mouse-face 'mode-line-highlight)))))
716#+end_src
717
718****** Position in file
719
720#+begin_src emacs-lisp :noweb-ref functions
721 (defun acdw/modeline/position ()
722 "Displays the current cursor position in the mode-line."
723 `((line-number-mode (-6 " %l"))
724 ((column-number-mode
725 (column-number-indicator-zero-based
726 (4 ":%c")
727 (4 ":%C"))))
728 " " mode-line-percent-position "%% "
729 ,(if (region-active-p)
730 (propertize (format "+%s "
731 (apply #'+ (mapcar
732 (lambda (pos)
733 (- (cdr pos)
734 (car pos)))
735 (region-bounds))))
736 'font-lock-face 'font-lock-variable-name-face))))
737#+end_src
738
739**** Blackout some modes :package: 572**** Blackout some modes :package:
740 573
741Like =diminish= or =delight=, =blackout= allows me to remove some 574Like =diminish= or =delight=, =blackout= allows me to remove some
@@ -755,29 +588,6 @@ Shows where we are in the modeline.
755 (which-function-mode +1) 588 (which-function-mode +1)
756#+end_src 589#+end_src
757 590
758**** COMMENT Nyan mode :package:
759
760+Fuck it, let's have some fun.+ COMMENTED out because it messes up my
761modeline :(
762
763This obviously needs a lot more research.
764
765#+begin_src emacs-lisp :noweb-ref packages
766 (straight-use-package 'nyan-mode)
767#+end_src
768
769I add it to the modeline [[*Simple modeline][below]].
770
771#+begin_src emacs-lisp :noweb-ref settings
772 (setq-default nyan-bar-length 20)
773#+end_src
774
775But I still have to enable the mode ?!
776
777#+begin_src emacs-lisp :noweb-ref settings
778 (nyan-mode +1)
779#+end_src
780
781**** Mode-line faces 591**** Mode-line faces
782 592
783#+begin_src emacs-lisp :noweb-ref linux-specific 593#+begin_src emacs-lisp :noweb-ref linux-specific
@@ -891,52 +701,6 @@ to /hide/ those contents.
891 read-file-name-completion-ignore-case t) 701 read-file-name-completion-ignore-case t)
892#+end_src 702#+end_src
893 703
894*** COMMENT Selectrum :package:
895
896*COMMENT 2021-02-01*: For some reason, selectrum will randomly do a thing where
897it, like, flashes up and down in the minibuffer? I don't know how to explain
898it, it's super weird. I guess I should file a bug report ... but until then,
899I'll just use =icomplete-vertical=.
900
901My minibuffer completion system uses =selectrum=, =prescient=, =company=,
902and =marginalia=. At some point, I'd like to take a deep dive in =embark=
903(possibly switching out =selectrum=), =ido=, =orderless=, or others,
904for now .... I just want to see my completions.
905
906#+begin_src emacs-lisp :noweb-ref packages
907 (straight-use-package 'selectrum)
908#+end_src
909
910#+begin_src emacs-lisp :noweb-ref modes
911 (selectrum-mode +1)
912#+end_src
913
914*** COMMENT Prescient :package:
915
916#+begin_src emacs-lisp :noweb-ref packages
917 (straight-use-package 'prescient)
918 (require 'prescient)
919#+end_src
920
921Prescient can persist itself too.
922
923#+begin_src emacs-lisp :noweb-ref modes
924 (prescient-persist-mode +1)
925#+end_src
926
927**** COMMENT Selectrum integration
928
929Let's have =prescient= and =selectrum= work together.
930
931#+begin_src emacs-lisp :noweb-ref packages
932 (straight-use-package 'selectrum-prescient)
933#+end_src
934
935#+begin_src emacs-lisp :noweb-ref modes
936 (with-eval-after-load 'selectrum
937 (selectrum-prescient-mode +1))
938#+end_src
939
940*** Icomplete 704*** Icomplete
941 705
942#+begin_src emacs-lisp :noweb-ref packages 706#+begin_src emacs-lisp :noweb-ref packages
@@ -1063,15 +827,6 @@ I like the rich annotations provided by =marginalia=.
1063 nil)) 827 nil))
1064#+end_src 828#+end_src
1065 829
1066**** COMMENT Integration with Selectrum
1067
1068#+begin_src emacs-lisp :noweb-ref functions
1069 (advice-add #'marginalia-cycle :after
1070 (lambda ()
1071 (when (bound-and-true-p selectrum-mode)
1072 (selectrum-exhibit))))
1073#+end_src
1074
1075** Imenu 830** Imenu
1076 831
1077#+begin_src emacs-lisp :noweb-ref settings 832#+begin_src emacs-lisp :noweb-ref settings
@@ -1344,20 +1099,6 @@ the user is looking at something else.
1344 1099
1345** Garbage collection 1100** Garbage collection
1346 1101
1347*** COMMENT Garbage Collection Magic Hack :package:
1348
1349Look, I'm not going to look too deeply into this. It's /magic/ afer
1350all.
1351
1352#+begin_src emacs-lisp :noweb-ref packages
1353 (straight-use-package 'gcmh)
1354#+end_src
1355
1356#+begin_src emacs-lisp :noweb-ref modes
1357 (gcmh-mode +1)
1358 (blackout 'gcmh-mode)
1359#+end_src
1360
1361*** Simple GC munging about 1102*** Simple GC munging about
1362 1103
1363From [[https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/][bling]], from ... 2016? Maybe this isn't great, but it's one less package so 1104From [[https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/][bling]], from ... 2016? Maybe this isn't great, but it's one less package so
@@ -1836,26 +1577,6 @@ already commented. That's it.
1836 1577
1837** Word count 1578** Word count
1838 1579
1839*** COMMENT WC Mode :package:
1840
1841I'm just going to comment this out for right now because I honestly
1842don't know if it's that useful.
1843
1844#+begin_src emacs-lisp :noweb-ref packages
1845 (straight-use-package 'wc-mode)
1846#+end_src
1847
1848#+begin_src emacs-lisp :noweb-ref hooks
1849 (defun hook--wc-mode-no-keybinds ()
1850 (wc-mode +1)
1851 (define-key wc-mode-map (kbd "C-c C-w w") nil)
1852 (define-key wc-mode-map (kbd "C-c C-w l") nil)
1853 (define-key wc-mode-map (kbd "C-c C-w a") nil)
1854 (define-key wc-mode-map (kbd "C-c C-w c") nil))
1855
1856 (add-hook 'text-mode-hook #'hook--wc-mode-no-keybinds)
1857#+end_src
1858
1859*** Key binding 1580*** Key binding
1860 1581
1861I just found out that =M-== counts the words in a region. That's great, but I 1582I just found out that =M-== counts the words in a region. That's great, but I
@@ -2475,71 +2196,6 @@ See [[https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/mast
2475 )) 2196 ))
2476#+end_src 2197#+end_src
2477 2198
2478*** COMMENT Elfeed-goodies
2479
2480#+begin_src emacs-lisp :noweb-ref packages
2481 (straight-use-package 'elfeed-goodies)
2482#+end_src
2483
2484#+begin_src emacs-lisp :noweb-ref hooks
2485 (with-eval-after-load 'elfeed
2486 (require 'elfeed-goodies)
2487 (elfeed-goodies/setup))
2488#+end_src
2489
2490#+begin_src emacs-lisp :noweb-ref settings
2491 (setq-default elfeed-goodies/entry-pane-position 'top
2492 elfeed-goodies/powerline-default-separator nil
2493 elfeed-goodies/tag-column-width 16)
2494#+end_src
2495
2496*** COMMENT Elfeed-protocol
2497
2498I'm not /the most/ happy with this -- it seems like a lot for not that
2499much -- but until I figure out a proper syncing solution, it'll do.
2500
2501#+begin_src emacs-lisp :noweb-ref packages
2502 (straight-use-package 'elfeed-protocol)
2503#+end_src
2504
2505#+begin_src emacs-lisp :noweb-ref settings
2506 (setq-default elfeed-protocol-ttrss-maxsize 200
2507 elfeed-feeds
2508 '(("ttrss+https://acdw@rss.tildeverse.org"
2509 :use-authinfo t)))
2510#+end_src
2511
2512#+begin_src emacs-lisp :noweb-ref modes
2513 (with-eval-after-load 'elfeed
2514 (elfeed-protocol-enable))
2515#+end_src
2516
2517For whatever reason, =G= (=elfeed-search-fetch=) doesn't fetch anything
2518new from TTRSS. So I rebind it to ... =elfeed-protocol-ttrss-reinit=
2519(=elfeed-protocol-ttrss-update= doesn't pull everything for some reason
2520... this kind of thing is why I'm looking at other elfeed-sync
2521options).
2522
2523#+begin_src emacs-lisp :noweb-ref bindings
2524 (with-eval-after-load 'elfeed-protocol
2525 (defun acdw-elfeed-protocol-ttrss-update-then-reinit ()
2526 "Update, then reinit, the first entry in `elfeed-feeds'."
2527 (interactive)
2528 (let ((url (caar elfeed-feeds))
2529 (msg-update "Elfeed Protocol: Updating...")
2530 (msg-reinit "Elfeed Protocol: Re-initializing..."))
2531 (message "%s" msg-update)
2532 (elfeed-protocol-ttrss-update url)
2533 (message "%s Done." msg-update)
2534
2535 (message "%s" msg-reinit)
2536 (elfeed-protocol-ttrss-reinit url)
2537 (message "%s Done." msg-reinit)))
2538
2539 (define-key elfeed-search-mode-map "G"
2540 #'acdw-elfeed-protocol-ttrss-update-then-reinit))
2541#+end_src
2542
2543** 0x0 (null pointer) :package: 2199** 0x0 (null pointer) :package:
2544 2200
2545An ease-of-life package that lets me upload my shitty code to share it with 2201An ease-of-life package that lets me upload my shitty code to share it with