diff options
| author | Stefan Monnier | 2012-06-01 16:24:17 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-06-01 16:24:17 -0400 |
| commit | 2612a3d60a30a8bdef066d636b72ab810d1e6f95 (patch) | |
| tree | d4ca59bac97735666ac8e21d8b718cc8e32c7fc2 | |
| parent | cbffd0bdfe19dbce25239fd9954126753457f5c8 (diff) | |
| download | emacs-2612a3d60a30a8bdef066d636b72ab810d1e6f95.tar.gz emacs-2612a3d60a30a8bdef066d636b72ab810d1e6f95.zip | |
* lisp/gnus/nntp.el: Stop the `letf' madness.
(nntp--report-1): New var.
(nntp-report): Merge nntp-report-1 into it.
(nntp-with-open-group-function): Set nntp--report-1 instead of modifying
the nntp-report function.
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/nntp.el | 38 |
2 files changed, 23 insertions, 21 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 95fb18bfbd7..a51b9401caf 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2012-06-01 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2012-06-01 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * nntp.el: Stop the `letf' madness. | ||
| 4 | (nntp--report-1): New var. | ||
| 5 | (nntp-report): Merge nntp-report-1 into it. | ||
| 6 | (nntp-with-open-group-function): Set nntp--report-1 instead of modifying | ||
| 7 | the nntp-report function. | ||
| 8 | |||
| 3 | * auth-source.el: Fix comment-style to follow the convention. | 9 | * auth-source.el: Fix comment-style to follow the convention. |
| 4 | 10 | ||
| 5 | 2012-05-27 Katsumi Yamaoka <yamaoka@jpl.org> | 11 | 2012-05-27 Katsumi Yamaoka <yamaoka@jpl.org> |
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 621aece8920..e237227f78a 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el | |||
| @@ -344,26 +344,26 @@ backend doesn't catch this error.") | |||
| 344 | (insert (format-time-string "%Y%m%dT%H%M%S.%3N") | 344 | (insert (format-time-string "%Y%m%dT%H%M%S.%3N") |
| 345 | " " nntp-address " " string "\n"))) | 345 | " " nntp-address " " string "\n"))) |
| 346 | 346 | ||
| 347 | (defvar nntp--report-1 nil) | ||
| 348 | |||
| 347 | (defun nntp-report (&rest args) | 349 | (defun nntp-report (&rest args) |
| 348 | "Report an error from the nntp backend. The first string in ARGS | 350 | "Report an error from the nntp backend. The first string in ARGS |
| 349 | can be a format string. For some commands, the failed command may be | 351 | can be a format string. For some commands, the failed command may be |
| 350 | retried once before actually displaying the error report." | 352 | retried once before actually displaying the error report." |
| 353 | (if nntp--report-1 | ||
| 354 | (progn | ||
| 355 | ;; Throw out to nntp-with-open-group-error so that the connection may | ||
| 356 | ;; be restored and the command retried." | ||
| 357 | (when nntp-record-commands | ||
| 358 | (nntp-record-command "*** CONNECTION LOST ***")) | ||
| 359 | (throw 'nntp-with-open-group-error t)) | ||
| 351 | 360 | ||
| 352 | (when nntp-record-commands | 361 | (when nntp-record-commands |
| 353 | (nntp-record-command "*** CALLED nntp-report ***")) | 362 | (nntp-record-command "*** CALLED nntp-report ***")) |
| 354 | |||
| 355 | (nnheader-report 'nntp args) | ||
| 356 | 363 | ||
| 357 | (apply 'error args)) | 364 | (nnheader-report 'nntp args) |
| 358 | 365 | ||
| 359 | (defun nntp-report-1 (&rest args) | 366 | (apply 'error args))) |
| 360 | "Throws out to nntp-with-open-group-error so that the connection may | ||
| 361 | be restored and the command retried." | ||
| 362 | |||
| 363 | (when nntp-record-commands | ||
| 364 | (nntp-record-command "*** CONNECTION LOST ***")) | ||
| 365 | |||
| 366 | (throw 'nntp-with-open-group-error t)) | ||
| 367 | 367 | ||
| 368 | (defmacro nntp-copy-to-buffer (buffer start end) | 368 | (defmacro nntp-copy-to-buffer (buffer start end) |
| 369 | "Copy string from unibyte current buffer to multibyte buffer." | 369 | "Copy string from unibyte current buffer to multibyte buffer." |
| @@ -633,10 +633,6 @@ be restored and the command retried." | |||
| 633 | (t | 633 | (t |
| 634 | nil))) | 634 | nil))) |
| 635 | 635 | ||
| 636 | (eval-when-compile | ||
| 637 | (defvar nntp-with-open-group-internal nil) | ||
| 638 | (defvar nntp-report-n nil)) | ||
| 639 | |||
| 640 | (defun nntp-with-open-group-function (-group -server -connectionless -bodyfun) | 636 | (defun nntp-with-open-group-function (-group -server -connectionless -bodyfun) |
| 641 | "Protect against servers that don't like clients that keep idle connections opens. | 637 | "Protect against servers that don't like clients that keep idle connections opens. |
| 642 | The problem being that these servers may either close a connection or | 638 | The problem being that these servers may either close a connection or |
| @@ -647,9 +643,9 @@ connection timeouts (which may be several minutes) or | |||
| 647 | `nntp-connection-timeout' has expired. When these occur | 643 | `nntp-connection-timeout' has expired. When these occur |
| 648 | `nntp-with-open-group', opens a new connection then re-issues the NNTP | 644 | `nntp-with-open-group', opens a new connection then re-issues the NNTP |
| 649 | command whose response triggered the error." | 645 | command whose response triggered the error." |
| 650 | (letf ((nntp-report-n (symbol-function 'nntp-report)) | 646 | (let ((nntp-report-n nntp--report-1) |
| 651 | ((symbol-function 'nntp-report) (symbol-function 'nntp-report-1)) | 647 | (nntp--report-1 t) |
| 652 | (nntp-with-open-group-internal nil)) | 648 | (nntp-with-open-group-internal nil)) |
| 653 | (while (catch 'nntp-with-open-group-error | 649 | (while (catch 'nntp-with-open-group-error |
| 654 | ;; Open the connection to the server | 650 | ;; Open the connection to the server |
| 655 | ;; NOTE: Existing connections are NOT tested. | 651 | ;; NOTE: Existing connections are NOT tested. |
| @@ -685,7 +681,7 @@ command whose response triggered the error." | |||
| 685 | (when -timer | 681 | (when -timer |
| 686 | (nnheader-cancel-timer -timer))) | 682 | (nnheader-cancel-timer -timer))) |
| 687 | nil)) | 683 | nil)) |
| 688 | (setf (symbol-function 'nntp-report) nntp-report-n)) | 684 | (setq nntp--report-1 nntp-report-n)) |
| 689 | nntp-with-open-group-internal)) | 685 | nntp-with-open-group-internal)) |
| 690 | 686 | ||
| 691 | (defmacro nntp-with-open-group (group server &optional connectionless &rest forms) | 687 | (defmacro nntp-with-open-group (group server &optional connectionless &rest forms) |