summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/octave.el72
2 files changed, 45 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 20f293525b4..f7aa1d48fa0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2013-05-05 Leo Liu <sdl.web@gmail.com>
+
+ * progmodes/octave.el (inferior-octave-strip-ctrl-g)
+ (inferior-octave-output-filter): Remove.
+ (octave-send-region, inferior-octave-startup): Fix callers.
+ (inferior-octave-mode-map): Don't use comint-dynamic-complete.
+ (octave-binary-file-extensions): New user variable.
+ (octave-find-definition): Confirm if opening binary files.
+ (octave-help-file): Use octave-find-definition to get the binary
+ confirmation.
+ (octave-help): Adjust for octave-help-file change.
+
2013-05-05 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/pascal.el (pascal-font-lock-keywords): Use backquotes.
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 10f6007204b..6d06f1a2275 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -590,8 +590,9 @@ mode, set this to (\"-q\" \"--traditional\")."
(let ((map (make-sparse-keymap)))
(set-keymap-parent map comint-mode-map)
(define-key map "\M-." 'octave-find-definition)
- (define-key map "\t" 'comint-dynamic-complete)
+ (define-key map "\t" 'completion-at-point)
(define-key map "\C-hd" 'octave-help)
+ ;; Same as in `shell-mode'.
(define-key map "\M-?" 'comint-dynamic-list-filename-completions)
(define-key map "\C-c\C-l" 'inferior-octave-dynamic-list-input-ring)
(define-key map [menu-bar inout list-history]
@@ -730,7 +731,7 @@ startup file, `~/.emacs-octave'."
inferior-octave-output-string))
;; And finally, everything is back to normal.
- (set-process-filter proc 'inferior-octave-output-filter)
+ (set-process-filter proc 'comint-output-filter)
;; Just in case, to be sure a cd in the startup file
;; won't have detrimental effects.
(inferior-octave-resync-dirs)))
@@ -783,21 +784,6 @@ startup file, `~/.emacs-octave'."
(set-window-configuration conf)
(setq unread-command-events (list ch)))))))
-(defun inferior-octave-strip-ctrl-g (string)
- "Strip leading `^G' character.
-If STRING starts with a `^G', ring the bell and strip it."
- (if (string-match "^\a" string)
- (progn
- (ding)
- (setq string (substring string 1))))
- string)
-
-(defun inferior-octave-output-filter (proc string)
- "Standard output filter for the inferior Octave process.
-Ring Emacs bell if process output starts with an ASCII bell, and pass
-the rest to `comint-output-filter'."
- (comint-output-filter proc (inferior-octave-strip-ctrl-g string)))
-
(defun inferior-octave-output-digest (_proc string)
"Special output filter for the inferior Octave process.
Save all output between newlines into `inferior-octave-output-list', and
@@ -1398,27 +1384,26 @@ entered without parens)."
(interactive "r")
(inferior-octave t)
(let ((proc inferior-octave-process)
- (string (buffer-substring-no-properties beg end))
- line)
+ (string (buffer-substring-no-properties beg end))
+ line)
(with-current-buffer inferior-octave-buffer
(setq inferior-octave-output-list nil)
(while (not (string-equal string ""))
- (if (string-match "\n" string)
- (setq line (substring string 0 (match-beginning 0))
- string (substring string (match-end 0)))
- (setq line string string ""))
- (setq inferior-octave-receive-in-progress t)
- (inferior-octave-send-list-and-digest (list (concat line "\n")))
- (while inferior-octave-receive-in-progress
- (accept-process-output proc))
- (insert-before-markers
- (mapconcat 'identity
- (append
- (if octave-send-echo-input (list line) (list ""))
- (mapcar 'inferior-octave-strip-ctrl-g
- inferior-octave-output-list)
- (list inferior-octave-output-string))
- "\n")))))
+ (if (string-match "\n" string)
+ (setq line (substring string 0 (match-beginning 0))
+ string (substring string (match-end 0)))
+ (setq line string string ""))
+ (setq inferior-octave-receive-in-progress t)
+ (inferior-octave-send-list-and-digest (list (concat line "\n")))
+ (while inferior-octave-receive-in-progress
+ (accept-process-output proc))
+ (insert-before-markers
+ (mapconcat 'identity
+ (append
+ (if octave-send-echo-input (list line) (list ""))
+ inferior-octave-output-list
+ (list inferior-octave-output-string))
+ "\n")))))
(if octave-send-show-buffer
(display-buffer inferior-octave-buffer)))
@@ -1482,9 +1467,7 @@ code line."
(define-button-type 'octave-help-file
'follow-link t
'action #'help-button-action
- 'help-function (lambda (fn)
- (find-file fn)
- (octave-goto-function-definition)))
+ 'help-function 'octave-find-definition)
(define-button-type 'octave-help-function
'follow-link t
@@ -1527,7 +1510,7 @@ code line."
(replace-match "" nil nil nil 1)
(insert "`")
(help-insert-xref-button (file-name-nondirectory file)
- 'octave-help-file file)
+ 'octave-help-file fn)
(insert "'")))
;; Make 'See also' clickable
(with-syntax-table octave-mode-syntax-table
@@ -1537,6 +1520,12 @@ code line."
(match-end 0)
:type 'octave-help-function))))))))
+(defcustom octave-binary-file-extensions '("oct" "mex")
+ "A list of binary file extensions for Octave."
+ :type '(repeat string)
+ :group 'octave
+ :version "24.4")
+
(defvar find-tag-marker-ring)
(defun octave-find-definition (fn)
@@ -1552,6 +1541,11 @@ if iskeyword(\"%s\") disp(\"`%s' is a keyword\") else which(\"%s\") endif\n"
(match-string 1 line))))
(if (not file)
(user-error "%s" (or line (format "`%s' not found" fn)))
+ (when (and (member (file-name-extension file)
+ octave-binary-file-extensions)
+ (not (yes-or-no-p (format "File `%s' may be binary; open? "
+ (file-name-nondirectory file)))))
+ (error "Aborted"))
(require 'etags)
(ring-insert find-tag-marker-ring (point-marker))
(find-file file)