sbbs.el

Diff
Login

Differences From Artifact [a0ab64dda3]:

To Artifact [1635b42a7e]:


218
219
220
221
222
223
224
225
226
227
228




229
230
231
232
233




234
235
236
237
238
239
240
218
219
220
221
222
223
224




225
226
227
228
229




230
231
232
233
234
235
236
237
238
239
240







-
-
-
-
+
+
+
+

-
-
-
-
+
+
+
+








(defun sbbs--parse-number-range (desc limit)
  "Generate list of numbers, as specified by DESC.

To avoid memory overflows, limit number of entries to LIMIT."
  (save-match-data
    (apply #'nconc
		   (mapcar
		    (lambda (range)
			  (cond ((string-match "\\`\\([[:digit:]]+\\)-\\([[:digit:]]+\\)\\'" range)
				     (number-sequence (string-to-number (match-string 1 range))
           (mapcar
            (lambda (range)
              (cond ((string-match "\\`\\([[:digit:]]+\\)-\\([[:digit:]]+\\)\\'" range)
                     (number-sequence (string-to-number (match-string 1 range))
                                      (min limit (string-to-number (match-string 2 range)))))
				    ((string-match "\\`\\([[:digit:]]+\\)\\'" range)
				     (list (string-to-number (match-string 1 range))))
				    (t (error "Invalid range"))))
		    (split-string desc ",")))))
                    ((string-match "\\`\\([[:digit:]]+\\)\\'" range)
                     (list (string-to-number (match-string 1 range))))
                    (t (error "Invalid range"))))
            (split-string desc ",")))))

(defun sbbs--read-jump-to (nr)
  "Set point to first character of post with number NR."
  (let ((up (point-min)) (down (point-max)) current)
    (while (progn
             (goto-char (+ up (/ (- down up) 2)))
             (setq current (get-text-property (point) 'sbbs-thread-nr))