bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#64296: 30.0.50; problem with gnus-summary-resend-message


From: Andrew Cohen
Subject: bug#64296: 30.0.50; problem with gnus-summary-resend-message
Date: Tue, 27 Jun 2023 21:06:46 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

>>>>> "AC" == Andrew Cohen <acohen@ust.hk> writes:

>>>>> "PM" == Peter Münster <pm@a16n.net> writes:
    PM> On Tue, Jun 27 2023, Peter Münster wrote:
    >>> Yes, it works. Thanks!

    PM> Sorry, no, there is a new problem. When displaying a message
    PM> with such a header:

    PM> In-Reply-To: <87o7p2b7w5.fsf@a16n.net> ("Peter Münster"'s
    PM> message of "Thu, 09 Mar 2023 10:18:02 +0100")

    PM> I get this error: "cond: End of buffer"

    PM> And the message is displayed in it's raw format...

[...]

    AC> In the meantime I'll see if I can reproduce the problem to
    AC> figure out what is happening (if you can provide a backtrace
    AC> that might also help).

The problem is the presence of the ":" in the parenthetical comment
following the mailbox. If I am reading the spec correctly this is not
allowed (the ":" and ";" are special characters). But it is relatively
common nonetheless.

I think the following version should take care of it. Try it for awhile
and see if any other problems arise.  If not I'll push it to master.

#+begin_src emacs-lisp
(defun ietf-drums-parse-addresses (string &optional rawp)
  "Parse STRING and return a list of MAILBOX / DISPLAY-NAME pairs.
If RAWP, don't actually parse the addresses, but instead return
a list of address strings."
  (if (null string)
      nil
    (with-temp-buffer
      (ietf-drums-init string)
      (let ((beg (point))
            pairs c address)
        (while (not (eobp))
          (setq c (char-after))
          (cond
           ((eq c '?:)
            (setq beg (1+ (point)))
            (skip-chars-forward "^;")
            (when-let ((address
                  (condition-case nil
                      (ietf-drums-parse-addresses
                       (buffer-substring beg (point)) rawp)
                    (error nil))))
              (if (listp address)
                  (setq pairs (append address pairs))
                (push address pairs)))
            (condition-case nil
                (forward-char 1)
              (error nil))
            (setq beg (point)))
           ((memq c '(?\" ?< ?\())
            (condition-case nil
                (forward-sexp 1)
              (error
               (skip-chars-forward "^,"))))
           ((eq c ?,)
            (setq address
                  (if rawp
                      (buffer-substring beg (point))
                    (condition-case nil
                        (ietf-drums-parse-address
                         (buffer-substring beg (point)))
                      (error nil))))
            (when (or (consp address)
                      (and (stringp address) (< 0 (length address))))
              (push address pairs))
            (forward-char 1)
            (setq beg (point)))
           ((not (eobp))
            (forward-char 1))))
        (setq address
              (if rawp
                  (buffer-substring beg (point))
                (condition-case nil
                    (ietf-drums-parse-address
                     (buffer-substring beg (point)))
                  (error nil))))
        (when (or (consp address)
                  (and (stringp address) (< 0 (length address))))
          (push address pairs))
        (nreverse pairs)))))
#+end_src



-- 
Andrew Cohen





reply via email to

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