aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Sonderfeld2013-09-28 10:30:37 +0800
committerLeo Liu2013-09-28 10:30:37 +0800
commit5af5ed086500a5adb6ac3b10bbc0416b6246d473 (patch)
tree05ae399f0d51e57a3817b5e716742ab9b4f8270f
parent25201ef030764e1dbc1d4c01eb78ba66fb2de1cd (diff)
downloademacs-5af5ed086500a5adb6ac3b10bbc0416b6246d473.tar.gz
emacs-5af5ed086500a5adb6ac3b10bbc0416b6246d473.zip
* lisp/progmodes/octave.el (octave-mode-map): Add key binding for
octave-lookfor. (octave-mode-menu): Add octave-lookfor. (inferior-octave-mode-map, octave-help-mode-map): Bind C-ha to octave-lookfor. (octave-lookfor): New function.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/octave.el30
2 files changed, 39 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e1561b03fd..67bfd2e5c67 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12013-09-28 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
2
3 * lisp/progmodes/octave.el (octave-mode-map): Add key binding for
4 octave-lookfor.
5 (octave-mode-menu): Add octave-lookfor.
6 (inferior-octave-mode-map, octave-help-mode-map): Bind C-ha to
7 octave-lookfor.
8 (octave-lookfor): New function.
9
12013-09-28 Stefan Monnier <monnier@iro.umontreal.ca> 102013-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 * emacs-lisp/cl-macs.el: 12 * emacs-lisp/cl-macs.el:
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index f20a57940be..a5e59b744a6 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -109,6 +109,7 @@ parenthetical grouping.")
109 (define-key map "\C-c/" 'smie-close-block) 109 (define-key map "\C-c/" 'smie-close-block)
110 (define-key map "\C-c;" 'octave-update-function-file-comment) 110 (define-key map "\C-c;" 'octave-update-function-file-comment)
111 (define-key map "\C-hd" 'octave-help) 111 (define-key map "\C-hd" 'octave-help)
112 (define-key map "\C-ha" 'octave-lookfor)
112 (define-key map "\C-c\C-f" 'octave-insert-defun) 113 (define-key map "\C-c\C-f" 'octave-insert-defun)
113 (define-key map "\C-c\C-il" 'octave-send-line) 114 (define-key map "\C-c\C-il" 'octave-send-line)
114 (define-key map "\C-c\C-ib" 'octave-send-block) 115 (define-key map "\C-c\C-ib" 'octave-send-block)
@@ -143,6 +144,7 @@ parenthetical grouping.")
143 ["Start Octave Process" run-octave t] 144 ["Start Octave Process" run-octave t]
144 ["Documentation Lookup" info-lookup-symbol t] 145 ["Documentation Lookup" info-lookup-symbol t]
145 ["Help on Function" octave-help t] 146 ["Help on Function" octave-help t]
147 ["Search help" octave-lookfor t]
146 ["Find Function Definition" octave-find-definition t] 148 ["Find Function Definition" octave-find-definition t]
147 ["Insert Function" octave-insert-defun t] 149 ["Insert Function" octave-insert-defun t]
148 ["Update Function File Comment" octave-update-function-file-comment t] 150 ["Update Function File Comment" octave-update-function-file-comment t]
@@ -634,6 +636,7 @@ mode, include \"-q\" and \"--traditional\"."
634 (define-key map "\M-." 'octave-find-definition) 636 (define-key map "\M-." 'octave-find-definition)
635 (define-key map "\t" 'completion-at-point) 637 (define-key map "\t" 'completion-at-point)
636 (define-key map "\C-hd" 'octave-help) 638 (define-key map "\C-hd" 'octave-help)
639 (define-key map "\C-ha" 'octave-lookfor)
637 ;; Same as in `shell-mode'. 640 ;; Same as in `shell-mode'.
638 (define-key map "\M-?" 'comint-dynamic-list-filename-completions) 641 (define-key map "\M-?" 'comint-dynamic-list-filename-completions)
639 (define-key map "\C-c\C-l" 'inferior-octave-dynamic-list-input-ring) 642 (define-key map "\C-c\C-l" 'inferior-octave-dynamic-list-input-ring)
@@ -1599,6 +1602,7 @@ code line."
1599 (let ((map (make-sparse-keymap))) 1602 (let ((map (make-sparse-keymap)))
1600 (define-key map "\M-." 'octave-find-definition) 1603 (define-key map "\M-." 'octave-find-definition)
1601 (define-key map "\C-hd" 'octave-help) 1604 (define-key map "\C-hd" 'octave-help)
1605 (define-key map "\C-ha" 'octave-lookfor)
1602 map)) 1606 map))
1603 1607
1604(define-derived-mode octave-help-mode help-mode "OctHelp" 1608(define-derived-mode octave-help-mode help-mode "OctHelp"
@@ -1677,6 +1681,32 @@ code line."
1677 :type 'octave-help-function))))) 1681 :type 'octave-help-function)))))
1678 (octave-help-mode))))) 1682 (octave-help-mode)))))
1679 1683
1684(defun octave-lookfor (str &optional all)
1685 "Search for the string STR in all function help strings.
1686If ALL is non-nil search the entire help string else only search the first
1687sentence."
1688 (interactive "sSearch for: \nP")
1689 (inferior-octave-send-list-and-digest
1690 (list (format "lookfor (%s'%s');\n"
1691 (if all "'-all', " "")
1692 str)))
1693 (let ((lines inferior-octave-output-list))
1694 (when (string-match "error: \\(.*\\)$" (car lines))
1695 (error "%s" (match-string 1 (car lines))))
1696 (with-help-window octave-help-buffer
1697 (princ (mapconcat 'identity lines "\n"))
1698 (with-current-buffer octave-help-buffer
1699 ;; Bound to t so that `help-buffer' returns current buffer for
1700 ;; `help-setup-xref'.
1701 (let ((help-xref-following t))
1702 (help-setup-xref (list 'octave-lookfor str all)
1703 (called-interactively-p 'interactive)))
1704 (goto-char (point-min))
1705 (while (re-search-forward "^\\([^[:blank:]]+\\) " nil 'noerror)
1706 (make-text-button (match-beginning 1) (match-end 1)
1707 :type 'octave-help-function))
1708 (octave-help-mode)))))
1709
1680(defcustom octave-source-directories nil 1710(defcustom octave-source-directories nil
1681 "A list of directories for Octave sources. 1711 "A list of directories for Octave sources.
1682If the environment variable OCTAVE_SRCDIR is set, it is searched first." 1712If the environment variable OCTAVE_SRCDIR is set, it is searched first."