erc-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Erc-discuss] /list produces incomplete output: analysis and workaro


From: Aaron S. Hawley
Subject: Re: [Erc-discuss] /list produces incomplete output: analysis and workaround
Date: Tue, 15 May 2012 13:48:33 -0400

On 5/15/12, Sascha Wilde <address@hidden> wrote:
> Hi *,
>
> I discovered, that erc /list does not display all channels the server
> announces: it turns out that visited and even channels already parted
> are omitted.
>
> The reason is, that the function to display the channels is added as
> hook to erc-server-322-functions after erc-server-322.  But
> erc-server-322 returns a non-NIL value when erc-update-channel-topic
> succeeds on a channel -- which in turn leads to the following hook
> functions not being called.
>
> I'm not deep enough into the code to call it a solution -- but the
> following simple workaround (which simply makes sure that erc-server-322
> always returns NIL) seems to work:
>
> --- erc-backend.el           2012-05-14    03:00:11.666556805 +0200
> +++ erc-backend.el_patched   2012-05-15    17:48:13.064059897 +0200
> @@ -1696,7 +1696,8 @@
>      (multiple-value-bind (channel num-users)
>          (values-list (cdr (erc-response.command-args parsed)))
>        (add-to-list 'erc-channel-list (list channel))
> -      (erc-update-channel-topic channel topic))))
> +      (erc-update-channel-topic channel topic)))
> +  nil)
>
>  (defun erc-server-322-message (proc parsed)
>    "Display a message for the 322 event."
>
> cheers
> sascha

One wonders how many other handlers also return non-nill, but should return nil.

The other option is making sure the handlers of erc-list.el get first
priority by not appending them with third argument to `add-hook'.

--- erc-list.el 2012-04-02 19:37:14.000000000 -0400
+++ erc-list.el 2012-05-15 13:33:13.460361100 -0400
@@ -58,8 +58,8 @@
   ((erc-with-all-buffers-of-server nil
      #'erc-open-server-buffer-p
      (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))
-   (add-hook 'erc-server-321-functions 'erc-server-321-message t)
-   (add-hook 'erc-server-322-functions 'erc-server-322-message t)))
+   (add-hook 'erc-server-321-functions 'erc-server-321-message)
+   (add-hook 'erc-server-322-functions 'erc-server-322-message)))

 ;; Format a record for display.
 (defun erc-list-make-string (channel users topic)
@@ -174,7 +174,7 @@
 (defun erc-list-install-322-handler (server-buffer)
   (with-current-buffer server-buffer
     ;; Arrange for 322 responses to insert into our buffer.
-    (add-hook 'erc-server-322-functions 'erc-list-handle-322 t t)
+    (add-hook 'erc-server-322-functions 'erc-list-handle-322 nil t)
     ;; Arrange for 323 (end of list) to end this.
     (erc-once-with-server-event
      323



reply via email to

[Prev in Thread] Current Thread [Next in Thread]