sbbs.el

Check-in [a8434e7370]
Login
Overview
Comment:Untabify region in 'sbbs--parse-number-range'
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: a8434e737086eada88ce99b2f3f00bfa240180188627e943823da8f0b0008b54
User & Date: zge on 2024-03-01 22:00:03
Other Links: branch diff | manifest | tags
Context
2024-03-01
22:00
Rework directory local variables check-in: 303773e90d user: zge tags: master, trunk
22:00
Untabify region in 'sbbs--parse-number-range' check-in: a8434e7370 user: zge tags: master, trunk
2024-02-29
20:07
Fix detection of references in 'sbbs-show-replies' The 'sbbs-ref' property was not stored in the overlay, but as a text-property inside the buffer. For that reason, it would always find no references, even if there were references in the same thread. check-in: 830ca8047f user: zge tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified sbbs.el from [a0ab64dda3] to [1635b42a7e].

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))
                                      (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 ",")))))

(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))







|
|
|
|

|
|
|
|







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))
                                      (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 ",")))))

(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))