annotate lisp/hyperbole/hibtypes.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 4be1180a9e89
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hibtypes.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: Hyperbole System Implicit Button Types.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: extensions, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
9 ;; ORG: InfoDock Associates
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
10 ;;
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
11 ;; This file is part of Hyperbole.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
12 ;; Available for use and distribution under the same terms as GNU Emacs.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
13 ;;
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
14 ;; Copyright (C) 1991-1997 Free Software Foundation, Inc.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
15 ;; Developed with support from Motorola Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; ORIG-DATE: 19-Sep-91 at 20:45:31
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
18 ;; LAST-MOD: 20-Feb-97 at 11:17:04 by Bob Weiner
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
19
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (require 'hactypes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Public implicit button types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (run-hooks 'hibtypes:begin-load-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; ========================================================================
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
33 ;;; Use func-menu.el to jump to a function referred to in the same file in
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
34 ;;; which it is defined. Function references across files are handled
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
35 ;;; separately be clauses within the `hkey-alist' variable.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
36 ;;; ========================================================================
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
37
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
38 (defib function-in-buffer ()
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
39 "Return function name defined within this buffer that point is within or after, else nil.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
40 This triggers only when the func-menu.el package has been loaded and the
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
41 current major mode is one handled by func-menu."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
42 (if (and (boundp 'fume-function-name-regexp-alist)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
43 (assq major-mode fume-function-name-regexp-alist)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
44 (not (eq major-mode 'dired-mode))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
45 ;; Not sure if this is defined in early versions of Emacs.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
46 (fboundp 'skip-syntax-backward))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
47 (save-excursion
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
48 (skip-syntax-backward "w_")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
49 (if (looking-at "\\(\\sw\\|\\s_\\)+")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
50 (let ((function-name (buffer-substring (point) (match-end 0)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
51 (start (point))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
52 (end (match-end 0))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
53 function-pos)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
54 (if fume-funclist
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
55 nil
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
56 (fume-set-defaults)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
57 (let ((fume-scanning-message nil))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
58 (fume-rescan-buffer)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
59 (setq function-pos (cdr-safe (assoc function-name fume-funclist)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
60 (if function-pos
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
61 (progn (ibut:label-set function-name start end)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
62 (hact 'function-in-buffer function-name
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
63 function-pos))))))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
64
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
65 ;;; ========================================================================
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ;;; Follows URLs by invoking a browser.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (require 'hsys-w3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;; Handles internal references within an annotated bibliography, delimiters=[]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (defib annot-bib ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "Displays annotated bibliography entries referenced internally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 References must be delimited by square brackets, must begin with a word
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 constituent character, and must not be in buffers whose names begin with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ' ' or '*' character or which do not have an attached file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (and (not (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (let ((chr (aref (buffer-name) 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (not (or (= chr ? ) (= chr ?*))))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
84 ;; Force [PPG-sw-process-id], if defined, to take precedence.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
85 (not (htype:names 'ibtypes 'ppg-sw-process))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (let* ((ref-and-pos (hbut:label-p t "[" "]" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (ref (car ref-and-pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (and ref (= ?w (char-syntax (aref ref 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (progn (ibut:label-set ref-and-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (hact 'annot-bib ref))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;; Summarizes an Internet rfc for random access browsing by section.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defib rfc-toc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 "Summarizes contents of an Internet rfc from anywhere within rfc buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 Each line in summary may be selected to jump to section."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (toc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (opoint (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (if (and (string-match "rfc" (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (progn (setq toc (search-forward "Table of Contents" nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (re-search-forward "^[ \t]*1.0?[ \t]+[^ \t\n]" nil t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (and toc 2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (progn (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (ibut:label-set (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (hact 'rfc-toc (buffer-name) opoint))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;;; Jumps to C/C++ source line associated with Cscope C analyzer output line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (defib cscope ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 "Jumps to C/C++ source line associated with Cscope C analyzer output line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 Requires pre-loading of the cscope.el Lisp library available from the Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 Lisp archives and the commercial cscope program available from UNIX System
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 Laboratories. Otherwise, does nothing."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (and (boundp 'cscope:bname-prefix) ;; (featurep 'cscope)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (stringp cscope:bname-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (string-match (regexp-quote cscope:bname-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (= (match-beginning 0) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (looking-at cscope-output-line-regexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (let (start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (skip-chars-backward "^\n\^M")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (setq start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (skip-chars-forward "^\n\^M")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (setq end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (ibut:label-set (buffer-substring start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (hact 'cscope-interpret-output-line))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ;;; Makes README table of contents entries jump to associated sections.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defib text-toc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "Jumps to the text file section referenced by a table of contents entry at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 File name must contain README and there must be a `Table of Contents' or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 `Contents' label on a line by itself (it may begin with an asterisk),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 preceding the table of contents. Each toc entry must begin with some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 whitespace followed by one or more asterisk characters. Each file section
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 name line must start with one or more asterisk characters at the very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 beginning of the line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (let (section)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (if (and (string-match "README" (buffer-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (if (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "[ \t]+\\*+[ \t]+\\(.*[^ \t]\\)[ \t]*$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (setq section (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (progn (ibut:label-set section (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (save-excursion (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "^\\**[ \t]*\\(Table of \\)Contents[ \t]*$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (hact 'text-toc section))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;;; Makes directory summaries into file list menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (defib dir-summary ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "Detects filename buttons in files named \"MANIFEST\" or \"DIR\".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 Displays selected files. Each file name must be at the beginning of the line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 or may be preceded by some semicolons and must be followed by one or more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 spaces and then another non-space, non-parenthesis, non-brace character."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (if buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (let ((file (file-name-nondirectory buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 entry start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (if (or (string= file "DIR") (string= file "MANIFEST"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 "\\(;+[ \t]*\\)?\\([^(){}* \t\n]+\\)[ \t]+[^(){}* \t\n]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq entry (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (match-beginning 2) (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 start (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 end (match-end 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (if (file-exists-p entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (progn (ibut:label-set entry start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (hact 'link-to-file entry))))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;;; Executes or documents command bindings of brace delimited key sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (require 'hib-kbd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ;;; Makes Internet RFC references retrieve the RFC.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (defib rfc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "Retrieves and displays an Internet rfc referenced at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 Requires ange-ftp or efs when needed for remote retrievals. The following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 formats are recognized: RFC822, rfc-822, and RFC 822. The 'hpath:rfc'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 variable specifies the location from which to retrieve RFCs."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (let ((case-fold-search t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (rfc-num nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (and (not (memq major-mode '(dired-mode monkey-mode)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (boundp 'hpath:rfc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (stringp hpath:rfc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (skip-chars-backward "-rRfFcC0-9")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (if (looking-at "rfc[- ]?\\([0-9]+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (setq rfc-num
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (ibut:label-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (buffer-substring (match-beginning 0) (match-end 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; Ensure ange-ftp is available for retrieving a remote
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; RFC, if need be.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (if (string-match "^/.+:" hpath:rfc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; This is a remote path.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (hpath:ange-ftp-available-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; local path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (hact 'link-to-rfc rfc-num))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;;; Makes Hyperbole mail addresses output Hyperbole envir info.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (defib hyp-address ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "Turns a Hyperbole e-mail list address into an implicit button which inserts Hyperbole environment information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 Useful when sending mail to a Hyperbole mail list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 See also the documentation for `actypes::hyp-config'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (if (memq major-mode (list hmail:composer hnews:composer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (let ((addr (find-tag-default)))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
241 (cond ((set:member addr (list "hyperbole" "hyperbole@infodock.com"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (hact 'hyp-config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ((set:member addr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (list "hyperbole-request"
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
245 "hyperbole-request@infodock.com"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (hact 'hyp-request))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 ;;; Makes source entries in Hyperbole reports selectable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (defib hyp-source ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "Turns source location entries in Hyperbole reports into buttons that jump to the associated location."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (if (looking-at hbut:source-prefix)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (let ((src (hbut:source)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (if src
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (progn (if (not (stringp src)) (setq src (prin1-to-string src)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (ibut:label-set src (point) (progn (end-of-line) (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (hact 'hyp-source src)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;;; Shows man page associated with a man apropos entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (defib man-apropos ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 "Makes man apropos entries display associated man pages when selected."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (let ((nm "[^ \t\n!@,][^ \t\n,]*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 topic)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (and (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 "^\\(\\*[ \t]+[!@]\\)?\\(" nm "[ \t]*,[ \t]*\\)*\\(" nm "\\)[ \t]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 "\\(([-0-9a-zA-z]+)\\)\\(::\\)?[ \t]+-[ \t]+[^ \t\n]"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setq topic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (concat (buffer-substring (match-beginning 3) (match-end 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (buffer-substring (match-beginning 4) (match-end 4))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (ibut:label-set topic (match-beginning 3) (match-end 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (hact 'man-show topic)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 ;;; Follows links to Hyperbole outliner cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (if hyperb:kotl-p (require 'klink))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 ;;; Displays files and directories when double quoted pathname is activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (defib pathname ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 "Makes a delimited, valid pathname display the path entry.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 Also works for delimited and non-delimited ange-ftp and efs pathnames.
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
297 Emacs Lisp library files (filenames that end in .el and .elc) are looked up
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
298 using the load-path directory list.
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
299
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 See `hpath:at-p' function documentation for possible delimiters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 See `hpath:suffixes' variable documentation for suffixes that are added to or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 removed from pathname when searching for a valid match.
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
303 See `hpath:find' function documentation for special file display options."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let ((path (hpath:at-p)))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
305 (cond (path
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
306 (ibut:label-set path)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
307 (hact 'link-to-file path))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
308 ((and (fboundp 'locate-file)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
309 (setq path (or (hargs:delimited "\"" "\"")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
310 ;; Filenames in Info docs
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
311 (hargs:delimited "\`" "\'")
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
312 ;; Filenames in TexInfo docs
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
313 (hargs:delimited "@file{" "}")))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
314 (string-match ".\\.el?c\\'" path))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
315 (ibut:label-set path)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
316 (setq path (locate-file path load-path))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
317 (if path (hact 'link-to-file path))))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 70
diff changeset
318
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;;; Jumps to source line associated with debugger stack frame or breakpoint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ;;; lines. Supports gdb, dbx, and xdb.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (defib debugger-source ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 "Jumps to source line associated with debugger stack frame or breakpoint lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 This works with gdb, dbx, and xdb. Such lines are recognized in any buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (cond ((looking-at ".+ \\(at\\|file\\) \\([^ :]+\\):\\([0-9]+\\)\\.?$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ;; GDB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (let* ((file (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (line-num (buffer-substring (match-beginning 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (match-end 3)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (but-label (concat file ":" line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (setq line-num (string-to-int line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (ibut:label-set but-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (hact 'link-to-file-line file line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 ((looking-at ".+ (file=[^\"\n]+\"\\([^\"\n]+\\)\", line=\\([0-9]+\\),")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 ;; XEmacs assertion failure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (let* ((file (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (line-num (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (but-label (concat file ":" line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (setq line-num (string-to-int line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (ibut:label-set but-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (hact 'link-to-file-line file line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ((looking-at ".+ line \\([0-9]+\\) in \"\\([^\"]+\\)\"$")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; New DBX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (let* ((file (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (line-num (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (but-label (concat file ":" line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (setq line-num (string-to-int line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (ibut:label-set but-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (hact 'link-to-file-line file line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 ((or (looking-at ".+ \\[\"\\([^\"]+\\)\":\\([0-9]+\\),") ;; Old DBX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (looking-at ".+ \\[\\([^: ]+\\): \\([0-9]+\\)\\]")) ;; HP-UX xdb
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (let* ((file (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (line-num (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (but-label (concat file ":" line-num)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (setq line-num (string-to-int line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (ibut:label-set but-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (hact 'link-to-file-line file line-num))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;;; Jumps to source line associated with grep or compilation error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 ;;; With credit to Michael Lipp and Mike Williams for the idea.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (defib grep-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 "Jumps to line associated with grep or compilation error msgs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 Messages are recognized in any buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (if (equal (buffer-name) "*compilation*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (require 'compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;; Make sure we have a parsed error-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (if (eq compilation-error-list t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (progn (compilation-forget-errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (setq compilation-parsing-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (if (not compilation-error-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ;; Emacs V19 incompatibly adds two non-optional arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;; over V18.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (compilation-parse-errors nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (error (compilation-parse-errors)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; Locate and parse grep messages found in any buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (if (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 ;; UNIX C compiler and Introl 68HC11 C compiler errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (looking-at "\\([^ \t\n\^M:]+\\): ?\\([0-9]+\\)[ :]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;; BSO/Tasking 68HC08 C compiler errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (looking-at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 "[a-zA-Z 0-9]+: \\([^ \t\n\^M]+\\) line \\([0-9]+\\)[ \t]*:")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;; UNIX Lint errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (looking-at "[^:]+: \\([^ \t\n\^M:]+\\): line \\([0-9]+\\):")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;; SparcWorks C compiler errors (ends with :)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;; IBM AIX xlc C compiler errors (ends with .)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (looking-at "\"\\([^\"]+\\)\", line \\([0-9]+\\)[:.]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;; Introl as11 assembler errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (looking-at " \\*+ \\([^ \t\n\^M]+\\) - \\([0-9]+\\) ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; perl5: ... at file.c line 10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (looking-at ".+ at \\([^ \t\n]+\\) line +\\([0-9]+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (let* ((file (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (line-num (buffer-substring (match-beginning 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (but-label (concat file ":" line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (source-loc (hbut:key-src t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (if (stringp source-loc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (setq file (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 file (file-name-directory source-loc))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (setq line-num (string-to-int line-num))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (ibut:label-set but-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (hact 'link-to-file-line file line-num))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;;; Jumps to source of Emacs Lisp V19 byte-compiler error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (defib elisp-compiler-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 "Jumps to source code for definition associated with byte-compiler error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 Works when activated anywhere within an error line."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (if (or (equal (buffer-name) "*Compile-Log*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (equal (buffer-name) "*compilation*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (and (re-search-backward "^[^ \t\n\r]" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (looking-at "While compiling"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (let (src buffer-p label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (and (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (re-search-backward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 "^While compiling [^\t\n]+ in \\(file\\|buffer\\) \\([^ \n]+\\):$"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (setq buffer-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (equal (buffer-substring (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 "buffer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 src (buffer-substring (match-beginning 2) (match-end 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (re-search-backward "^While compiling \\([^ \n]+\\)\\(:$\\| \\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (setq label (buffer-substring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (ibut:label-set label (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 ;; Remove prefix generated by actype and ibtype definitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (setq label (hypb:replace-match-string "[^:]+::" label "" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (hact 'link-to-regexp-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (concat "^\(def[a-z \t]+" (regexp-quote label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 "[ \t\n\(]")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 1 src buffer-p))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ;;; Jumps to source associated with a line of output from 'patch'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (defib patch-msg ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 "Jumps to source code associated with output from the 'patch' program.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 Patch applies diffs to source code."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (if (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (looking-at "Patching \\|Hunk "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (let ((opoint (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (file) line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (cond ((looking-at "Hunk .+ at \\([0-9]+\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (setq line (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (ibut:label-set line (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (if (re-search-backward "^Patching file \\(\\S +\\)" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (setq file (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 ((looking-at "Patching file \\(\\S +\\)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (setq file (buffer-substring (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 line "1")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (ibut:label-set file (match-beginning 1) (match-end 1))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (goto-char opoint)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (if (null file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (setq line (string-to-int line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (hact 'link-to-file-line file line)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;;; Composes mail, in another window, to the e-mail address at point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (defib mail-address ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 "If on an e-mail address in a specific buffer type, mail to that address in another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 Applies to the rolodex match buffer, any buffer attached to a file in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 'rolo-file-list', or any buffer with \"mail\" or \"rolo\" (case-insensitive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 within its name."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (if (or (and (let ((case-fold-search t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (string-match "mail\\|rolo" (buffer-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;; Don't want this to trigger in a mail/news summary buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (not (or (hmail:lister-p) (hnews:lister-p))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (if (boundp 'rolo-display-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (equal (buffer-name) rolo-display-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (and buffer-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 (boundp 'rolo-file-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (set:member (current-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (mapcar 'get-file-buffer rolo-file-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (let ((address (mail-address-at-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (if address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (ibut:label-set address (match-beginning 1) (match-end 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (hact 'mail-other-window nil address))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (defconst mail-address-regexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 "\\([_a-zA-Z][-_a-zA-Z0-9.!@+%]*@[-_a-zA-Z0-9.!@+%]+\\.[a-zA-Z][-_a-zA-Z][-_a-zA-Z]?\\|[a-zA-Z][-_a-zA-Z0-9.!+%]+@[-_a-zA-Z0-9@]+\\)\\($\\|[^a-zA-Z0-9.!@%]\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 "Regexp with group 1 matching an Internet email address.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (defun mail-address-at-p ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 "Return e-mail address, a string, that point is within or nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (skip-chars-backward "^ \t\n\^M\"\'(){}[];<>|")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (if (looking-at mail-address-regexp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (buffer-substring (match-beginning 1) (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;;; Displays Info nodes when double quoted "(file)node" button is activated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defib Info-node ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 "Makes \"(file)node\" buttons display the associated Info node."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (let* ((node-ref-and-pos (hbut:label-p t "\"" "\"" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (node-ref (hpath:is-p (car node-ref-and-pos) nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (and node-ref (string-match "([^\)]+)" node-ref)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (ibut:label-set node-ref-and-pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (hact 'link-to-Info-node node-ref))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;;; Inserts completion into minibuffer or other window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;;; ========================================================================
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (defib completion ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 "Inserts completion at point into minibuffer or other window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (let ((completion (hargs:completion t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (and completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (ibut:label-set completion)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (hact 'completion))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (run-hooks 'hibtypes:end-load-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (provide 'hibtypes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556