sbbs.el

Check-in [8395dc0011]
Login
Overview
Comment:added sbbs-show-replies
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 8395dc00118b3c6c3987b56bb60d0b8709968586e0244fa5f1dd32f05dd1a022
User & Date: philip@warpmail.net on 2020-04-24 08:40:00
Other Links: branch diff | manifest | tags
Context
2020-04-24
09:30
show spoilers when point is on one check-in: 5794890443 user: philip@warpmail.net tags: master, trunk
08:40
added sbbs-show-replies check-in: 8395dc0011 user: philip@warpmail.net tags: master, trunk
2020-03-17
12:31
implemented fontification in compose buffer check-in: 45803d5d77 user: philip@warpmail.net tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified sbbs.el from [4c0b868675] to [dd4c4f4886].

   209    209               (unless (memq (get-text-property (point) 'sbbs-thread-nr)
   210    210                             spec)
   211    211                 (add-text-properties
   212    212                  (point) last '(invisible t intangible t)))
   213    213               (setq last (point)))))
   214    214         (goto-char (point-min))
   215    215         (when spec
   216         -        (sbbs--read-jump-to (car spec)))
          216  +        (sbbs--read-jump-to (apply #'min spec)))
   217    217         (let ((point (point)))
   218    218           (when sbbs-jump-to-link
   219    219             (forward-button 1)
   220    220             (when (invisible-p (point))
   221    221               (goto-char point)))))))
   222    222   
   223    223   (defun sbbs--insert-link (text link)
................................................................................
   249    249                                 (sbbs-view-open id range)))
   250    250                              ;; other thread
   251    251                              ((/= id sbbs--thread-id)
   252    252                               (let ((sbbs--board board))
   253    253                                 (sbbs-view-open id range)))
   254    254                              ;; this thread
   255    255                              (range (sbbs--limit-to-range range))))))
   256         -        (insert-button text 'action func)))))
          256  +        (insert-button text 'action func 'sbbs-ref range)))))
   257    257   
   258    258   (defun sbbs--insert-sxml-par (sxml)
   259    259     "Insert paragraph contents SXML at point."
   260    260     (dolist (it sxml)
   261    261       (cond ((stringp it)
   262    262              (insert (propertize it 'face 'variable-pitch)))
   263    263             ((eq (car it) 'br)
................................................................................
   389    389   (defun sbbs-show-pop (&optional n)
   390    390     "Show all hidden posts.
   391    391   
   392    392   A prefix argument N, repeats this N times. If negative or zero,
   393    393   pop all the way up."
   394    394     (interactive "P")
   395    395     (let ((n (or n 1)))
          396  +    (unless sbbs--limit-stack
          397  +      (message "Nothing left to pop"))
   396    398       (dotimes (_ (if (> n 0) n (length sbbs--limit-stack)))
   397    399         (let ((point (car (pop sbbs--limit-stack))))
   398    400           (sbbs--limit-to-range (cdar sbbs--limit-stack) t)
   399    401           (when point (goto-char point))))))
   400    402   
          403  +(defun sbbs-show-replies ()
          404  +  "Show all posts responding to post at point."
          405  +  (interactive)
          406  +  (let ((nr (get-text-property (point) 'sbbs-thread-nr))
          407  +        (point (point)) overlay range)
          408  +    (while (setq overlay (next-button point))
          409  +      (when (memq nr (overlay-get overlay 'sbbs-ref))
          410  +        (push (get-text-property (overlay-start overlay)
          411  +                                 'sbbs-thread-nr)
          412  +              range))
          413  +      (setq point (overlay-end overlay)))
          414  +    (if range
          415  +        (sbbs--limit-to-range range)
          416  +      (message "No posts referencing %d" nr))))
          417  +
   401    418   (defun sbbs-view-open (id &optional range)
   402    419     "Open thread ID in new buffer."
   403    420     (interactive (list (tabulated-list-get-id)))
   404    421     (let ((url (sbbs--board-url (format "/%d" id) t))
   405    422           (headline (or (and (not (tabulated-list-get-entry))
   406    423                              header-line-format)
   407    424                         (substring-no-properties
................................................................................
   548    565       (define-key map (kbd "<tab>") #'forward-button)
   549    566       (define-key map (kbd "<backtab>") #'backward-button)
   550    567       (define-key map (kbd "r") #'sbbs-read-reply)
   551    568       (define-key map (kbd "n") #'sbbs-read-next)
   552    569       (define-key map (kbd "p") #'sbbs-read-previous)
   553    570       (define-key map (kbd "a") #'sbbs-show-pop)
   554    571       (define-key map (kbd "A") #'sbbs-show-all)
          572  +    (define-key map (kbd "f") #'sbbs-show-replies)
   555    573       map))
   556    574   
   557    575   (define-derived-mode sbbs-read-mode special-mode "SchemeBBS Read"
   558    576     "Major mode for reading a thread."
   559    577     (buffer-disable-undo)
   560    578     (visual-line-mode t)
   561    579     (setq-local revert-buffer-function #'sbbs--reload-thread))