From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.help Subject: Trouble saving fontification information Date: Tue, 25 Nov 2008 00:55:13 -0800 (PST) Organization: http://groups.google.com Message-ID: <01659e10-aeef-4fa9-8c69-03653c7236f7@s9g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1227606079 14129 80.91.229.12 (25 Nov 2008 09:41:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Nov 2008 09:41:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 25 10:42:24 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L4uR5-0008B8-TS for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Nov 2008 10:42:24 +0100 Original-Received: from localhost ([127.0.0.1]:42973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4uPw-0007dQ-C8 for geh-help-gnu-emacs@m.gmane.org; Tue, 25 Nov 2008 04:41:12 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!s9g2000prm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 168 Original-NNTP-Posting-Host: 60.234.132.53 Original-X-Trace: posting.google.com 1227603313 18408 127.0.0.1 (25 Nov 2008 08:55:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 25 Nov 2008 08:55:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s9g2000prm.googlegroups.com; posting-host=60.234.132.53; posting-account=SVVH0AoAAABplEQzMkIR3gU7a0gK8IuF User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:164748 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60079 Archived-At: Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. Please describe exactly what actions triggered the bug and the precise symptoms of the bug: I have written the following code to save Emacs' fontification information to an HTML document for display in a web browser, but the trouble is that it is rather unreliable, sometimes no fontification is viewable on the web browser, other times all fontification information is viewable, and still other times, some information is viewable. What am I doing wrong to make Emacs so flaky in its performance? (defun d-html-quote-insert-char (ch) (cond ((eq ch ?<) (insert "<")) ((eq ch ?>) (insert ">")) ((eq ch ?&) (insert "&")) (t (insert (format "%c" ch))))) (defun d-convert-font (font) (cond ((eq font 'font-lock-comment-face) 'flcf) ((eq font 'font-lock-keyword-face) 'flkf) ((eq font 'font-lock-string-face) 'flsf) ((eq font 'font-lock-type-face) 'fltf) ((eq font 'font-lock-variable-name-face) 'flvnf) ((eq font 'font-lock-function-name-face) 'flfnf) ((eq font 'd-face-cc-digits) 'libd-purple) ((eq font 'd-face-cc-global) 'libd-green) ((eq font 'font-lock-constant-face) 'libd-red))) (defun d-append (ch font) (save-excursion (set-buffer "*output*") (goto-char (point-max)) ;;(setq font (d-convert-font font)) (if (eq last font) (d-html-quote-insert-char ch) (if (not (eq last nil)) (insert "")) (if (not (eq font nil)) (insert "")) (setq last font) (d-html-quote-insert-char ch)))) (defun pretty-print (file) (interactive "fEnter a filename: ") (save-excursion (if (get-buffer "*output*") (kill-buffer "*output*")) (generate-new-buffer "*output*") (find-file file) (c++-mode) ;;(sjs-mode) (font-lock-fontify-buffer) (setq last nil) ;;(message "*** begin") (goto-char (point-min)) ;;(d-movement--unpad-buffer) (save-excursion (set-buffer "*output*") (insert "\n") (insert " \n") (insert " \n") (insert " \n") (insert "\n") (insert "
"))
    ;;(save-excursion (set-buffer "*output*") (insert ""))
    (while (< (point) (point-max))
      (setq font (get-char-property (point) 'face))
      (setq ch   (char-after (point)))
      (if (not (eq ch nil))
          (d-append ch font))
      (forward-char 1))
    ;;(message "*** end")
    (save-excursion
      (set-buffer "*output*")
      (insert "
\n") (insert "\n") (insert "\n") (html-mode)) ;;(d-movement--pad-buffer) )) If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. If you would like to further debug the crash, please read the file d:/Program Files/emacs-22.2/etc/DEBUG for instructions. In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-27 on RELEASE Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4)' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: ENZ locale-coding-system: cp1252 default-enable-multibyte-characters: t Major mode: Dired by name Minor modes in effect: recentf-mode: t tabbar-mode: t display-time-mode: t dired-omit-mode: t show-paren-mode: t encoded-kbd-mode: t tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t Recent input: C-d d l C-g M-x d r e p o r Recent messages: Loading recentf...done Loading d:/home/.recentf...done Cleaning up the recentf list...done (0 removed) Loading d:/home/dlisp/d-start.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. (No files need saving) Omitting... Omitted 32 lines. Quit Loading emacsbug...done