aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-05-27 13:08:04 +0800
committerLeo Liu2013-05-27 13:08:04 +0800
commit837fd9af07fa66cd711a3979b5f121ec39dc1112 (patch)
treec9a1b09598dbd70c456c6dc0be146e041cf8d8d3
parent2d8ac645c23cde0b8dbe093d56b2ea183609d6bc (diff)
downloademacs-837fd9af07fa66cd711a3979b5f121ec39dc1112.tar.gz
emacs-837fd9af07fa66cd711a3979b5f121ec39dc1112.zip
* 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'.
-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 @@
12013-05-27 Leo Liu <sdl.web@gmail.com>
2
3 * progmodes/octave.el (inferior-octave-directory-tracker-resync):
4 New variable.
5 (inferior-octave-directory-tracker): Automatically re-sync
6 default-directory.
7 (octave-help): Improve handling of 'See also'.
8
12013-05-27 Stefan Monnier <monnier@iro.umontreal.ca> 92013-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 10
3 * doc-view.el: Minor naming convention tweaks. 11 * 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'."
885 (setq list (cdr list))) 885 (setq list (cdr list)))
886 (set-process-filter proc filter)))) 886 (set-process-filter proc filter))))
887 887
888(defvar inferior-octave-directory-tracker-resync nil)
889(make-variable-buffer-local 'inferior-octave-directory-tracker-resync)
890
888(defun inferior-octave-directory-tracker (string) 891(defun inferior-octave-directory-tracker (string)
889 "Tracks `cd' commands issued to the inferior Octave process. 892 "Tracks `cd' commands issued to the inferior Octave process.
890Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused." 893Use \\[inferior-octave-resync-dirs] to resync if Emacs gets confused."
894 (when inferior-octave-directory-tracker-resync
895 (setq inferior-octave-directory-tracker-resync nil)
896 (inferior-octave-resync-dirs))
891 (cond 897 (cond
892 ((string-match "^[ \t]*cd[ \t;]*$" string) 898 ((string-match "^[ \t]*cd[ \t;]*$" string)
893 (cd "~")) 899 (cd "~"))
894 ((string-match "^[ \t]*cd[ \t]+\\([^ \t\n;]*\\)[ \t\n;]*" string) 900 ((string-match "^[ \t]*cd[ \t]+\\([^ \t\n;]*\\)[ \t\n;]*" string)
895 (with-demoted-errors ; in case directory doesn't exist 901 (condition-case err
896 (cd (substring string (match-beginning 1) (match-end 1))))))) 902 (cd (match-string 1 string))
903 (error (setq inferior-octave-directory-tracker-resync t)
904 (message "%s: `%s'"
905 (error-message-string err)
906 (match-string 1 string)))))))
897 907
898(defun inferior-octave-resync-dirs () 908(defun inferior-octave-resync-dirs ()
899 "Resync the buffer's idea of the current directory. 909 "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"
1627 ;; Make 'See also' clickable 1637 ;; Make 'See also' clickable
1628 (with-syntax-table octave-mode-syntax-table 1638 (with-syntax-table octave-mode-syntax-table
1629 (when (re-search-forward "^\\s-*See also:" nil t) 1639 (when (re-search-forward "^\\s-*See also:" nil t)
1630 (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" nil t) 1640 (let ((end (or (save-excursion (re-search-forward "^\\s-*$" nil t))
1631 (make-text-button (match-beginning 0) 1641 (point-max))))
1632 (match-end 0) 1642 (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" end t)
1633 :type 'octave-help-function)))) 1643 (make-text-button (match-beginning 0)
1644 ;; If the match ends with . exclude it.
1645 (if (eq (char-before (match-end 0)) ?.)
1646 (1- (match-end 0))
1647 (match-end 0))
1648 :type 'octave-help-function)))))
1634 (octave-help-mode))))) 1649 (octave-help-mode)))))
1635 1650
1636(defcustom octave-source-directories nil 1651(defcustom octave-source-directories nil