* Trouble saving fontification information
@ 2008-11-25 8:55 Davin Pearson
2008-11-25 14:09 ` Xah Lee
0 siblings, 1 reply; 3+ messages in thread
From: Davin Pearson @ 2008-11-25 8:55 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Trouble saving fontification information
2008-11-25 8:55 Trouble saving fontification information Davin Pearson
@ 2008-11-25 14:09 ` Xah Lee
2008-11-26 0:42 ` Davin Pearson
0 siblings, 1 reply; 3+ messages in thread
From: Xah Lee @ 2008-11-25 14:09 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 25, 12:55 am, Davin Pearson <davin.pear...@gmail.com> wrote:
> 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-em...@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?
>
Not sure what's your intent in posting the above message here.
Are you trying to ask a elisp question? Are you trying to file a bug
report? Are you just trying to complain?
if you have elisp question, please make it specific. If bug report,
the proper place is M-x report-emacs-bug. If complain, please make it
clear what exactly are you complaining about, and a better newsgroup
for that would be “comp.emacs”.
if you just want a feature to turn emacs fontification to html, there
are at least 2 robust packages for that. I use htmlize.el by Hrvoje
Niksic.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-26 0:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 8:55 Trouble saving fontification information Davin Pearson
2008-11-25 14:09 ` Xah Lee
2008-11-26 0:42 ` Davin Pearson
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).