more emacs 24 changes

pull/4/head
Blake DeMarcy 2017-03-02 20:55:46 -06:00
parent ca247bb185
commit c30627a604
1 changed files with 35 additions and 15 deletions

50
bbj.el
View File

@ -393,24 +393,44 @@ or any of its children."
(bbj:insert-sep))) (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) (defun bbj:render-tag-span (dom)
"A slightly modified version of `shr-tag-span' which handles quotes and stuff." "A slightly modified version of `shr-tag-span' which handles quotes and stuff."
(let ((class (if bbj:old-p (let ((class (if bbj:old-p
(assq :class (cdr dom)) (alist-get :class dom)
(dom-attr dom 'class)))) (dom-attr dom 'class)))
(dolist (sub (if (consp (car dom)) (cddr (car dom)) (cddr dom))) (text (if bbj:old-p
(if (stringp sub) (alist-get 'text dom)
(cond (car (last dom)))))
((equal class "quote") (cond
(insert (propertize sub ((equal class "quote")
'face 'font-lock-constant-face (insert (propertize text
'type 'quote))) 'face 'font-lock-constant-face
((equal class "linequote") 'type 'quote)))
(insert (propertize sub ((equal class "linequote")
'face 'font-lock-string-face (unless (bolp) (insert "\n"))
'type 'linequote))) (insert (propertize text
(t (shr-insert sub))) 'face 'font-lock-string-face
(shr-descend sub))))) 'type 'linequote)))
(text (shr-insert text)))))
(defun bbj:mksep () (defun bbj:mksep ()