hamacs/ha-aux-apps.org
Howard Abrams ca4799e524 Migrating my local leader key to major-mode-hydra
Seems that the leader has a bug when it comes to local mode maps, and
the major-mode hydra is an attractive alternative. Granted, I do feel
the need to group things for the tabular view, but that isn't a bad thing.

Need to take a pass at my more-complex code in my programming stuff.
2024-03-03 20:18:00 -08:00

224 lines
9.1 KiB
Org Mode
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#+title: Auxillary and Optional Applications
#+author: Howard X. Abrams
#+date: 2021-11-18
#+tags: emacs
A literate programming file for helper apps in Emacs.
#+begin_src emacs-lisp :exports none
;;; ha-aux-apps --- Configuring helper apps in Emacs. -*- lexical-binding: t; -*-
;;
;; © 2021-2023 Howard X. Abrams
;; Licensed under a Creative Commons Attribution 4.0 International License.
;; See http://creativecommons.org/licenses/by/4.0/
;;
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>
;; Maintainer: Howard X. Abrams
;; Created: November 18, 2021
;;
;; This file is not part of GNU Emacs.
;;
;; *NB:* Do not edit this file. Instead, edit the original literate file at:
;; ~/other/hamacs/ha-aux-apps.org
;; And tangle the file to recreate this one.
;;
;;; Code:
#+end_src
* Introduction
The following applications are not needed. I alternate between trying to /stay in Emacs/ taking advantage of the consistent interface, and using a stand-alone app on my Workday computer.
* Federation
** Mastodon
Glad to see the 2FA feature is working on the [[https://codeberg.org/martianh/mastodon.el][mastodon.el]] project, and even more glad to see the great birdland diaspora arrive in the land of the toots.
#+begin_src emacs-lisp
(use-package mastodon
:straight (:host codeberg :repo "martianh/mastodon.el")
:init
(setq mastodon-instance-url "https://emacs.ch"
mastodon-active-user "howard"))
#+end_src
I would like a dedicate perspective to Mastodon, and I would like a leader key sequence that /expands/ will all options, once Mastodon is running in its own perspective:
#+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))
(use-package major-mode-hydra
:config
(major-mode-hydra-define mastodon-mode nil
("Timelines"
(("u" mastodon-tl--update "update")
("F" mastodon-tl--get-federated-timeline "Federated")
("H" mastodon-tl--get-home-timeline "Home")
("L" mastodon-tl--get-local-timeline "Local")
("T" mastodon-tl--get-tag-timeline "Hashtag"))
"Specials"
(("M" mastodon-notifications--get-mentions "Mentions")
("N" mastodon-notifications-get "Notifications")
("A" mastodon-tl--followed-tags-timeline "All Tags")
("S" mastodon-profile--view-bookmarks "Saved bookmarks")
("O" mastodon-profile--my-profile "My Profile"))
"Post"
(("c" mastodon-toot "Compose toot")
("e" mastodon-toot--edit-toot-at-point "Edit toot")
("t" mastodon-tl--thread "Read thread")
("r" mastodon-toot--reply "Reply")
("m" mastodon-tl--dm-user "Direct Msg")
("d" mastodon-toot--delete-toot "Delete"))
"Toot"
(("f" mastodon-toot--toggle-favourite "Favorite")
("b" mastodon-toot--toggle-boost "Boost")
("s" mastodon-toot--toggle-bookmark "Save")
("y" mastodon-toot--copy-toot-url "Copy URL")
("Y" mastodon-toot--copy-toot-text "Copy text"))
"Navigation"
(("n" mastodon-tl--next-tab-item "next" :color pink)
("p" mastodon-tl--previous-tab-item "previous" :color pink))))))
#+end_src
Lets turn on non-fixed-width fonts to make everything easier to read:
#+begin_src emacs-lisp
(use-package mastodon
:hook (mastodon-mode . mixed-pitch-mode))
#+end_src
#+end_src
** Matrix/Element
Yet another encrypted chat/VoIP client-server, but unlike Signal and Telegram, [[matrix.org][Matrix]] is act ually open source. In other words, a project for nerds. Well be using Alphapapas latest [[https://github.c om/alphapapa/ement.el][ement]] project.
#+begin_src emacs-lisp
(use-package ement
:straight (:host github :repo "alphapapa/ement.el")
:config
(defun ha-ement-connect ()
(interactive)
(let* ((auth-results (auth-source-search :host "howardism-matrix"))
(auth-first (first auth-results))
(username (plist-get auth-first :user))
(password (funcall (plist-get auth-first :secret))))
(ement-connect :user-id username
:password password
:uri-prefix "https://howardism.org"))
(ha-leader
"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)))
(ha-leader
"a x" '(:ignore t :which-key "matrix")
"a x x" '("connect" . ha-ement-connect)
"a x s" '("send" . ement-send-direct-message)))
#+end_src
Perhaps we can make it more attractive:
#+begin_src emacs-lisp
(use-package ement
:hook (ement-room-mode . ha-textual-litagures)
:init
(setq ement-save-sessions t
ement-room-send-message-filter 'ement-room-send-org-filter))
#+end_src
* Other
** Twitter
The venerable [[https://github.com/hayamiz/twittering-mode/tree/master][twittering-mode]] allows me to follow all the twits.
#+begin_src emacs-lisp :tangle no
(use-package twittering-mode
:init
(setq twittering-use-master-password t
epa-pinentry-mode 'loopback)
:config
(defalias 'epa--decode-coding-string 'decode-coding-string)
(ha-leader "a t" '("twitter" . twit)))
#+end_src
And we are no longer using this package.
** Telega
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)
(when (fboundp 'evil-insert-state)
(add-hook 'telega-chat-mode-hook 'evil-insert-state))
(ha-leader "a t" '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.
In the Telega chats, lets turn on non-fixed-width fonts:
#+begin_src emacs-lisp
(use-package telega
:hook (telega-chat-mode . mixed-pitch-mode))
#+end_src
* RPG DM
Been working on my [[https://gitlab.com/howardabrams/emacs-rpgdm][RPG DM project]] for getting Emacs helping as a /Dungeon Master's Assistant/. The idea is to be able to roll dice and whatnot. What I find most useful is the [[https://gitlab.com/howardabrams/emacs-rpgdm/-/blob/main/rpgdm-tables.el][random tables]].
#+begin_src emacs-lisp
(when (f-directory? "~/other/emacs-rpgdm")
(use-package rpgdm
:straight (:local-repo "~/other/emacs-rpgdm")
:commands (rpgdm-mode rpgdm-tables-load)
:init (setq rpgdm-base (expand-file-name "~/other/emacs-rpgdm"))
:config (ha-leader "t D" '("rpg dm" . rpgdm-mode))))
#+end_src
And my [[https://gitlab.com/howardabrams/emacs-ironsworn][new Ironsworn project]] expands on it, giving me both the Oracles and the Moves. With an Org file, I can easily play Solo:
#+begin_src emacs-lisp
(when (f-directory? "~/other/emacs-ironsworn")
(use-package rpgdm-ironsworn
:after rpgdm
:straight (:local-repo "~/other/emacs-ironsworn")
:init
(setq rpgdm-ironsworn-project (expand-file-name "~/other/emacs-ironsworn")
;; Ignore org links that call my RPG functions:
org-link-elisp-skip-confirm-regexp (rx string-start (optional "(") "rpgdm-"
(or "tables-" "ironsworn-")
(one-or-more any)))))
#+end_src
The project is interesting, and I should record a tutorial how to use it.
* Playing Music
Why not? Lets see if the [[https://github.com/isamert/empv.el][empv]] project is sufficient. First install =mpv=, as in:
#+begin_src sh
brew install mpv
#+end_src
What else?
#+begin_src emacs-lisp
(use-package empv
:straight (:host github :repo "isamert/empv.el")
:general (ha-leader
"a p" '(empv-map :wk "play music")))
#+end_src
* Technical Artifacts :noexport:
Let's =provide= a name so we can =require= this file:
#+begin_src emacs-lisp :exports none
(provide 'ha-aux-apps)
;;; ha-aux-apps.el ends here
#+end_src
#+DESCRIPTION: A literate programming file for helper apps in Emacs.
#+PROPERTY: header-args:sh :tangle no
#+PROPERTY: header-args:emacs-lisp :tangle yes
#+PROPERTY: header-args :results none :eval no-export :comments no mkdirp yes
#+OPTIONS: num:nil toc:t todo:nil tasks:nil tags:nil date:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
#+INFOJS_OPT: view:nil toc:t ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js