aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-06-01 11:38:36 +0800
committerLeo Liu2013-06-01 11:38:36 +0800
commitc75c93c7edffdc9592ac0e37bbba35dc5838b09c (patch)
treef7f333191a06f3130ba6d31172e3609a7dc429b2
parentda9aff1154d9bf612067f1f0cb05fb0ad865d3ce (diff)
downloademacs-c75c93c7edffdc9592ac0e37bbba35dc5838b09c.tar.gz
emacs-c75c93c7edffdc9592ac0e37bbba35dc5838b09c.zip
* progmodes/octave.el (octave-mode-syntax-table): Give `.'
punctuation syntax. (inferior-octave-minimal-columns) (inferior-octave-last-column-width): New variables. (inferior-octave-track-window-width-change): New function. (inferior-octave-mode): Adjust column width so that Octave output, for example from 'ls', can fit into the window nicely.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/octave.el34
2 files changed, 35 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d87b9960d49..1743e8b64c5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12013-06-01 Leo Liu <sdl.web@gmail.com>
2
3 * progmodes/octave.el (octave-mode-syntax-table): Give `.'
4 punctuation syntax.
5 (inferior-octave-minimal-columns)
6 (inferior-octave-last-column-width): New variables.
7 (inferior-octave-track-window-width-change): New function.
8 (inferior-octave-mode): Adjust column width so that Octave output,
9 for example from 'ls', can fit into the window nicely.
10
12013-05-31 Dmitry Gutov <dgutov@yandex.ru> 112013-05-31 Dmitry Gutov <dgutov@yandex.ru>
2 12
3 * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): 13 * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p):
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index bacd37b3d3c..c6e19fe3a15 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -191,10 +191,9 @@ parenthetical grouping.")
191 (modify-syntax-entry ?! "." table) 191 (modify-syntax-entry ?! "." table)
192 (modify-syntax-entry ?\\ "." table) 192 (modify-syntax-entry ?\\ "." table)
193 (modify-syntax-entry ?\' "." table) 193 (modify-syntax-entry ?\' "." table)
194 ;; Was "w" for abbrevs, but now that it's not necessary any more,
195 (modify-syntax-entry ?\` "." table) 194 (modify-syntax-entry ?\` "." table)
195 (modify-syntax-entry ?. "." table)
196 (modify-syntax-entry ?\" "\"" table) 196 (modify-syntax-entry ?\" "\"" table)
197 (modify-syntax-entry ?. "_" table)
198 (modify-syntax-entry ?_ "_" table) 197 (modify-syntax-entry ?_ "_" table)
199 ;; The "b" flag only applies to the second letter of the comstart 198 ;; The "b" flag only applies to the second letter of the comstart
200 ;; and the first letter of the comend, i.e. the "4b" below is ineffective. 199 ;; and the first letter of the comend, i.e. the "4b" below is ineffective.
@@ -676,13 +675,16 @@ in the Inferior Octave buffer.")
676 (setq-local eldoc-documentation-function 'octave-eldoc-function) 675 (setq-local eldoc-documentation-function 'octave-eldoc-function)
677 676
678 (setq comint-input-ring-file-name 677 (setq comint-input-ring-file-name
679 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist") 678 (or (getenv "OCTAVE_HISTFILE") "~/.octave_hist")
680 comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024)) 679 comint-input-ring-size (or (getenv "OCTAVE_HISTSIZE") 1024))
681 (setq-local comint-dynamic-complete-functions 680 (setq-local comint-dynamic-complete-functions
682 inferior-octave-dynamic-complete-functions) 681 inferior-octave-dynamic-complete-functions)
683 (setq-local comint-prompt-read-only inferior-octave-prompt-read-only) 682 (setq-local comint-prompt-read-only inferior-octave-prompt-read-only)
684 (add-hook 'comint-input-filter-functions 683 (add-hook 'comint-input-filter-functions
685 'inferior-octave-directory-tracker nil t) 684 'inferior-octave-directory-tracker nil t)
685 ;; http://thread.gmane.org/gmane.comp.gnu.octave.general/48572
686 (add-hook 'window-configuration-change-hook
687 'inferior-octave-track-window-width-change nil t)
686 (comint-read-input-ring t)) 688 (comint-read-input-ring t))
687 689
688;;;###autoload 690;;;###autoload
@@ -913,6 +915,24 @@ directory and makes this the current buffer's default directory."
913 (inferior-octave-send-list-and-digest '("disp (pwd ())\n")) 915 (inferior-octave-send-list-and-digest '("disp (pwd ())\n"))
914 (cd (car inferior-octave-output-list))) 916 (cd (car inferior-octave-output-list)))
915 917
918(defcustom inferior-octave-minimal-columns 80
919 "The minimal column width for the inferior Octave process."
920 :type 'integer
921 :group 'octave
922 :version "24.4")
923
924(defvar inferior-octave-last-column-width nil)
925
926(defun inferior-octave-track-window-width-change ()
927 ;; http://thread.gmane.org/gmane.comp.gnu.octave.general/48572
928 (let ((width (max inferior-octave-minimal-columns (window-width))))
929 (unless (eq inferior-octave-last-column-width width)
930 (setq-local inferior-octave-last-column-width width)
931 (when (and inferior-octave-process
932 (process-live-p inferior-octave-process))
933 (inferior-octave-send-list-and-digest
934 (list (format "putenv(\"COLUMNS\", \"%s\");\n" width)))))))
935
916 936
917;;; Miscellaneous useful functions 937;;; Miscellaneous useful functions
918 938
@@ -1639,11 +1659,7 @@ if ismember(exist(\"%s\"), [2 3 5 103]) print_usage(\"%s\") endif\n"
1639 (when (re-search-forward "^\\s-*See also:" nil t) 1659 (when (re-search-forward "^\\s-*See also:" nil t)
1640 (let ((end (save-excursion (re-search-forward "^\\s-*$" nil t)))) 1660 (let ((end (save-excursion (re-search-forward "^\\s-*$" nil t))))
1641 (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" end t) 1661 (while (re-search-forward "\\_<\\(?:\\sw\\|\\s_\\)+\\_>" end t)
1642 (make-text-button (match-beginning 0) 1662 (make-text-button (match-beginning 0) (match-end 0)
1643 ;; If the match ends with . exclude it.
1644 (if (eq (char-before (match-end 0)) ?.)
1645 (1- (match-end 0))
1646 (match-end 0))
1647 :type 'octave-help-function))))) 1663 :type 'octave-help-function)))))
1648 (octave-help-mode))))) 1664 (octave-help-mode)))))
1649 1665