X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/947518dbb88bbb43c86aa71516b12014839a8ddd..704172e6d4ef5cf66c087b7eb8643a4309726ff7:/lisp/htmlfontify.el diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 8bb8d3df22..5128ca8f9c 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -1,6 +1,6 @@ ;;; htmlfontify.el --- htmlize a buffer/source tree with optional hyperlinks -;; Copyright (C) 2002-2003, 2009-2013 Free Software Foundation, Inc. +;; Copyright (C) 2002-2003, 2009-2014 Free Software Foundation, Inc. ;; Emacs Lisp Archive Entry ;; Package: htmlfontify @@ -146,6 +146,8 @@ main-content <=MAIN_CONTENT;\\n\" rtfm-section file style rtfm-section file)) "Convert buffers and files to HTML." :group 'applications :link '(variable-link htmlfontify-manual) + :link '(custom-manual "(htmlfontify) Top") + :link '(info-link "(htmlfontify) Customization") :prefix "hfy-") (defcustom hfy-page-header 'hfy-default-header @@ -1326,9 +1328,7 @@ return a `defface' style list of face properties instead of a face symbol." (defun hfy-overlay-props-at (p) "Grab overlay properties at point P. The plists are returned in descending priority order." - (sort (mapcar #'overlay-properties (overlays-at p)) - (lambda (A B) (> (or (cadr (memq 'priority A)) 0) ;FIXME: plist-get? - (or (cadr (memq 'priority B)) 0))))) + (mapcar #'overlay-properties (overlays-at p 'sorted))) ;; construct an assoc of (face-name . (css-name . "{ css-style }")) elements: (defun hfy-compile-stylesheet () @@ -1619,7 +1619,7 @@ span also begins a invisible portion of text. An implementation can use TEXT-BLOCK, TEXT-ID, TEXT-BEGINS-BLOCK-P to implement fold/unfold-on-mouse-click like -behaviour. +behavior. The default handler is `hfy-begin-span'.") @@ -1640,7 +1640,6 @@ FILE, if set, is the file name." (css-map nil) (invis-ranges nil) (rovl nil) - (orig-ovls (overlays-in (point-min) (point-max))) (rmin (when mark-active (region-beginning))) (rmax (when mark-active (region-end ))) ) (when (and mark-active @@ -1662,12 +1661,6 @@ FILE, if set, is the file name." (set-buffer html-buffer) ;; rip out props that could interfere with our htmlization of the buffer: (remove-text-properties (point-min) (point-max) hfy-ignored-properties) - ;; Apply overlay invisible spec - (setq orig-ovls - (sort orig-ovls - (lambda (A B) - (> (or (cadr (memq 'priority (overlay-properties A))) 0) - (or (cadr (memq 'priority (overlay-properties B))) 0))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; at this point, html-buffer retains the fontification of the parent: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1707,7 +1700,7 @@ FILE, if set, is the file name." ;; think we only need to relocate the hfy-endl property, as the hfy-linkp ;; property has already served its main purpose by this point. ;;(message "mapcar over the CSS-MAP") - (message "invis-ranges:\n%S" invis-ranges) + ;; (message "invis-ranges:\n%S" invis-ranges) (dolist (point-face css-map) (let ((pt (car point-face)) (fn (cdr point-face)) @@ -1816,17 +1809,25 @@ fontified. This is a simple convenience wrapper around (eval-and-compile (require 'font-lock)) (if (boundp 'font-lock-cache-position) (or font-lock-cache-position - (set 'font-lock-cache-position (make-marker)))) - (if (not noninteractive) - (progn - (message "hfy interactive mode (%S %S)" window-system major-mode) - (when (and font-lock-defaults - font-lock-mode) - (font-lock-fontify-region (point-min) (point-max) nil))) + (setq font-lock-cache-position (make-marker)))) + (cond + (noninteractive (message "hfy batch mode (%s:%S)" (or (buffer-file-name) (buffer-name)) major-mode) - (when font-lock-defaults - (font-lock-fontify-buffer)) )) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (when font-lock-defaults + (font-lock-fontify-buffer)))) + ((fboundp #'jit-lock-fontify-now) + (message "hfy jit-lock mode (%S %S)" window-system major-mode) + (jit-lock-fontify-now)) + (t + (message "hfy interactive mode (%S %S)" window-system major-mode) + ;; If jit-lock is not in use, then the buffer is already fontified! + ;; (when (and font-lock-defaults + ;; font-lock-mode) + ;; (font-lock-fontify-region (point-min) (point-max) nil)) + ))) ;;;###autoload (defun htmlfontify-buffer (&optional srcdir file) @@ -2110,7 +2111,7 @@ FILE is the specific file we are rendering." ;; functionality easier to implement. ;; ( tar file functionality not merged here because it requires a ;; hacked copy of etags capable of tagging stdin: if Francesco -;; Potorti accepts a patch, or otherwise implements stdin tagging, +;; Potortì accepts a patch, or otherwise implements stdin tagging, ;; then I will provide a `htmlfontify-tar-file' defun ) (defun hfy-parse-tags-buffer (srcdir buffer) "Parse a BUFFER containing etags formatted output, loading the @@ -2410,9 +2411,9 @@ You may also want to set `hfy-page-header' and `hfy-page-footer'." (load file 'NOERROR nil nil) )) -;;;### (autoloads nil "hfy-cmap" "hfy-cmap.el" "df4e418d0d8749ead9d32bb2c7a5bd56") +;;;### (autoloads nil "hfy-cmap" "hfy-cmap.el" "27dc80b0f7187aaf582805a8f887819a") ;;; Generated autoloads from hfy-cmap.el -(push (purecopy '(htmlfontify 0 20)) package--builtin-versions) + (autoload 'htmlfontify-load-rgb-file "hfy-cmap" "\ Load an X11 style rgb.txt FILE. Search `hfy-rgb-load-path' if FILE is not specified.