Mercurial > emacs
comparison lisp/mh-e/mh-search.el @ 68212:0c77c0b9a620
* mh-comp.el (mh-show-buffer-message-number): Replace (car
(read-from-string string) with (string-to-number string).
* mh-e.el (mh-parse-flist-output-line, mh-folder-size-folder): Ditto.
* mh-mime.el (mh-mml-forward-message): Ditto.
* mh-search.el (mh-swish-next-result, mh-mairix-next-result)
(mh-namazu-next-result, mh-grep-next-result, mh-md5sum-parser)
(mh-openssl-parser, mh-index-update-maps): Ditto.
* mh-seq.el (mh-translate-range, mh-narrow-to-header-field)
(mh-thread-generate): Ditto.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Mon, 16 Jan 2006 20:05:14 +0000 |
parents | 5012e59a73c7 |
children | 37d03b3298bf |
comparison
equal
deleted
inserted
replaced
68211:3299c642df41 | 68212:0c77c0b9a620 |
---|---|
1103 (< (match-end 0) (1- (length s)))) | 1103 (< (match-end 0) (1- (length s)))) |
1104 (format "+%s" | 1104 (format "+%s" |
1105 (substring s (match-end 0) (1- (length s)))) | 1105 (substring s (match-end 0) (1- (length s)))) |
1106 (return 'error))) | 1106 (return 'error))) |
1107 (let* ((s (buffer-substring-no-properties (1+ (point)) end)) | 1107 (let* ((s (buffer-substring-no-properties (1+ (point)) end)) |
1108 (val (ignore-errors (read-from-string s)))) | 1108 (n (ignore-errors (string-to-number s)))) |
1109 (if (and (consp val) (numberp (car val))) | 1109 (if n n (return 'error))) |
1110 (car val) | |
1111 (return 'error))) | |
1112 nil))) | 1110 nil))) |
1113 (forward-line))) | 1111 (forward-line))) |
1114 | 1112 |
1115 ;;; Mairix interface | 1113 ;;; Mairix interface |
1116 | 1114 |
1182 (goto-char start) | 1180 (goto-char start) |
1183 (unless (search-forward mh-user-path end t) | 1181 (unless (search-forward mh-user-path end t) |
1184 (return 'error)) | 1182 (return 'error)) |
1185 (list (format "+%s" (buffer-substring-no-properties | 1183 (list (format "+%s" (buffer-substring-no-properties |
1186 (point) (1- msg-start))) | 1184 (point) (1- msg-start))) |
1187 (car (read-from-string | 1185 (string-to-number |
1188 (buffer-substring-no-properties msg-start end))) | 1186 (buffer-substring-no-properties msg-start end)) |
1189 nil))) | 1187 nil))) |
1190 (forward-line))) | 1188 (forward-line))) |
1191 | 1189 |
1192 (defun mh-mairix-regexp-builder (regexp-list) | 1190 (defun mh-mairix-regexp-builder (regexp-list) |
1193 "Generate query for mairix. | 1191 "Generate query for mairix. |
1311 (string-match mh-user-path file-name) | 1309 (string-match mh-user-path file-name) |
1312 (let* ((folder/msg (substring file-name (match-end 0))) | 1310 (let* ((folder/msg (substring file-name (match-end 0))) |
1313 (mark (mh-search-from-end ?/ folder/msg))) | 1311 (mark (mh-search-from-end ?/ folder/msg))) |
1314 (unless mark (return 'error)) | 1312 (unless mark (return 'error)) |
1315 (list (format "+%s" (substring folder/msg 0 mark)) | 1313 (list (format "+%s" (substring folder/msg 0 mark)) |
1316 (let ((n (ignore-errors (read-from-string | 1314 (let ((n (ignore-errors (string-to-number |
1317 (substring folder/msg (1+ mark)))))) | 1315 (substring folder/msg (1+ mark)))))) |
1318 (if (and (consp n) (numberp (car n))) | 1316 (if n n (return 'error))) |
1319 (car n) | |
1320 (return 'error))) | |
1321 nil)))) | 1317 nil)))) |
1322 (forward-line))) | 1318 (forward-line))) |
1323 | 1319 |
1324 ;;; Pick interface | 1320 ;;; Pick interface |
1325 | 1321 |
1456 (setq msg-end (point)) | 1452 (setq msg-end (point)) |
1457 (unless (search-backward "/" folder-start t) | 1453 (unless (search-backward "/" folder-start t) |
1458 (return 'error)) | 1454 (return 'error)) |
1459 (list (format "+%s" (buffer-substring-no-properties | 1455 (list (format "+%s" (buffer-substring-no-properties |
1460 folder-start (point))) | 1456 folder-start (point))) |
1461 (let ((val (ignore-errors (read-from-string | 1457 (let ((n (ignore-errors (string-to-number |
1462 (buffer-substring-no-properties | 1458 (buffer-substring-no-properties |
1463 (1+ (point)) msg-end))))) | 1459 (1+ (point)) msg-end))))) |
1464 (if (and (consp val) (integerp (car val))) | 1460 (if n n (return 'error))) |
1465 (car val) | |
1466 (return 'error))) | |
1467 match)))) | 1461 match)))) |
1468 (forward-line))) | 1462 (forward-line))) |
1469 | 1463 |
1470 | 1464 |
1471 | 1465 |
1802 first-space last-slash) | 1796 first-space last-slash) |
1803 (setq first-space (search-forward " " end t)) | 1797 (setq first-space (search-forward " " end t)) |
1804 (goto-char end) | 1798 (goto-char end) |
1805 (setq last-slash (search-backward "/" begin t)) | 1799 (setq last-slash (search-backward "/" begin t)) |
1806 (cond ((and first-space last-slash) | 1800 (cond ((and first-space last-slash) |
1807 (cons (car (read-from-string (buffer-substring-no-properties | 1801 (cons (string-to-number (buffer-substring-no-properties |
1808 (1+ last-slash) end))) | 1802 (1+ last-slash) end)) |
1809 (buffer-substring-no-properties begin (1- first-space)))) | 1803 (buffer-substring-no-properties begin (1- first-space)))) |
1810 (t (cons nil nil))))) | 1804 (t (cons nil nil))))) |
1811 | 1805 |
1812 (defun mh-openssl-parser () | 1806 (defun mh-openssl-parser () |
1813 "Parse openssl output." | 1807 "Parse openssl output." |
1816 last-space last-slash) | 1810 last-space last-slash) |
1817 (goto-char end) | 1811 (goto-char end) |
1818 (setq last-space (search-backward " " begin t)) | 1812 (setq last-space (search-backward " " begin t)) |
1819 (setq last-slash (search-backward "/" begin t)) | 1813 (setq last-slash (search-backward "/" begin t)) |
1820 (cond ((and last-slash last-space) | 1814 (cond ((and last-slash last-space) |
1821 (cons (car (read-from-string (buffer-substring-no-properties | 1815 (cons (string-to-number (buffer-substring-no-properties |
1822 (1+ last-slash) (1- last-space)))) | 1816 (1+ last-slash) (1- last-space))) |
1823 (buffer-substring-no-properties (1+ last-space) end)))))) | 1817 (buffer-substring-no-properties (1+ last-space) end)))))) |
1824 | 1818 |
1825 (defalias 'mh-md5-parser 'mh-openssl-parser) | 1819 (defalias 'mh-md5-parser 'mh-openssl-parser) |
1826 | 1820 |
1827 ;;;###mh-autoload | 1821 ;;;###mh-autoload |
1856 (insert mh-user-path (substring folder 1) "/" msg "\n")) | 1850 (insert mh-user-path (substring folder 1) "/" msg "\n")) |
1857 (t | 1851 (t |
1858 ;; update maps | 1852 ;; update maps |
1859 (setq checksum (buffer-substring-no-properties | 1853 (setq checksum (buffer-substring-no-properties |
1860 (point) (line-end-position))) | 1854 (point) (line-end-position))) |
1861 (let ((msg (car (read-from-string msg)))) | 1855 (let ((msg (string-to-number msg))) |
1862 (set-buffer folder) | 1856 (set-buffer folder) |
1863 (mh-index-update-single-msg msg checksum origin-map))))) | 1857 (mh-index-update-single-msg msg checksum origin-map))))) |
1864 (forward-line)))) | 1858 (forward-line)))) |
1865 ;; Run checksum program if needed | 1859 ;; Run checksum program if needed |
1866 (unless (and (eobp) (bobp)) | 1860 (unless (and (eobp) (bobp)) |