]> git.armaanb.net Git - config.org.git/blobdiff - config.org
Don't ask about context when entering mu4e
[config.org.git] / config.org
index 63939b94cd128fd95aa4748e98778679279cd8d1..7888771bb49e4e2cdb01914d0cf6f6be3d9943ef 100644 (file)
@@ -15,9 +15,7 @@ Another important choice has been to integrate Emacs into a large part of my com
 Lastly, I use Evil mode. I think modal keybindings are simple and more ergonomic than standard Emacs style, and Vim keybindings are what I'm comfortable with and are pervasive throughout computing.
 ** TODOs
 *** TODO Turn keybinding and hook declarations into use-package declarations where possible
-*** TODO Put configs with passwords in here with some kind of authentication
-- Offlineimap
-- irc.el
+*** TODO Include offlineimap config
 ** License
 Released under the [[https://opensource.org/licenses/MIT][MIT license]] by Armaan Bhojwani, 2021. Note that many snippets are taken from online, and other sources, who are credited for their work at the snippet.
 * Package management
@@ -269,8 +267,10 @@ Add back C-a/C-x
     (add-to-list 'org-structure-template-alist '("za" . "src conf :tangle ~/.config/zathura/zathurarc"))
     (add-to-list 'org-structure-template-alist '("ff1" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userChrome.css"))
     (add-to-list 'org-structure-template-alist '("ff2" . "src css :tangle ~/.mozilla/firefox/armaan-release/chrome/userContent.css"))
-    (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources")
-    (add-to-list 'org-structure-template-alist '("tm" . "src conf :tangle ~/.tmux.conf")))
+    (add-to-list 'org-structure-template-alist '("xr" . "src conf :tangle ~/.Xresources"))
+    (add-to-list 'org-structure-template-alist '("tm" . "src conf :tangle ~/.tmux.conf"))
+    (add-to-list 'org-structure-template-alist '("gp" . "src conf :tangle ~/.gnupg/gpg.conf"))
+    (add-to-list 'org-structure-template-alist '("ag" . "src conf :tangle ~/.gnupg/gpg-agent.conf")))
 #+end_src
 * Autocompletion
 ** Ivy
@@ -357,6 +357,7 @@ Contexts are a not very well known feature of mu4e that makes it super easy to m
           mu4e-confirm-quit nil
           mu4e-view-use-gnus t
           mail-user-agent 'mu4e-user-agent
+          mail-context-policy 'pick-first
           mu4e-contexts
           `( ,(make-mu4e-context
                :name "school"
@@ -443,30 +444,34 @@ Some EWW enhancements.
   (global-set-key (kbd "C-c w") 'eww)
 #+end_src
 ** IRC
-*** Setup ERC
 #+begin_src emacs-lisp
-  (use-package erc
-    :straight (:type built-in)
+  (use-package circe
     :config
-    (erc-notifications-mode 1)
-    (erc-track-enable)
-    (erc-smiley-disable)
-    :custom (erc-prompt-for-password . nil))
+    (enable-lui-track)
+    (enable-circe-color-nicks))
 
-  (use-package erc-hl-nicks
-    :config (erc-hl-nicks-mode 1))
+  (defun fetch-password (&rest params)
+    (require 'auth-source)
+    (let ((match (car (apply 'auth-source-search params))))
+      (if match
+          (let ((secret (plist-get match :secret)))
+            (if (functionp secret)
+                (funcall secret)
+              secret))
+        (error "Password not found for %S" params))))
 
-  (defun acheam-irc ()
-    "Connect to irc"
-    (interactive)
-    (erc-tls :server "irc.armaanb.net" :nick "emacs"))
+  (setq circe-network-options
+        '(("pounce"
+           :host "irc.armaanb.net"
+           :nick "emacs"
+           :use-tls t
+           :port "6697"
+           :pass (lambda (fetch-password
+                          :login "emacs"
+                          :machine "irc.armaanb.net"
+                          :port 6697))))
 
-  (acheam-irc)
-#+end_src
-** Emacs Anywhere
-Use Emacs globally. Use the Emacs daemon and bind a key in your wm to =emacsclient --eval "(emacs-everywhere)"=.
-#+begin_src emacs-lisp
-  (use-package emacs-everywhere)
+        (circe "pounce")
 #+end_src
 * Emacs IDE
 ** Code cleanup
@@ -545,6 +550,25 @@ Use Emacs globally. Use the Emacs daemon and bind a key in your wm to =emacsclie
     :straight (git-email :repo "https://git.sr.ht/~yoctocell/git-email")
     :config (git-email-piem-mode))
 #+end_src
+** Java
+*** Evaluate current buffer
+Stolen from https://stackoverflow.com/questions/19953924/how-do-you-run-java-codes-in-emacs
+#+begin_src emacs-lisp
+  (defun java-eval-buffer ()
+    "run current program (that requires no input)"
+    (interactive)
+    (let* ((source (file-name-nondirectory buffer-file-name))
+           (out    (file-name-sans-extension source))
+           (class  (concat out ".class")))
+      (save-buffer)
+      (shell-command (format "rm -f %s && javac %s" class source))
+      (if (file-exists-p class)
+          (shell-command (format "java %s" out) "*scratch*")
+        (progn
+          (set (make-local-variable 'compile-command)
+               (format "javac %s" source))
+          (command-execute 'compile)))))
+#+end_src
 * General text editing
 ** Indentation
 Indent after every change.
@@ -751,15 +775,15 @@ No more clogging up init.el.
 #+begin_src conf :tangle ~/.spectrwm.conf
   program[email] = emacsclient -c --eval "(mu4e)"
   program[irc] = emacsclient -c --eval '(switch-to-buffer "irc.armaanb.net:6697")'
+  program[rss] = emacsclient -c --eval '(elfeed)'
   program[emacs] = emacsclient -c
   program[firefox] = firefox
   program[calc] = st -e because -l
-  program[emacs-anywhere] = emacsclient --eval "(emacs-everywhere)"
 
   bind[email] = MOD+Control+1
   bind[irc] = MOD+Control+2
-  bind[firefox] = MOD+Control+3
-  bind[emacs-anywhere] = MOD+Control+4
+  bind[rss] = MOD+Control+3
+  bind[firefox] = MOD+Control+4
   bind[calc] = MOD+Control+5
   bind[emacs] = MOD+Control+Return
 #+end_src
@@ -1215,5 +1239,19 @@ Modus operandi theme.
 ** Tmux
 #+begin_src conf :tangle ~/.tmux.conf
   set -g status off
+  set -g mouse on
   set-window-option -g mode-keys vi
 #+end_src
+** GPG
+*** Config
+#+begin_src conf :tangle ~/.gnupg/gpg.conf
+  default-key 3C9ED82FFE788E4A
+  use-agent
+#+end_src
+*** Agent
+#+begin_src conf :tangle ~/.gnupg/gpg-agent.conf
+  pinentry-program /sbin/pinentry-gnome3
+  max-cache-ttl 600
+  default-cache-ttl 600
+  allow-emacs-pinentry
+#+end_src