all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
@ 2017-12-01 10:54 stardiviner
  2017-12-01 18:28 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: stardiviner @ 2017-12-01 10:54 UTC (permalink / raw)
  To: emacs-help

let erc-join-channel support to select channels from history or a
defined list.


I have a code prototype:

#+begin_src emacs-lisp
(defun erc-join-channel (channel &optional key)
  "Join CHANNEL.

If `point' is at the beginning of a channel name, use that as default."
  (interactive
   (list
    (let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) ""))
          (table (when (erc-server-buffer-live-p)
                   (set-buffer (process-buffer erc-server-process))
                   erc-channel-list)))
      (completing-read "Join channel: " table nil nil nil nil chnl))
    (when (or current-prefix-arg erc-prompt-for-channel-key)
      (read-from-minibuffer "Channel key (RET for none): " nil))))
  (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
#+end_src

#+begin_src emacs-lisp
(defcustom erc-join-channels-frequently-alist nil
  "Alist of channels to select when you join channels.

Every element in the alist has the form (SERVER . CHANNELS).
SERVER is a regexp matching the server, and channels is the
list of channels to join.

If the channel(s) require channel keys for joining, the passwords
are found via auth-source.  For instance, if you use ~/.authinfo
as your auth-source backend, then put something like the
following in that file:

machine irc.example.net login \"#fsf\" password sEcReT

Customize this variable to set the value for your first connect.
Once you are connected and join and part channels, this alist
keeps track of what channels you are on, and will join them
again when you get disconnected.  When you restart Emacs, however,
those changes are lost, and the customization you saved the last
time is used again."
  :group 'erc-join
  :type '(repeat (cons :tag "Server"
                           (regexp :tag "Name")
                           (repeat :tag "Channels"
                                     (string :tag "Name")))))

(setq erc-join-channels-frequently-alist
      '((".*\\.freenode.net" ; "freenode.net"
         "#emacs"
         "#org-mode"
         "#lisp"
         "#clojure"
         "#clojure-beginners"
         "#archlinux"
         "#swift-lang"
         "#docker"
         "#hackerrank"
         )))

(defun erc-join-channels-frequently-select (channel &optional key)
  "Select a channel to join from alist of channels to."
  (interactive "P")
  (completing-read "Select a channel to join: "
                   (cdr (car
                         erc-join-channels-frequently-alist)))
  ;; TODO match IRC server for the selected channel.
  )

;; FIXME:
(advice-add 'erc-join-channels-frequently-select :before 'erc-join-channel)
#+end_src


With this feature, user can avoid typing, and don't need to remember the
channel name, and use the join channels history.




^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-08-04  8:48 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 10:54 [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list stardiviner
2017-12-01 18:28 ` Drew Adams
2017-12-01 21:53   ` Emanuel Berg
2017-12-01 19:18 ` Emanuel Berg
2017-12-02  5:44 ` bug#29533: Fwd: " stardiviner
2019-10-23  9:21   ` Lars Ingebrigtsen
2020-05-04 12:07     ` Stefan Kangas
2020-05-04 12:38       ` stardiviner
2020-05-04 13:12         ` Stefan Kangas
2020-05-12  5:36           ` stardiviner
2020-05-12 12:48             ` Stefan Kangas
2020-05-13  8:41               ` stardiviner
2020-05-13 11:37               ` stardiviner
2020-05-13 12:32                 ` Stefan Kangas
2020-05-14  3:38                   ` stardiviner
2020-05-14 14:40                     ` Stefan Kangas
2020-05-18 12:21                       ` stardiviner
2020-05-19  0:15                         ` Stefan Kangas
2020-08-03  8:51                         ` Lars Ingebrigtsen
2020-08-03 13:47                           ` bug#29533: [CLOSED] " numbchild
2020-08-04  8:48                             ` Lars Ingebrigtsen
2020-05-13 14:29                 ` Noam Postavsky
2020-05-14  3:32                   ` stardiviner

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.