From: Davin Pearson <davin.pearson@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Trouble saving fontification information
Date: Tue, 25 Nov 2008 00:55:13 -0800 (PST) [thread overview]
Message-ID: <01659e10-aeef-4fa9-8c69-03653c7236f7@s9g2000prm.googlegroups.com> (raw)
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 "</span>"))
(if (not (eq font nil))
(insert "<span class=\"" (prin1-to-string font) "\">"))
(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 "<html>\n")
(insert " <head>\n")
(insert " <link rel=\"stylesheet\" href=\"stylesheet9.css\"
type=\"text/css\">\n")
(insert " </head>\n")
(insert "<body>\n")
(insert "<pre>"))
;;(save-excursion (set-buffer "*output*") (insert "<span class=
\"nil\">"))
(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 "</pre>\n")
(insert "</body>\n")
(insert "</html>\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:
<f3> C-d d l <tab> C-g M-x d <backspace> r e p o r
<tab> <return>
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
next reply other threads:[~2008-11-25 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-25 8:55 Davin Pearson [this message]
2008-11-25 14:09 ` Trouble saving fontification information Xah Lee
2008-11-26 0:42 ` Davin Pearson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01659e10-aeef-4fa9-8c69-03653c7236f7@s9g2000prm.googlegroups.com \
--to=davin.pearson@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).