From unknown Sat Aug 16 23:50:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6279: Resolve alias face in htmlfontify.el Resent-From: Masatake YAMATO Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 May 2010 14:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6279 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6279@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.127497196810838 (code B ref -1); Thu, 27 May 2010 14:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2010 14:52:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRz-0002ol-Ph for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:48 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRw-0002oe-Vf for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:46 -0400 Received: from lists.gnu.org ([199.232.76.165]:52724) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OHeRs-0000Qo-2w for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:40 -0400 Received: from [140.186.70.92] (port=53490 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHeRq-0005ZH-Iq for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHeRp-0005Es-6R for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7042) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRo-0005En-T9 for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:37 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4REqaXq021067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 May 2010 10:52:36 -0400 Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4REqYY3004413 for ; Thu, 27 May 2010 10:52:35 -0400 Date: Thu, 27 May 2010 23:53:26 +0900 (JST) Message-Id: <20100527.235326.730793605263490146.yamato@redhat.com> From: Masatake YAMATO In-Reply-To: <20100524.154536.959493690167583231.yamato@redhat.com> References: <20100524.154536.959493690167583231.yamato@redhat.com> Organization: Red Hat Japan, Inc. Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.5 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) This is a bug report with a patch. Please review the patch and merge it to the emacs official source tree if appreciated. To reproduce a bug: 1. Make a new verilog-mode buffer and put following small code to the buffer: --------------------------------- // -*- verilog -*- function x; endfunction ----------------------------------- 2. M-x toggle-debug-on-error 3. M-x htmlfontify-buffer You will get following backtrace. --------------------------------- Debugger entered--Lisp error: (wrong-type-argument listp font-lock-reference-face) car(font-lock-reference-face) (let ((key ...) (val ...) (next ...) (that nil) (this nil) \ (parent nil)) (if (eq key :inherit) (let ... ...) (setq this ...)) \ (setq that (hfy-face-to-style-i next)) (nconc this that parent)) (progn (let (... ... ... ... ... ...) (if ... ... ...) (setq that ...) (nconc this that parent))) (if fn (progn (let ... ... ... ...))) (when fn (let (... ... ... ... ... ...) (if ... ... ...) (setq that ...) (nconc this that parent))) hfy-face-to-style-i(font-lock-reference-face) (hfy-flatten-style (hfy-face-to-style-i face-def)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) (let ((face-def ...) (final-style nil)) (setq final-style (hfy-flatten-style ...)) \ (if (not ...) (progn ...)) final-style) hfy-face-to-style(font-lock-reference-face) (setq css-list (hfy-face-to-style fn)) (let ((css-list nil) (css-text nil) (seen nil)) (setq css-list (hfy-face-to-style fn)) \ (setq css-text (mapcar ... css-list)) (cons (hfy-css-name fn) (format "{%s}" ...))) hfy-face-to-css(font-lock-reference-face) (cons fn (hfy-face-to-css fn)) (cons (cons fn (hfy-face-to-css fn)) style) (setq style (cons (cons fn ...) style)) (push (cons fn (hfy-face-to-css fn)) style) (if (and (setq fn ...) (not ...)) (push (cons fn ...) style)) (while (< pt (point-max)) (if (and ... ...) (push ... style)) (setq pt (next-char-property-change pt))) (save-excursion (goto-char pt) (while (< pt ...) (if ... ...) (setq pt ...))) (let ((pt ...) (fn nil) (style nil)) (save-excursion (goto-char pt) (while ... ... ...)) (push (cons ... ...) style)) hfy-compile-stylesheet() (setq css-sheet (hfy-compile-stylesheet) css-map (hfy-compile-face-map) invis-ranges (hfy-find-invisible-ranges)) (let* ((html-buffer ...) (css-sheet nil) (css-map nil) (invis-ranges nil) (rovl nil) \ (orig-ovls ...) (rmin ...) (rmax ...)) (when (and mark-active transient-mark-mode) \ ... hfy-fontify-buffer(nil "foo.v") (switch-to-buffer (hfy-fontify-buffer srcdir file)) (if (interactive-p) (switch-to-buffer (hfy-fontify-buffer srcdir file)) (hfy-fontify-buffer srcdir file)) htmlfontify-buffer() call-interactively(htmlfontify-buffer t nil) execute-extended-command(nil) call-interactively(execute-extended-command nil nil) ----------------------------------- (Some newlines are inserted. A line started with `...' is truncated.) It seems that htmlfontify.el doesn't consider face alias which is used to mark obsolete face like `font-lock-reference-face'. 2010-05-27 Masatake YAMATO * htmlfontify.el (hfy-face-resolve-face): New function to resolve alias faces. (hfy-face-to-style): Use `hfy-face-resolve-face' === modified file 'lisp/htmlfontify.el' *** lisp/htmlfontify.el 2010-04-24 02:36:43 +0000 --- lisp/htmlfontify.el 2010-05-27 14:42:16 +0000 *************** *** 1026,1039 **** (setq n (apply '* m)) (nconc r (hfy-size (if x (round n) (* n 1.0)))) )) (defun hfy-face-to-style (fn) "Take FN, a font or `defface' style font specification, \(as returned by `face-attr-construct' or `hfy-face-attr-for-class') and return a `hfy-style-assoc'.\n See also `hfy-face-to-style-i', `hfy-flatten-style'." ;;(message "hfy-face-to-style");;DBUG ! (let ((face-def (if (facep fn) ! (hfy-face-attr-for-class fn hfy-display-class) fn)) (final-style nil)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) --- 1030,1057 ---- (setq n (apply '* m)) (nconc r (hfy-size (if x (round n) (* n 1.0)))) )) + (defun hfy-face-resolve-face (fn) + (cond + ((facep fn) + (hfy-face-attr-for-class fn hfy-display-class)) + ((symbolp fn) + ;; Obsolte face like `font-lock-reference-face' is defined + ;; as an alias for another face. Following + ;; expression tries to resolve the alias. + (let ((new-fn (symbol-value fn))) + (if (eq new-fn fn) + fn + (hfy-face-resolve-face new-fn)))) + (t + fn))) + (defun hfy-face-to-style (fn) "Take FN, a font or `defface' style font specification, \(as returned by `face-attr-construct' or `hfy-face-attr-for-class') and return a `hfy-style-assoc'.\n See also `hfy-face-to-style-i', `hfy-flatten-style'." ;;(message "hfy-face-to-style");;DBUG ! (let ((face-def (hfy-face-resolve-face fn)) (final-style nil)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) From unknown Sat Aug 16 23:50:42 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Masatake YAMATO Subject: bug#6279: closed (Re: bug#6279: Resolve alias face in htmlfontify.el) Message-ID: References: <87ocg1bbwg.fsf@stupidchicken.com> <20100527.235326.730793605263490146.yamato@redhat.com> X-Gnu-PR-Message: they-closed 6279 X-Gnu-PR-Package: emacs Reply-To: 6279@debbugs.gnu.org Date: Thu, 27 May 2010 15:31:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1274974262-14057-1" This is a multi-part message in MIME format... ------------=_1274974262-14057-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6279: Resolve alias face in htmlfontify.el which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6279@debbugs.gnu.org. --=20 6279: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6279 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1274974262-14057-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6279-done) by debbugs.gnu.org; 27 May 2010 15:30:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHf2G-0003TN-Jm for submit@debbugs.gnu.org; Thu, 27 May 2010 11:30:16 -0400 Received: from pantheon-po44.its.yale.edu ([130.132.50.78]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHf2E-0003HK-GX for 6279-done@debbugs.gnu.org; Thu, 27 May 2010 11:30:15 -0400 Received: from furry (dhcp128036014059.central.yale.edu [128.36.14.59]) (authenticated bits=0) by pantheon-po44.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o4RFU9lF021360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 27 May 2010 11:30:09 -0400 Received: by furry (Postfix, from userid 1000) id 1424BC057; Thu, 27 May 2010 11:30:08 -0400 (EDT) From: Chong Yidong To: Masatake YAMATO Subject: Re: bug#6279: Resolve alias face in htmlfontify.el References: <20100524.154536.959493690167583231.yamato@redhat.com> <20100527.235326.730793605263490146.yamato@redhat.com> Date: Thu, 27 May 2010 11:30:07 -0400 In-Reply-To: <20100527.235326.730793605263490146.yamato@redhat.com> (Masatake YAMATO's message of "Thu, 27 May 2010 23:53:26 +0900 (JST)") Message-ID: <87ocg1bbwg.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 6279-done Cc: 6279-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Masatake YAMATO writes: > This is a bug report with a patch. Please review the patch and > merge it to the emacs official source tree if appreciated. > > It seems that htmlfontify.el doesn't consider face alias which > is used to mark obsolete face like `font-lock-reference-face'. Thanks, I've applied your patch. ------------=_1274974262-14057-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 May 2010 14:52:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRz-0002ol-Ph for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:48 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRw-0002oe-Vf for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:46 -0400 Received: from lists.gnu.org ([199.232.76.165]:52724) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OHeRs-0000Qo-2w for submit@debbugs.gnu.org; Thu, 27 May 2010 10:52:40 -0400 Received: from [140.186.70.92] (port=53490 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHeRq-0005ZH-Iq for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHeRp-0005Es-6R for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7042) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeRo-0005En-T9 for bug-gnu-emacs@gnu.org; Thu, 27 May 2010 10:52:37 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4REqaXq021067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 May 2010 10:52:36 -0400 Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4REqYY3004413 for ; Thu, 27 May 2010 10:52:35 -0400 Date: Thu, 27 May 2010 23:53:26 +0900 (JST) Message-Id: <20100527.235326.730793605263490146.yamato@redhat.com> To: bug-gnu-emacs@gnu.org Subject: Resolve alias face in htmlfontify.el From: Masatake YAMATO In-Reply-To: <20100524.154536.959493690167583231.yamato@redhat.com> References: <20100524.154536.959493690167583231.yamato@redhat.com> Organization: Red Hat Japan, Inc. Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.5 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) This is a bug report with a patch. Please review the patch and merge it to the emacs official source tree if appreciated. To reproduce a bug: 1. Make a new verilog-mode buffer and put following small code to the buffer: --------------------------------- // -*- verilog -*- function x; endfunction ----------------------------------- 2. M-x toggle-debug-on-error 3. M-x htmlfontify-buffer You will get following backtrace. --------------------------------- Debugger entered--Lisp error: (wrong-type-argument listp font-lock-reference-face) car(font-lock-reference-face) (let ((key ...) (val ...) (next ...) (that nil) (this nil) \ (parent nil)) (if (eq key :inherit) (let ... ...) (setq this ...)) \ (setq that (hfy-face-to-style-i next)) (nconc this that parent)) (progn (let (... ... ... ... ... ...) (if ... ... ...) (setq that ...) (nconc this that parent))) (if fn (progn (let ... ... ... ...))) (when fn (let (... ... ... ... ... ...) (if ... ... ...) (setq that ...) (nconc this that parent))) hfy-face-to-style-i(font-lock-reference-face) (hfy-flatten-style (hfy-face-to-style-i face-def)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) (let ((face-def ...) (final-style nil)) (setq final-style (hfy-flatten-style ...)) \ (if (not ...) (progn ...)) final-style) hfy-face-to-style(font-lock-reference-face) (setq css-list (hfy-face-to-style fn)) (let ((css-list nil) (css-text nil) (seen nil)) (setq css-list (hfy-face-to-style fn)) \ (setq css-text (mapcar ... css-list)) (cons (hfy-css-name fn) (format "{%s}" ...))) hfy-face-to-css(font-lock-reference-face) (cons fn (hfy-face-to-css fn)) (cons (cons fn (hfy-face-to-css fn)) style) (setq style (cons (cons fn ...) style)) (push (cons fn (hfy-face-to-css fn)) style) (if (and (setq fn ...) (not ...)) (push (cons fn ...) style)) (while (< pt (point-max)) (if (and ... ...) (push ... style)) (setq pt (next-char-property-change pt))) (save-excursion (goto-char pt) (while (< pt ...) (if ... ...) (setq pt ...))) (let ((pt ...) (fn nil) (style nil)) (save-excursion (goto-char pt) (while ... ... ...)) (push (cons ... ...) style)) hfy-compile-stylesheet() (setq css-sheet (hfy-compile-stylesheet) css-map (hfy-compile-face-map) invis-ranges (hfy-find-invisible-ranges)) (let* ((html-buffer ...) (css-sheet nil) (css-map nil) (invis-ranges nil) (rovl nil) \ (orig-ovls ...) (rmin ...) (rmax ...)) (when (and mark-active transient-mark-mode) \ ... hfy-fontify-buffer(nil "foo.v") (switch-to-buffer (hfy-fontify-buffer srcdir file)) (if (interactive-p) (switch-to-buffer (hfy-fontify-buffer srcdir file)) (hfy-fontify-buffer srcdir file)) htmlfontify-buffer() call-interactively(htmlfontify-buffer t nil) execute-extended-command(nil) call-interactively(execute-extended-command nil nil) ----------------------------------- (Some newlines are inserted. A line started with `...' is truncated.) It seems that htmlfontify.el doesn't consider face alias which is used to mark obsolete face like `font-lock-reference-face'. 2010-05-27 Masatake YAMATO * htmlfontify.el (hfy-face-resolve-face): New function to resolve alias faces. (hfy-face-to-style): Use `hfy-face-resolve-face' === modified file 'lisp/htmlfontify.el' *** lisp/htmlfontify.el 2010-04-24 02:36:43 +0000 --- lisp/htmlfontify.el 2010-05-27 14:42:16 +0000 *************** *** 1026,1039 **** (setq n (apply '* m)) (nconc r (hfy-size (if x (round n) (* n 1.0)))) )) (defun hfy-face-to-style (fn) "Take FN, a font or `defface' style font specification, \(as returned by `face-attr-construct' or `hfy-face-attr-for-class') and return a `hfy-style-assoc'.\n See also `hfy-face-to-style-i', `hfy-flatten-style'." ;;(message "hfy-face-to-style");;DBUG ! (let ((face-def (if (facep fn) ! (hfy-face-attr-for-class fn hfy-display-class) fn)) (final-style nil)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) --- 1030,1057 ---- (setq n (apply '* m)) (nconc r (hfy-size (if x (round n) (* n 1.0)))) )) + (defun hfy-face-resolve-face (fn) + (cond + ((facep fn) + (hfy-face-attr-for-class fn hfy-display-class)) + ((symbolp fn) + ;; Obsolte face like `font-lock-reference-face' is defined + ;; as an alias for another face. Following + ;; expression tries to resolve the alias. + (let ((new-fn (symbol-value fn))) + (if (eq new-fn fn) + fn + (hfy-face-resolve-face new-fn)))) + (t + fn))) + (defun hfy-face-to-style (fn) "Take FN, a font or `defface' style font specification, \(as returned by `face-attr-construct' or `hfy-face-attr-for-class') and return a `hfy-style-assoc'.\n See also `hfy-face-to-style-i', `hfy-flatten-style'." ;;(message "hfy-face-to-style");;DBUG ! (let ((face-def (hfy-face-resolve-face fn)) (final-style nil)) (setq final-style (hfy-flatten-style (hfy-face-to-style-i face-def))) ------------=_1274974262-14057-1--