From 162001146308443268647c2caaeff9dd88ff815e Mon Sep 17 00:00:00 2001 From: Mark Redeman Date: Sat, 23 Jun 2018 02:31:55 +0200 Subject: [PATCH 1/4] Add: keybinding to open irc --- modules/config/default/+bindings.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index 901696b74..a3a7a4143 100644 --- a/modules/config/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -667,6 +667,9 @@ :desc "Eshell" :n "e" #'+eshell/open :desc "Eshell in popup" :n "E" #'+eshell/open-popup + (:when (featurep! :app irc) + :desc "IRC" :n "I" #'=irc) + (:when (featurep! :collab floobits) :desc "floobits" :prefix "f" :n "c" #'floobits-clear-highlights From 7a6407eb92302f95e9cb2bc0cef035fc4b390d68 Mon Sep 17 00:00:00 2001 From: Mark Redeman Date: Sat, 23 Jun 2018 14:44:40 +0200 Subject: [PATCH 2/4] Add: reasonable default keybindings for circe The =+irc/send-message= function was added so that we can send private messages using =SPC m m= or =M-x= with =+irc/send-message=. --- modules/app/irc/autoload/irc.el | 6 ++++++ modules/app/irc/config.el | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/app/irc/autoload/irc.el b/modules/app/irc/autoload/irc.el index 1e1f01210..a630fb61d 100644 --- a/modules/app/irc/autoload/irc.el +++ b/modules/app/irc/autoload/irc.el @@ -36,6 +36,12 @@ workspace for it." (and (+irc-setup-wconf inhibit-workspace) (call-interactively #'circe))) +;;;###autoload +(defun +irc/send-message (who what) + "Send WHO a message containing WHAT." + (interactive "sWho: \nsWhat: ") + (circe-command-MSG who what)) + ;;;###autoload (defun +irc/quit () "Kill current circe session and workgroup." diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index a32ecf355..f6d9b982e 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -125,7 +125,23 @@ playback.") (after! solaire-mode ;; distinguish chat/channel buffers from server buffers. - (add-hook 'circe-chat-mode-hook #'solaire-mode))) + (add-hook 'circe-chat-mode-hook #'solaire-mode)) + + (map! + (:localleader + (:map circe-mode-map + :desc "Next active buffer" :n "a" #'tracking-next-buffer + :desc "Join channel" :n "j" #'circe-command-JOIN + :desc "Send private message" :n "m" #'+irc/send-message + :desc "Part current channel" :n "p" #'circe-command-PART + :desc "Quit irc" :n "Q" #'+irc/quit + :desc "Reconnect" :n "R" #'circe-reconnect + + (:when (featurep! :completion ivy) + :desc "Jump to channel" :n "c" #'+irc/ivy-jump-to-channel)) + + (:map circe-channel-mode-map + :desc "Show names" :n "n" #'circe-command-NAMES))) (def-package! circe-color-nicks From e8834710c2c9c4fa803a1b5f4d6bccf3345463e5 Mon Sep 17 00:00:00 2001 From: Mark Redeman Date: Sat, 23 Jun 2018 15:28:27 +0200 Subject: [PATCH 3/4] Docs: improve irc documentation Explain how `+pass-user-fields` works and show a basic example for configuring a pass entry to be used by circe. Show how to connect to IRC and show a list of commands that can be used in circe buffers. --- modules/app/irc/README.org | 40 ++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/modules/app/irc/README.org b/modules/app/irc/README.org index caf043a6d..b06d136fc 100644 --- a/modules/app/irc/README.org +++ b/modules/app/irc/README.org @@ -3,10 +3,12 @@ This module turns adds an IRC client to Emacs ([[https://github.com/jorgenschaefer/circe][~circe~)]] with native notifications ([[https://github.com/eqyiel/circe-notifications][circe-notifications]]). * Table of Contents :TOC: -- [[#dependencies][Dependencies]] -- [[#configure][Configure]] - - [[#pass-the-unix-password-manager][Pass: the unix password manager]] - - [[#emacs-auth-source-api][Emacs' auth-source API]] +- [[Dependencies][Dependencies]] +- [[Configure][Configure]] + - [[Pass: the unix password manager][Pass: the unix password manager]] + - [[Emacs' auth-source API][Emacs' auth-source API]] +- [[Appendix][Appendix]] + - [[Commands][Commands]] * Dependencies This module has no dependencies, besides =gnutls-cli= or =openssl= for secure connections. @@ -52,6 +54,15 @@ But wait, there's more! This stores your password in a public variable which cou And you're good to go! +Note that =+pass-get-user= tries to find your username by looking for the fields +listed in =+pass-user-fields= (by default =login=, =user==, =username== and =email=)=). +An example configuration looks like + +#+BEGIN_SRC txt :tangle no +mysecretpassword +username: myusername +#+END_SRC + ** Emacs' auth-source API ~auth-source~ is built into Emacs. As suggested [[https://github.com/jorgenschaefer/circe/wiki/Configuration#safer-password-management][in the circe wiki]], you can store (and retrieve) encrypted passwords with it. @@ -78,3 +89,24 @@ And you're good to go! :channels ("#emacs"))) #+END_SRC +* Appendix +** Commands +Here is a list of available commands, their default keybindings (defined in +[[../../private/default/+bindings.el][private/default/+bindings.el]]), and corresponding ex commands (if any -- defined +in [[../../private/default/+evil-commands.el][private/default/+evil-commands.el]]). + +| command | key | description | +|---------+-----------+-------------------------------------------| +| ~=irc~ | =SPC o I= | Connect to IRC and all configured servers | + +When in a circe buffer these keybindings will be available. + +| command | key | description | +|------------------------+-----------+----------------------------------------------| +| ~tracking-next-buffer~ | =SPC m a= | Switch to the next active buffer | +| ~circe-command-JOIN~ | =SPC m j= | Join a channel | +| ~+irc/send-message~ | =SPC m m= | Send a private message | +| ~circe-command-NAMES~ | =SPC m n= | List the names of the current channel | +| ~circe-command-PART~ | =SPC m p= | Part the current channel | +| ~+irc/quit~ | =SPC m Q= | Kill the current circe session and workgroup | +| ~circe-reconnect~ | =SPC m R= | Reconnect the current server | From a8c31db7be5845805956f3bdf26c52c0e828045e Mon Sep 17 00:00:00 2001 From: Mark Redeman Date: Sat, 23 Jun 2018 23:04:03 +0200 Subject: [PATCH 4/4] Remove the `SPC o I` keybinding to open IRC --- modules/app/irc/README.org | 12 ++++++------ modules/app/irc/config.el | 2 +- modules/config/default/+bindings.el | 3 --- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/app/irc/README.org b/modules/app/irc/README.org index b06d136fc..865b11c31 100644 --- a/modules/app/irc/README.org +++ b/modules/app/irc/README.org @@ -91,13 +91,13 @@ username: myusername * Appendix ** Commands -Here is a list of available commands, their default keybindings (defined in -[[../../private/default/+bindings.el][private/default/+bindings.el]]), and corresponding ex commands (if any -- defined -in [[../../private/default/+evil-commands.el][private/default/+evil-commands.el]]). -| command | key | description | -|---------+-----------+-------------------------------------------| -| ~=irc~ | =SPC o I= | Connect to IRC and all configured servers | +To connect to IRC you can invoke the ~=irc~ function using =M-x= or your own +custom keybinding. + +| command | description | +|---------+-------------------------------------------| +| ~=irc~ | Connect to IRC and all configured servers | When in a circe buffer these keybindings will be available. diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index f6d9b982e..a75e37bed 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -141,7 +141,7 @@ playback.") :desc "Jump to channel" :n "c" #'+irc/ivy-jump-to-channel)) (:map circe-channel-mode-map - :desc "Show names" :n "n" #'circe-command-NAMES))) + :desc "Show names" :n "n" #'circe-command-NAMES)))) (def-package! circe-color-nicks diff --git a/modules/config/default/+bindings.el b/modules/config/default/+bindings.el index a3a7a4143..901696b74 100644 --- a/modules/config/default/+bindings.el +++ b/modules/config/default/+bindings.el @@ -667,9 +667,6 @@ :desc "Eshell" :n "e" #'+eshell/open :desc "Eshell in popup" :n "E" #'+eshell/open-popup - (:when (featurep! :app irc) - :desc "IRC" :n "I" #'=irc) - (:when (featurep! :collab floobits) :desc "floobits" :prefix "f" :n "c" #'floobits-clear-highlights