aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ.D. Smith2006-11-20 21:41:00 +0000
committerJ.D. Smith2006-11-20 21:41:00 +0000
commit1ada3be2b69995df7b7e9c0cfdbb8b60a0a710b0 (patch)
tree96b4e958ba1c58f0f4d4b9e646ae82462433f4e0
parente08734e296664bbe11f4dd5a151d7f9f17da4615 (diff)
downloademacs-1ada3be2b69995df7b7e9c0cfdbb8b60a0a710b0.tar.gz
emacs-1ada3be2b69995df7b7e9c0cfdbb8b60a0a710b0.zip
(idlwave-html-help-location): Fail gracefully for missing help packages.
(idlwave-help-assistant-open-link): Open full links. (idlwave-help-assistant-help-with-topic): Direct help link.
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/progmodes/idlw-help.el86
2 files changed, 83 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e95791ab82c..fc028549c75 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12006-11-20 J.D. Smith <jdsmith@as.arizona.edu>
2
3 * progmodes/idlw-help.el (idlwave-html-help-location): Fail
4 gracefully for missing help packages.
5 (idlwave-help-assistant-open-link): Open full links.
6 (idlwave-help-assistant-help-with-topic): Direct help link.
7
8 * progmodes/idlwave.el (idlwave-mode): Set
9 add-log-current-defun-function.
10 (idlwave-current-routine-fullname): Added, to support add-log.
11 (idlwave-convert-xml-system-routine-info): Simplify XML parsing
12 to reflect improvements to xml-parse-file.
13 (idlwave-mode-menu-def): New binding for help-with-topic.
14
15 * progmodes/idlw-shell.el (idlwave-shell-filter-directory):
16 Handle extra newlines and spaces.
17 (idlwave-shell-mode-map): Add help-with-topic.
18
12006-11-20 Chong Yidong <cyd@stupidchicken.com> 192006-11-20 Chong Yidong <cyd@stupidchicken.com>
2 20
3 * tutorial.el (tutorial-warning-face): New face. 21 * tutorial.el (tutorial-warning-face): New face.
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index e5726312623..1d370244523 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -6,7 +6,7 @@
6;; Authors: J.D. Smith <jdsmith@as.arizona.edu> 6;; Authors: J.D. Smith <jdsmith@as.arizona.edu>
7;; Carsten Dominik <dominik@science.uva.nl> 7;; Carsten Dominik <dominik@science.uva.nl>
8;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu> 8;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
9;; Version: 6.0_em22 9;; Version: 6.1_em22
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
@@ -307,10 +307,12 @@ Here are all keybindings.
307 (> (length idlwave-html-help-location) 0) 307 (> (length idlwave-html-help-location) 0)
308 idlwave-html-help-location) 308 idlwave-html-help-location)
309 (getenv "IDLWAVE_HELP_LOCATION")))) 309 (getenv "IDLWAVE_HELP_LOCATION"))))
310 (if (file-directory-p syshelp-dir) 310 (if (and syshelp-dir (file-directory-p syshelp-dir))
311 syshelp-dir 311 syshelp-dir
312 (setq help-dir (expand-file-name "idl_html_help" help-dir)) 312 (if help-dir
313 (if (file-directory-p help-dir) help-dir)))) 313 (progn
314 (setq help-dir (expand-file-name "idl_html_help" help-dir))
315 (if (file-directory-p help-dir) help-dir))))))
314 316
315(defvar idlwave-help-assistant-available nil) 317(defvar idlwave-help-assistant-available nil)
316 318
@@ -319,6 +321,7 @@ Here are all keybindings.
319 (let ((sys-dir (idlwave-sys-dir)) 321 (let ((sys-dir (idlwave-sys-dir))
320 (help-loc (idlwave-html-help-location))) 322 (help-loc (idlwave-html-help-location)))
321 (if (or (not (file-directory-p sys-dir)) 323 (if (or (not (file-directory-p sys-dir))
324 (not help-loc)
322 (not (file-directory-p help-loc))) 325 (not (file-directory-p help-loc)))
323 (message 326 (message
324 "HTML help location not found: try setting `idlwave-system-directory' and/or `idlwave-html-help-location'.")) 327 "HTML help location not found: try setting `idlwave-system-directory' and/or `idlwave-html-help-location'."))
@@ -1239,8 +1242,8 @@ IDL assistant.")
1239(defun idlwave-help-assistant-command () 1242(defun idlwave-help-assistant-command ()
1240 (expand-file-name idlwave-help-assistant-command (idlwave-sys-dir))) 1243 (expand-file-name idlwave-help-assistant-command (idlwave-sys-dir)))
1241 1244
1242(defun idlwave-help-assistant-start (&optional link) 1245(defun idlwave-help-assistant-start (&optional full-link)
1243 "Start the IDL Assistant, loading LINK, if passed." 1246 "Start the IDL Assistant, loading link FULL-LINK, if passed."
1244 (when (or (not idlwave-help-assistant-socket) 1247 (when (or (not idlwave-help-assistant-socket)
1245 (not (eq (process-status idlwave-help-assistant-socket) 'open))) 1248 (not (eq (process-status idlwave-help-assistant-socket) 'open)))
1246 (let* ((help-loc (idlwave-html-help-location)) 1249 (let* ((help-loc (idlwave-html-help-location))
@@ -1249,8 +1252,7 @@ IDL assistant.")
1249 (nconc 1252 (nconc
1250 (if (memq system-type '(ms-dos windows-nt)) 1253 (if (memq system-type '(ms-dos windows-nt))
1251 `("-profile" ,(expand-file-name "idl.adp" help-loc))) 1254 `("-profile" ,(expand-file-name "idl.adp" help-loc)))
1252 (if link 1255 (if full-link `("-file" ,full-link))))
1253 `("-file" ,(expand-file-name link help-loc)))))
1254 port) 1256 port)
1255 (if idlwave-help-assistant-socket 1257 (if idlwave-help-assistant-socket
1256 (delete-process idlwave-help-assistant-socket)) 1258 (delete-process idlwave-help-assistant-socket))
@@ -1271,8 +1273,10 @@ IDL assistant.")
1271 (open-network-stream "IDL_ASSISTANT_SOCK" 1273 (open-network-stream "IDL_ASSISTANT_SOCK"
1272 nil "localhost" port)) 1274 nil "localhost" port))
1273 (if (eq (process-status idlwave-help-assistant-socket) 'open) 1275 (if (eq (process-status idlwave-help-assistant-socket) 'open)
1274 (process-send-string idlwave-help-assistant-socket 1276 (progn
1275 (concat "setHelpPath " help-loc "\n")) 1277 (process-send-string idlwave-help-assistant-socket
1278 (concat "setHelpPath " help-loc "\n"))
1279 t)
1276 (idlwave-help-assistant-close) 1280 (idlwave-help-assistant-close)
1277 (error "Cannot communicate with IDL_ASSISTANT")))))) 1281 (error "Cannot communicate with IDL_ASSISTANT"))))))
1278 1282
@@ -1282,17 +1286,57 @@ IDL assistant.")
1282 1286
1283(defun idlwave-help-assistant-open-link (&optional link) 1287(defun idlwave-help-assistant-open-link (&optional link)
1284 ;; Open a link (file name with anchor, no leading path) in the assistant. 1288 ;; Open a link (file name with anchor, no leading path) in the assistant.
1285 (if link 1289 (let ((help-loc (idlwave-html-help-location))
1286 (let ((file (expand-file-name link (idlwave-html-help-location)))) 1290 topic anchor file just-started exists full-link)
1287 (idlwave-help-assistant-start link) 1291
1288 (process-send-string idlwave-help-assistant-socket 1292 (if (string-match "\.html" link)
1289 (concat "openLink " file "\n")) 1293 (setq topic (substring link 0 (match-beginning 0))
1290 (string-match "\.html" link) 1294 anchor (substring link (match-end 0)))
1291 (process-send-string idlwave-help-assistant-socket 1295 (error "Malformed help link."))
1292 (concat "searchIndexNoOpen " 1296
1293 (substring link 0 (match-beginning 0)) 1297 (setq file (expand-file-name (concat topic ".html") help-loc))
1294 "\n"))) 1298 (if (file-exists-p file)
1295 (idlwave-help-assistant-raise))) 1299 (setq exists t)
1300 (setq file (expand-file-name
1301 (concat (upcase topic) ".html") help-loc))
1302 (setq exists (file-exists-p file)))
1303
1304 (setq full-link (concat file anchor)
1305 just-started (idlwave-help-assistant-start (if exists full-link)))
1306 (if exists
1307 (progn
1308 (if (not just-started)
1309 (process-send-string idlwave-help-assistant-socket
1310 (concat "openLink " full-link "\n")))
1311 (process-send-string idlwave-help-assistant-socket
1312 (concat "searchIndexNoOpen " topic "\n")))
1313 (process-send-string idlwave-help-assistant-socket
1314 (concat "searchIndexAndOpen " topic "\n"))))
1315 (idlwave-help-assistant-raise))
1316
1317(defvar idlwave-help-assistant-help-with-topic-history nil
1318 "The history of help topics selected with the minibuffer.")
1319
1320(defun idlwave-help-assistant-help-with-topic (&optional topic)
1321 "Prompt for and provide help with TOPIC."
1322 (interactive)
1323 (let (list)
1324 (unless topic
1325 (idlwave-routines)
1326 (setq list (append (mapcar (lambda (x)
1327 (concat (nth 2 x) (car x)))
1328 idlwave-system-routines)
1329 (mapcar (lambda (x)
1330 (concat "." (car x)))
1331 idlwave-executive-commands-alist)
1332 idlwave-system-class-info))
1333 (setq topic
1334 (idlwave-completing-read
1335 "Help Topic: " list
1336 nil nil nil
1337 'idlwave-help-assistant-help-with-topic-history)))
1338 (if (and topic (not (string= topic "")))
1339 (idlwave-help-assistant-open-link (concat topic ".html")))))
1296 1340
1297(defun idlwave-help-assistant-close () 1341(defun idlwave-help-assistant-close ()
1298 (when (and idlwave-help-assistant-process 1342 (when (and idlwave-help-assistant-process