From unknown Sat Jun 21 10:40:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6239: Running htmlfontify in batch mode 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: Fri, 21 May 2010 14:33:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6239 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6239@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12744523537463 (code B ref -1); Fri, 21 May 2010 14:33:03 +0000 Received: (at submit) by debbugs.gnu.org; 21 May 2010 14:32:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFTH6-0001wJ-9i for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:33 -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 1OFTH2-0001wD-G6 for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:29 -0400 Received: from lists.gnu.org ([199.232.76.165]:42901) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OFTGx-0003po-KB for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:23 -0400 Received: from [140.186.70.92] (port=48796 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFTGv-0008Ib-C6 for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:22 -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 1OFTGs-0002m1-U8 for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49566) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFTGs-0002lW-Lo for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:18 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4LEWG98032548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 May 2010 10:32:16 -0400 Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4LEWFY8032517 for ; Fri, 21 May 2010 10:32:16 -0400 Date: Fri, 21 May 2010 23:30:28 +0900 (JST) Message-Id: <20100521.233028.544549952346250291.yamato@redhat.com> From: Masatake YAMATO 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.17 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.9 (------) 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.8 (------) This is a bug report with a patch which fixes the bug. Please, include the patch to the official emacs tree if appreciated. I'm trying to convert a source code to a html file with htmlfontify.el. I'd like to do it in a batch job. With the following script(CONVERTER) and command line I expect I can convert a source code file into html format: --------------------------------------------------------------- #!/home/yamato/var/emacs/src/emacs --script ; CONVERTER (defun print-to-stderr (str) (mapcar 'external-debugging-output str)) (let ((input (car argv)) (output (cadr argv))) (unless input (print-to-stderr "*** No INPUT is given\n") (kill-emacs 1) ) (unless output (print-to-stderr "*** No OUTPUT is given\n") (kill-emacs 1) ) (unless (file-readable-p input) (print-to-stderr (format "*** Cannot read %s\n" input)) (kill-exit 1) ) (unless (file-writable-p output) (print-to-stderr (format "*** Cannot write %s\n" output)) (kill-emacs 1) ) (let ((srcdir (or (file-name-directory input) "./")) (dstdir output) (file (file-name-nondirectory input))) (require 'htmlfontify) (htmlfontify-load-rgb-file) (let ((hfy-display-class '((type . x-toolkit) (class . color) (background . light)))) (hfy-copy-and-fontify-file srcdir dstdir file)))) --------------------------------------------------------------- $ ./CONVERTER emacs/src/epaths.h /tmp/ But, the command line is failed because htmlfontify.el tries to modify data in pure storage. With following patch it works as I expected. 2010-05-21 Masatake YAMATO * htmlfontify.el (hfy-face-attr-for-class): Use `append' instead of `nconc'. === modified file 'lisp/htmlfontify.el' *** lisp/htmlfontify.el 2010-04-24 02:36:43 +0000 --- lisp/htmlfontify.el 2010-05-21 14:18:31 +0000 *************** *** 926,932 **** new-spec))))) (if (or (memq :inherit face-spec) (eq 'default face)) face-spec ! (nconc face-spec (list :inherit 'default))) )) ;; construct an assoc of (css-tag-name . css-tag-value) pairs ;; from a face or assoc of face attributes: --- 926,936 ---- new-spec))))) (if (or (memq :inherit face-spec) (eq 'default face)) face-spec ! ;; We cannot use `nconc' here. ! ;; As far as I inspected, (get face 'face-defface-spec) in ! ;; `hfy-combined-face-spec' returns data at pure storage ! ;; if noninteractive. ! (append face-spec (list :inherit 'default))) )) ;; construct an assoc of (css-tag-name . css-tag-value) pairs ;; from a face or assoc of face attributes: From unknown Sat Jun 21 10:40:39 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#6239: closed (Re: Running htmlfontify in batch mode) Message-ID: References: <87fx08xrgx.fsf@stupidchicken.com> <20100521.233028.544549952346250291.yamato@redhat.com> X-Gnu-PR-Message: they-closed 6239 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 6239@debbugs.gnu.org Date: Sun, 27 Jun 2010 18:26:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1277663161-26504-1" This is a multi-part message in MIME format... ------------=_1277663161-26504-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6239: Running htmlfontify in batch mode 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 6239@debbugs.gnu.org. --=20 6239: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6239 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1277663161-26504-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6239-done) by debbugs.gnu.org; 27 Jun 2010 18:25:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSwYG-0006tJ-Lh for submit@debbugs.gnu.org; Sun, 27 Jun 2010 14:25:56 -0400 Received: from pantheon-po16.its.yale.edu ([130.132.50.72]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OSwYF-0006tE-DR for 6239-done@debbugs.gnu.org; Sun, 27 Jun 2010 14:25:55 -0400 Received: from furry (dhcp128036163046.central.yale.edu [128.36.163.46]) (authenticated bits=0) by pantheon-po16.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o5RIPo9H016424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 27 Jun 2010 14:25:51 -0400 Received: by furry (Postfix, from userid 1000) id EEC0916EC25; Sun, 27 Jun 2010 20:25:50 +0200 (CEST) From: Chong Yidong To: Masatake YAMATO Subject: Re: Running htmlfontify in batch mode Date: Sun, 27 Jun 2010 14:25:50 -0400 Message-ID: <87fx08xrgx.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6239-done Cc: 6239-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.8 (--) > htmlfontify.el tries to modify data in pure storage. Thanks, I've checked in your patch. ------------=_1277663161-26504-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 May 2010 14:32:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFTH6-0001wJ-9i for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:33 -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 1OFTH2-0001wD-G6 for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:29 -0400 Received: from lists.gnu.org ([199.232.76.165]:42901) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OFTGx-0003po-KB for submit@debbugs.gnu.org; Fri, 21 May 2010 10:32:23 -0400 Received: from [140.186.70.92] (port=48796 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OFTGv-0008Ib-C6 for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:22 -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 1OFTGs-0002m1-U8 for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49566) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OFTGs-0002lW-Lo for bug-gnu-emacs@gnu.org; Fri, 21 May 2010 10:32:18 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4LEWG98032548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 May 2010 10:32:16 -0400 Received: from localhost (beach.nrt.redhat.com [10.64.200.71]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4LEWFY8032517 for ; Fri, 21 May 2010 10:32:16 -0400 Date: Fri, 21 May 2010 23:30:28 +0900 (JST) Message-Id: <20100521.233028.544549952346250291.yamato@redhat.com> To: bug-gnu-emacs@gnu.org Subject: Running htmlfontify in batch mode From: Masatake YAMATO 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.17 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.9 (------) 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.8 (------) This is a bug report with a patch which fixes the bug. Please, include the patch to the official emacs tree if appreciated. I'm trying to convert a source code to a html file with htmlfontify.el. I'd like to do it in a batch job. With the following script(CONVERTER) and command line I expect I can convert a source code file into html format: --------------------------------------------------------------- #!/home/yamato/var/emacs/src/emacs --script ; CONVERTER (defun print-to-stderr (str) (mapcar 'external-debugging-output str)) (let ((input (car argv)) (output (cadr argv))) (unless input (print-to-stderr "*** No INPUT is given\n") (kill-emacs 1) ) (unless output (print-to-stderr "*** No OUTPUT is given\n") (kill-emacs 1) ) (unless (file-readable-p input) (print-to-stderr (format "*** Cannot read %s\n" input)) (kill-exit 1) ) (unless (file-writable-p output) (print-to-stderr (format "*** Cannot write %s\n" output)) (kill-emacs 1) ) (let ((srcdir (or (file-name-directory input) "./")) (dstdir output) (file (file-name-nondirectory input))) (require 'htmlfontify) (htmlfontify-load-rgb-file) (let ((hfy-display-class '((type . x-toolkit) (class . color) (background . light)))) (hfy-copy-and-fontify-file srcdir dstdir file)))) --------------------------------------------------------------- $ ./CONVERTER emacs/src/epaths.h /tmp/ But, the command line is failed because htmlfontify.el tries to modify data in pure storage. With following patch it works as I expected. 2010-05-21 Masatake YAMATO * htmlfontify.el (hfy-face-attr-for-class): Use `append' instead of `nconc'. === modified file 'lisp/htmlfontify.el' *** lisp/htmlfontify.el 2010-04-24 02:36:43 +0000 --- lisp/htmlfontify.el 2010-05-21 14:18:31 +0000 *************** *** 926,932 **** new-spec))))) (if (or (memq :inherit face-spec) (eq 'default face)) face-spec ! (nconc face-spec (list :inherit 'default))) )) ;; construct an assoc of (css-tag-name . css-tag-value) pairs ;; from a face or assoc of face attributes: --- 926,936 ---- new-spec))))) (if (or (memq :inherit face-spec) (eq 'default face)) face-spec ! ;; We cannot use `nconc' here. ! ;; As far as I inspected, (get face 'face-defface-spec) in ! ;; `hfy-combined-face-spec' returns data at pure storage ! ;; if noninteractive. ! (append face-spec (list :inherit 'default))) )) ;; construct an assoc of (css-tag-name . css-tag-value) pairs ;; from a face or assoc of face attributes: ------------=_1277663161-26504-1--