sbbs.el

Check-in [80dcfa319c]
Login
Overview
Comment:Fix outlines
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 80dcfa319cdf8fcc35ab60adc6adbaa99f5061dae9b5a985e9db087e39b56e42
User & Date: zge on 2021-05-29 14:28:30
Other Links: branch diff | manifest | tags
Context
2022-01-22
18:12
Add sbbs-open-externally command check-in: 92c5d47565 user: philip tags: master, trunk
2021-05-29
14:28
Fix outlines check-in: 80dcfa319c user: zge tags: master, trunk
12:53
Improve check if region is active check-in: 438efd04c7 user: zge tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified sbbs.el from [f9185109d4] to [deeb5b67a8].

26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
..
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
...
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
...
177
178
179
180
181
182
183

184
185
186
187
188
189
190
191
...
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
...
403
404
405
406
407
408
409

410
411
412
413
414
415
416
417
...
499
500
501
502
503
504
505

506
507
508
509
510
511
512
513
...
715
716
717
718
719
720
721

722
723
724
725
726
727
728
729
(require 'text-property-search)
(require 'tabulated-list)
(require 'button)
(require 'url)
(require 'hl-line)
(require 'rx)


  ;; CUSTOMIZABLE DATA

(defgroup sbbs nil
  "SchemeBBS client."
  :group 'applications
  :prefix "sbbs-")

(defcustom sbbs-boards
................................................................................
  "Face for code blocks in threads.")

(defface sbbs--post-header-face
  '((nil :extend t
         :inherit highlight))
  "Face for post headers in the thread view.")


  ;; VARIABLES

(defvar-local sbbs--board nil
  "Buffer local reference to current board.

See `sbbs-make-board'.")

(defvar-local sbbs--thread-id nil
................................................................................

(defvar-local sbbs--limit-stack nil
  "Stack of last limit specs.")

(defvar-local sbbs--last-spoiler nil
  "Point of last spoiler visited.")


  ;; BOARD OBJECT AND FUNCTIONS

(defun sbbs-make-board (domain name &optional tls)
  "Create board object, using DOMAIN, NAME and TLS flag."
  (vector domain name tls))

(defsubst sbbs--board-domain (board)
  "Get domain part of a BOARD object."
................................................................................
                               (sbbs--board-name def))
                     "Board: ")
                   boards nil t "/" nil def)))
      (if (stringp choice)
          (cdr (assoc choice boards))
        choice))))


  ;; UTILITY FUNCTIONS

(defun sbbs--reload-thread (&optional _ignore-auto _noconfirm)
  "Function to reload an opened thread."
  (when sbbs--thread-id (sbbs-view-open sbbs--thread-id)))

(defun sbbs--reload-board ()
  "Function to regenerate thread index.
................................................................................
            ((> nr current) (setq up (point))))))
  (unless (and (eq 'highlight (get-text-property (point) 'face))
               (looking-at-p "\\`#[[:digit:]]+"))
    ;; in case we are on the first character of a post, we shouldn't
    ;; jump back, since that would mean setting to point to NR-1.
    (sbbs-read-previous 1)))


  ;; UI GENERATOR

(defconst sbbs--link-regexp
  (rx-to-string
   `(: bos
       (or (: "/" (group-n 2 (+ alnum))
              "/" (group-n 3 (+ digit))
              "/" (group-n 4 (: (+ digit) (? "-" (+ digit)))
................................................................................
         (setq sbbs--last-spoiler (point)))
        (sbbs--last-spoiler
         (dolist (o (overlays-at sbbs--last-spoiler))
           (when (overlay-get o 'sbbs-uncover-p)
             (delete-overlay o)))
         (setq sbbs--last-spoiler nil))))


  ;; URL.EL CALLBACKS

(defun sbbs--fix-encoding ()
  "Convert the raw response after point to utf-8."
  (save-excursion
    ;; see http://textboard.org/prog/39/263
    (set-buffer-multibyte nil)
    (while (search-forward-regexp
................................................................................
          (delete-blank-lines)
          (when range
            (sbbs--limit-to-range range))
          (if sbbs-open-at-last-post
              (sbbs-goto-end)
            (goto-char (point-min))))))))


  ;; INTERACTIVE FUNCTIONS

(defun sbbs-show-all ()
  "Show all hidden posts."
  (interactive)
  (sbbs-show-pop -1))

(defun sbbs-show-pop (&optional n)
................................................................................
        (url-retrieve url #'sbbs--board-loader
                      (list (current-buffer)))
        (switch-to-buffer (current-buffer))))))

;;;###autoload
(defalias 'sbbs #'sbbs-browse)


  ;; MAJOR MODES

(defvar sbbs-view-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "RET") #'sbbs-view-open)
    (define-key map (kbd "c") #'sbbs-view-compose)
    map))








>
|







 







>
|







 







>
|







 







>
|







 







>
|







 







>
|







 







>
|







 







>
|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
...
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
...
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
...
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
...
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
(require 'text-property-search)
(require 'tabulated-list)
(require 'button)
(require 'url)
(require 'hl-line)
(require 'rx)

 
;;; CUSTOMIZABLE DATA

(defgroup sbbs nil
  "SchemeBBS client."
  :group 'applications
  :prefix "sbbs-")

(defcustom sbbs-boards
................................................................................
  "Face for code blocks in threads.")

(defface sbbs--post-header-face
  '((nil :extend t
         :inherit highlight))
  "Face for post headers in the thread view.")

 
;;; VARIABLES

(defvar-local sbbs--board nil
  "Buffer local reference to current board.

See `sbbs-make-board'.")

(defvar-local sbbs--thread-id nil
................................................................................

(defvar-local sbbs--limit-stack nil
  "Stack of last limit specs.")

(defvar-local sbbs--last-spoiler nil
  "Point of last spoiler visited.")

 
;;; BOARD OBJECT AND FUNCTIONS

(defun sbbs-make-board (domain name &optional tls)
  "Create board object, using DOMAIN, NAME and TLS flag."
  (vector domain name tls))

(defsubst sbbs--board-domain (board)
  "Get domain part of a BOARD object."
................................................................................
                               (sbbs--board-name def))
                     "Board: ")
                   boards nil t "/" nil def)))
      (if (stringp choice)
          (cdr (assoc choice boards))
        choice))))

 
;;; UTILITY FUNCTIONS

(defun sbbs--reload-thread (&optional _ignore-auto _noconfirm)
  "Function to reload an opened thread."
  (when sbbs--thread-id (sbbs-view-open sbbs--thread-id)))

(defun sbbs--reload-board ()
  "Function to regenerate thread index.
................................................................................
            ((> nr current) (setq up (point))))))
  (unless (and (eq 'highlight (get-text-property (point) 'face))
               (looking-at-p "\\`#[[:digit:]]+"))
    ;; in case we are on the first character of a post, we shouldn't
    ;; jump back, since that would mean setting to point to NR-1.
    (sbbs-read-previous 1)))

 
;;; UI GENERATOR

(defconst sbbs--link-regexp
  (rx-to-string
   `(: bos
       (or (: "/" (group-n 2 (+ alnum))
              "/" (group-n 3 (+ digit))
              "/" (group-n 4 (: (+ digit) (? "-" (+ digit)))
................................................................................
         (setq sbbs--last-spoiler (point)))
        (sbbs--last-spoiler
         (dolist (o (overlays-at sbbs--last-spoiler))
           (when (overlay-get o 'sbbs-uncover-p)
             (delete-overlay o)))
         (setq sbbs--last-spoiler nil))))

 
;;; URL.EL CALLBACKS

(defun sbbs--fix-encoding ()
  "Convert the raw response after point to utf-8."
  (save-excursion
    ;; see http://textboard.org/prog/39/263
    (set-buffer-multibyte nil)
    (while (search-forward-regexp
................................................................................
          (delete-blank-lines)
          (when range
            (sbbs--limit-to-range range))
          (if sbbs-open-at-last-post
              (sbbs-goto-end)
            (goto-char (point-min))))))))

 
;;; INTERACTIVE FUNCTIONS

(defun sbbs-show-all ()
  "Show all hidden posts."
  (interactive)
  (sbbs-show-pop -1))

(defun sbbs-show-pop (&optional n)
................................................................................
        (url-retrieve url #'sbbs--board-loader
                      (list (current-buffer)))
        (switch-to-buffer (current-buffer))))))

;;;###autoload
(defalias 'sbbs #'sbbs-browse)

 
;;; MAJOR MODES

(defvar sbbs-view-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "RET") #'sbbs-view-open)
    (define-key map (kbd "c") #'sbbs-view-compose)
    map))