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

36
bbj.el
View File

@ -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)
(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 sub
(insert (propertize text
'face 'font-lock-constant-face
'type 'quote)))
((equal class "linequote")
(insert (propertize sub
(unless (bolp) (insert "\n"))
(insert (propertize text
'face 'font-lock-string-face
'type 'linequote)))
(t (shr-insert sub)))
(shr-descend sub)))))
(text (shr-insert text)))))
(defun bbj:mksep ()