+2002-07-15 Daiki Ueno <ueno@unixuser.org>
+
+ * liece-url.el (liece-url-regexp-alist): New user option.
+ (liece-url-add-buttons): Respect liece-url-regexp-alist. This
+ function is the slightly modified version of the implementation by
+ akira yamada <akira@arika.org>. [cf. <Liece:00070>]
+
2002-05-19 Daiki Ueno <ueno@unixuser.org>
* liece-xemacs.el (liece-xemacs-modeline-glyph): Check 'xbm.
:type 'alist
:group 'liece-url)
+(defcustom liece-url-regexp-alist nil
+ "Mapping from reegxp to URL.
+This alist is used for defining alternate URL abbrevs.
+For example:
+ (setq liece-url-regexp-alist
+ '((\"\\\\bBug#\\\\([0-9][0-9]*\\\\)\\\\b\" . \"http://bugs.debian.org/\\\\1\")))"
+ :type 'alist
+ :group 'liece-url)
+
(define-widget 'liece-url-link 'link
"A link to an www page."
:help-echo 'widget-url-link-help-echo
(defun liece-url-add-buttons (start end)
(save-excursion
- (goto-char start)
- (while (re-search-forward liece-url-regexp end t)
- (let ((url (match-string 0)))
- (if liece-highlight-mode
- (liece-widget-convert-button
- 'url-link (match-beginning 0)(match-end 0) url))
- (unless (assoc url liece-url-alist)
- (push (list url) liece-url-alist)
- (run-hook-with-args 'liece-add-url-functions url))))))
+ (let ((pairs (cons (cons liece-url-regexp t)
+ liece-url-regexp-alist)))
+ (dolist (pair pairs)
+ (goto-char start)
+ (while (re-search-forward (car pair) end t)
+ (let ((url (match-string 0)))
+ (if (stringp (cdr pair))
+ (setq url (save-match-data
+ (string-match (car pair) url)
+ (replace-match (cdr pair) nil nil url)))
+ (if (functionp (cdr pair))
+ (setq url (funcall (cdr pair) url))))
+ (if liece-highlight-mode
+ (liece-widget-convert-button
+ 'url-link (match-beginning 0) (match-end 0) url))
+ (unless (assoc url liece-url-alist)
+ (push (list url) liece-url-alist)
+ (run-hook-with-args 'liece-add-url-functions url))))))))
(defun liece-command-browse-url (&optional url)
(interactive