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

* RE: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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
  2 siblings, 1 reply; 23+ messages in thread
From: Drew Adams @ 2017-12-01 18:28 UTC (permalink / raw)
  To: stardiviner, emacs-help

> Subject: [Feature Request] ERC: let erc-join-channel support
> to select channels from history or a defined list

Is this a request for vanilla Emacs to do that?  If so,
just as an FYI, `M-x report-emacs-bug' is for enhancement
requests as well as bug reports.

help-gnu-emacs is more of a help-in-using-Emacs list.

(I'm not saying you shouldn't have posted the msg here
- just an FYI about `report-emacs-bug'.)



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

* Re: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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 19:18 ` Emanuel Berg
  2017-12-02  5:44 ` bug#29533: Fwd: " stardiviner
  2 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2017-12-01 19:18 UTC (permalink / raw)
  To: help-gnu-emacs

stardiviner wrote:

> With this feature, user can avoid typing, and
> don't need to remember the channel name

You sure typed a lot and remembered a lot of
Elisp to do that.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2017-12-01 18:28 ` Drew Adams
@ 2017-12-01 21:53   ` Emanuel Berg
  0 siblings, 0 replies; 23+ messages in thread
From: Emanuel Berg @ 2017-12-01 21:53 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

> Is this a request for vanilla Emacs to do
> that? If so, just as an FYI, `M-x
> report-emacs-bug' is for enhancement requests
> as well as bug reports.
>
> help-gnu-emacs is more of
> a help-in-using-Emacs list.
>
> (I'm not saying you shouldn't have posted the
> msg here - just an FYI about
> `report-emacs-bug'.)

There is also gmane.emacs.erc.general which is
erc-discuss@gnu.org . But as said ERC or
anything Elisp is never OT on
gmane.emacs.help ...

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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 19:18 ` Emanuel Berg
@ 2017-12-02  5:44 ` stardiviner
  2019-10-23  9:21   ` Lars Ingebrigtsen
  2 siblings, 1 reply; 23+ messages in thread
From: stardiviner @ 2017-12-02  5:44 UTC (permalink / raw)
  To: 29533

[-- Attachment #1: Type: text/plain, Size: 3310 bytes --]




-------- Forwarded Message --------
Subject: 	[Feature Request] ERC: let erc-join-channel support to select
channels from history or a defined list
Date: 	Fri, 1 Dec 2017 18:54:26 +0800
From: 	stardiviner <numbchild@gmail.com>
To: 	emacs-help <help-gnu-emacs@gnu.org>



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.


[-- Attachment #2: Type: text/html, Size: 4423 bytes --]

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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2017-12-02  5:44 ` bug#29533: Fwd: " stardiviner
@ 2019-10-23  9:21   ` Lars Ingebrigtsen
  2020-05-04 12:07     ` Stefan Kangas
  0 siblings, 1 reply; 23+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-23  9:21 UTC (permalink / raw)
  To: stardiviner; +Cc: 29533

stardiviner <numbchild@gmail.com> writes:

> let erc-join-channel support to select channels from history or a
> defined list.
>
> I have a code prototype:

I think this sounds like a useful addition, but to include it in Emacs,
we'd need to have the copyright for the code assigned to the FSF.  Would
you be willing to sign such papers?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2019-10-23  9:21   ` Lars Ingebrigtsen
@ 2020-05-04 12:07     ` Stefan Kangas
  2020-05-04 12:38       ` stardiviner
  0 siblings, 1 reply; 23+ messages in thread
From: Stefan Kangas @ 2020-05-04 12:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stardiviner, 29533

Lars Ingebrigtsen <larsi@gnus.org> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> let erc-join-channel support to select channels from history or a
>> defined list.
>>
>> I have a code prototype:
>
> I think this sounds like a useful addition, but to include it in Emacs,
> we'd need to have the copyright for the code assigned to the FSF.  Would
> you be willing to sign such papers?

That was 6 monhts ago.  Any news here?  We would need the copyright
assignment to add your code to Emacs.

Best regards,
Stefan Kangas





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-04 12:07     ` Stefan Kangas
@ 2020-05-04 12:38       ` stardiviner
  2020-05-04 13:12         ` Stefan Kangas
  0 siblings, 1 reply; 23+ messages in thread
From: stardiviner @ 2020-05-04 12:38 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533


[-- Attachment #1.1: Type: text/plain, Size: 1077 bytes --]


Stefan Kangas <stefan@marxist.se> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> stardiviner <numbchild@gmail.com> writes:
>>
>>> let erc-join-channel support to select channels from history or a
>>> defined list.
>>>
>>> I have a code prototype:
>>
>> I think this sounds like a useful addition, but to include it in Emacs,
>> we'd need to have the copyright for the code assigned to the FSF.  Would
>> you be willing to sign such papers?
>
> That was 6 monhts ago.  Any news here?  We would need the copyright
> assignment to add your code to Emacs.

Sorry for late response, I forgot this email.

I actually assigned FSF copyright assignment.

I attached it.

Also after cleaned the mail index, I can't find the first original email now.
Don't know whether code is fine.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

[-- Attachment #1.2: assigned copyright file --]
[-- Type: application/pdf, Size: 330589 bytes --]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-04 12:38       ` stardiviner
@ 2020-05-04 13:12         ` Stefan Kangas
  2020-05-12  5:36           ` stardiviner
  0 siblings, 1 reply; 23+ messages in thread
From: Stefan Kangas @ 2020-05-04 13:12 UTC (permalink / raw)
  To: stardiviner; +Cc: Lars Ingebrigtsen, 29533

stardiviner <numbchild@gmail.com> writes:

> I actually assigned FSF copyright assignment.

Thank you for clarifying.

> Also after cleaned the mail index, I can't find the first original email now.
> Don't know whether code is fine.

You can find the full discussion here:
   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29533

Could you please help check that your patch looks okay to you, and
still applies to current master?  And could you send an updated patch
if needed?  That would help us tremendously in reviewing and
eventually pushing this.

Thanks in advance.

Best regards,
Stefan Kangas





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-04 13:12         ` Stefan Kangas
@ 2020-05-12  5:36           ` stardiviner
  2020-05-12 12:48             ` Stefan Kangas
  0 siblings, 1 reply; 23+ messages in thread
From: stardiviner @ 2020-05-12  5:36 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> I actually assigned FSF copyright assignment.
>
> Thank you for clarifying.
>
>> Also after cleaned the mail index, I can't find the first original email now.
>> Don't know whether code is fine.
>
> You can find the full discussion here:
>    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=29533
>
> Could you please help check that your patch looks okay to you, and
> still applies to current master?  And could you send an updated patch
> if needed?  That would help us tremendously in reviewing and
> eventually pushing this.
>
> Thanks in advance.

Hi, Stefan, I'm afraid I can't submit patch soon. This task is not
priority on my tasks now. Because this patch is long time agon, I barely
use ERC recently. I still keep this task waited, when I got time to deal
with it, and finished it, I will send it here. Sorry about this.

Regards, stardiviner

>
> Best regards,
> Stefan Kangas


-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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
  0 siblings, 2 replies; 23+ messages in thread
From: Stefan Kangas @ 2020-05-12 12:48 UTC (permalink / raw)
  To: stardiviner; +Cc: Lars Ingebrigtsen, 29533

stardiviner <numbchild@gmail.com> writes:

> Hi, Stefan, I'm afraid I can't submit patch soon. This task is not
> priority on my tasks now. Because this patch is long time agon, I barely
> use ERC recently. I still keep this task waited, when I got time to deal
> with it, and finished it, I will send it here. Sorry about this.

Thank you.  There is no particular rush, but it would be good to get the
patch merged eventually.

Best regards,
Stefan Kangas





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-12 12:48             ` Stefan Kangas
@ 2020-05-13  8:41               ` stardiviner
  2020-05-13 11:37               ` stardiviner
  1 sibling, 0 replies; 23+ messages in thread
From: stardiviner @ 2020-05-13  8:41 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> Hi, Stefan, I'm afraid I can't submit patch soon. This task is not
>> priority on my tasks now. Because this patch is long time agon, I barely
>> use ERC recently. I still keep this task waited, when I got time to deal
>> with it, and finished it, I will send it here. Sorry about this.
>
> Thank you.  There is no particular rush, but it would be good to get the
> patch merged eventually.

That's great, I've already put this task in my Org Agenda. You're nice, Stefan.

>
> Best regards,
> Stefan Kangas


- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl67ssoUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMyXwgAqsA5uYryHV5x25FXNu+3olPa3jJc
S3kZj5kf5UePisSN4THmqN0jKY3F537u6cajznbH9LWEP32suojhPK6LrGAAJIyJ
AzdMB549xGeT9EyG+MUI9M1uNW+yq+nXTNIn4qg/EQo4yGbmPNnJ4diQiPtaExim
hFkkiuTaJeN551F/8lGqzsPIPbCleof653BnwZ/wGUXdc/9WfOxuO8Sc76TVKOMW
rTos73vA+FDYiqyr0uHJnSFeJqKeWOCEDFeHGvzc64KoiHSX4L241D/cHRP9Az0G
YySpb6Caejzxa6z0/Pwzr9drnsDVLvsVmSf51dykkPiJR97EGVcTsPt7nQ==
=dmnn
-----END PGP SIGNATURE-----





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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-13 14:29                 ` Noam Postavsky
  1 sibling, 2 replies; 23+ messages in thread
From: stardiviner @ 2020-05-13 11:37 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> Hi, Stefan, I'm afraid I can't submit patch soon. This task is not
>> priority on my tasks now. Because this patch is long time agon, I barely
>> use ERC recently. I still keep this task waited, when I got time to deal
>> with it, and finished it, I will send it here. Sorry about this.
>
> Thank you.  There is no particular rush, but it would be good to get the
> patch merged eventually.

I have a question, I have code like bellowing:


#+begin_src emacs-lisp
;;; original code
(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)))

;;===============================================================================

(defcustom erc-join-channels-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-alist
      '((".*\\.freenode.net" ; "freenode.net"
         "#emacs"
         "#org-mode"
         "#lisp"
         "#clojure"
         "#clojure-beginners"
         "#archlinux"
         "#swift-lang"
         "#docker"
         "#hackerrank")))

(defun erc-join-channel-select (args)
  "Select a channel to join from alist of channels to."
  (let ((channel (completing-read
                  "Select a channel: "
                  (cdr (assoc
                        (completing-read "Select a server: "
                                         (mapcar 'car erc-join-channels-alist))
                        erc-join-channels-alist)))))
    (setq args (list channel))))

(advice-add 'erc-join-channel :filter-args 'erc-join-channel-select)

(advice-remove 'erc-join-channel 'erc-join-channel-select)
#+end_src

When I press [C-c C-j] (erc-join-channel), the advice is added on function,
but seems not working. Don't know why, do you have any clue?

>
> Best regards,
> Stefan Kangas


- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl672+IUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMAIwf/XPYrBcVkSGyUPTS/8jtwGHwh2vE9
n+lQnTJbd0+9J88D9Hr2lyULOuxtCArBnVYCIHeQSEY8PKvAsXir+Dkw0Jdu50wu
nxnm5YB4vpeerTzZubVuTwiecZqIlu92ZhpNM7Dwh8UZar+R/MxeuBs5u7O84e8p
R4BFEwQC9u5GDfy8TmcGaJocbXEOo0a4XMC81Yqgrukxn1qwRyLq9IYdQzFZTaaq
qzuhmDTmjsvF7AS3nz4E+wuu2VTmLYZ7+60KA+2XPP9NJ6IzmrAiWyltpSzBFkf4
Y48DuFr/PT3R3jpwQfWdwaJVGPjDH0WPFNisEGpq5eAISqMZesuBZiCB7w==
=Itr2
-----END PGP SIGNATURE-----





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-13 11:37               ` stardiviner
@ 2020-05-13 12:32                 ` Stefan Kangas
  2020-05-14  3:38                   ` stardiviner
  2020-05-13 14:29                 ` Noam Postavsky
  1 sibling, 1 reply; 23+ messages in thread
From: Stefan Kangas @ 2020-05-13 12:32 UTC (permalink / raw)
  To: stardiviner; +Cc: Lars Ingebrigtsen, 29533

stardiviner <numbchild@gmail.com> writes:

> When I press [C-c C-j] (erc-join-channel), the advice is added on function,
> but seems not working. Don't know why, do you have any clue?

I don't usually use erc, so I'll have to leave that for someone else.

Best regards,
Stefan Kangas





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-13 11:37               ` stardiviner
  2020-05-13 12:32                 ` Stefan Kangas
@ 2020-05-13 14:29                 ` Noam Postavsky
  2020-05-14  3:32                   ` stardiviner
  1 sibling, 1 reply; 23+ messages in thread
From: Noam Postavsky @ 2020-05-13 14:29 UTC (permalink / raw)
  To: stardiviner; +Cc: Lars Ingebrigtsen, Stefan Kangas, 29533

stardiviner <numbchild@gmail.com> writes:

> ;;; original code
> (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 [...]

> (defun erc-join-channel-select (args)
>   "Select a channel to join from alist of channels to."
>   (let ((channel (completing-read
>                   "Select a channel: "
>                   (cdr (assoc
>                         (completing-read "Select a server: "
>                                          (mapcar 'car erc-join-channels-alist))
>                         erc-join-channels-alist)))))
>     (setq args (list channel))))

> (advice-add 'erc-join-channel :filter-args 'erc-join-channel-select)

> When I press [C-c C-j] (erc-join-channel), the advice is added on function,
> but seems not working. Don't know why, do you have any clue?

I think advice doesn't affect interactive calls the way you expect.  I
forget the details of it, but anyway it's probably better to just remap
instead, along the lines of:

    (defun erc-join-channel-select ()
      "Select a channel to join from alist of channels to."
      (erj-join-channel
       (completing-read
        "Select a channel: "
        (cdr (assoc
              (completing-read "Select a server: "
                               (mapcar 'car erc-join-channels-alist))
              erc-join-channels-alist)))))

    (define-key erc-mode-map [remap erc-join-channel] 'erc-join-channel-select)





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-13 14:29                 ` Noam Postavsky
@ 2020-05-14  3:32                   ` stardiviner
  0 siblings, 0 replies; 23+ messages in thread
From: stardiviner @ 2020-05-14  3:32 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: stardiviner, Lars Ingebrigtsen, Stefan Kangas, 29533

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Noam Postavsky <npostavs@gmail.com> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> ;;; original code
>> (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 [...]
>
>> (defun erc-join-channel-select (args)
>>   "Select a channel to join from alist of channels to."
>>   (let ((channel (completing-read
>>                   "Select a channel: "
>>                   (cdr (assoc
>>                         (completing-read "Select a server: "
>>                                          (mapcar 'car erc-join-channels-alist))
>>                         erc-join-channels-alist)))))
>>     (setq args (list channel))))
>
>> (advice-add 'erc-join-channel :filter-args 'erc-join-channel-select)
>
>> When I press [C-c C-j] (erc-join-channel), the advice is added on function,
>> but seems not working. Don't know why, do you have any clue?
>
> I think advice doesn't affect interactive calls the way you expect.  I
> forget the details of it, but anyway it's probably better to just remap
> instead, along the lines of:
>
>     (defun erc-join-channel-select ()
>       "Select a channel to join from alist of channels to."
>       (erj-join-channel
>        (completing-read
>         "Select a channel: "
>         (cdr (assoc
>               (completing-read "Select a server: "
>                                (mapcar 'car erc-join-channels-alist))
>               erc-join-channels-alist)))))
>
>     (define-key erc-mode-map [remap erc-join-channel] 'erc-join-channel-select)

Thanks, I apply you solution, I changed erc's default [C-c C-j] keybinding to new command.

- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68u+gUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNwvAf8CY1KyFvDnCFl+xXOJmmhKjv+oomo
4M10Vx1bAlCeWH0UYojgydIjEwmjKYcG3GKFCeyIC2B6rx6aZ3t89QmpIr/QQaYD
k+4qCpTI9O72eVHGLFCxNf6U6ob5T/BEqe1CwgG9QmTGko4cjQl6rJEnxPYe8KUk
lvhdFPwY09dUHbc8k6nd2/MaBucm+g9TiPc8Y8FxXdHb88EZC0WUSzF9FkuQ2FHJ
47ZXOdm/UwPmWZpnIpSJ1XxXSDxB0iejHyKCpFraZLbFWp9IjwJGBA+mKwPu8LII
74+5oQFXB9lxhl9EoQbTzR/qrSrL1ISlynV+wSZomVVAXKLTeJIA8EsYeQ==
=zIfK
-----END PGP SIGNATURE-----





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-13 12:32                 ` Stefan Kangas
@ 2020-05-14  3:38                   ` stardiviner
  2020-05-14 14:40                     ` Stefan Kangas
  0 siblings, 1 reply; 23+ messages in thread
From: stardiviner @ 2020-05-14  3:38 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> When I press [C-c C-j] (erc-join-channel), the advice is added on function,
>> but seems not working. Don't know why, do you have any clue?
>
> I don't usually use erc, so I'll have to leave that for someone else.
>
> Best regards,
> Stefan Kangas

Ok, I applied changes on Emacs source code, but when I try to commit, I got
following warning which stops me creating commit.

```
  1 git … commit --
lisp/erc/erc.el:4018: indent with spaces.
+                       (regexp :tag "Name")
lisp/erc/erc.el:4019: indent with spaces.
+                       (repeat :tag "Channels"
lisp/erc/erc.el:4020: indent with spaces.
+                               (string :tag "Name")))))
lisp/erc/erc.el:4046: indent with spaces.
+          (completing-read "Select a server: "
lisp/erc/erc.el:4047: indent with spaces.
+                           (mapcar 'car erc-join-channels-alist))
lisp/erc/erc.el:4048: indent with spaces.
+          erc-join-channels-alist)))))
```

I didi an google search, but still don't know how to set this. Shouldn't it be
space-indented?

And here is my patch diff. How should I submit this patch to Emacs/erc ?

#+begin_src diff
Staged changes (1)
modified   lisp/erc/erc.el
@@ -1161,7 +1161,7 @@ erc-mode-map
     (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
     (define-key map "\C-c\C-f" 'erc-toggle-flood-control)
     (define-key map "\C-c\C-i" 'erc-invite-only-mode)
- -    (define-key map "\C-c\C-j" 'erc-join-channel)
+    (define-key map "\C-c\C-j" 'erc-join-channel-select)
     (define-key map "\C-c\C-n" 'erc-channel-names)
     (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress)
     (define-key map "\C-c\C-p" 'erc-part-from-channel)
@@ -3993,6 +3993,34 @@ erc-input-action
     (if (not (string-match "^\\s-*$" action))
         (erc-send-action (erc-default-target) action))))
 
+(defcustom erc-join-channels-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-alist '(("*.freenode.net" "#emacs" "#org-mode")))
+
 (defun erc-join-channel (channel &optional key)
   "Join CHANNEL.
 
@@ -4008,6 +4036,17 @@ erc-join-channel
       (read-from-minibuffer "Channel key (RET for none): " nil))))
   (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
 
+(defun erc-join-channel-select ()
+  "Select a channel to join from alist of channels to."
+  (interactive)
+  (erc-join-channel
+   (completing-read
+    "Select a channel: "
+    (cdr (assoc
+          (completing-read "Select a server: "
+                           (mapcar 'car erc-join-channels-alist))
+          erc-join-channels-alist)))))
+
 (defun erc-part-from-channel (reason)
   "Part from the current channel and prompt for a REASON."
   (interactive
#+end_src

- -- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl68vUgUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsOj+QgApWTHBQZttqcuSdM2V0S3voKFVpKi
uN9rqFjPsko7KMeoqTh3Usw7ixHcjmgDyhbzMOfRZ0wBhUk1mugRtoZ6JLIeLVt+
PecrqLukLXygPaSUDDRnRysZLaol1SThGQdX1Lv4F85Qa8ijPHBeMZITx6hlQSvb
/a9nuHm8R4FurEstf1iVUJOhb7Oe4ikBb+Q+ER3gWCQDaBZyvm5J0nDSlwJb44Zs
4MB4I3vTCxDBh69WGi7iZBggygpfhf+pM/0vwAY0w/IiBd6/1j4KuxX48WQkwtjQ
BgP0dwOWOSA6wTAtdaSlW5m3qWAIKSd/5j2gVMwalmK4702QvzDcc6/mDA==
=k6Jw
-----END PGP SIGNATURE-----





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-14  3:38                   ` stardiviner
@ 2020-05-14 14:40                     ` Stefan Kangas
  2020-05-18 12:21                       ` stardiviner
  0 siblings, 1 reply; 23+ messages in thread
From: Stefan Kangas @ 2020-05-14 14:40 UTC (permalink / raw)
  To: stardiviner; +Cc: Lars Ingebrigtsen, 29533

stardiviner <numbchild@gmail.com> writes:

> +                           (mapcar 'car erc-join-channels-alist))
> lisp/erc/erc.el:4048: indent with spaces.
> +          erc-join-channels-alist)))))
> ```
>
> I didi an google search, but still don't know how to set this. Shouldn't it be
> space-indented?

Yes, you should prefer indenting with spaces for the most part.

Maybe there is something in your local git configuration that is causing
this?

> And here is my patch diff. How should I submit this patch to Emacs/erc ?

You should ideally send the patch as an attached file produced by:

    git format-patch -1 HEAD

Also, we have some requirements for contributions, such as including a
ChangeLog entry.  This is described in the CONTRIBUTE file, and you can
also see examples in the git log.  (You can use `C-x 4 a' so you don't
have to type as much.)

Are there any changes that needs doing in the manual?  Should this be
announced in etc/NEWS?

Best regards,
Stefan Kangas





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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
  0 siblings, 2 replies; 23+ messages in thread
From: stardiviner @ 2020-05-18 12:21 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stardiviner, Lars Ingebrigtsen, 29533


[-- Attachment #1.1: Type: text/plain, Size: 1574 bytes --]


Stefan Kangas <stefan@marxist.se> writes:

> stardiviner <numbchild@gmail.com> writes:
>
>> +                           (mapcar 'car erc-join-channels-alist))
>> lisp/erc/erc.el:4048: indent with spaces.
>> +          erc-join-channels-alist)))))
>> ```
>>
>> I didi an google search, but still don't know how to set this. Shouldn't it be
>> space-indented?
>
> Yes, you should prefer indenting with spaces for the most part.

I figured why, I'm using Magit, and it seems enabled verify hooks by default.

>
> Maybe there is something in your local git configuration that is causing
> this?
>
>> And here is my patch diff. How should I submit this patch to Emacs/erc ?
>
> You should ideally send the patch as an attached file produced by:
>
>     git format-patch -1 HEAD
>
> Also, we have some requirements for contributions, such as including a
> ChangeLog entry.  This is described in the CONTRIBUTE file, and you can
> also see examples in the git log.  (You can use `C-x 4 a' so you don't
> have to type as much.)
>
> Are there any changes that needs doing in the manual?  Should this be
> announced in etc/NEWS?

No need to be announced in etc/NEWS. It's still original keybinding. And not a
big difference.

At last, I attached my generated commit in attachment.

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Join-channel-smartly-from-alist-of-stored-channels.patch --]
[-- Type: text/x-patch, Size: 3225 bytes --]

From 26f73fe065196ab8759f6c7f046587e47672ad47 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Mon, 18 May 2020 20:16:21 +0800
Subject: [PATCH] Join channel smartly from alist of stored channels

* lisp/erc/erc.el (erc-mode-map): Add an option to store your frequently
joined channels. And replace original `erc-join-channel' with
`erc-join-channel-select'.
---
 lisp/erc/erc.el | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index cfde84e19a..be59b4203f 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1161,7 +1161,7 @@ erc-mode-map
     (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
     (define-key map "\C-c\C-f" 'erc-toggle-flood-control)
     (define-key map "\C-c\C-i" 'erc-invite-only-mode)
-    (define-key map "\C-c\C-j" 'erc-join-channel)
+    (define-key map "\C-c\C-j" 'erc-join-channel-select)
     (define-key map "\C-c\C-n" 'erc-channel-names)
     (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress)
     (define-key map "\C-c\C-p" 'erc-part-from-channel)
@@ -3993,6 +3993,34 @@ erc-input-action
     (if (not (string-match "^\\s-*$" action))
         (erc-send-action (erc-default-target) action))))
 
+(defcustom erc-join-channels-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-alist '(("*.freenode.net" "#emacs" "#org-mode")))
+
 (defun erc-join-channel (channel &optional key)
   "Join CHANNEL.
 
@@ -4008,6 +4036,17 @@ erc-join-channel
       (read-from-minibuffer "Channel key (RET for none): " nil))))
   (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
 
+(defun erc-join-channel-select ()
+  "Select a channel to join from alist of channels to."
+  (interactive)
+  (erc-join-channel
+   (completing-read
+    "Select a channel: "
+    (cdr (assoc
+          (completing-read "Select a server: "
+                           (mapcar 'car erc-join-channels-alist))
+          erc-join-channels-alist)))))
+
 (defun erc-part-from-channel (reason)
   "Part from the current channel and prompt for a REASON."
   (interactive
-- 
2.26.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 515 bytes --]

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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-05-18 12:21                       ` stardiviner
@ 2020-05-19  0:15                         ` Stefan Kangas
  2020-08-03  8:51                         ` Lars Ingebrigtsen
  1 sibling, 0 replies; 23+ messages in thread
From: Stefan Kangas @ 2020-05-19  0:15 UTC (permalink / raw)
  To: Amin Bandali; +Cc: stardiviner, Lars Ingebrigtsen, 29533

Hi Amin,

stardiviner <numbchild@gmail.com> writes:

> At last, I attached my generated commit in attachment.

Could you please help review the below patch?  I don't really use ERC.

Thanks in advance.

Best regards,
Stefan Kangas

> From 26f73fe065196ab8759f6c7f046587e47672ad47 Mon Sep 17 00:00:00 2001
> From: stardiviner <numbchild@gmail.com>
> Date: Mon, 18 May 2020 20:16:21 +0800
> Subject: [PATCH] Join channel smartly from alist of stored channels
>
> * lisp/erc/erc.el (erc-mode-map): Add an option to store your frequently
> joined channels. And replace original `erc-join-channel' with
> `erc-join-channel-select'.
> ---
>  lisp/erc/erc.el | 41 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 40 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
> index cfde84e19a..be59b4203f 100644
> --- a/lisp/erc/erc.el
> +++ b/lisp/erc/erc.el
> @@ -1161,7 +1161,7 @@ erc-mode-map
>      (define-key map "\C-c\C-e" 'erc-toggle-ctcp-autoresponse)
>      (define-key map "\C-c\C-f" 'erc-toggle-flood-control)
>      (define-key map "\C-c\C-i" 'erc-invite-only-mode)
> -    (define-key map "\C-c\C-j" 'erc-join-channel)
> +    (define-key map "\C-c\C-j" 'erc-join-channel-select)
>      (define-key map "\C-c\C-n" 'erc-channel-names)
>      (define-key map "\C-c\C-o" 'erc-get-channel-mode-from-keypress)
>      (define-key map "\C-c\C-p" 'erc-part-from-channel)
> @@ -3993,6 +3993,34 @@ erc-input-action
>      (if (not (string-match "^\\s-*$" action))
>          (erc-send-action (erc-default-target) action))))
>
> +(defcustom erc-join-channels-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-alist '(("*.freenode.net" "#emacs" "#org-mode")))
> +
>  (defun erc-join-channel (channel &optional key)
>    "Join CHANNEL.
>
> @@ -4008,6 +4036,17 @@ erc-join-channel
>        (read-from-minibuffer "Channel key (RET for none): " nil))))
>    (erc-cmd-JOIN channel (when (>= (length key) 1) key)))
>
> +(defun erc-join-channel-select ()
> +  "Select a channel to join from alist of channels to."
> +  (interactive)
> +  (erc-join-channel
> +   (completing-read
> +    "Select a channel: "
> +    (cdr (assoc
> +          (completing-read "Select a server: "
> +                           (mapcar 'car erc-join-channels-alist))
> +          erc-join-channels-alist)))))
> +
>  (defun erc-part-from-channel (reason)
>    "Part from the current channel and prompt for a REASON."
>    (interactive
> --
> 2.26.2





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

* bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  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
  1 sibling, 1 reply; 23+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-03  8:51 UTC (permalink / raw)
  To: stardiviner; +Cc: Stefan Kangas, 29533

stardiviner <numbchild@gmail.com> writes:

> No need to be announced in etc/NEWS. It's still original keybinding. And not a
> big difference.

It needs a NEWS entry (it's a new user-level variable), and it needs
documentation in the erc manual.

But I don't really understand the patch.

> * lisp/erc/erc.el (erc-mode-map): Add an option to store your frequently
> joined channels. And replace original `erc-join-channel' with
> `erc-join-channel-select'.

[...]

> +(defcustom erc-join-channels-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

I'm not sure why this is documented here -- this is what erc does in
general, isn't it?

> +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.

Did you miss including this bit in the patch?  There's no logic for
keeping the variable up-to-date in the code you sent, neither for
re-joining after a disconnect.

> +(setq erc-join-channels-alist '(("*.freenode.net" "#emacs" "#org-mode")))
> +

Debugging left behind?

> +(defun erc-join-channel-select ()
> +  "Select a channel to join from alist of channels to."
> +  (interactive)
> +  (erc-join-channel
> +   (completing-read
> +    "Select a channel: "
> +    (cdr (assoc
> +          (completing-read "Select a server: "
> +                           (mapcar 'car erc-join-channels-alist))
> +          erc-join-channels-alist)))))

Should the server default to the current one?  And this code should go
into the `interactive' part, since you're prompting the user.

Also, the original erc-join-channel has this logic:

(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))

Which should looks very useful, and should be replicated in the new
command.  Also:

    (when (or current-prefix-arg erc-prompt-for-channel-key)
      (read-from-minibuffer "Channel key (RET for none): " nil))))

should also be replicated, and at that point, perhaps the
erc-join-channel-select command isn't that useful -- perhaps
erc-join-channel should instead just be amended to add the channels from
-alist to the table the user is prompted for.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#29533: [CLOSED] Re: bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-08-03  8:51                         ` Lars Ingebrigtsen
@ 2020-08-03 13:47                           ` numbchild
  2020-08-04  8:48                             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 23+ messages in thread
From: numbchild @ 2020-08-03 13:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Kangas, 29533

[-- Attachment #1: Type: text/plain, Size: 3994 bytes --]

Hi, Lars, thanks for reviewing my patch. I almost forgot what my patch did
since
I send it a long time ago. I read my old email and idea. And I have an
conclusion that this patch seems not very useful for most users. So I give
up
merging this patch into ERC. I'm so sorry for my impulsive decision that
wasted your time.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Aug 3, 2020 at 4:52 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> stardiviner <numbchild@gmail.com> writes:
>
> > No need to be announced in etc/NEWS. It's still original keybinding. And
> not a
> > big difference.
>
> It needs a NEWS entry (it's a new user-level variable), and it needs
> documentation in the erc manual.
>
> But I don't really understand the patch.
>
> > * lisp/erc/erc.el (erc-mode-map): Add an option to store your frequently
> > joined channels. And replace original `erc-join-channel' with
> > `erc-join-channel-select'.
>
> [...]
>
> > +(defcustom erc-join-channels-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
>
> I'm not sure why this is documented here -- this is what erc does in
> general, isn't it?
>
> > +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.
>
> Did you miss including this bit in the patch?  There's no logic for
> keeping the variable up-to-date in the code you sent, neither for
> re-joining after a disconnect.
>
> > +(setq erc-join-channels-alist '(("*.freenode.net" "#emacs"
> "#org-mode")))
> > +
>
> Debugging left behind?
>
> > +(defun erc-join-channel-select ()
> > +  "Select a channel to join from alist of channels to."
> > +  (interactive)
> > +  (erc-join-channel
> > +   (completing-read
> > +    "Select a channel: "
> > +    (cdr (assoc
> > +          (completing-read "Select a server: "
> > +                           (mapcar 'car erc-join-channels-alist))
> > +          erc-join-channels-alist)))))
>
> Should the server default to the current one?  And this code should go
> into the `interactive' part, since you're prompting the user.
>
> Also, the original erc-join-channel has this logic:
>
> (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))
>
> Which should looks very useful, and should be replicated in the new
> command.  Also:
>
>     (when (or current-prefix-arg erc-prompt-for-channel-key)
>       (read-from-minibuffer "Channel key (RET for none): " nil))))
>
> should also be replicated, and at that point, perhaps the
> erc-join-channel-select command isn't that useful -- perhaps
> erc-join-channel should instead just be amended to add the channels from
> -alist to the table the user is prompted for.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 5647 bytes --]

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

* bug#29533: [CLOSED] Re: bug#29533: Fwd: [Feature Request] ERC: let erc-join-channel support to select channels from history or a defined list
  2020-08-03 13:47                           ` bug#29533: [CLOSED] " numbchild
@ 2020-08-04  8:48                             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 23+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-04  8:48 UTC (permalink / raw)
  To: numbchild; +Cc: Stefan Kangas, 29533

"numbchild@gmail.com" <numbchild@gmail.com> writes:

> Hi, Lars, thanks for reviewing my patch. I almost forgot what my patch
> did since I send it a long time ago. I read my old email and idea. And
> I have an conclusion that this patch seems not very useful for most
> users. So I give up merging this patch into ERC. I'm so sorry for my
> impulsive decision that wasted your time.

No time wasted.  :-) I thought it was a useful idea, but it needed some
polish.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ 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.