From c69b070c5104e5319735ff667f09e7e4a58d1237 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sat, 25 Nov 2023 11:38:12 +0100 Subject: [PATCH] update htmlize Signed-off-by: Andreas Gerler --- elpa/htmlize-20191111.2130/htmlize-pkg.el | 2 - .../htmlize-autoloads.el | 8 +- elpa/htmlize-20210825.2150/htmlize-pkg.el | 12 ++ .../htmlize.el | 103 +++++++----------- 4 files changed, 60 insertions(+), 65 deletions(-) delete mode 100644 elpa/htmlize-20191111.2130/htmlize-pkg.el rename elpa/{htmlize-20191111.2130 => htmlize-20210825.2150}/htmlize-autoloads.el (93%) create mode 100644 elpa/htmlize-20210825.2150/htmlize-pkg.el rename elpa/{htmlize-20191111.2130 => htmlize-20210825.2150}/htmlize.el (96%) diff --git a/elpa/htmlize-20191111.2130/htmlize-pkg.el b/elpa/htmlize-20191111.2130/htmlize-pkg.el deleted file mode 100644 index bbc710ca..00000000 --- a/elpa/htmlize-20191111.2130/htmlize-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "htmlize" "20191111.2130" "Convert buffer text and decorations to HTML." 'nil :commit "86f22f211e9230857197c42a9823d3f05381deed" :keywords '("hypermedia" "extensions") :authors '(("Hrvoje Niksic" . "hniksic@gmail.com")) :maintainer '("Hrvoje Niksic" . "hniksic@gmail.com") :url "https://github.com/hniksic/emacs-htmlize") diff --git a/elpa/htmlize-20191111.2130/htmlize-autoloads.el b/elpa/htmlize-20210825.2150/htmlize-autoloads.el similarity index 93% rename from elpa/htmlize-20191111.2130/htmlize-autoloads.el rename to elpa/htmlize-20210825.2150/htmlize-autoloads.el index 2de24ed5..af5b68b0 100644 --- a/elpa/htmlize-20191111.2130/htmlize-autoloads.el +++ b/elpa/htmlize-20210825.2150/htmlize-autoloads.el @@ -1,4 +1,4 @@ -;;; htmlize-autoloads.el --- automatically extracted autoloads +;;; htmlize-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -69,7 +69,11 @@ HTMLize dired-marked files. \(fn ARG &optional TARGET-DIRECTORY)" t nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "htmlize" '("htmlize-"))) +(register-definition-prefixes "htmlize" '("htmlize-")) + +;;;*** + +;;;### (autoloads nil nil ("htmlize-pkg.el") (0 0 0 0)) ;;;*** diff --git a/elpa/htmlize-20210825.2150/htmlize-pkg.el b/elpa/htmlize-20210825.2150/htmlize-pkg.el new file mode 100644 index 00000000..18f5dedf --- /dev/null +++ b/elpa/htmlize-20210825.2150/htmlize-pkg.el @@ -0,0 +1,12 @@ +(define-package "htmlize" "20210825.2150" "Convert buffer text and decorations to HTML." 'nil :commit "dd27bc3f26efd728f2b1f01f9e4ac4f61f2ffbf9" :authors + '(("Hrvoje Niksic" . "hniksic@gmail.com")) + :maintainers + '(("Hrvoje Niksic" . "hniksic@gmail.com")) + :maintainer + '("Hrvoje Niksic" . "hniksic@gmail.com") + :keywords + '("hypermedia" "extensions") + :url "https://github.com/hniksic/emacs-htmlize") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/htmlize-20191111.2130/htmlize.el b/elpa/htmlize-20210825.2150/htmlize.el similarity index 96% rename from elpa/htmlize-20191111.2130/htmlize.el rename to elpa/htmlize-20210825.2150/htmlize.el index 9aa19f34..b158a65d 100644 --- a/elpa/htmlize-20191111.2130/htmlize.el +++ b/elpa/htmlize-20210825.2150/htmlize.el @@ -1,12 +1,11 @@ ;;; htmlize.el --- Convert buffer text and decorations to HTML. -*- lexical-binding: t -*- -;; Copyright (C) 1997-2003,2005,2006,2009,2011,2012,2014,2017,2018 Hrvoje Niksic +;; Copyright (C) 1997-2003,2005,2006,2009,2011,2012,2014,2017,2018,2020 Hrvoje Niksic ;; Author: Hrvoje Niksic ;; Homepage: https://github.com/hniksic/emacs-htmlize ;; Keywords: hypermedia, extensions -;; Package-Version: 20191111.2130 -;; Version: 1.56 +;; Version: 1.57 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -83,13 +82,13 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) (eval-when-compile (defvar font-lock-auto-fontify) (defvar font-lock-support-mode) (defvar global-font-lock-mode)) -(defconst htmlize-version "1.56") +(defconst htmlize-version "1.57") (defgroup htmlize nil "Convert buffer text and faces to HTML." @@ -551,7 +550,7 @@ list." (when (plist-get imgprops :file) (let ((location (plist-get (cdr (find-image (list imgprops))) :file))) (when location - (setq imgprops (plist-put (copy-list imgprops) :file location))))) + (setq imgprops (plist-put (cl-copy-list imgprops) :file location))))) (if htmlize-force-inline-images (let ((location (plist-get imgprops :file)) data) @@ -598,9 +597,9 @@ list." (put-text-property 0 (length htmlize-ellipsis) 'htmlize-ellipsis t htmlize-ellipsis) (defun htmlize-match-inv-spec (inv) - (member* inv buffer-invisibility-spec - :key (lambda (i) - (if (symbolp i) i (car i))))) + (cl-member inv buffer-invisibility-spec + :key (lambda (i) + (if (symbolp i) i (car i))))) (defun htmlize-decode-invisibility-spec (invisible) ;; Return t, nil, or `ellipsis', depending on how invisible text should be inserted. @@ -620,7 +619,7 @@ list." ;; CDR, replace the invisible text with an ellipsis. (let ((match (if (symbolp invisible) (htmlize-match-inv-spec invisible) - (some #'htmlize-match-inv-spec invisible)))) + (cl-some #'htmlize-match-inv-spec invisible)))) (cond ((null match) t) ((cdr-safe (car match)) 'ellipsis) (t nil))))) @@ -644,7 +643,7 @@ list." (if additions (let ((textlist nil) (strpos 0)) - (dolist (add (stable-sort additions #'< :key #'car)) + (dolist (add (cl-stable-sort additions #'< :key #'car)) (let ((addpos (car add)) (addtext (cdr add))) (push (substring text strpos addpos) textlist) @@ -732,7 +731,7 @@ list." ;; Increase COLUMN by the length of the text we've ;; skipped since last tab or newline. (Encountering ;; newline resets it.) - (incf column (- match-pos last-match)) + (cl-incf column (- match-pos last-match)) ;; Calculate tab size based on tab-width and COLUMN. (setq tab-size (- tab-width (% column tab-width))) ;; Expand the tab, carefully recreating the `display' @@ -742,7 +741,7 @@ list." (when display (put-text-property 0 tab-size 'display display expanded-tab)) (push expanded-tab chunks)) - (incf column tab-size) + (cl-incf column tab-size) (setq chunk-start (1+ match-pos))) (t ;; Reset COLUMN at beginning of line. @@ -772,7 +771,7 @@ list." (when htmlize-untabify (setq text (htmlize-untabify-string text (current-column)))) (setq text (htmlize-string-to-html text)) - (values text trailing-ellipsis))) + (cl-values text trailing-ellipsis))) (defun htmlize-despam-address (string) "Replace every occurrence of '@' in STRING with %40. @@ -989,7 +988,7 @@ If no rgb.txt file is found, return nil." ;; type `htmlize-fstruct', while the term "face" is reserved for Emacs ;; faces. -(defstruct htmlize-fstruct +(cl-defstruct htmlize-fstruct foreground ; foreground color, #rrggbb background ; background color, #rrggbb size ; size @@ -1003,7 +1002,7 @@ If no rgb.txt file is found, return nil." (defun htmlize-face-set-from-keyword-attr (fstruct attr value) ;; For ATTR and VALUE, set the equivalent value in FSTRUCT. - (case attr + (cl-case attr (:foreground (setf (htmlize-fstruct-foreground fstruct) (htmlize-color-to-rgb value))) (:background @@ -1036,7 +1035,7 @@ If no rgb.txt file is found, return nil." (while head (let ((inherit (face-attribute (car head) :inherit))) (cond ((listp inherit) - (setcdr tail (copy-list inherit)) + (setcdr tail (cl-copy-list inherit)) (setq tail (last tail))) ((eq inherit 'unspecified)) (t @@ -1044,11 +1043,11 @@ If no rgb.txt file is found, return nil." (setq tail (cdr tail))))) (pop head)) (let ((size-list - (loop + (cl-loop for f in face-list - for h = (face-attribute f :height) + for h = (and (facep f) (face-attribute f :height)) collect (if (eq h 'unspecified) nil h)))) - (reduce 'htmlize-merge-size (cons nil size-list))))) + (cl-reduce 'htmlize-merge-size (cons nil size-list))))) (defun htmlize-face-css-name (face) ;; Generate the css-name property for the given face. Emacs places @@ -1116,10 +1115,10 @@ If no rgb.txt file is found, return nil." ;; ...) ;; for the given list of boolean attributes. (cons 'progn - (loop for attr in attr-list - for attr-sym = (intern (format "htmlize-fstruct-%s" attr)) - collect `(when (,attr-sym ,source) - (setf (,attr-sym ,dest) (,attr-sym ,source)))))) + (cl-loop for attr in attr-list + for attr-sym = (intern (format "htmlize-fstruct-%s" attr)) + collect `(when (,attr-sym ,source) + (setf (,attr-sym ,dest) (,attr-sym ,source)))))) (defun htmlize-merge-size (merged next) ;; Calculate the size of the merge of MERGED and NEXT. @@ -1147,8 +1146,8 @@ If no rgb.txt file is found, return nil." ;; return it. (car fstruct-list)) (t - (reduce #'htmlize-merge-two-faces - (cons (make-htmlize-fstruct) fstruct-list))))) + (cl-reduce #'htmlize-merge-two-faces + (cons (make-htmlize-fstruct) fstruct-list))))) ;; GNU Emacs 20+ supports attribute lists in `face' properties. For ;; example, you can use `(:foreground "red" :weight bold)' as an @@ -1242,7 +1241,7 @@ If no rgb.txt file is found, return nil." ;; Uniquify the face's css-name by using NAME-1, NAME-2, ;; etc. (while (member new-name css-names) - (setq new-name (format "%s-%s" css-name (incf i)))) + (setq new-name (format "%s-%s" css-name (cl-incf i)))) (unless (equal new-name css-name) (setf (htmlize-fstruct-css-name fstruct) new-name)) (push new-name css-names))))) @@ -1264,34 +1263,16 @@ overlays that specify `face'." (while (< pos (point-max)) (setq face-prop (get-text-property pos 'face) next (or (next-single-property-change pos 'face) (point-max))) - (setq faces (nunion (htmlize-decode-face-prop face-prop) - faces :test 'equal)) + (setq faces (cl-nunion (htmlize-decode-face-prop face-prop) + faces :test 'equal)) (setq pos next))) ;; Faces used by overlays. (dolist (overlay (overlays-in (point-min) (point-max))) (let ((face-prop (overlay-get overlay 'face))) - (setq faces (nunion (htmlize-decode-face-prop face-prop) - faces :test 'equal)))) + (setq faces (cl-nunion (htmlize-decode-face-prop face-prop) + faces :test 'equal)))) faces)) -(if (>= emacs-major-version 25) - (defun htmlize-sorted-overlays-at (pos) - (overlays-at pos t)) - - (defun htmlize-sorted-overlays-at (pos) - ;; Like OVERLAYS-AT with the SORTED argument, for older Emacsen. - (let ((overlays (overlays-at pos))) - (setq overlays (sort* overlays #'< - :key (lambda (o) - (- (overlay-end o) (overlay-start o))))) - (setq overlays - (stable-sort overlays #'< - :key (lambda (o) - (let ((prio (overlay-get o 'priority))) - (if (numberp prio) prio 0))))) - (nreverse overlays)))) - - ;; htmlize-faces-at-point returns the faces in use at point. The ;; faces are sorted by increasing priority, i.e. the last face takes ;; precedence. @@ -1309,9 +1290,9 @@ overlays that specify `face'." ;; Faces from overlays. (let ((overlays ;; Collect overlays at point that specify `face'. - (delete-if-not (lambda (o) - (overlay-get o 'face)) - (nreverse (htmlize-sorted-overlays-at (point))))) + (cl-delete-if-not (lambda (o) + (overlay-get o 'face)) + (nreverse (overlays-at (point) t)))) list face-prop) (dolist (overlay overlays) (setq face-prop (overlay-get overlay 'face) @@ -1359,7 +1340,7 @@ overlays that specify `face'." That means that GENERATOR will be evaluated and returned the first time it's called with the same value of KEY. All other times, the cached \(memoized) value will be returned." - (let ((value (gensym))) + (let ((value (cl-gensym))) `(let ((,value (gethash ,key htmlize-memoization-table))) (unless ,value (setq ,value ,generator) @@ -1423,9 +1404,9 @@ it's called with the same value of KEY. All other times, the cached (htmlize-css-specs (gethash 'default face-map)) "\n ") "\n }\n") - (dolist (face (sort* (copy-list buffer-faces) #'string-lessp - :key (lambda (f) - (htmlize-fstruct-css-name (gethash f face-map))))) + (dolist (face (cl-sort (cl-copy-list buffer-faces) #'string-lessp + :key (lambda (f) + (htmlize-fstruct-css-name (gethash f face-map))))) (let* ((fstruct (gethash face face-map)) (cleaned-up-face-name (let ((s @@ -1560,8 +1541,8 @@ it's called with the same value of KEY. All other times, the cached (completed nil)) (unwind-protect (let* ((buffer-faces (htmlize-faces-in-buffer)) - (face-map (htmlize-make-face-map (adjoin 'default buffer-faces))) - (places (gensym)) + (face-map (htmlize-make-face-map (cl-adjoin 'default buffer-faces))) + (places (cl-gensym)) (title (if (buffer-file-name) (file-name-nondirectory (buffer-file-name)) (buffer-name)))) @@ -1622,13 +1603,13 @@ it's called with the same value of KEY. All other times, the cached fstruct-list (delq nil (mapcar (lambda (f) (gethash f face-map)) face-list))) - (multiple-value-setq (text trailing-ellipsis) + (cl-multiple-value-setq (text trailing-ellipsis) (htmlize-extract-text (point) next-change trailing-ellipsis)) ;; Don't bother writing anything if there's no text (this ;; happens in invisible regions). (when (> (length text) 0) ;; Open the new markup if necessary and insert the text. - (when (not (equalp fstruct-list last-fstruct-list)) + (when (not (cl-equalp fstruct-list last-fstruct-list)) (funcall close-markup) (setq last-fstruct-list fstruct-list close-markup (funcall text-markup fstruct-list htmlbuf))) @@ -1877,7 +1858,7 @@ corresponding source file." (provide 'htmlize) ;; Local Variables: -;; byte-compile-warnings: (not cl-functions unresolved obsolete) +;; byte-compile-warnings: (not unresolved obsolete) ;; End: ;;; htmlize.el ends here -- 2.47.3