Trimmer way for app-specific perspectives
This commit is contained in:
parent
29fb549c32
commit
9853d3f4ed
5 changed files with 82 additions and 106 deletions
|
@ -41,16 +41,7 @@ I would like a dedicate perspective to Mastodon, and I would like a leader key s
|
|||
#+begin_src emacs-lisp
|
||||
(use-package mastodon
|
||||
:config
|
||||
(defun mastodon-perspective ()
|
||||
(interactive)
|
||||
(let ((already-tooted? (seq-contains-p
|
||||
(persp-names) "mastodon" 'equal)))
|
||||
(persp-switch "mastodon")
|
||||
(unless already-tooted?
|
||||
(mastodon))))
|
||||
|
||||
(ha-leader
|
||||
"a m" '("mastodon" . mastodon-perspective))
|
||||
(ha-leader "a m" `("mastodon" . ,(ha-app-perspective "mastodon" #'mastodon)))
|
||||
|
||||
(use-package major-mode-hydra
|
||||
:config
|
||||
|
@ -111,8 +102,7 @@ Yet another encrypted chat/VoIP client-server, but unlike Signal and Telegram, [
|
|||
"a x S" '("send" . ement-send-direct-message)
|
||||
"a x s" '("send" . ement-room-send-message)
|
||||
"a x c" '("compose" . ement-room-compose-message)
|
||||
"a x r" '("room" . ement-view-room)
|
||||
"a x d" '("discover" . mastodon-discover)))
|
||||
"a x r" '("room" . ement-view-room)))
|
||||
|
||||
(ha-leader
|
||||
"a x" '(:ignore t :which-key "matrix")
|
||||
|
@ -145,19 +135,18 @@ And we are no longer using this package.
|
|||
I'm thinking the [[https://zevlg.github.io/telega.el/][Telega package]] would be better than Bitlbee for Telegram communication.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package telega
|
||||
:commands (telega)
|
||||
:config
|
||||
(setq telega-user-use-avatars nil
|
||||
telega-use-tracking-for nil ; '(any pin unread)
|
||||
telega-chat-use-markdown-formatting t
|
||||
telega-emoji-use-images t
|
||||
; telega-completing-read-function #'ivy-completing-read
|
||||
telega-msg-rainbow-title nil)
|
||||
:config
|
||||
(setq telega-user-use-avatars nil
|
||||
telega-use-tracking-for nil ; '(any pin unread)
|
||||
telega-chat-use-markdown-formatting t
|
||||
telega-emoji-use-images t
|
||||
; telega-completing-read-function #'ivy-completing-read
|
||||
telega-msg-rainbow-title nil)
|
||||
|
||||
(when (fboundp 'evil-insert-state)
|
||||
(add-hook 'telega-chat-mode-hook 'evil-insert-state))
|
||||
(when (fboundp 'evil-insert-state)
|
||||
(add-hook 'telega-chat-mode-hook 'evil-insert-state))
|
||||
|
||||
(ha-leader "a t" 'telega))
|
||||
(ha-leader "a t" `("telega" . ,(ha-app-perspective "telega" #'telega))))
|
||||
#+end_src
|
||||
For some reason, you need [[https://github.com/Fanael/rainbow-identifiers][rainbow-identifiers]] to work, oh, I guess the docs state this.
|
||||
|
||||
|
|
|
@ -667,6 +667,22 @@ The /special/ perspective is a nice shortcut to the one I use the most:
|
|||
(interactive)
|
||||
(persp-switch "projects"))
|
||||
#+end_src
|
||||
|
||||
I often want a workspace dedicated to an /application/, so this function:
|
||||
#+begin_src emacs-lisp
|
||||
(defun ha-app-perspective (name func)
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(let ((already-started? (seq-contains-p (persp-names) name 'equal)))
|
||||
(persp-switch name)
|
||||
(unless already-started?
|
||||
(call-interactively func)))))
|
||||
#+end_src
|
||||
|
||||
And I can then use it like:
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(ha-leader "a x" `("to foobar" . ,(ha-app-perspective "foobar" #'foobar)))
|
||||
#+end_src
|
||||
*** Predefined Workspaces
|
||||
Let's describe a list of startup project workspaces. This way, I don't need the clutter of the recent state, but also get back to a state of mental normality.
|
||||
Granted, this list is essentially a list of projects that I'm currently developing, so I expect this to change often.
|
||||
|
|
11
ha-email.org
11
ha-email.org
|
@ -102,8 +102,7 @@ And some leader-based keybindings:
|
|||
(use-package notmuch
|
||||
:config
|
||||
(ha-leader ; Should I put these under an "m" heading?
|
||||
"a e" '("new mail" . notmuch-retrieve-messages)
|
||||
"a m" '("read mail" . notmuch)
|
||||
"a n" '("new mail" . notmuch-retrieve-messages)
|
||||
"a c" '("compose mail" . compose-mail))
|
||||
|
||||
(major-mode-hydra-define notmuch-hello-mode nil
|
||||
|
@ -129,13 +128,7 @@ Also, let's do some basic configuration of Emacs' mail system:
|
|||
|
||||
Create a special mail perspective:
|
||||
#+begin_src emacs-lisp
|
||||
(defun ha-email-persp-start ()
|
||||
"Create an IRC workspace and start my IRC client."
|
||||
(interactive)
|
||||
(persp-switch "mail")
|
||||
(notmuch))
|
||||
|
||||
(ha-leader "a M" '("mail persp" . ha-email-persp-start))
|
||||
(ha-leader "a M" `("mail" . ,(ha-app-perspective "mail" #'notmuch)))
|
||||
#+end_src
|
||||
* Configuration
|
||||
Do I want to sign messages by default? Nope.
|
||||
|
|
|
@ -86,21 +86,9 @@ According to Ben Maughan and [[http://pragmaticemacs.com/emacs/to-eww-or-not-to-
|
|||
(elfeed-show-visit t)))
|
||||
#+end_src
|
||||
|
||||
Quick way to start and jump to my world of feeds.
|
||||
#+begin_src emacs-lisp
|
||||
(defun ha-elfeed-persp ()
|
||||
"Create an ELFEED workspace and start my ELFEED client."
|
||||
(interactive)
|
||||
(let ((already-reading? (seq-contains-p
|
||||
(persp-names) "feeds" 'equal)))
|
||||
(persp-switch "feeds")
|
||||
(unless already-reading?
|
||||
(elfeed))))
|
||||
#+end_src
|
||||
|
||||
And some global keys to display them in the =apps= menu:
|
||||
#+begin_src emacs-lisp
|
||||
(ha-leader "a f" '("elfeed switch" . ha-elfeed-persp))
|
||||
(ha-leader "a f" `("feed reader" . ,(ha-app-perspective "elfeed" #'elfeed)))
|
||||
#+end_src
|
||||
* The Feeds :elfeed:
|
||||
The [[https://github.com/remyhonig/elfeed-org][elfeed-org]] project configures =elfeed= to read the RSS feeds from an Org file … like this one!
|
||||
|
|
112
ha-irc.org
112
ha-irc.org
|
@ -27,50 +27,39 @@ A literate programming configuration file for IRC communiction.
|
|||
* Introduction
|
||||
My IRC /needs/ are basic, but I'm not sure which I want to use.
|
||||
** ERC
|
||||
Initial variable configuration for ERC.
|
||||
#+begin_src emacs-lisp
|
||||
(use-package erc-hl-nicks
|
||||
:after erc)
|
||||
|
||||
(use-package erc-image
|
||||
:after erc)
|
||||
|
||||
(use-package erc
|
||||
:commands erc
|
||||
:config
|
||||
(setq
|
||||
erc-nick "howard-abrams"
|
||||
erc-user-full-name "Howard Abrams"
|
||||
erc-prompt ">>"
|
||||
erc-prompt-for-nickserv-password nil
|
||||
erc-auto-query 'bury
|
||||
erc-join-buffer 'bury
|
||||
erc-interpret-mirc-color t
|
||||
erc-rename-buffers t
|
||||
erc-hide-list '("JOIN" "PART" "QUIT")
|
||||
erc-track-enable-keybindings nil
|
||||
erc-track-visibility nil ; Only use the selected frame for visibility
|
||||
erc-fill-column 120
|
||||
erc-fill-function 'erc-fill-static
|
||||
erc-fill-static-center 20
|
||||
erc-timestamp-only-if-changed-flag nil
|
||||
;; erc-timestamp-format "%H:%M"
|
||||
erc-autojoin-channels-alist '(("howardabrams.com" "#emacs" "#org-mode"))
|
||||
erc-quit-reason (lambda (s) (or s "Fading out..."))
|
||||
erc-modules
|
||||
'(autoaway autojoin button completion fill irccontrols keep-place
|
||||
list match menu move-to-prompt netsplit networks noncommands
|
||||
readonly ring stamp track hl-nicks)))
|
||||
(setq erc-nick "howard-abrams"
|
||||
erc-user-full-name "Howard Abrams"
|
||||
erc-server "irc.libera.chat")
|
||||
|
||||
(defun ha-erc-connect-irc ()
|
||||
"Connect to my favorite IRC server with ERC."
|
||||
(interactive)
|
||||
(let* ((auth-results (auth-source-search :host "irc.libera.chat" :port 6667 :max 1))
|
||||
(auth-first (first auth-results))
|
||||
(username (plist-get auth-first :user))
|
||||
(password (funcall (plist-get auth-first :secret))))
|
||||
(erc :server "irc.libera.chat" :port 6667)
|
||||
(sit-for 2)
|
||||
(erc-cmd-QUOTE (format "PASS %s:%s" username password))))
|
||||
(seq-let (username password) (auth-source-user-and-password "irc.libera.chat")
|
||||
(setq erc-session-username username
|
||||
erc-session-password password
|
||||
erc-password password))
|
||||
|
||||
(setq erc-prompt ">>"
|
||||
erc-prompt-for-nickserv-password nil
|
||||
erc-auto-query 'bury
|
||||
erc-join-buffer 'bury
|
||||
erc-interpret-mirc-color t
|
||||
erc-rename-buffers t
|
||||
erc-hide-list '("JOIN" "PART" "QUIT")
|
||||
erc-track-enable-keybindings nil
|
||||
erc-track-visibility nil ; Only use the selected frame for visibility
|
||||
erc-fill-column 120
|
||||
erc-fill-function 'erc-fill-static
|
||||
erc-fill-static-center 20
|
||||
erc-timestamp-only-if-changed-flag nil
|
||||
;; erc-timestamp-format "%H:%M"
|
||||
erc-autojoin-channels-alist '((".*" "#emacs" "#org-mode"))
|
||||
erc-quit-reason (lambda (s) (or s "Fading out..."))
|
||||
erc-modules
|
||||
'(autoaway autojoin button completion fill irccontrols keep-place
|
||||
list match menu move-to-prompt netsplit networks noncommands
|
||||
readonly ring stamp track hl-nicks)))
|
||||
#+end_src
|
||||
|
||||
I like to make sure the text formats to the size of the window:
|
||||
|
@ -81,6 +70,12 @@ I like to make sure the text formats to the size of the window:
|
|||
(setq erc-fill-column (1- (window-width))))
|
||||
#+end_src
|
||||
|
||||
Interesting plugins:
|
||||
#+begin_src emacs-lisp
|
||||
(use-package erc-hl-nicks :after erc)
|
||||
(use-package erc-image :after erc)
|
||||
#+end_src
|
||||
|
||||
* ZNC Server
|
||||
I'm using my own ZNC server, and I need to log in with a password stored in my GPG auth storage:
|
||||
|
||||
|
@ -98,36 +93,31 @@ I'm using my own ZNC server, and I need to log in with a password stored in my G
|
|||
|
||||
* Key Bindings
|
||||
Quick way to start and jump to my IRC world.
|
||||
#+begin_src emacs-lisp
|
||||
(defun ha-irc-persp-start ()
|
||||
"Create an IRC workspace and start my IRC client."
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(defun ha-irc ()
|
||||
(interactive)
|
||||
(persp-switch "irc")
|
||||
(ha-erc-connect-irc))
|
||||
|
||||
(defun ha-irc-persp-switch ()
|
||||
"Switch to the IRC workspace and load the next buffer."
|
||||
(interactive)
|
||||
(persp-switch "irc")
|
||||
(call-interactively 'erc-track-switch-buffer))
|
||||
(erc :server "irc.libera.chat" :port 6667 :full-name erc-user-full-name
|
||||
:nick erc-nick :user erc-session-username :password erc-session-password))
|
||||
#+end_src
|
||||
|
||||
And some global keys to display them:
|
||||
#+begin_src emacs-lisp
|
||||
(ha-leader
|
||||
"a i" '("irc switch" . ha-irc-persp-switch)
|
||||
"a I" '("irc start" . ha-irc-persp-start))
|
||||
(ha-leader "a i" `("irc" . ,(ha-app-perspective "irc" #'ha-erc)))
|
||||
#+end_src
|
||||
|
||||
And a quick shortcuts to call it:
|
||||
#+begin_src emacs-lisp
|
||||
(major-mode-hydra-define erc-mode nil
|
||||
("Server"
|
||||
(("r" ha-erc-connect-irc "reconnect")
|
||||
("p" ha-erc-reconnect-password) "send password")
|
||||
"Channel"
|
||||
(("o" erc-track-switch-buffer "next channel")
|
||||
("w" ha-erc-resize-text "resize text"))))
|
||||
(use-package major-mode-hydra
|
||||
:after erc
|
||||
:config
|
||||
(major-mode-hydra-define erc-mode nil
|
||||
("Server"
|
||||
(("r" erc-server-reconnect "reconnect")
|
||||
("p" ha-erc-reconnect-password "send password"))
|
||||
"Channel"
|
||||
(("o" erc-track-switch-buffer "next channel")
|
||||
("j" erc-join-channel "join channel")
|
||||
("w" ha-erc-resize-text "resize text")))))
|
||||
#+end_src
|
||||
* Display Configuration
|
||||
Using the [[https://github.com/seagle0128/doom-modeline][Doom Modeline]] to add notifications:
|
||||
|
|
Loading…
Reference in a new issue