#972885 Lexical binding causes regression for gnus-summary-highlight

Package:
emacs
Source:
emacs
Submitter:
Florent Rougon
Date:
2021-02-22 19:33:06 UTC
Severity:
normal
Tags:
#972885#5
Date:
2020-10-25 19:18:05 UTC
From:
To:
Hello,

After upgrading my emacs packages today:

   [UPGRADE] emacs:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-bin-common:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-bin-common-dbgsym:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-common:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-el:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-gtk:amd64 1:26.3+1-2 -> 1:27.1+1-2
   [UPGRADE] emacs-gtk-dbgsym:amd64 1:26.3+1-2 -> 1:27.1+1-2

Gnus bundled with Emacs 27 can't enter any group anymore (from the
*Group* buffer). If I try to enter a group, I get the following error:

  Symbol's value as variable is void: article

Here is a backtrace of the error:

Debugger entered--Lisp error: (void-variable article)
  #f(compiled-function () #<bytecode 0x1575a84d72dd>)()
  funcall(#f(compiled-function () #<bytecode 0x1575a84d72dd>))
  (let ((face (funcall (gnus-summary-highlight-line-0)))) (if (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face)) nil (gnus-put-text-property-excluding-characters-with-faces beg (point-at-eol) 'face (setq face (if (boundp face) (symbol-value face) face))) (if gnus-summary-highlight-line-function (progn (funcall gnus-summary-highlight-line-function article face)))))
  (let* ((beg (point-at-bol)) (article (or (gnus-summary-article-number) gnus-current-article)) (score (or (cdr (assq article gnus-newsgroup-scored)) gnus-summary-default-score 0)) (mark (or (let ((cl-x (gnus-data-find-in ... gnus-newsgroup-data))) (progn (progn (nth 1 cl-x)))) gnus-unread-mark)) (inhibit-read-only t) (default gnus-summary-default-score) (default-high gnus-summary-default-high-score) (default-low gnus-summary-default-low-score) (uncached (and gnus-summary-use-undownloaded-faces (memq article gnus-newsgroup-undownloaded) (not (memq article gnus-newsgroup-cached))))) (let ((face (funcall (gnus-summary-highlight-line-0)))) (if (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face)) nil (gnus-put-text-property-excluding-characters-with-faces beg (point-at-eol) 'face (setq face (if (boundp face) (symbol-value face) face))) (if gnus-summary-highlight-line-function (progn (funcall gnus-summary-highlight-line-function article face))))))
  gnus-summary-highlight-line()
  gnus-summary-insert-line([0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil] 0 nil t 90 t nil "" nil 1)
  gnus-update-summary-mark-positions()
  gnus-summary-setup-buffer("nnml+mail:AUCTeX")
  gnus-summary-read-group-1("nnml+mail:AUCTeX" nil t nil nil nil)
  gnus-summary-read-group("nnml+mail:AUCTeX" nil t nil nil nil nil)
  gnus-group-read-group(nil t)
  gnus-group-select-group(nil)
  gnus-topic-select-group(nil)
  funcall-interactively(gnus-topic-select-group nil)
  call-interactively(gnus-topic-select-group nil nil)
  command-execute(gnus-topic-select-group)

This happens when `gnus-summary-highlight-line' from
/usr/share/emacs/27.1/lisp/gnus/gnus-sum.el.gz calls the byte-compiled
function that `gnus-summary-highlight-line-0' evaluates to. I've used my
nnml+mail:AUCTeX group as an example here, but this happens with all
groups I've tried. Hence, I can't read any mail with this version of the
emacs package. :-|

Thanks for your work!

Regards

#972885#10
Date:
2020-10-26 01:33:08 UTC
From:
To:
retitle 972885 Lexical binding causes regression for gnus-summary-highlight
thanks

The problem appears to be due to the (presumably recent) use of lexical
binding in /usr/share/emacs/27.1/lisp/gnus/gnus-sum.el.gz
(cf. lexical-binding:t on the first line).

It is triggered by this piece of configuration from my .gnus.el:

(eval-after-load "gnus-sum"
  '(add-to-list
    'gnus-summary-highlight
    '((memq article gnus-newsgroup-processable)
      . flo-gnus-summary-processable-face)))

This code nicely highlights lines in the *Summary* buffer corresponding
to articles that have the process mark set. It has worked perfectly for
years until the aforementioned Emacs upgrade.

The problem can be solved either by me not using the above configuration
bit anymore (which is of course a regression), or by making the
`article' variable use dynamic binding before the failing `funcall' in
`gnus-summary-highlight-line' (see the attached patch; the change could
probably be done earlier in the function, along with the other similar
defvar's, but I've only tested the attached patch).

Regards

#972885#17
Date:
2020-10-27 01:43:34 UTC
From:
To:
Florent Rougon <f.rougon@free.fr> writes:

Nice catch.  Have you, or are you already planning to post this
upstream?

#972885#22
Date:
2020-10-27 09:05:48 UTC
From:
To:
tags 972885 + upstream
thanks

Hi Rob, thanks for your reply.

Rob Browning <rlb@defaultvalue.org> wrote:

Well, I haven't done so but could certainly do it. I assume the Gnus
development list ("ding") would be more appropriate than an Emacs dev
list or Emacs bug report?

Regards

#972885#29
Date:
2021-02-22 19:30:32 UTC
From:
To:
Gnus no longer exists outside of Emacs.
I suggest you report this with M-x report-emacs-bug.
I note that `article' is not documented as one of the variables one can use in `gnus-summary-highlight'.

#972885#32
Date:
2021-02-22 19:30:32 UTC
From:
To:
Gnus no longer exists outside of Emacs.
I suggest you report this with M-x report-emacs-bug.
I note that `article' is not documented as one of the variables one can use in `gnus-summary-highlight'.