From c30627a604b91887febf43d09f0cf8ed0a4b434c Mon Sep 17 00:00:00 2001 From: Blake DeMarcy Date: Thu, 2 Mar 2017 20:55:46 -0600 Subject: [PATCH] more emacs 24 changes --- bbj.el | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/bbj.el b/bbj.el index ffa4831..9ed2535 100644 --- a/bbj.el +++ b/bbj.el @@ -393,24 +393,44 @@ or any of its children." (bbj:insert-sep))) +;; (defun bbj:render-tag-span (dom) +;; "A slightly modified version of `shr-tag-span' which handles quotes and stuff." +;; (let ((class (if bbj:old-p +;; (assq :class (cdr dom)) +;; (dom-attr dom 'class)))) +;; (dolist (sub (if (consp (car dom)) (cddr (car dom)) (cddr dom))) +;; (if (stringp sub) +;; (cond +;; ((equal class "quote") +;; (insert (propertize sub +;; 'face 'font-lock-constant-face +;; 'type 'quote))) +;; ((equal class "linequote") +;; (insert (propertize sub +;; 'face 'font-lock-string-face +;; 'type 'linequote))) +;; (t (shr-insert sub))) +;; (shr-descend sub))))) + (defun bbj:render-tag-span (dom) "A slightly modified version of `shr-tag-span' which handles quotes and stuff." (let ((class (if bbj:old-p - (assq :class (cdr dom)) - (dom-attr dom 'class)))) - (dolist (sub (if (consp (car dom)) (cddr (car dom)) (cddr dom))) - (if (stringp sub) - (cond - ((equal class "quote") - (insert (propertize sub - 'face 'font-lock-constant-face - 'type 'quote))) - ((equal class "linequote") - (insert (propertize sub - 'face 'font-lock-string-face - 'type 'linequote))) - (t (shr-insert sub))) - (shr-descend sub))))) + (alist-get :class dom) + (dom-attr dom 'class))) + (text (if bbj:old-p + (alist-get 'text dom) + (car (last dom))))) + (cond + ((equal class "quote") + (insert (propertize text + 'face 'font-lock-constant-face + 'type 'quote))) + ((equal class "linequote") + (unless (bolp) (insert "\n")) + (insert (propertize text + 'face 'font-lock-string-face + 'type 'linequote))) + (text (shr-insert text))))) (defun bbj:mksep ()