Index: sbbs.el ================================================================== --- sbbs.el +++ sbbs.el @@ -211,11 +211,11 @@ (add-text-properties (point) last '(invisible t intangible t))) (setq last (point))))) (goto-char (point-min)) (when spec - (sbbs--read-jump-to (car spec))) + (sbbs--read-jump-to (apply #'min spec))) (let ((point (point))) (when sbbs-jump-to-link (forward-button 1) (when (invisible-p (point)) (goto-char point))))))) @@ -251,11 +251,11 @@ ((/= id sbbs--thread-id) (let ((sbbs--board board)) (sbbs-view-open id range))) ;; this thread (range (sbbs--limit-to-range range)))))) - (insert-button text 'action func))))) + (insert-button text 'action func 'sbbs-ref range))))) (defun sbbs--insert-sxml-par (sxml) "Insert paragraph contents SXML at point." (dolist (it sxml) (cond ((stringp it) @@ -391,15 +391,32 @@ A prefix argument N, repeats this N times. If negative or zero, pop all the way up." (interactive "P") (let ((n (or n 1))) + (unless sbbs--limit-stack + (message "Nothing left to pop")) (dotimes (_ (if (> n 0) n (length sbbs--limit-stack))) (let ((point (car (pop sbbs--limit-stack)))) (sbbs--limit-to-range (cdar sbbs--limit-stack) t) (when point (goto-char point)))))) +(defun sbbs-show-replies () + "Show all posts responding to post at point." + (interactive) + (let ((nr (get-text-property (point) 'sbbs-thread-nr)) + (point (point)) overlay range) + (while (setq overlay (next-button point)) + (when (memq nr (overlay-get overlay 'sbbs-ref)) + (push (get-text-property (overlay-start overlay) + 'sbbs-thread-nr) + range)) + (setq point (overlay-end overlay))) + (if range + (sbbs--limit-to-range range) + (message "No posts referencing %d" nr)))) + (defun sbbs-view-open (id &optional range) "Open thread ID in new buffer." (interactive (list (tabulated-list-get-id))) (let ((url (sbbs--board-url (format "/%d" id) t)) (headline (or (and (not (tabulated-list-get-entry)) @@ -550,10 +567,11 @@ (define-key map (kbd "r") #'sbbs-read-reply) (define-key map (kbd "n") #'sbbs-read-next) (define-key map (kbd "p") #'sbbs-read-previous) (define-key map (kbd "a") #'sbbs-show-pop) (define-key map (kbd "A") #'sbbs-show-all) + (define-key map (kbd "f") #'sbbs-show-replies) map)) (define-derived-mode sbbs-read-mode special-mode "SchemeBBS Read" "Major mode for reading a thread." (buffer-disable-undo)