emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112739: * progmodes/octave.el (infer


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112739: * progmodes/octave.el (inferior-octave-directory-tracker-resync):
Date: Mon, 27 May 2013 13:08:04 +0800
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112739
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Mon 2013-05-27 13:08:04 +0800
message:
  * 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'.
modified:
  lisp/ChangeLog
  lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-05-27 01:08:43 +0000
+++ b/lisp/ChangeLog    2013-05-27 05:08:04 +0000
@@ -1,3 +1,11 @@
+2013-05-27  Leo Liu  <address@hidden>
+
+       * 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  <address@hidden>
 
        * doc-view.el: Minor naming convention tweaks.

=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el  2013-05-24 19:37:55 +0000
+++ b/lisp/progmodes/octave.el  2013-05-27 05:08:04 +0000
@@ -885,15 +885,25 @@
          (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 @@
         ;; 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]