From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#36492: c-mode fails with errors during fontification Date: Wed, 03 Jul 2019 23:56:19 +0300 Organization: LINKOV.NET Message-ID: <87imsikh64.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="234197"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 36492@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 03 23:03:36 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1himPd-000yf9-MS for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jul 2019 23:03:34 +0200 Original-Received: from localhost ([::1]:40610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1himKP-0001F2-7a for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Jul 2019 16:58:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36140) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1himKJ-0001Ew-RB for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:58:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1himKI-0006FS-HG for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41321) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1himKI-0006FI-Dq for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1himKI-0001pL-9H for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Jul 2019 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36492 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15621874356965 (code B ref -1); Wed, 03 Jul 2019 20:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Jul 2019 20:57:15 +0000 Original-Received: from localhost ([127.0.0.1]:50142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1himJW-0001oH-U6 for submit@debbugs.gnu.org; Wed, 03 Jul 2019 16:57:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1himJV-0001o9-87 for submit@debbugs.gnu.org; Wed, 03 Jul 2019 16:57:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35946) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1himJT-0001C0-Pi for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:57:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1himJR-0005fR-QL for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:57:11 -0400 Original-Received: from antelope.elm.relay.mailchannels.net ([23.83.212.4]:2906) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1himJP-0005cP-Kd for bug-gnu-emacs@gnu.org; Wed, 03 Jul 2019 16:57:08 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 8D51034195D for ; Wed, 3 Jul 2019 20:57:03 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (100-96-8-155.trex.outbound.svc.cluster.local [100.96.8.155]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 156343415B5 for ; Wed, 3 Jul 2019 20:57:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.3); Wed, 03 Jul 2019 20:57:03 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Imminent-Daffy: 7f8ac250685bcaef_1562187423374_22397168 X-MC-Loop-Signature: 1562187423373:1206309981 X-MC-Ingress-Time: 1562187423373 Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTP id DB4D780550 for ; Wed, 3 Jul 2019 13:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=Il1tOqnvIp79dGzJwa+Z0iH125o=; b=WDOBrI0mDFlcrkS7z OdmkO4jF8Je8T5CwSGdDgQavOZZzLmM2V2Ei4WVlrTlnB9uyATw2TXWBDjXgbC3T 4bQZCidA0g+KFJaXTcF1s4NlWt8a8qNzufzIoPZgxp7Zt653cOYMvJbL85jTLvP1 rrT1t2Z+M3QuDGnVeCB889TDDU= Original-Received: from mail.jurta.org (m91-129-100-10.cust.tele2.ee [91.129.100.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTPSA id C03BE80561 for ; Wed, 3 Jul 2019 13:56:58 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a34 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrfedtgdduheejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddttddruddtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddttddruddtpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:162037 Archived-At: --=-=-= Content-Type: text/plain Opening this message in Gnus fails with the following backtrace after setting (setq diff-font-lock-syntax 'hunk-also) because c-mode fails to fontify the attachment. Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) c-forward-decl-or-cast-1(0 top nil) (setq decl-or-cast (c-forward-decl-or-cast-1 match-pos context last-cast-end)) (if (eq context 'not-decl) ...) (if (or (and (eq (get-text-property (point) 'face) 'font-lock-keyword-face) ...) ...) t ...) (if (if (or (and (eq (get-text-property (point) 'face) 'font-lock-keyword-face) ...) ...) t ...) ...) (lambda (match-pos inside-macro &optional toplev) ...)(0 nil t) c-find-decl-spots(11 "[[:alpha:]_]" (nil font-lock-type-face font-lock-constant-face font-lock-keyword-face) ...) (let (start-pos context ...) ... nil) (save-restriction (let (start-pos context ...) ... nil)) (progn (save-restriction (let (start-pos context ...) ... nil))) (if (< (point) limit) (progn (save-restriction (let (start-pos context ...) ... nil)))) c-font-lock-declarations(11) font-lock-fontify-keywords-region(1 11 nil) font-lock-default-fontify-region(1 11 nil) funcall(font-lock-default-fontify-region 1 11 nil) (let (new-beg new-end new-region case-fold-search) ...) c-font-lock-fontify-region(1 11 nil) font-lock-fontify-region(1 11) #f(compiled-function (beg end) #)(1 11) font-lock-ensure(1 11) diff-syntax-fontify-props(#("a/test.c" 0 8 (face (diff-file-header diff-header))) "int i)\n{\n1" (1 3) t) diff-syntax-fontify-hunk(78 111 t) diff-syntax-fontify(78 111) #f(compiled-function (beg end) #)(78 111) diff--iterate-hunks(113 #f(compiled-function (beg end) #)) diff--font-lock-syntax(113) font-lock-fontify-keywords-region(1 113 nil) font-lock-default-fontify-region(1 113 nil) font-lock-fontify-region(1 113) #f(compiled-function (beg end) #)(1 113) font-lock-ensure() (if (eq major-mode 'fundamental-mode) nil (font-lock-ensure)) (progn (if mode (let ((#:wconfig (current-window-configuration))) ...) ...) ...) (condition-case #:err (progn ...) ((debug error) (message "Error: %S" #:err) nil)) (let ((font-lock-verbose nil) (enable-local-variables nil)) ...) (progn (buffer-disable-undo) (mm-enable-multibyte) ...) (unwind-protect (progn (buffer-disable-undo) (mm-enable-multibyte) ...) ...) (save-current-buffer (set-buffer #:temp-buffer) (unwind-protect ...)) (let ((#:temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer ...)) (let ((charset (mail-content-type-get (nth 1 handle) 'charset)) text coding-system ovs) ...) mm-display-inline-fontify(... diff-mode) mm-display-patch-inline(...) mm-display-inline(...) gnus-mime-display-single(...) gnus-mime-display-part(...) mapcar(gnus-mime-display-part (...)) gnus-mime-display-mixed((...)) gnus-mime-display-part((#("multipart/mixed" 0 15 ...) ...)) gnus-display-mime() gnus-article-prepare-display() gnus-article-prepare(5460 nil) funcall(gnus-article-prepare 5460 nil) (prog1 (funcall (or gnus-summary-display-article-function ...) article all-header) ...) (if (null article) nil (prog1 (funcall (or gnus-summary-display-article-function ...) article all-header))) gnus-summary-display-article(5460 nil) (progn (gnus-summary-display-article article all-headers) ...) (if (or (and gnus-single-article-buffer ...)) ... 'old) (save-current-buffer (set-buffer gnus-summary-buffer) ...) (let ((article (or article (gnus-summary-article-number))) ...) ...) gnus-summary-select-article(nil nil pseudo) (eq (gnus-summary-select-article nil nil 'pseudo) 'old) (if (eq (gnus-summary-select-article nil nil 'pseudo) 'old) ...) gnus-summary-scroll-up(1) funcall-interactively(gnus-summary-scroll-up 1) call-interactively(gnus-summary-scroll-up nil nil) command-execute(gnus-summary-scroll-up) I don't know if it's possible to fix c-mode to not raise the error during fontification. But at least the patch below will avoid this error while displaying such attachments in Gnus. Normally calling font-lock-ensure ignores the fontification errors when called from font-lock. But in mm-display-inline-fontify font-lock-ensure is called directly from top-level, so this patch ignores its errors. diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el index 6ffa1fc168..ebaf8435c0 100644 --- a/lisp/gnus/mm-view.el +++ b/lisp/gnus/mm-view.el @@ -500,7 +500,7 @@ mm-display-inline-fontify (setq mode major-mode))) ;; Do not fontify if the guess mode is fundamental. (unless (eq major-mode 'fundamental-mode) - (font-lock-ensure)))) + (ignore-errors (font-lock-ensure))))) (setq text (buffer-string)) (when (eq mode 'diff-mode) (setq ovs (mapcar (lambda (ov) (list ov (overlay-start ov) Then visiting such attachments will just leave this line in *Messages* without wreaking much havoc: Error during redisplay: (jit-lock-function 1) signaled (wrong-type-argument integer-or-marker-p nil) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=test.diff diff --git a/test.c b/test.c index aaa..bbb 100644 --- a/test.c +++ b/test.c @@ -1,3 +2,3 @@ int i) { -1 +2 --=-=-=--