comparison lisp/hyperbole/kotl/klink.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 131b0175ea99
children 8619ce7e4c50
comparison
equal deleted inserted replaced
99:2d83cbd90d8d 100:4be1180a9e89
6 ;; KEYWORDS: extensions, hypermedia, outlines, wp 6 ;; KEYWORDS: extensions, hypermedia, outlines, wp
7 ;; 7 ;;
8 ;; AUTHOR: Bob Weiner & Kellie Clark 8 ;; AUTHOR: Bob Weiner & Kellie Clark
9 ;; 9 ;;
10 ;; ORIG-DATE: 15-Nov-93 at 12:15:16 10 ;; ORIG-DATE: 15-Nov-93 at 12:15:16
11 ;; LAST-MOD: 1-Nov-95 at 23:07:37 by Bob Weiner 11 ;; LAST-MOD: 6-Jan-97 at 19:00:58 by Bob Weiner
12 ;; 12 ;;
13 ;; DESCRIPTION: 13 ;; DESCRIPTION:
14 ;; 14 ;;
15 ;;; link = 15 ;;; link =
16 ;; < pathname [, cell-ref] [, position] > 16 ;; < pathname [, cell-ref] [, position] >
100 (cell-ref (insert "<@ " cell-ref ">")) 100 (cell-ref (insert "<@ " cell-ref ">"))
101 (t (error "(klink:create) Invalid reference, '%s'" reference))))) 101 (t (error "(klink:create) Invalid reference, '%s'" reference)))))
102 102
103 (defun klink:at-p () 103 (defun klink:at-p ()
104 "Return non-nil iff point is within a klink. 104 "Return non-nil iff point is within a klink.
105 See documentation for the `link-to-kotl' function for valid klink formats. 105 See documentation for the `actypes::link-to-kotl' function for valid klink
106 Value returned is a list of: link-label, link-start-position, and 106 formats. Value returned is a list of: link-label, link-start-position, and
107 link-end-position, (including delimiters)." 107 link-end-position, (including delimiters)."
108 (let (bol klink referent) 108 (let (bol klink referent)
109 (if (and 109 (if (and
110 ;; If this is an OO-Browser listing buffer, ignore anything that 110 ;; If this is an OO-Browser listing buffer, ignore anything that
111 ;; looks like a klink, e.g. a C++ <template> class. 111 ;; looks like a klink, e.g. a C++ <template> class.
125 ;; Don't match to \<(explicit)> Hyperbole buttons 125 ;; Don't match to \<(explicit)> Hyperbole buttons
126 (/= (char-after (1+ (point))) ?\())) 126 (/= (char-after (1+ (point))) ?\()))
127 (setq klink (hbut:label-p t "<" ">" t)) 127 (setq klink (hbut:label-p t "<" ">" t))
128 (stringp (setq referent (car klink))) 128 (stringp (setq referent (car klink)))
129 ;; Eliminate matches to e-mail address like, <user@domain>. 129 ;; Eliminate matches to e-mail address like, <user@domain>.
130 (not (string-match "[^<> \t\n][!&@]" referent))) 130 (not (string-match "[^<> \t\n][!&@]" referent))
131 ;; Eliminate matches to URLs
132 (not (string-match "\\`[a-zA-Z]+:" referent))
133 ;; Don't match to <HTML> and </SGML> tags.
134 (not (and (memq major-mode
135 (if (boundp 'id-select-markup-modes)
136 id-select-markup-modes
137 '(html-mode sgml-mode)))
138 ;; Assume , followed by a number is a klink.
139 (not (string-match ",\\s *[0-9]" referent))
140 (string-match "\\`[a-zA-Z!/]" referent))))
131 klink))) 141 klink)))
132 142
133 ;;; ************************************************************************ 143 ;;; ************************************************************************
134 ;;; Hyperbole type definitions 144 ;;; Hyperbole type definitions
135 ;;; ************************************************************************ 145 ;;; ************************************************************************