help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble saving fontification information


From: Davin Pearson
Subject: Trouble saving fontification information
Date: Tue, 25 Nov 2008 00:55:13 -0800 (PST)
User-agent: G2/1.0

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 "&lt;"))
   ((eq ch ?>)
    (insert "&gt;"))
   ((eq ch ?&)
    (insert "&amp;"))
   (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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]