diff options
| author | Juanma Barranquero | 2010-01-11 18:26:28 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2010-01-11 18:26:28 +0100 |
| commit | 30afcdfffd95e24183956a666749cf6c03150d14 (patch) | |
| tree | 590c0e4e3860ac72f41abc2a9b02ad729906aedb | |
| parent | 92b1c41682b7bc139fddb19acc7824ecf779fea5 (diff) | |
| download | emacs-30afcdfffd95e24183956a666749cf6c03150d14.tar.gz emacs-30afcdfffd95e24183956a666749cf6c03150d14.zip | |
Fix typos and remove superfluous backslash-quoting in htmlfontify.el.
* htmlfontify.el (htmlfontify-load-rgb-file)
(htmlfontify-unload-rgb-file, hfy-fallback-colour-values)
(htmlfontify-manual, htmlfontify, hfy-page-header, hfy-page-footer)
(hfy-src-doc-link-style, hfy-src-doc-link-unstyle, hfy-link-extn)
(hfy-link-style-fun, hfy-index-file, hfy-instance-file)
(hfy-html-quote-regex, hfy-init-kludge-hook, hfy-post-html-hooks)
(hfy-default-face-def, hfy-etag-regex, hfy-html-quote-map)
(hfy-etags-cmd-alist-default, hfy-etags-bin, hfy-ignored-properties)
(hfy-which-etags, hfy-etags-cmd, hfy-istext-command, hfy-display-class)
(hfy-optimisations, hfy-tags-cache, hfy-tags-sortl, hfy-tags-rmap)
(hfy-style-assoc, hfy-sheet-assoc, hfy-facemap-assoc, hfy-interq)
(hfy-colour-vals, hfy-default-header, hfy-link-style-string)
(hfy-triplet, hfy-slant, hfy-weight, hfy-combined-face-spec)
(hfy-face-attr-for-class, hfy-face-to-style-i, hfy-size-to-int)
(hfy-flatten-style, hfy-face-to-style, hfy-face-or-def-to-name)
(hfy-face-to-css, hfy-p-to-face, hfy-p-to-face-lennart, hfy-face-at)
(hfy-fontified-p, hfy-merge-adjacent-spans, hfy-buffer)
(hfy-html-enkludge-buffer, hfy-html-quote, hfy-html-dekludge-buffer)
(hfy-force-fontification, htmlfontify-buffer, hfy-dirname)
(hfy-make-directory, hfy-text-p, hfy-mark-tag-names, hfy-relstub)
(hfy-href-stub, hfy-href, hfy-mark-tag-hrefs, hfy-prepare-index-i)
(hfy-prepare-index, hfy-prepare-tag-map, hfy-subtract-maps)
(htmlfontify-run-etags): Fix typos in docstrings and remove superfluous
backslash-quoting from parentheses, etc.
| -rw-r--r-- | lisp/ChangeLog | 27 | ||||
| -rw-r--r-- | lisp/htmlfontify.el | 437 |
2 files changed, 245 insertions, 219 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87b70778312..51687a04553 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2010-01-11 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * htmlfontify.el (htmlfontify-load-rgb-file) | ||
| 4 | (htmlfontify-unload-rgb-file, hfy-fallback-colour-values) | ||
| 5 | (htmlfontify-manual, htmlfontify, hfy-page-header, hfy-page-footer) | ||
| 6 | (hfy-src-doc-link-style, hfy-src-doc-link-unstyle, hfy-link-extn) | ||
| 7 | (hfy-link-style-fun, hfy-index-file, hfy-instance-file) | ||
| 8 | (hfy-html-quote-regex, hfy-init-kludge-hook, hfy-post-html-hooks) | ||
| 9 | (hfy-default-face-def, hfy-etag-regex, hfy-html-quote-map) | ||
| 10 | (hfy-etags-cmd-alist-default, hfy-etags-bin, hfy-ignored-properties) | ||
| 11 | (hfy-which-etags, hfy-etags-cmd, hfy-istext-command, hfy-display-class) | ||
| 12 | (hfy-optimisations, hfy-tags-cache, hfy-tags-sortl, hfy-tags-rmap) | ||
| 13 | (hfy-style-assoc, hfy-sheet-assoc, hfy-facemap-assoc, hfy-interq) | ||
| 14 | (hfy-colour-vals, hfy-default-header, hfy-link-style-string) | ||
| 15 | (hfy-triplet, hfy-slant, hfy-weight, hfy-combined-face-spec) | ||
| 16 | (hfy-face-attr-for-class, hfy-face-to-style-i, hfy-size-to-int) | ||
| 17 | (hfy-flatten-style, hfy-face-to-style, hfy-face-or-def-to-name) | ||
| 18 | (hfy-face-to-css, hfy-p-to-face, hfy-p-to-face-lennart, hfy-face-at) | ||
| 19 | (hfy-fontified-p, hfy-merge-adjacent-spans, hfy-buffer) | ||
| 20 | (hfy-html-enkludge-buffer, hfy-html-quote, hfy-html-dekludge-buffer) | ||
| 21 | (hfy-force-fontification, htmlfontify-buffer, hfy-dirname) | ||
| 22 | (hfy-make-directory, hfy-text-p, hfy-mark-tag-names, hfy-relstub) | ||
| 23 | (hfy-href-stub, hfy-href, hfy-mark-tag-hrefs, hfy-prepare-index-i) | ||
| 24 | (hfy-prepare-index, hfy-prepare-tag-map, hfy-subtract-maps) | ||
| 25 | (htmlfontify-run-etags): Fix typos in docstrings and remove superfluous | ||
| 26 | backslash-quoting from parentheses, etc. | ||
| 27 | |||
| 1 | 2010-01-11 Chong Yidong <cyd@stupidchicken.com> | 28 | 2010-01-11 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 29 | ||
| 3 | * progmodes/js.el: Autoload javascript-mode alias. | 30 | * progmodes/js.el: Autoload javascript-mode alias. |
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index d5fba48c45a..0f868784d14 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el | |||
| @@ -107,19 +107,19 @@ | |||
| 107 | (autoload | 107 | (autoload |
| 108 | 'htmlfontify-load-rgb-file | 108 | 'htmlfontify-load-rgb-file |
| 109 | "hfy-cmap" | 109 | "hfy-cmap" |
| 110 | "Load an rgb.txt file for colour name -> rgb translation purposes." | 110 | "Load an rgb.txt file for color name -> rgb translation purposes." |
| 111 | 'interactive) | 111 | 'interactive) |
| 112 | 112 | ||
| 113 | (autoload | 113 | (autoload |
| 114 | 'htmlfontify-unload-rgb-file | 114 | 'htmlfontify-unload-rgb-file |
| 115 | "hfy-cmap" | 115 | "hfy-cmap" |
| 116 | "Unload the current colour name -> rgb translation map." | 116 | "Unload the current color name -> rgb translation map." |
| 117 | 'interactive) | 117 | 'interactive) |
| 118 | 118 | ||
| 119 | (autoload | 119 | (autoload |
| 120 | 'hfy-fallback-colour-values | 120 | 'hfy-fallback-colour-values |
| 121 | "hfy-cmap" | 121 | "hfy-cmap" |
| 122 | "Use a fallback method for obtaining the rgb values for a colour." | 122 | "Use a fallback method for obtaining the rgb values for a color." |
| 123 | 'interactive) | 123 | 'interactive) |
| 124 | ) | 124 | ) |
| 125 | 125 | ||
| @@ -131,8 +131,8 @@ | |||
| 131 | "The generator meta tag for this version of htmlfontify.") | 131 | "The generator meta tag for this version of htmlfontify.") |
| 132 | 132 | ||
| 133 | (defconst htmlfontify-manual "Htmlfontify Manual" | 133 | (defconst htmlfontify-manual "Htmlfontify Manual" |
| 134 | "Copy and convert buffers and files to html, adding hyperlinks between files | 134 | "Copy and convert buffers and files to HTML, adding hyperlinks between files |
| 135 | \(driven by etags\) if requested. | 135 | \(driven by etags) if requested. |
| 136 | \nInteractive functions: | 136 | \nInteractive functions: |
| 137 | `htmlfontify-buffer' | 137 | `htmlfontify-buffer' |
| 138 | `htmlfontify-run-etags' | 138 | `htmlfontify-run-etags' |
| @@ -144,50 +144,50 @@ fontify a file you have open: M-x htmlfontify-buffer | |||
| 144 | prepare the etags map for a directory: M-x htmlfontify-run-etags | 144 | prepare the etags map for a directory: M-x htmlfontify-run-etags |
| 145 | copy a directory, fontifying as you go: M-x htmlfontify-copy-and-link-dir\n | 145 | copy a directory, fontifying as you go: M-x htmlfontify-copy-and-link-dir\n |
| 146 | The following might be useful when running non-windowed or in batch mode: | 146 | The following might be useful when running non-windowed or in batch mode: |
| 147 | \(note that they shouldn't be necessary - we have a built in map\)\n | 147 | \(note that they shouldn't be necessary - we have a built in map)\n |
| 148 | load an X11 style rgb.txt file: M-x htmlfontify-load-rgb-file | 148 | load an X11 style rgb.txt file: M-x htmlfontify-load-rgb-file |
| 149 | unload the current rgb.txt file: M-x htmlfontify-unload-rgb-file\n | 149 | unload the current rgb.txt file: M-x htmlfontify-unload-rgb-file\n |
| 150 | And here's a programmatic example:\n | 150 | And here's a programmatic example:\n |
| 151 | \(defun rtfm-build-page-header \(file style\) | 151 | \(defun rtfm-build-page-header (file style) |
| 152 | \(format \"#define TEMPLATE red+black.html | 152 | (format \"#define TEMPLATE red+black.html |
| 153 | #define DEBUG 1 | 153 | #define DEBUG 1 |
| 154 | #include <build/menu-dirlist|>\\n | 154 | #include <build/menu-dirlist|>\\n |
| 155 | html-css-url := /css/red+black.css | 155 | html-css-url := /css/red+black.css |
| 156 | title := rtfm.etla.org \( %s / src/%s \) | 156 | title := rtfm.etla.org ( %s / src/%s ) |
| 157 | bodytag := | 157 | bodytag := |
| 158 | head <=STYLESHEET;\\n | 158 | head <=STYLESHEET;\\n |
| 159 | %s | 159 | %s |
| 160 | STYLESHEET | 160 | STYLESHEET |
| 161 | main-title := rtfm / %s / src/%s\\n | 161 | main-title := rtfm / %s / src/%s\\n |
| 162 | main-content <=MAIN_CONTENT;\\n\" rtfm-section file style rtfm-section file\)\) | 162 | main-content <=MAIN_CONTENT;\\n\" rtfm-section file style rtfm-section file)) |
| 163 | 163 | ||
| 164 | \(defun rtfm-build-page-footer \(file\) \"\\nMAIN_CONTENT\\n\"\) | 164 | \(defun rtfm-build-page-footer (file) \"\\nMAIN_CONTENT\\n\") |
| 165 | 165 | ||
| 166 | \(defun rtfm-build-source-docs \(section srcdir destdir\) | 166 | \(defun rtfm-build-source-docs (section srcdir destdir) |
| 167 | \(interactive | 167 | (interactive |
| 168 | \"s section[eg- emacs / p4-blame]:\\nD source-dir: \\nD output-dir: \"\) | 168 | \"s section[eg- emacs / p4-blame]:\\nD source-dir: \\nD output-dir: \") |
| 169 | \(require 'htmlfontify\) | 169 | (require 'htmlfontify) |
| 170 | \(hfy-load-tags-cache srcdir\) | 170 | (hfy-load-tags-cache srcdir) |
| 171 | \(let \(\(hfy-page-header 'rtfm-build-page-header\) | 171 | (let ((hfy-page-header 'rtfm-build-page-header) |
| 172 | \(hfy-page-footer 'rtfm-build-page-footer\) | 172 | (hfy-page-footer 'rtfm-build-page-footer) |
| 173 | \(rtfm-section section\) | 173 | (rtfm-section section) |
| 174 | \(hfy-index-file \"index\"\)\) | 174 | (hfy-index-file \"index\")) |
| 175 | \(htmlfontify-run-etags srcdir\) | 175 | (htmlfontify-run-etags srcdir) |
| 176 | \(htmlfontify-copy-and-link-dir srcdir destdir \".src\" \".html\"\)\)\)") | 176 | (htmlfontify-copy-and-link-dir srcdir destdir \".src\" \".html\")))") |
| 177 | 177 | ||
| 178 | (defgroup htmlfontify nil | 178 | (defgroup htmlfontify nil |
| 179 | "Copy and convert buffers and files to html, adding hyperlinks between | 179 | "Copy and convert buffers and files to HTML, adding hyperlinks between |
| 180 | files \(driven by etags\) if requested.\n | 180 | files (driven by etags) if requested.\n |
| 181 | See: `htmlfontify-manual'" | 181 | See also `htmlfontify-manual'." |
| 182 | :group 'applications | 182 | :group 'applications |
| 183 | :prefix "hfy-") | 183 | :prefix "hfy-") |
| 184 | 184 | ||
| 185 | (defcustom hfy-page-header 'hfy-default-header | 185 | (defcustom hfy-page-header 'hfy-default-header |
| 186 | "Function called with two arguments \(the filename relative to the top | 186 | "Function called with two arguments (the filename relative to the top |
| 187 | level source directory being etag\'d and fontified), and a string containing | 187 | level source directory being etag'd and fontified), and a string containing |
| 188 | the <style>...</style> text to embed in the document- the string returned will | 188 | the <style>...</style> text to embed in the document- the string returned will |
| 189 | be used as the header for the htmlfontified version of the source file.\n | 189 | be used as the header for the htmlfontified version of the source file.\n |
| 190 | See also: `hfy-page-footer'" | 190 | See also `hfy-page-footer'." |
| 191 | :group 'htmlfontify | 191 | :group 'htmlfontify |
| 192 | ;; FIXME: Why place such a :tag everywhere? Isn't it imposing your | 192 | ;; FIXME: Why place such a :tag everywhere? Isn't it imposing your |
| 193 | ;; own Custom preference on your users? --Stef | 193 | ;; own Custom preference on your users? --Stef |
| @@ -204,7 +204,7 @@ be large and take a long time to render or be difficult to navigate." | |||
| 204 | 204 | ||
| 205 | (defcustom hfy-page-footer 'hfy-default-footer | 205 | (defcustom hfy-page-footer 'hfy-default-footer |
| 206 | "As `hfy-page-header', but generates the output footer | 206 | "As `hfy-page-header', but generates the output footer |
| 207 | \(and takes only 1 argument, the filename\)." | 207 | \(and takes only one argument, the filename)." |
| 208 | :group 'htmlfontify | 208 | :group 'htmlfontify |
| 209 | :tag "page-footer" | 209 | :tag "page-footer" |
| 210 | :type '(function)) | 210 | :type '(function)) |
| @@ -216,29 +216,29 @@ be large and take a long time to render or be difficult to navigate." | |||
| 216 | :type '(string)) | 216 | :type '(string)) |
| 217 | 217 | ||
| 218 | (defcustom hfy-src-doc-link-style "text-decoration: underline;" | 218 | (defcustom hfy-src-doc-link-style "text-decoration: underline;" |
| 219 | "String to add to the \'<style> a\' variant of an htmlfontify css class." | 219 | "String to add to the '<style> a' variant of an htmlfontify CSS class." |
| 220 | :group 'htmlfontify | 220 | :group 'htmlfontify |
| 221 | :tag "src-doc-link-style" | 221 | :tag "src-doc-link-style" |
| 222 | :type '(string)) | 222 | :type '(string)) |
| 223 | 223 | ||
| 224 | (defcustom hfy-src-doc-link-unstyle " text-decoration: none;" | 224 | (defcustom hfy-src-doc-link-unstyle " text-decoration: none;" |
| 225 | "Regex to remove from the <style> a variant of an htmlfontify css class." | 225 | "Regex to remove from the <style> a variant of an htmlfontify CSS class." |
| 226 | :group 'htmlfontify | 226 | :group 'htmlfontify |
| 227 | :tag "src-doc-link-unstyle" | 227 | :tag "src-doc-link-unstyle" |
| 228 | :type '(string)) | 228 | :type '(string)) |
| 229 | 229 | ||
| 230 | (defcustom hfy-link-extn nil | 230 | (defcustom hfy-link-extn nil |
| 231 | "File extension used for href links - Useful where the htmlfontify | 231 | "File extension used for href links. |
| 232 | output files are going to be processed again, with a resulting change | 232 | Useful where the htmlfontify output files are going to be processed |
| 233 | in file extension. If nil, then any code using this should fall back | 233 | again, with a resulting change in file extension. If nil, then any |
| 234 | to `hfy-extn'." | 234 | code using this should fall back to `hfy-extn'." |
| 235 | :group 'htmlfontify | 235 | :group 'htmlfontify |
| 236 | :tag "link-extension" | 236 | :tag "link-extension" |
| 237 | :type '(choice string (const nil))) | 237 | :type '(choice string (const nil))) |
| 238 | 238 | ||
| 239 | (defcustom hfy-link-style-fun 'hfy-link-style-string | 239 | (defcustom hfy-link-style-fun 'hfy-link-style-string |
| 240 | "Set this to a function, which will be called with one argument | 240 | "Set this to a function, which will be called with one argument |
| 241 | \(a \"{ foo: bar; ...}\" css style-string\) - it should return a copy of | 241 | \(a \"{ foo: bar; ...}\" CSS style-string) - it should return a copy of |
| 242 | its argument, altered so as to make any changes you want made for text which | 242 | its argument, altered so as to make any changes you want made for text which |
| 243 | is a hyperlink, in addition to being in the class to which that style would | 243 | is a hyperlink, in addition to being in the class to which that style would |
| 244 | normally be applied." | 244 | normally be applied." |
| @@ -246,23 +246,23 @@ normally be applied." | |||
| 246 | :tag "link-style-function" | 246 | :tag "link-style-function" |
| 247 | :type '(function)) | 247 | :type '(function)) |
| 248 | 248 | ||
| 249 | (defcustom hfy-index-file "hfy-index" | 249 | (defcustom hfy-index-file "hfy-index" |
| 250 | "Name \(sans extension\) of the tag definition index file produced during | 250 | "Name (sans extension) of the tag definition index file produced during |
| 251 | fontification-and-hyperlinking." | 251 | fontification-and-hyperlinking." |
| 252 | :group 'htmlfontify | 252 | :group 'htmlfontify |
| 253 | :tag "index-file" | 253 | :tag "index-file" |
| 254 | :type '(string)) | 254 | :type '(string)) |
| 255 | 255 | ||
| 256 | (defcustom hfy-instance-file "hfy-instance" | 256 | (defcustom hfy-instance-file "hfy-instance" |
| 257 | "Name \(sans extension\) of the tag usage index file produced during | 257 | "Name (sans extension) of the tag usage index file produced during |
| 258 | fontification-and-hyperlinking." | 258 | fontification-and-hyperlinking." |
| 259 | :group 'htmlfontify | 259 | :group 'htmlfontify |
| 260 | :tag "instance-file" | 260 | :tag "instance-file" |
| 261 | :type '(string)) | 261 | :type '(string)) |
| 262 | 262 | ||
| 263 | (defcustom hfy-html-quote-regex "\\(<\\|\"\\|&\\|>\\)" | 263 | (defcustom hfy-html-quote-regex "\\(<\\|\"\\|&\\|>\\)" |
| 264 | "Regex to match \(with a single back-reference per match\) strings in HTML | 264 | "Regex to match (with a single back-reference per match) strings in HTML |
| 265 | which should be quoted with `hfy-html-quote' \(and `hfy-html-quote-map'\) | 265 | which should be quoted with `hfy-html-quote' (and `hfy-html-quote-map') |
| 266 | to make them safe." | 266 | to make them safe." |
| 267 | :group 'htmlfontify | 267 | :group 'htmlfontify |
| 268 | :tag "html-quote-regex" | 268 | :tag "html-quote-regex" |
| @@ -271,28 +271,28 @@ to make them safe." | |||
| 271 | (define-obsolete-variable-alias 'hfy-init-kludge-hooks 'hfy-init-kludge-hook | 271 | (define-obsolete-variable-alias 'hfy-init-kludge-hooks 'hfy-init-kludge-hook |
| 272 | "23.2") | 272 | "23.2") |
| 273 | (defcustom hfy-init-kludge-hook '(hfy-kludge-cperl-mode) | 273 | (defcustom hfy-init-kludge-hook '(hfy-kludge-cperl-mode) |
| 274 | "List of functions to call when starting htmlfontify-buffer to do any | 274 | "List of functions to call when starting `htmlfontify-buffer' to do any |
| 275 | kludging necessary to get highlighting modes to bahave as you want, even | 275 | kludging necessary to get highlighting modes to behave as you want, even |
| 276 | when not running under a window system." | 276 | when not running under a window system." |
| 277 | :group 'htmlfontify | 277 | :group 'htmlfontify |
| 278 | :tag "init-kludge-hooks" | 278 | :tag "init-kludge-hooks" |
| 279 | :type '(hook)) | 279 | :type '(hook)) |
| 280 | 280 | ||
| 281 | (defcustom hfy-post-html-hooks nil | 281 | (defcustom hfy-post-html-hooks nil |
| 282 | "List of functions to call after creating and filling the html buffer. | 282 | "List of functions to call after creating and filling the HTML buffer. |
| 283 | These functions will be called with the html buffer as the current buffer" | 283 | These functions will be called with the html buffer as the current buffer." |
| 284 | :group 'htmlfontify | 284 | :group 'htmlfontify |
| 285 | :tag "post-html-hooks" | 285 | :tag "post-html-hooks" |
| 286 | :options '(set-auto-mode) | 286 | :options '(set-auto-mode) |
| 287 | :type '(hook)) | 287 | :type '(hook)) |
| 288 | 288 | ||
| 289 | (defcustom hfy-default-face-def nil | 289 | (defcustom hfy-default-face-def nil |
| 290 | "Fallback `defface' specification for the face \'default, used when | 290 | "Fallback `defface' specification for the face 'default, used when |
| 291 | `hfy-display-class' has been set \(the normal htmlfontify way of extracting | 291 | `hfy-display-class' has been set (the normal htmlfontify way of extracting |
| 292 | potentially non-current face information doesn\'t necessarily work for | 292 | potentially non-current face information doesn't necessarily work for |
| 293 | \'default\).\n | 293 | 'default).\n |
| 294 | Example: I customise this to:\n | 294 | Example: I customize this to:\n |
| 295 | \(\(t :background \"black\" :foreground \"white\" :family \"misc-fixed\"\)\)" | 295 | \((t :background \"black\" :foreground \"white\" :family \"misc-fixed\"))" |
| 296 | :group 'htmlfontify | 296 | :group 'htmlfontify |
| 297 | :tag "default-face-definition" | 297 | :tag "default-face-definition" |
| 298 | :type '(alist)) | 298 | :type '(alist)) |
| @@ -306,7 +306,7 @@ Example: I customise this to:\n | |||
| 306 | in order, to:\n | 306 | in order, to:\n |
| 307 | 1 - The tag | 307 | 1 - The tag |
| 308 | 2 - The line | 308 | 2 - The line |
| 309 | 3 - The char \(point\) at which the tag occurs." | 309 | 3 - The char (point) at which the tag occurs." |
| 310 | :group 'htmlfontify | 310 | :group 'htmlfontify |
| 311 | :tag "etag-regex" | 311 | :tag "etag-regex" |
| 312 | :type '(regexp)) | 312 | :type '(regexp)) |
| @@ -315,7 +315,7 @@ in order, to:\n | |||
| 315 | ("<" "<" ) | 315 | ("<" "<" ) |
| 316 | ("&" "&" ) | 316 | ("&" "&" ) |
| 317 | (">" ">" )) | 317 | (">" ">" )) |
| 318 | "Alist of char -> entity mappings used to make the text html-safe." | 318 | "Alist of char -> entity mappings used to make the text HTML-safe." |
| 319 | :group 'htmlfontify | 319 | :group 'htmlfontify |
| 320 | :tag "html-quote-map" | 320 | :tag "html-quote-map" |
| 321 | :type '(alist :key-type (string))) | 321 | :type '(alist :key-type (string))) |
| @@ -358,13 +358,13 @@ done;") | |||
| 358 | (defcustom hfy-etags-cmd-alist | 358 | (defcustom hfy-etags-cmd-alist |
| 359 | hfy-etags-cmd-alist-default | 359 | hfy-etags-cmd-alist-default |
| 360 | "Alist of possible shell commands that will generate etags output that | 360 | "Alist of possible shell commands that will generate etags output that |
| 361 | `htmlfontify' can use. \'%s\' will be replaced by `hfy-etags-bin'." | 361 | `htmlfontify' can use. '%s' will be replaced by `hfy-etags-bin'." |
| 362 | :group 'htmlfontify | 362 | :group 'htmlfontify |
| 363 | :tag "etags-cmd-alist" | 363 | :tag "etags-cmd-alist" |
| 364 | :type '(alist :key-type (string) :value-type (string)) )) | 364 | :type '(alist :key-type (string) :value-type (string)) )) |
| 365 | 365 | ||
| 366 | (defcustom hfy-etags-bin "etags" | 366 | (defcustom hfy-etags-bin "etags" |
| 367 | "Location of etags binary (we begin by assuming it\'s in your path).\n | 367 | "Location of etags binary (we begin by assuming it's in your path).\n |
| 368 | Note that if etags is not in your path, you will need to alter the shell | 368 | Note that if etags is not in your path, you will need to alter the shell |
| 369 | commands in `hfy-etags-cmd-alist'." | 369 | commands in `hfy-etags-cmd-alist'." |
| 370 | :group 'htmlfontify | 370 | :group 'htmlfontify |
| @@ -377,20 +377,20 @@ commands in `hfy-etags-cmd-alist'." | |||
| 377 | :tag "shell-file-name" | 377 | :tag "shell-file-name" |
| 378 | :type '(file)) | 378 | :type '(file)) |
| 379 | 379 | ||
| 380 | (defcustom hfy-ignored-properties '(read-only | 380 | (defcustom hfy-ignored-properties '(read-only |
| 381 | intangible | 381 | intangible |
| 382 | modification-hooks | 382 | modification-hooks |
| 383 | insert-in-front-hooks | 383 | insert-in-front-hooks |
| 384 | insert-behind-hooks | 384 | insert-behind-hooks |
| 385 | point-entered | 385 | point-entered |
| 386 | point-left) | 386 | point-left) |
| 387 | "Properties to omit when copying a fontified buffer for html transformation." | 387 | "Properties to omit when copying a fontified buffer for HTML transformation." |
| 388 | :group 'htmlfontify | 388 | :group 'htmlfontify |
| 389 | :tag "ignored-properties" | 389 | :tag "ignored-properties" |
| 390 | :type '(repeat symbol)) | 390 | :type '(repeat symbol)) |
| 391 | 391 | ||
| 392 | (defun hfy-which-etags () | 392 | (defun hfy-which-etags () |
| 393 | "Return a string indicating which flavour of etags we are using." | 393 | "Return a string indicating which flavour of etags we are using." |
| 394 | (let ((v (shell-command-to-string (concat hfy-etags-bin " --version")))) | 394 | (let ((v (shell-command-to-string (concat hfy-etags-bin " --version")))) |
| 395 | (cond ((string-match "exube" v) "exuberant ctags") | 395 | (cond ((string-match "exube" v) "exuberant ctags") |
| 396 | ((string-match "GNU E" v) "emacs etags" )) )) | 396 | ((string-match "GNU E" v) "emacs etags" )) )) |
| @@ -400,8 +400,8 @@ commands in `hfy-etags-cmd-alist'." | |||
| 400 | "The etags equivalent command to run in a source directory to generate a tags | 400 | "The etags equivalent command to run in a source directory to generate a tags |
| 401 | file for the whole source tree from there on down. The command should emit | 401 | file for the whole source tree from there on down. The command should emit |
| 402 | the etags output on stdout.\n | 402 | the etags output on stdout.\n |
| 403 | Two canned commands are provided - they drive Emacs\' etags and | 403 | Two canned commands are provided - they drive Emacs' etags and |
| 404 | exuberant-ctags\' etags respectively." | 404 | exuberant-ctags' etags respectively." |
| 405 | :group 'htmlfontify | 405 | :group 'htmlfontify |
| 406 | :tag "etags-command" | 406 | :tag "etags-command" |
| 407 | :type (eval-and-compile | 407 | :type (eval-and-compile |
| @@ -412,8 +412,8 @@ exuberant-ctags\' etags respectively." | |||
| 412 | 412 | ||
| 413 | (defcustom hfy-istext-command "file %s | sed -e 's@^[^:]*:[ \t]*@@'" | 413 | (defcustom hfy-istext-command "file %s | sed -e 's@^[^:]*:[ \t]*@@'" |
| 414 | "Command to run with the name of a file, to see whether it is a text file | 414 | "Command to run with the name of a file, to see whether it is a text file |
| 415 | or not. The command should emit a string containing the word \'text\' if | 415 | or not. The command should emit a string containing the word 'text' if |
| 416 | the file is a text file, and a string not containing \'text\' otherwise." | 416 | the file is a text file, and a string not containing 'text' otherwise." |
| 417 | :group 'htmlfontify | 417 | :group 'htmlfontify |
| 418 | :tag "istext-command" | 418 | :tag "istext-command" |
| 419 | :type '(string)) | 419 | :type '(string)) |
| @@ -427,27 +427,27 @@ the file is a text file, and a string not containing \'text\' otherwise." | |||
| 427 | 427 | ||
| 428 | (defcustom hfy-display-class nil | 428 | (defcustom hfy-display-class nil |
| 429 | "Display class to use to determine which display class to use when | 429 | "Display class to use to determine which display class to use when |
| 430 | calculating a face\'s attributes. This is useful when, for example, you | 430 | calculating a face's attributes. This is useful when, for example, you |
| 431 | are running Emacs on a tty or in batch mode, and want htmlfontify to have | 431 | are running Emacs on a tty or in batch mode, and want htmlfontify to have |
| 432 | access to the face spec you would use if you were connected to an X display.\n | 432 | access to the face spec you would use if you were connected to an X display.\n |
| 433 | Some valid class specification elements are:\n | 433 | Some valid class specification elements are:\n |
| 434 | \'\(class color\) | 434 | '(class color) |
| 435 | \'\(class grayscale\) | 435 | '(class grayscale) |
| 436 | \'\(background dark\) | 436 | '(background dark) |
| 437 | \'\(background light\) | 437 | '(background light) |
| 438 | \'\(type x-toolkit\) | 438 | '(type x-toolkit) |
| 439 | \'\(type tty\) | 439 | '(type tty) |
| 440 | \'\(type motif\) | 440 | '(type motif) |
| 441 | \'\(type lucid\) | 441 | '(type lucid) |
| 442 | Multiple values for a tag may be combined, to indicate that any one or more | 442 | Multiple values for a tag may be combined, to indicate that any one or more |
| 443 | of these values in the specification key constitutes a match, eg:\n | 443 | of these values in the specification key constitutes a match, eg:\n |
| 444 | \'\(\(class color grayscale\) \(type tty\)\) would match any of:\n | 444 | '((class color grayscale) (type tty)) would match any of:\n |
| 445 | \'\(\(class color\)\) | 445 | '((class color)) |
| 446 | \'\(\(class grayscale\)\) | 446 | '((class grayscale)) |
| 447 | \'\(\(class color grayscale\)\)\) | 447 | '((class color grayscale)) |
| 448 | \'\(\(class color foo\)\) | 448 | '((class color foo)) |
| 449 | \'\(\(type tty\)\) | 449 | '((type tty)) |
| 450 | \'\(\(type tty\) \(class color\)\)\n | 450 | '((type tty) (class color))\n |
| 451 | and so on." | 451 | and so on." |
| 452 | :type '(alist :key-type (symbol) :value-type (symbol)) | 452 | :type '(alist :key-type (symbol) :value-type (symbol)) |
| 453 | :group 'htmlfontify | 453 | :group 'htmlfontify |
| @@ -464,7 +464,7 @@ and so on." | |||
| 464 | (const :tag "Bright" light ))) )) | 464 | (const :tag "Bright" light ))) )) |
| 465 | 465 | ||
| 466 | (defcustom hfy-optimisations (list 'keep-overlays) | 466 | (defcustom hfy-optimisations (list 'keep-overlays) |
| 467 | "Optimisations to turn on: So far, the following have been implemented:\n | 467 | "Optimizations to turn on: So far, the following have been implemented:\n |
| 468 | merge-adjacent-tags: If two (or more) span tags are adjacent, identical and | 468 | merge-adjacent-tags: If two (or more) span tags are adjacent, identical and |
| 469 | separated by nothing more than whitespace, they will | 469 | separated by nothing more than whitespace, they will |
| 470 | be merged into one span. | 470 | be merged into one span. |
| @@ -472,15 +472,15 @@ and so on." | |||
| 472 | zap-string-links : Suppress hyperlinking of tags found in strings. | 472 | zap-string-links : Suppress hyperlinking of tags found in strings. |
| 473 | div-wrapper : Add <div class=\"default\"> </div> tags around the | 473 | div-wrapper : Add <div class=\"default\"> </div> tags around the |
| 474 | output. | 474 | output. |
| 475 | keep-overlays : More of a bell \(or possibly whistle\) than an | 475 | keep-overlays : More of a bell (or possibly whistle) than an |
| 476 | optimisation - If on, preserve overlay highlighting | 476 | optimization - If on, preserve overlay highlighting |
| 477 | \(cf ediff or goo-font-lock\) as well as basic faces\n | 477 | (cf ediff or goo-font-lock) as well as basic faces.\n |
| 478 | And the following are planned but not yet available:\n | 478 | And the following are planned but not yet available:\n |
| 479 | kill-context-leak : Suppress hyperlinking between files highlighted by | 479 | kill-context-leak : Suppress hyperlinking between files highlighted by |
| 480 | different modes.\n | 480 | different modes.\n |
| 481 | Note: like compiler optimisations, these optimise the _output_ of the code, | 481 | Note: like compiler optimizations, these optimize the _output_ of the code, |
| 482 | not the processing of the source itself, and are therefore likely to slow | 482 | not the processing of the source itself, and are therefore likely to slow |
| 483 | htmlfontify down, at least a little. Except for skip-refontification, | 483 | htmlfontify down, at least a little. Except for skip-refontification, |
| 484 | which can never slow you down, but may result in incomplete fontification." | 484 | which can never slow you down, but may result in incomplete fontification." |
| 485 | :type '(set (const :tag "merge-adjacent-tags" merge-adjacent-tags ) | 485 | :type '(set (const :tag "merge-adjacent-tags" merge-adjacent-tags ) |
| 486 | (const :tag "zap-comment-links" zap-comment-links ) | 486 | (const :tag "zap-comment-links" zap-comment-links ) |
| @@ -490,86 +490,86 @@ which can never slow you down, but may result in incomplete fontification." | |||
| 490 | (const :tag "div-wrapper" div-wrapper ) | 490 | (const :tag "div-wrapper" div-wrapper ) |
| 491 | (const :tag "keep-overlays" keep-overlays )) | 491 | (const :tag "keep-overlays" keep-overlays )) |
| 492 | :group 'htmlfontify | 492 | :group 'htmlfontify |
| 493 | :tag "optimisations") | 493 | :tag "optimizations") |
| 494 | 494 | ||
| 495 | (defvar hfy-tags-cache nil | 495 | (defvar hfy-tags-cache nil |
| 496 | "Alist of the form:\n | 496 | "Alist of the form:\n |
| 497 | \(\(\"/src/dir/0\" . tag-hash0\) \(\"/src/dir/1\" tag-hash1\) ...\)\n | 497 | \((\"/src/dir/0\" . tag-hash0) (\"/src/dir/1\" tag-hash1) ...)\n |
| 498 | Each tag hash entry then contains entries of the form:\n | 498 | Each tag hash entry then contains entries of the form:\n |
| 499 | \"tag_string\" => ((\"file/name.ext\" line char) ... )\n | 499 | \"tag_string\" => ((\"file/name.ext\" line char) ... )\n |
| 500 | ie an alist mapping \(relative\) file paths to line and character offsets.\n | 500 | ie an alist mapping (relative) file paths to line and character offsets.\n |
| 501 | See `hfy-load-tags-cache'.") | 501 | See also `hfy-load-tags-cache'.") |
| 502 | 502 | ||
| 503 | (defvar hfy-tags-sortl nil | 503 | (defvar hfy-tags-sortl nil |
| 504 | "Alist of the form \(\(\"/src/dir\" . (tag0 tag1 tag2)\) ... \)\n | 504 | "Alist of the form ((\"/src/dir\" . (tag0 tag1 tag2)) ... )\n |
| 505 | Where the tags are stored in descending order of length.\n | 505 | where the tags are stored in descending order of length.\n |
| 506 | See `hfy-load-tags-cache'.") | 506 | See also `hfy-load-tags-cache'.") |
| 507 | 507 | ||
| 508 | (defvar hfy-tags-rmap nil | 508 | (defvar hfy-tags-rmap nil |
| 509 | "Alist of the form \(\(\"/src/dir\" . tag-rmap-hash\)\)\n | 509 | "Alist of the form ((\"/src/dir\" . tag-rmap-hash))\n |
| 510 | Where tag-rmap-hash has entries of the form: | 510 | where tag-rmap-hash has entries of the form: |
| 511 | \"tag_string\" => ( \"file/name.ext\" line char ) | 511 | \"tag_string\" => ( \"file/name.ext\" line char ) |
| 512 | Unlike `hfy-tags-cache' these are the locations of occurrences of | 512 | Unlike `hfy-tags-cache' these are the locations of occurrences of |
| 513 | tagged items, not the locations of their definitions.") | 513 | tagged items, not the locations of their definitions.") |
| 514 | 514 | ||
| 515 | (defvar hfy-style-assoc 'please-ignore-this-line | 515 | (defvar hfy-style-assoc 'please-ignore-this-line |
| 516 | "An assoc representing/describing an Emacs face. | 516 | "An assoc representing/describing an Emacs face. |
| 517 | Properties may be repeated, In which case later properties should be | 517 | Properties may be repeated, in which case later properties should be |
| 518 | treated as if they were inherited from a \'parent\' font. | 518 | treated as if they were inherited from a 'parent' font. |
| 519 | \(For some properties, only the first encountered value is of any importance, | 519 | \(For some properties, only the first encountered value is of any importance, |
| 520 | for others the values might be cumulative, and for others they might be | 520 | for others the values might be cumulative, and for others they might be |
| 521 | cumulative in a complex way).\n | 521 | cumulative in a complex way.)\n |
| 522 | Some examples:\n | 522 | Some examples:\n |
| 523 | \(hfy-face-to-style 'default\) => | 523 | \(hfy-face-to-style 'default) => |
| 524 | \(\(\"background\" . \"rgb\(0, 0, 0\)\"\) | 524 | ((\"background\" . \"rgb(0, 0, 0)\") |
| 525 | \(\"color\" . \"rgb\(255, 255, 255\)\"\) | 525 | (\"color\" . \"rgb(255, 255, 255)\") |
| 526 | \(\"font-style\" . \"normal\"\) | 526 | (\"font-style\" . \"normal\") |
| 527 | \(\"font-weight\" . \"500\"\) | 527 | (\"font-weight\" . \"500\") |
| 528 | \(\"font-stretch\" . \"normal\"\) | 528 | (\"font-stretch\" . \"normal\") |
| 529 | \(\"font-family\" . \"misc-fixed\"\) | 529 | (\"font-family\" . \"misc-fixed\") |
| 530 | \(\"font-size\" . \"13pt\"\) | 530 | (\"font-size\" . \"13pt\") |
| 531 | \(\"text-decoration\" . \"none\"\)\)\n | 531 | (\"text-decoration\" . \"none\"))\n |
| 532 | \(hfy-face-to-style 'Info-title-3-face\) => | 532 | \(hfy-face-to-style 'Info-title-3-face) => |
| 533 | \(\(\"font-weight\" . \"700\"\) | 533 | ((\"font-weight\" . \"700\") |
| 534 | \(\"font-family\" . \"helv\"\) | 534 | (\"font-family\" . \"helv\") |
| 535 | \(\"font-size\" . \"120%\"\) | 535 | (\"font-size\" . \"120%\") |
| 536 | \(\"text-decoration\" . \"none\"\)\)\n") | 536 | (\"text-decoration\" . \"none\"))\n") |
| 537 | 537 | ||
| 538 | (defvar hfy-sheet-assoc 'please-ignore-this-line | 538 | (defvar hfy-sheet-assoc 'please-ignore-this-line |
| 539 | "An assoc with elements of the form (face-name style-name . stlye-string):\n | 539 | "An assoc with elements of the form (face-name style-name . style-string):\n |
| 540 | '\(\(default \"default\" . \"{background: black;color: white}\"\) | 540 | '((default \"default\" . \"{background: black; color: white}\") |
| 541 | \(font-lock-string-face \"string\" . \"{color: rgb\(64,224,208\)}\"\)\)" ) | 541 | (font-lock-string-face \"string\" . \"{color: rgb(64,224,208)}\"))" ) |
| 542 | 542 | ||
| 543 | (defvar hfy-facemap-assoc 'please-ignore-this-line | 543 | (defvar hfy-facemap-assoc 'please-ignore-this-line |
| 544 | "An assoc of \(point . FACE-SYMBOL\) or \(point . DEFFACE-LIST\) | 544 | "An assoc of (point . FACE-SYMBOL) or (point . DEFFACE-LIST) |
| 545 | and (point . 'end) elements, in descending order of point value | 545 | and (point . 'end) elements, in descending order of point value |
| 546 | \(ie from the file's end to its beginning\).\n | 546 | \(ie from the file's end to its beginning).\n |
| 547 | The map is in reverse order because inserting a <style> tag \(or any other | 547 | The map is in reverse order because inserting a <style> tag (or any other |
| 548 | string) at POINT invalidates the map for all entries with a greater value of | 548 | string) at `point' invalidates the map for all entries with a greater value of |
| 549 | point. By traversing the map from greatest to least POINT, we still invalidate | 549 | point. By traversing the map from greatest to least point, we still invalidate |
| 550 | the map as we go, but only those points we have already dealt with \( and | 550 | the map as we go, but only those points we have already dealt with (and |
| 551 | therefore no longer care about \) will be invalid at any time.\n | 551 | therefore no longer care about) will be invalid at any time.\n |
| 552 | '\(\(64820 . end\) | 552 | '((64820 . end) |
| 553 | \(64744 . font-lock-comment-face\) | 553 | (64744 . font-lock-comment-face) |
| 554 | \(64736 . end\) | 554 | (64736 . end) |
| 555 | \(64722 . font-lock-string-face\) | 555 | (64722 . font-lock-string-face) |
| 556 | \(64630 . end\) | 556 | (64630 . end) |
| 557 | \(64623 . font-lock-string-face\) | 557 | (64623 . font-lock-string-face) |
| 558 | \(64449 . end\) | 558 | (64449 . end) |
| 559 | \(64446 . font-lock-keyword-face\) | 559 | (64446 . font-lock-keyword-face) |
| 560 | \(64406 . end\) | 560 | (64406 . end) |
| 561 | \(64395 . font-lock-constant-face\) | 561 | (64395 . font-lock-constant-face) |
| 562 | \(64393 . end\) | 562 | (64393 . end) |
| 563 | \(64386 . font-lock-keyword-face\) | 563 | (64386 . font-lock-keyword-face) |
| 564 | \(64379 . end\) | 564 | (64379 . end) |
| 565 | ;; big similar section elided. You get the idea. | 565 | ;; big similar section elided. You get the idea. |
| 566 | \(4285 . font-lock-constant-face\) | 566 | (4285 . font-lock-constant-face) |
| 567 | \(4285 . end\) | 567 | (4285 . end) |
| 568 | \(4221 . font-lock-comment-face\) | 568 | (4221 . font-lock-comment-face) |
| 569 | \(4221 . end\) | 569 | (4221 . end) |
| 570 | \(4197 . font-lock-constant-face\) | 570 | (4197 . font-lock-constant-face) |
| 571 | \(4197 . end\) | 571 | (4197 . end) |
| 572 | \(1 . font-lock-comment-face\)\)") | 572 | (1 . font-lock-comment-face))") |
| 573 | 573 | ||
| 574 | (defvar hfy-tmpfont-stack nil | 574 | (defvar hfy-tmpfont-stack nil |
| 575 | "An alist of derived fonts resulting from overlays.") | 575 | "An alist of derived fonts resulting from overlays.") |
| @@ -583,7 +583,7 @@ therefore no longer care about \) will be invalid at any time.\n | |||
| 583 | "\\(" hfy-hex-regex hfy-hex-regex "\\)")) | 583 | "\\(" hfy-hex-regex hfy-hex-regex "\\)")) |
| 584 | 584 | ||
| 585 | (defun hfy-interq (set-a set-b) | 585 | (defun hfy-interq (set-a set-b) |
| 586 | "Return the intersection \(using `eq'\) of 2 lists SET-A and SET-B." | 586 | "Return the intersection (using `eq') of two lists SET-A and SET-B." |
| 587 | (let ((sa set-a) (interq nil) (elt nil)) | 587 | (let ((sa set-a) (interq nil) (elt nil)) |
| 588 | (while sa | 588 | (while sa |
| 589 | (setq elt (car sa) | 589 | (setq elt (car sa) |
| @@ -591,8 +591,8 @@ therefore no longer care about \) will be invalid at any time.\n | |||
| 591 | (if (memq elt set-b) (setq interq (cons elt interq)))) interq)) | 591 | (if (memq elt set-b) (setq interq (cons elt interq)))) interq)) |
| 592 | 592 | ||
| 593 | (defun hfy-colour-vals (colour) | 593 | (defun hfy-colour-vals (colour) |
| 594 | "Where COLOUR is a colour name or #XXXXXX style triplet, return a | 594 | "Where COLOUR is a color name or #XXXXXX style triplet, return a |
| 595 | list of 3 (16 bit) rgb values for said colour.\n | 595 | list of three (16 bit) rgb values for said color.\n |
| 596 | If a window system is unavailable, calls `hfy-fallback-colour-values'." | 596 | If a window system is unavailable, calls `hfy-fallback-colour-values'." |
| 597 | (if (string-match hfy-triplet-regex colour) | 597 | (if (string-match hfy-triplet-regex colour) |
| 598 | (mapcar | 598 | (mapcar |
| @@ -653,7 +653,7 @@ STYLE is the inline CSS stylesheet (or tag referring to an external sheet)." | |||
| 653 | // whether the current row is odd or even | 653 | // whether the current row is odd or even |
| 654 | var even = false; | 654 | var even = false; |
| 655 | 655 | ||
| 656 | // if arguments are provided to specify the colours | 656 | // if arguments are provided to specify the colors |
| 657 | // of the even & odd rows, then use the them; | 657 | // of the even & odd rows, then use the them; |
| 658 | // otherwise use the following defaults: | 658 | // otherwise use the following defaults: |
| 659 | var evenColor = arguments[1] ? arguments[1] : \"#fff\"; | 659 | var evenColor = arguments[1] ? arguments[1] : \"#fff\"; |
| @@ -739,7 +739,7 @@ FILE is the name of the file being rendered, in case it is needed." | |||
| 739 | "\n </body>\n</html>\n") | 739 | "\n </body>\n</html>\n") |
| 740 | 740 | ||
| 741 | (defun hfy-link-style-string (style-string) | 741 | (defun hfy-link-style-string (style-string) |
| 742 | "Replace the end of a css style declaration STYLE-STRING with the contents | 742 | "Replace the end of a CSS style declaration STYLE-STRING with the contents |
| 743 | of the variable `hfy-src-doc-link-style', removing text matching the regex | 743 | of the variable `hfy-src-doc-link-style', removing text matching the regex |
| 744 | `hfy-src-doc-link-unstyle' first, if necessary." | 744 | `hfy-src-doc-link-unstyle' first, if necessary." |
| 745 | ;;(message "hfy-colour-vals");;DBUG | 745 | ;;(message "hfy-colour-vals");;DBUG |
| @@ -755,11 +755,11 @@ of the variable `hfy-src-doc-link-style', removing text matching the regex | |||
| 755 | ;; utility functions - cast emacs style specification values into their | 755 | ;; utility functions - cast emacs style specification values into their |
| 756 | ;; css2 equivalents: | 756 | ;; css2 equivalents: |
| 757 | (defun hfy-triplet (colour) | 757 | (defun hfy-triplet (colour) |
| 758 | "Takes a COLOUR name \(string\) and return a CSS rgb(R, G, B) triplet string. | 758 | "Takes a COLOUR name (string) and return a CSS rgb(R, G, B) triplet string. |
| 759 | Uses the definition of \"white\" to map the numbers to the 0-255 range, so | 759 | Uses the definition of \"white\" to map the numbers to the 0-255 range, so |
| 760 | if you\'ve redefined white, \(esp if you've redefined it to have a triplet | 760 | if you've redefined white, (esp. if you've redefined it to have a triplet |
| 761 | member lower than that of the colour you are processing, strange things | 761 | member lower than that of the color you are processing) strange things |
| 762 | may happen\)." | 762 | may happen." |
| 763 | ;;(message "hfy-colour-vals");;DBUG | 763 | ;;(message "hfy-colour-vals");;DBUG |
| 764 | (let ((white (mapcar (lambda (I) (float (1+ I))) (hfy-colour-vals "white"))) | 764 | (let ((white (mapcar (lambda (I) (float (1+ I))) (hfy-colour-vals "white"))) |
| 765 | (rgb16 (mapcar (lambda (I) (float (1+ I))) (hfy-colour-vals colour)))) | 765 | (rgb16 (mapcar (lambda (I) (float (1+ I))) (hfy-colour-vals colour)))) |
| @@ -782,7 +782,7 @@ may happen\)." | |||
| 782 | :type 'float | 782 | :type 'float |
| 783 | :group 'htmlfontify) | 783 | :group 'htmlfontify) |
| 784 | 784 | ||
| 785 | (defun hfy-size (height) | 785 | (defun hfy-size (height) |
| 786 | "Derive a CSS font-size specifier from an Emacs font :height attribute HEIGHT. | 786 | "Derive a CSS font-size specifier from an Emacs font :height attribute HEIGHT. |
| 787 | Does not cope with the case where height is a function to be applied to | 787 | Does not cope with the case where height is a function to be applied to |
| 788 | the height of the underlying font." | 788 | the height of the underlying font." |
| @@ -794,8 +794,8 @@ the height of the underlying font." | |||
| 794 | ((integerp height) | 794 | ((integerp height) |
| 795 | (cons "font-size" (format "%dpt" (/ (* hfy-font-zoom height) 10 )))) )) ) | 795 | (cons "font-size" (format "%dpt" (/ (* hfy-font-zoom height) 10 )))) )) ) |
| 796 | 796 | ||
| 797 | (defun hfy-slant (slant) | 797 | (defun hfy-slant (slant) |
| 798 | "Derive a font-style css specifier from the Emacs :slant attribute SLANT: | 798 | "Derive a font-style CSS specifier from the Emacs :slant attribute SLANT: |
| 799 | CSS does not define the reverse-* styles, so just maps those to the | 799 | CSS does not define the reverse-* styles, so just maps those to the |
| 800 | regular specifiers." | 800 | regular specifiers." |
| 801 | (list (cons "font-style" | 801 | (list (cons "font-style" |
| @@ -806,7 +806,7 @@ regular specifiers." | |||
| 806 | "normal")))) | 806 | "normal")))) |
| 807 | 807 | ||
| 808 | (defun hfy-weight (weight) | 808 | (defun hfy-weight (weight) |
| 809 | "Derive a font-weight css specifier from an Emacs weight spec symbol WEIGHT." | 809 | "Derive a font-weight CSS specifier from an Emacs weight spec symbol WEIGHT." |
| 810 | (list (cons "font-weight" (cdr (assq weight '((ultra-bold . "900") | 810 | (list (cons "font-weight" (cdr (assq weight '((ultra-bold . "900") |
| 811 | (extra-bold . "800") | 811 | (extra-bold . "800") |
| 812 | (bold . "700") | 812 | (bold . "700") |
| @@ -816,7 +816,7 @@ regular specifiers." | |||
| 816 | (light . "300") | 816 | (light . "300") |
| 817 | (extra-light . "200") | 817 | (extra-light . "200") |
| 818 | (ultra-light . "100"))))))) | 818 | (ultra-light . "100"))))))) |
| 819 | 819 | ||
| 820 | (defun hfy-box-to-border-assoc (spec) | 820 | (defun hfy-box-to-border-assoc (spec) |
| 821 | (if spec | 821 | (if spec |
| 822 | (let ((tag (car spec)) | 822 | (let ((tag (car spec)) |
| @@ -866,7 +866,7 @@ VAL is ignored here." | |||
| 866 | 866 | ||
| 867 | (defun hfy-combined-face-spec (face) | 867 | (defun hfy-combined-face-spec (face) |
| 868 | "Return a `defface' style alist of possible specifications for FACE. | 868 | "Return a `defface' style alist of possible specifications for FACE. |
| 869 | Entries resulting from customisation \(`custom-set-faces'\) will take | 869 | Entries resulting from customization (`custom-set-faces') will take |
| 870 | precedence." | 870 | precedence." |
| 871 | (let ((spec nil)) | 871 | (let ((spec nil)) |
| 872 | (setq spec (append (or (get face 'saved-face) (list)) | 872 | (setq spec (append (or (get face 'saved-face) (list)) |
| @@ -876,19 +876,19 @@ precedence." | |||
| 876 | 876 | ||
| 877 | (defun hfy-face-attr-for-class (face &optional class) | 877 | (defun hfy-face-attr-for-class (face &optional class) |
| 878 | "Return the face attributes for FACE. | 878 | "Return the face attributes for FACE. |
| 879 | If CLASS is set, it must be a `defface' alist key \[see below\], | 879 | If CLASS is set, it must be a `defface' alist key [see below], |
| 880 | in which case the first face specification returned by `hfy-combined-face-spec' | 880 | in which case the first face specification returned by `hfy-combined-face-spec' |
| 881 | which *doesn\'t* clash with CLASS is returned.\n | 881 | which *doesn't* clash with CLASS is returned.\n |
| 882 | \(A specification with a class of t is considered to match any class you | 882 | \(A specification with a class of t is considered to match any class you |
| 883 | specify - this matches Emacs\' behaviour when deciding on which face attributes | 883 | specify - this matches Emacs' behavior when deciding on which face attributes |
| 884 | to use, to the best of my understanding\).\n | 884 | to use, to the best of my understanding).\n |
| 885 | If CLASS is nil, then you just get get whatever `face-attr-construct' returns, | 885 | If CLASS is nil, then you just get get whatever `face-attr-construct' returns, |
| 886 | ie the current specification in effect for FACE.\n | 886 | ie the current specification in effect for FACE.\n |
| 887 | *NOTE* This function forces any face that is not \'default and which has | 887 | *NOTE*: This function forces any face that is not 'default and which has |
| 888 | no :inherit property to inherit from \'default \( this is because \'default | 888 | no :inherit property to inherit from 'default (this is because 'default |
| 889 | is magical in that Emacs' fonts behave as if they inherit implicitly from | 889 | is magical in that Emacs' fonts behave as if they inherit implicitly from |
| 890 | \'default, but no such behaviour exists in HTML/CSS \).\n | 890 | 'default, but no such behavior exists in HTML/CSS).\n |
| 891 | See `hfy-display-class' for details of valid values for CLASS." | 891 | See also `hfy-display-class' for details of valid values for CLASS." |
| 892 | (let ((face-spec | 892 | (let ((face-spec |
| 893 | (if class | 893 | (if class |
| 894 | (let ((face-props (hfy-combined-face-spec face)) | 894 | (let ((face-props (hfy-combined-face-spec face)) |
| @@ -975,9 +975,9 @@ See `hfy-display-class' for details of valid values for CLASS." | |||
| 975 | ;; :height 98 :width normal :family "outline-courier new") | 975 | ;; :height 98 :width normal :family "outline-courier new") |
| 976 | (defun hfy-face-to-style-i (fn) | 976 | (defun hfy-face-to-style-i (fn) |
| 977 | "The guts of `hfy-face-to-style': FN should be a `defface' font spec, | 977 | "The guts of `hfy-face-to-style': FN should be a `defface' font spec, |
| 978 | as returned by `face-attr-construct' or `hfy-face-attr-for-class'. Note | 978 | as returned by `face-attr-construct' or `hfy-face-attr-for-class'. |
| 979 | that this function does not get font-sizes right if they are based on | 979 | Note that this function does not get font-sizes right if they are based |
| 980 | inherited modifiers \(via the :inherit\) attribute, and any other | 980 | on inherited modifiers (via the :inherit) attribute, and any other |
| 981 | modifiers that are cumulative if they appear multiple times need to be | 981 | modifiers that are cumulative if they appear multiple times need to be |
| 982 | merged by the user - `hfy-flatten-style' should do this." | 982 | merged by the user - `hfy-flatten-style' should do this." |
| 983 | ;;(message "hfy-face-to-style-i");;DBUG | 983 | ;;(message "hfy-face-to-style-i");;DBUG |
| @@ -1026,8 +1026,8 @@ merged by the user - `hfy-flatten-style' should do this." | |||
| 1026 | (nconc this that parent))) ) | 1026 | (nconc this that parent))) ) |
| 1027 | 1027 | ||
| 1028 | (defun hfy-size-to-int (spec) | 1028 | (defun hfy-size-to-int (spec) |
| 1029 | "Convert SPEC, a css font-size specifier, back to an Emacs :height attribute | 1029 | "Convert SPEC, a CSS font-size specifier, to an Emacs :height attribute value. |
| 1030 | value. Used while merging multiple font-size attributes." | 1030 | Used while merging multiple font-size attributes." |
| 1031 | ;;(message "hfy-size-to-int");;DBUG | 1031 | ;;(message "hfy-size-to-int");;DBUG |
| 1032 | (list | 1032 | (list |
| 1033 | (if (string-match "\\([0-9]+\\)\\(%\\|pt\\)" spec) | 1033 | (if (string-match "\\([0-9]+\\)\\(%\\|pt\\)" spec) |
| @@ -1044,7 +1044,7 @@ value. Used while merging multiple font-size attributes." | |||
| 1044 | "Take STYLE (see `hfy-face-to-style-i', `hfy-face-to-style') and merge | 1044 | "Take STYLE (see `hfy-face-to-style-i', `hfy-face-to-style') and merge |
| 1045 | any multiple attributes appropriately. Currently only font-size is merged | 1045 | any multiple attributes appropriately. Currently only font-size is merged |
| 1046 | down to a single occurrence - others may need special handling, but I | 1046 | down to a single occurrence - others may need special handling, but I |
| 1047 | haven\'t encountered them yet. Returns a `hfy-style-assoc'." | 1047 | haven't encountered them yet. Returns a `hfy-style-assoc'." |
| 1048 | ;;(message "(hfy-flatten-style %S)" style) ;;DBUG | 1048 | ;;(message "(hfy-flatten-style %S)" style) ;;DBUG |
| 1049 | (let ((n 0) | 1049 | (let ((n 0) |
| 1050 | (m (list 1)) | 1050 | (m (list 1)) |
| @@ -1062,9 +1062,9 @@ haven\'t encountered them yet. Returns a `hfy-style-assoc'." | |||
| 1062 | 1062 | ||
| 1063 | (defun hfy-face-to-style (fn) | 1063 | (defun hfy-face-to-style (fn) |
| 1064 | "Take FN, a font or `defface' style font specification, | 1064 | "Take FN, a font or `defface' style font specification, |
| 1065 | \(as returned by `face-attr-construct' or `hfy-face-attr-for-class'\) | 1065 | \(as returned by `face-attr-construct' or `hfy-face-attr-for-class') |
| 1066 | and return a `hfy-style-assoc'.\n | 1066 | and return a `hfy-style-assoc'.\n |
| 1067 | See also: `hfy-face-to-style-i', `hfy-flatten-style'." | 1067 | See also `hfy-face-to-style-i', `hfy-flatten-style'." |
| 1068 | ;;(message "hfy-face-to-style");;DBUG | 1068 | ;;(message "hfy-face-to-style");;DBUG |
| 1069 | (let ((face-def (if (facep fn) | 1069 | (let ((face-def (if (facep fn) |
| 1070 | (hfy-face-attr-for-class fn hfy-display-class) fn)) | 1070 | (hfy-face-attr-for-class fn hfy-display-class) fn)) |
| @@ -1086,7 +1086,7 @@ See also: `hfy-face-to-style-i', `hfy-flatten-style'." | |||
| 1086 | ;; also handle ephemeral fonts created by overlays, which don't actually | 1086 | ;; also handle ephemeral fonts created by overlays, which don't actually |
| 1087 | ;; have names: | 1087 | ;; have names: |
| 1088 | (defun hfy-face-or-def-to-name (fn) | 1088 | (defun hfy-face-or-def-to-name (fn) |
| 1089 | "Render a font symbol or `defface' font spec FN into a name \(string\)." | 1089 | "Render a font symbol or `defface' font spec FN into a name (string)." |
| 1090 | ;;(message "generating name for %s" fn) | 1090 | ;;(message "generating name for %s" fn) |
| 1091 | (if (not (listp fn)) | 1091 | (if (not (listp fn)) |
| 1092 | (format "%s" fn) | 1092 | (format "%s" fn) |
| @@ -1119,9 +1119,9 @@ See also: `hfy-face-to-style-i', `hfy-flatten-style'." | |||
| 1119 | ;; construct an assoc of (stripped-name . "{ css-stuff-here }") pairs | 1119 | ;; construct an assoc of (stripped-name . "{ css-stuff-here }") pairs |
| 1120 | ;; from a face: | 1120 | ;; from a face: |
| 1121 | (defun hfy-face-to-css (fn) | 1121 | (defun hfy-face-to-css (fn) |
| 1122 | "Take FN, a font or `defface' specification \(cf `face-attr-construct'\) | 1122 | "Take FN, a font or `defface' specification (cf `face-attr-construct') |
| 1123 | and return a CSS style specification.\n | 1123 | and return a CSS style specification.\n |
| 1124 | See also: `hfy-face-to-style'" | 1124 | See also `hfy-face-to-style'." |
| 1125 | ;;(message "hfy-face-to-css");;DBUG | 1125 | ;;(message "hfy-face-to-css");;DBUG |
| 1126 | (let ((css-list nil) | 1126 | (let ((css-list nil) |
| 1127 | (css-text nil) | 1127 | (css-text nil) |
| @@ -1140,7 +1140,7 @@ See also: `hfy-face-to-style'" | |||
| 1140 | 1140 | ||
| 1141 | ;; extract a face from a list of char properties, if there is one: | 1141 | ;; extract a face from a list of char properties, if there is one: |
| 1142 | (defun hfy-p-to-face (props) | 1142 | (defun hfy-p-to-face (props) |
| 1143 | "Given PROPS, a list of text-properties, return the value of the face | 1143 | "Given PROPS, a list of text properties, return the value of the face |
| 1144 | property, or nil." | 1144 | property, or nil." |
| 1145 | (if props | 1145 | (if props |
| 1146 | (if (string= (car props) "face") | 1146 | (if (string= (car props) "face") |
| @@ -1152,7 +1152,7 @@ property, or nil." | |||
| 1152 | nil)) | 1152 | nil)) |
| 1153 | 1153 | ||
| 1154 | (defun hfy-p-to-face-lennart (props) | 1154 | (defun hfy-p-to-face-lennart (props) |
| 1155 | "Given PROPS, a list of text-properties, return the value of the face | 1155 | "Given PROPS, a list of text properties, return the value of the face |
| 1156 | property, or nil." | 1156 | property, or nil." |
| 1157 | (when props | 1157 | (when props |
| 1158 | (let ((face (plist-get props 'face)) | 1158 | (let ((face (plist-get props 'face)) |
| @@ -1230,8 +1230,8 @@ MAP is the invisibility map as returned by `hfy-find-invisible-ranges'." | |||
| 1230 | ;; -- v | 1230 | ;; -- v |
| 1231 | (defun hfy-face-at (p) | 1231 | (defun hfy-face-at (p) |
| 1232 | "Find face in effect at point P. | 1232 | "Find face in effect at point P. |
| 1233 | If overlays are to be considered \(see `hfy-optimisations'\) then this may | 1233 | If overlays are to be considered (see `hfy-optimisations') then this may |
| 1234 | return a defface style list of face properties instead of a face symbol." | 1234 | return a `defface' style list of face properties instead of a face symbol." |
| 1235 | ;;(message "hfy-face-at");;DBUG | 1235 | ;;(message "hfy-face-at");;DBUG |
| 1236 | ;; Fix-me: clean up, remove face-name etc | 1236 | ;; Fix-me: clean up, remove face-name etc |
| 1237 | ;; not sure why we'd want to remove face-name? -- v | 1237 | ;; not sure why we'd want to remove face-name? -- v |
| @@ -1385,7 +1385,7 @@ The plists are returned in descending priority order." | |||
| 1385 | (push (cons 'default (hfy-face-to-css 'default)) style))) | 1385 | (push (cons 'default (hfy-face-to-css 'default)) style))) |
| 1386 | 1386 | ||
| 1387 | (defun hfy-fontified-p () | 1387 | (defun hfy-fontified-p () |
| 1388 | "`font-lock' doesn't like to say it\'s been fontified when in batch | 1388 | "`font-lock' doesn't like to say it's been fontified when in batch |
| 1389 | mode, but we want to know if we should fontify or raw copy, so in batch | 1389 | mode, but we want to know if we should fontify or raw copy, so in batch |
| 1390 | mode we check for non-default face properties. Otherwise we test | 1390 | mode we check for non-default face properties. Otherwise we test |
| 1391 | variable `font-lock-mode' and variable `font-lock-fontified' for truth." | 1391 | variable `font-lock-mode' and variable `font-lock-fontified' for truth." |
| @@ -1412,7 +1412,7 @@ variable `font-lock-mode' and variable `font-lock-fontified' for truth." | |||
| 1412 | this function merges adjacent style blocks which are of the same value | 1412 | this function merges adjacent style blocks which are of the same value |
| 1413 | and are separated by nothing more interesting than whitespace.\n | 1413 | and are separated by nothing more interesting than whitespace.\n |
| 1414 | <span class=\"foo\">narf</span> <span class=\"foo\">brain</span>\n | 1414 | <span class=\"foo\">narf</span> <span class=\"foo\">brain</span>\n |
| 1415 | \(as interpreted from FACE-MAP\) would become:\n | 1415 | \(as interpreted from FACE-MAP) would become:\n |
| 1416 | <span class=\"foo\">narf brain</span>\n | 1416 | <span class=\"foo\">narf brain</span>\n |
| 1417 | Returns a modified copy of FACE-MAP." | 1417 | Returns a modified copy of FACE-MAP." |
| 1418 | (let ((tmp-map face-map) | 1418 | (let ((tmp-map face-map) |
| @@ -1485,8 +1485,8 @@ Returns a modified copy of FACE-MAP." | |||
| 1485 | (if (hfy-opt 'merge-adjacent-tags) (hfy-merge-adjacent-spans map) map))) | 1485 | (if (hfy-opt 'merge-adjacent-tags) (hfy-merge-adjacent-spans map) map))) |
| 1486 | 1486 | ||
| 1487 | (defun hfy-buffer () | 1487 | (defun hfy-buffer () |
| 1488 | "Generate a buffer to hold the html output. | 1488 | "Generate a buffer to hold the HTML output. |
| 1489 | The filename of this buffer is derived from the source \(current\) buffer\'s | 1489 | The filename of this buffer is derived from the source (current) buffer's |
| 1490 | variable `buffer-file-name', if it is set, plus `hfy-extn'. | 1490 | variable `buffer-file-name', if it is set, plus `hfy-extn'. |
| 1491 | Otherwise a plausible filename is constructed from `default-directory', | 1491 | Otherwise a plausible filename is constructed from `default-directory', |
| 1492 | `buffer-name' and `hfy-extn'." | 1492 | `buffer-name' and `hfy-extn'." |
| @@ -1536,7 +1536,7 @@ Uses `hfy-link-style-fun' to do this." | |||
| 1536 | ;; tag all the dangerous characters we want to escape | 1536 | ;; tag all the dangerous characters we want to escape |
| 1537 | ;; (ie any "<> chars we _didn't_ put there explicitly for css markup) | 1537 | ;; (ie any "<> chars we _didn't_ put there explicitly for css markup) |
| 1538 | (defun hfy-html-enkludge-buffer () | 1538 | (defun hfy-html-enkludge-buffer () |
| 1539 | "Mark dangerous [\"\<\>] characters with the \'hfy-quoteme property.\n | 1539 | "Mark dangerous [\"<>] characters with the `hfy-quoteme' property.\n |
| 1540 | See also `hfy-html-dekludge-buffer'." | 1540 | See also `hfy-html-dekludge-buffer'." |
| 1541 | ;;(message "hfy-html-enkludge-buffer");;DBUG | 1541 | ;;(message "hfy-html-enkludge-buffer");;DBUG |
| 1542 | (save-excursion | 1542 | (save-excursion |
| @@ -1546,7 +1546,7 @@ See also `hfy-html-dekludge-buffer'." | |||
| 1546 | 1546 | ||
| 1547 | ;; dangerous char -> &entity; | 1547 | ;; dangerous char -> &entity; |
| 1548 | (defun hfy-html-quote (char-string) | 1548 | (defun hfy-html-quote (char-string) |
| 1549 | "Map CHAR-STRING to an html safe string (entity) if need be." | 1549 | "Map CHAR-STRING to an HTML safe string (entity) if need be." |
| 1550 | ;;(message "hfy-html-quote");;DBUG | 1550 | ;;(message "hfy-html-quote");;DBUG |
| 1551 | (or (cadr (assoc char-string hfy-html-quote-map)) char-string) ) | 1551 | (or (cadr (assoc char-string hfy-html-quote-map)) char-string) ) |
| 1552 | 1552 | ||
| @@ -1556,8 +1556,8 @@ See also `hfy-html-dekludge-buffer'." | |||
| 1556 | ;; enter any other text before we do this, we'd have to track another | 1556 | ;; enter any other text before we do this, we'd have to track another |
| 1557 | ;; map of offsets, which would be tedious... | 1557 | ;; map of offsets, which would be tedious... |
| 1558 | (defun hfy-html-dekludge-buffer () | 1558 | (defun hfy-html-dekludge-buffer () |
| 1559 | "Transform all dangerous characters marked with the \'hfy-quoteme property | 1559 | "Transform all dangerous characters marked with the `hfy-quoteme' property |
| 1560 | using `hfy-html-quote'\n | 1560 | using `hfy-html-quote'.\n |
| 1561 | See also `hfy-html-enkludge-buffer'." | 1561 | See also `hfy-html-enkludge-buffer'." |
| 1562 | ;;(message "hfy-html-dekludge-buffer");;DBUG | 1562 | ;;(message "hfy-html-dekludge-buffer");;DBUG |
| 1563 | (save-excursion | 1563 | (save-excursion |
| @@ -1774,7 +1774,7 @@ FILE, if set, is the file name." | |||
| 1774 | html-buffer)) | 1774 | html-buffer)) |
| 1775 | 1775 | ||
| 1776 | (defun hfy-force-fontification () | 1776 | (defun hfy-force-fontification () |
| 1777 | "Try to force font-locking even when it is optimised away." | 1777 | "Try to force font-locking even when it is optimized away." |
| 1778 | (run-hooks 'hfy-init-kludge-hook) | 1778 | (run-hooks 'hfy-init-kludge-hook) |
| 1779 | (eval-and-compile (require 'font-lock)) | 1779 | (eval-and-compile (require 'font-lock)) |
| 1780 | (if (boundp 'font-lock-cache-position) | 1780 | (if (boundp 'font-lock-cache-position) |
| @@ -1793,19 +1793,19 @@ FILE, if set, is the file name." | |||
| 1793 | 1793 | ||
| 1794 | (defun htmlfontify-buffer (&optional srcdir file) | 1794 | (defun htmlfontify-buffer (&optional srcdir file) |
| 1795 | "Create a new buffer, named for the current buffer + a .html extension, | 1795 | "Create a new buffer, named for the current buffer + a .html extension, |
| 1796 | containing an inline css-stylesheet and formatted css-markup html | 1796 | containing an inline CSS-stylesheet and formatted CSS-markup HTML |
| 1797 | that reproduces the look of the current Emacs buffer as closely | 1797 | that reproduces the look of the current Emacs buffer as closely |
| 1798 | as possible. | 1798 | as possible. |
| 1799 | 1799 | ||
| 1800 | Dangerous characters in the existing buffer are turned into html | 1800 | Dangerous characters in the existing buffer are turned into HTML |
| 1801 | entities, so you should even be able to do html-within-html | 1801 | entities, so you should even be able to do HTML-within-HTML |
| 1802 | fontified display. | 1802 | fontified display. |
| 1803 | 1803 | ||
| 1804 | You should, however, note that random control or eight-bit | 1804 | You should, however, note that random control or eight-bit |
| 1805 | characters such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet. | 1805 | characters such as ^L (\x0c) or ¤ (\xa4) won't get mapped yet. |
| 1806 | 1806 | ||
| 1807 | If the SRCDIR and FILE arguments are set, lookup etags derived | 1807 | If the SRCDIR and FILE arguments are set, lookup etags derived |
| 1808 | entries in the `hfy-tags-cache' and add html anchors and | 1808 | entries in the `hfy-tags-cache' and add HTML anchors and |
| 1809 | hyperlinks as appropriate." | 1809 | hyperlinks as appropriate." |
| 1810 | (interactive) | 1810 | (interactive) |
| 1811 | ;; pick up the file name in case we didn't receive it | 1811 | ;; pick up the file name in case we didn't receive it |
| @@ -1836,22 +1836,22 @@ Strips any leading \"./\" from each filename." | |||
| 1836 | ;; fed pretty carefully, so it should be Ok: | 1836 | ;; fed pretty carefully, so it should be Ok: |
| 1837 | (defun hfy-dirname (file) | 1837 | (defun hfy-dirname (file) |
| 1838 | "Return everything preceding the last \"/\" from a relative filename FILE, | 1838 | "Return everything preceding the last \"/\" from a relative filename FILE, |
| 1839 | on the assumption that this will produce a relative directory name. Hardly | 1839 | on the assumption that this will produce a relative directory name. |
| 1840 | bombproof, but good enough in the context in which it is being used." | 1840 | Hardly bombproof, but good enough in the context in which it is being used." |
| 1841 | ;;(message "hfy-dirname");;DBUG | 1841 | ;;(message "hfy-dirname");;DBUG |
| 1842 | (let ((f (directory-file-name file))) | 1842 | (let ((f (directory-file-name file))) |
| 1843 | (and (string-match "^\\(.*\\)/" f) (match-string 1 f)))) | 1843 | (and (string-match "^\\(.*\\)/" f) (match-string 1 f)))) |
| 1844 | 1844 | ||
| 1845 | ;; create a directory, cf mkdir -p | 1845 | ;; create a directory, cf mkdir -p |
| 1846 | (defun hfy-make-directory (dir) | 1846 | (defun hfy-make-directory (dir) |
| 1847 | "Approx equivalent of mkdir -p DIR." | 1847 | "Approx. equivalent of mkdir -p DIR." |
| 1848 | ;;(message "hfy-make-directory");;DBUG | 1848 | ;;(message "hfy-make-directory");;DBUG |
| 1849 | (if (file-exists-p dir) | 1849 | (if (file-exists-p dir) |
| 1850 | (if (file-directory-p dir) t) | 1850 | (if (file-directory-p dir) t) |
| 1851 | (make-directory dir t))) | 1851 | (make-directory dir t))) |
| 1852 | 1852 | ||
| 1853 | (defun hfy-text-p (srcdir file) | 1853 | (defun hfy-text-p (srcdir file) |
| 1854 | "Is SRCDIR/FILE text? Uses `hfy-istext-command' to determine this." | 1854 | "Is SRCDIR/FILE text? Uses `hfy-istext-command' to determine this." |
| 1855 | (let* ((cmd (format hfy-istext-command (expand-file-name file srcdir))) | 1855 | (let* ((cmd (format hfy-istext-command (expand-file-name file srcdir))) |
| 1856 | (rsp (shell-command-to-string cmd))) | 1856 | (rsp (shell-command-to-string cmd))) |
| 1857 | (if (string-match "text" rsp) t nil))) | 1857 | (if (string-match "text" rsp) t nil))) |
| @@ -1903,7 +1903,7 @@ Looks up the tags cache in `hfy-tags-cache' using SRCDIR as the key." | |||
| 1903 | 1903 | ||
| 1904 | ;; mark the tags native to this file for anchors | 1904 | ;; mark the tags native to this file for anchors |
| 1905 | (defun hfy-mark-tag-names (srcdir file) | 1905 | (defun hfy-mark-tag-names (srcdir file) |
| 1906 | "Mark tags in FILE (lookup SRCDIR in `hfy-tags-cache') with the \'hfy-anchor | 1906 | "Mark tags in FILE (lookup SRCDIR in `hfy-tags-cache') with the `hfy-anchor' |
| 1907 | property, with a value of \"tag.line-number\"." | 1907 | property, with a value of \"tag.line-number\"." |
| 1908 | ;;(message "(hfy-mark-tag-names %s %s)" srcdir file);;DBUG | 1908 | ;;(message "(hfy-mark-tag-names %s %s)" srcdir file);;DBUG |
| 1909 | (let ((cache-entry (assoc srcdir hfy-tags-cache)) | 1909 | (let ((cache-entry (assoc srcdir hfy-tags-cache)) |
| @@ -1925,7 +1925,7 @@ property, with a value of \"tag.line-number\"." | |||
| 1925 | 1925 | ||
| 1926 | (defun hfy-relstub (file &optional start) | 1926 | (defun hfy-relstub (file &optional start) |
| 1927 | "Return a \"../\" stub of the appropriate length for the current source | 1927 | "Return a \"../\" stub of the appropriate length for the current source |
| 1928 | tree depth \(as determined from FILE \(a filename\)\). | 1928 | tree depth, as determined from FILE (a filename). |
| 1929 | START is the offset at which to start looking for the / character in FILE." | 1929 | START is the offset at which to start looking for the / character in FILE." |
| 1930 | ;;(message "hfy-relstub");;DBUG | 1930 | ;;(message "hfy-relstub");;DBUG |
| 1931 | (let ((c "")) | 1931 | (let ((c "")) |
| @@ -1933,8 +1933,8 @@ START is the offset at which to start looking for the / character in FILE." | |||
| 1933 | (setq start (1+ start)) (setq c (concat c "../"))) c)) | 1933 | (setq start (1+ start)) (setq c (concat c "../"))) c)) |
| 1934 | 1934 | ||
| 1935 | (defun hfy-href-stub (this-file def-files tag) | 1935 | (defun hfy-href-stub (this-file def-files tag) |
| 1936 | "Return an href stub for a tag href i THIS-FILE: | 1936 | "Return an href stub for a tag href in THIS-FILE. |
| 1937 | If DEF-FILES \(list of files containing definitions for the tag in question\) | 1937 | If DEF-FILES (list of files containing definitions for the tag in question) |
| 1938 | contains only one entry, the href should link straight to that file. | 1938 | contains only one entry, the href should link straight to that file. |
| 1939 | Otherwise, the link should be to the index file.\n | 1939 | Otherwise, the link should be to the index file.\n |
| 1940 | We are not yet concerned with the file extensions/tag line number and so on at | 1940 | We are not yet concerned with the file extensions/tag line number and so on at |
| @@ -1942,7 +1942,7 @@ this point.\n | |||
| 1942 | If `hfy-split-index' is set, and the href wil be to an index file rather than | 1942 | If `hfy-split-index' is set, and the href wil be to an index file rather than |
| 1943 | a source file, append a .X to `hfy-index-file', where X is the uppercased | 1943 | a source file, append a .X to `hfy-index-file', where X is the uppercased |
| 1944 | first character of TAG.\n | 1944 | first character of TAG.\n |
| 1945 | See also: `hfy-relstub', `hfy-index-file'`'." | 1945 | See also `hfy-relstub', `hfy-index-file'." |
| 1946 | ;;(message "hfy-href-stub");;DBUG | 1946 | ;;(message "hfy-href-stub");;DBUG |
| 1947 | ;; FIXME: Why not use something like | 1947 | ;; FIXME: Why not use something like |
| 1948 | ;; (file-relative-name (if ...) (file-name-directory this-file)) ? --Stef | 1948 | ;; (file-relative-name (if ...) (file-name-directory this-file)) ? --Stef |
| @@ -1957,7 +1957,7 @@ See also: `hfy-relstub', `hfy-index-file'`'." | |||
| 1957 | THIS-FILE `hfy-link-extn' `hfy-extn' DEF-FILES TAG and TAG-MAP\n | 1957 | THIS-FILE `hfy-link-extn' `hfy-extn' DEF-FILES TAG and TAG-MAP\n |
| 1958 | THIS-FILE is the current source file | 1958 | THIS-FILE is the current source file |
| 1959 | DEF-FILES is a list of file containing possible link endpoints for TAG | 1959 | DEF-FILES is a list of file containing possible link endpoints for TAG |
| 1960 | TAG is the TAG in question | 1960 | TAG is the tag in question |
| 1961 | TAG-MAP is the entry in `hfy-tags-cache'." | 1961 | TAG-MAP is the entry in `hfy-tags-cache'." |
| 1962 | ;;(message "hfy-href");;DBUG | 1962 | ;;(message "hfy-href");;DBUG |
| 1963 | (concat | 1963 | (concat |
| @@ -1975,8 +1975,8 @@ word characters on either side." | |||
| 1975 | ;; mark all tags for hyperlinking, except the tags at | 1975 | ;; mark all tags for hyperlinking, except the tags at |
| 1976 | ;; their own points of definition, iyswim: | 1976 | ;; their own points of definition, iyswim: |
| 1977 | (defun hfy-mark-tag-hrefs (srcdir file) | 1977 | (defun hfy-mark-tag-hrefs (srcdir file) |
| 1978 | "Mark href start points with the \'hfy-link prop \(value: href string\)\n | 1978 | "Mark href start points with the `hfy-link' prop (value: href string).\n |
| 1979 | Mark href end points with the \'hfy-endl prop \(value t\)\n | 1979 | Mark href end points with the `hfy-endl' prop (value t).\n |
| 1980 | Avoid overlapping links, and mark links in descending length of | 1980 | Avoid overlapping links, and mark links in descending length of |
| 1981 | tag name in order to prevent subtags from usurping supertags, | 1981 | tag name in order to prevent subtags from usurping supertags, |
| 1982 | \(eg \"term\" for \"terminal\"). | 1982 | \(eg \"term\" for \"terminal\"). |
| @@ -2134,7 +2134,7 @@ FILE is the specific file we are rendering." | |||
| 2134 | `hfy-tags-cache' must already have an entry for SRCDIR for this to work. | 2134 | `hfy-tags-cache' must already have an entry for SRCDIR for this to work. |
| 2135 | `hfy-page-header', `hfy-page-footer', `hfy-link-extn' and `hfy-extn' | 2135 | `hfy-page-header', `hfy-page-footer', `hfy-link-extn' and `hfy-extn' |
| 2136 | all play a part here.\n | 2136 | all play a part here.\n |
| 2137 | If STUB is set, prepare an \(appropriately named\) index buffer | 2137 | If STUB is set, prepare an (appropriately named) index buffer |
| 2138 | specifically for entries beginning with STUB.\n | 2138 | specifically for entries beginning with STUB.\n |
| 2139 | If MAP is set, use that instead of `hfy-tags-cache'. | 2139 | If MAP is set, use that instead of `hfy-tags-cache'. |
| 2140 | FILENAME is the name of the file being indexed. | 2140 | FILENAME is the name of the file being indexed. |
| @@ -2184,7 +2184,7 @@ DSTDIR is the output directory, where files will be written." | |||
| 2184 | index-buf) )) | 2184 | index-buf) )) |
| 2185 | 2185 | ||
| 2186 | (defun hfy-prepare-index (srcdir dstdir) | 2186 | (defun hfy-prepare-index (srcdir dstdir) |
| 2187 | "Return a list of index buffer\(s\), as determined by `hfy-split-index'. | 2187 | "Return a list of index buffer(s), as determined by `hfy-split-index'. |
| 2188 | SRCDIR and DSTDIR are the source and output directories respectively." | 2188 | SRCDIR and DSTDIR are the source and output directories respectively." |
| 2189 | (if (not hfy-split-index) | 2189 | (if (not hfy-split-index) |
| 2190 | (list (hfy-prepare-index-i srcdir dstdir hfy-index-file nil)) | 2190 | (list (hfy-prepare-index-i srcdir dstdir hfy-index-file nil)) |
| @@ -2207,12 +2207,11 @@ SRCDIR and DSTDIR are the source and output directories respectively." | |||
| 2207 | index-list)) ))) cache-hash) ) index-list))) | 2207 | index-list)) ))) cache-hash) ) index-list))) |
| 2208 | 2208 | ||
| 2209 | (defun hfy-prepare-tag-map (srcdir dstdir) | 2209 | (defun hfy-prepare-tag-map (srcdir dstdir) |
| 2210 | "Prepare the counterpart\(s\) to the index buffer\(s\) - a list of buffers | 2210 | "Prepare the counterpart(s) to the index buffer(s) - a list of buffers |
| 2211 | with the same structure, but listing \( and linking to \) instances of tags | 2211 | with the same structure, but listing (and linking to) instances of tags |
| 2212 | \( as opposed to their definitions \).\n | 2212 | \(as opposed to their definitions).\n |
| 2213 | SRCDIR and DSTDIR are the source and output directories respectively. | 2213 | SRCDIR and DSTDIR are the source and output directories respectively. |
| 2214 | See: `hfy-prepare-index' | 2214 | See also `hfy-prepare-index', `hfy-split-index'." |
| 2215 | `hfy-split-index'." | ||
| 2216 | (if (not hfy-split-index) | 2215 | (if (not hfy-split-index) |
| 2217 | (list (hfy-prepare-index-i srcdir | 2216 | (list (hfy-prepare-index-i srcdir |
| 2218 | dstdir | 2217 | dstdir |
| @@ -2242,7 +2241,7 @@ See: `hfy-prepare-index' | |||
| 2242 | (defun hfy-subtract-maps (srcdir) | 2241 | (defun hfy-subtract-maps (srcdir) |
| 2243 | "Internal function - strips definitions of tags from the instance map. | 2242 | "Internal function - strips definitions of tags from the instance map. |
| 2244 | SRCDIR is the directory being \"published\". | 2243 | SRCDIR is the directory being \"published\". |
| 2245 | See: `hfy-tags-cache' and `hfy-tags-rmap'" | 2244 | See also `hfy-tags-cache', `hfy-tags-rmap'." |
| 2246 | (let ((new-list nil) | 2245 | (let ((new-list nil) |
| 2247 | (old-list nil) | 2246 | (old-list nil) |
| 2248 | (def-list nil) | 2247 | (def-list nil) |
| @@ -2262,7 +2261,7 @@ See: `hfy-tags-cache' and `hfy-tags-rmap'" | |||
| 2262 | 2261 | ||
| 2263 | (defun htmlfontify-run-etags (srcdir) | 2262 | (defun htmlfontify-run-etags (srcdir) |
| 2264 | "Load the etags cache for SRCDIR. | 2263 | "Load the etags cache for SRCDIR. |
| 2265 | See `hfy-load-tags-cache'." | 2264 | See also `hfy-load-tags-cache'." |
| 2266 | (interactive "D source directory: ") | 2265 | (interactive "D source directory: ") |
| 2267 | (setq srcdir (directory-file-name srcdir)) | 2266 | (setq srcdir (directory-file-name srcdir)) |
| 2268 | (hfy-load-tags-cache srcdir)) | 2267 | (hfy-load-tags-cache srcdir)) |