summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/progmodes/octave.el27
2 files changed, 29 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 76d538f8add..1163711a878 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2013-05-27 Leo Liu <sdl.web@gmail.com>
+
+ * progmodes/octave.el (inferior-octave-directory-tracker-resync):
+ New variable.
+ (inferior-octave-directory-tracker): Automatically re-sync
+ default-directory.
+ (octave-help): Improve handling of 'See also'.
+
2013-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
* doc-view.el: Minor naming convention tweaks.
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 243e3198584..4985f5fb38e 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -885,15 +885,25 @@ output is passed to the filter `inferior-octave-output-digest'."
(setq list (cdr list)))
(set-process-filter proc filter))))
+(defvar inferior-octave-directory-tracker-resync nil)
+(make-variable-buffer-local 'inferior-octave-directory-tracker-resync)
+
(defun inferior-octave-directory-tracker (string)
"Tracks `cd' commands issued to the inferior Octave process.
Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
+ (when inferior-octave-directory-tracker-resync
+ (setq inferior-octave-directory-tracker-resync nil)
+ (inferior-octave-resync-dirs))
(cond
((string-match "^[ \t]*cd[ \t;]*$" string)
(cd "~"))
((string-match "^[ \t]*cd[ \t]+\\([^ \t\n;]*\\)[ \t\n;]*" string)
- (with-demoted-errors ; in case directory doesn't exist
- (cd (substring string (match-beginning 1) (match-end 1)))))))
+ (condition-case err
+ (cd (match-string 1 string))
+ (error (setq inferior-octave-directory-tracker-resync t)
+ (message "%s: `%s'"
+ (error-message-string err)
+ (match-string 1 string)))))))
(defun inferior-octave-resync-dirs ()
"Resync the buffer's idea of the current directory.
@@ -1627,10 +1637,15 @@ if ismember(exist(\"%s\"), [2 3 5 103]) print_usage(\"%s\") endif\n"
;; Make 'See also' clickable
(with-syntax-table octave-mode-syntax-table
(when (re-search-forward "^\\s-*See also:" nil t)
- (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" nil t)
- (make-text-button (match-beginning 0)
- (match-end 0)
- :type 'octave-help-function))))
+ (let ((end (or (save-excursion (re-search-forward "^\\s-*$" nil t))
+ (point-max))))
+ (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" end t)
+ (make-text-button (match-beginning 0)
+ ;; If the match ends with . exclude it.
+ (if (eq (char-before (match-end 0)) ?.)
+ (1- (match-end 0))
+ (match-end 0))
+ :type 'octave-help-function)))))
(octave-help-mode)))))
(defcustom octave-source-directories nil