[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112423: * progmodes/octave.el (octav
From: |
Leo Liu |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112423: * progmodes/octave.el (octave-font-lock-keywords): Handle 'end' in |
Date: |
Tue, 30 Apr 2013 04:09:18 +0800 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112423
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Tue 2013-04-30 04:09:18 +0800
message:
* progmodes/octave.el (octave-font-lock-keywords): Handle 'end' in
indexing expression.
(octave-continuation-string): Do not use \.
(inferior-octave-complete-impossible): Remove.
(inferior-octave-completion-table)
(inferior-octave-completion-at-point): Remove its uses.
(inferior-octave-startup): completion_matches was introduced to
Octave in 1996 so safe to assume it.
(octave-function-file-comment): Improve to follow how Octave does it.
(octave-update-function-file-comment): Tweak.
modified:
lisp/ChangeLog
lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-04-29 04:37:36 +0000
+++ b/lisp/ChangeLog 2013-04-29 20:09:18 +0000
@@ -1,5 +1,18 @@
2013-04-29 Leo Liu <address@hidden>
+ * progmodes/octave.el (octave-font-lock-keywords): Handle 'end' in
+ indexing expression.
+ (octave-continuation-string): Do not use \.
+ (inferior-octave-complete-impossible): Remove.
+ (inferior-octave-completion-table)
+ (inferior-octave-completion-at-point): Remove its uses.
+ (inferior-octave-startup): completion_matches was introduced to
+ Octave in 1996 so safe to assume it.
+ (octave-function-file-comment): Improve to follow how Octave does it.
+ (octave-update-function-file-comment): Tweak.
+
+2013-04-29 Leo Liu <address@hidden>
+
* progmodes/octave.el (inferior-octave-startup-hook): Obsolete.
(inferior-octave-startup): Remove inferior-octave-startup-hook.
(octave-function-file-comment): Fix typo.
=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el 2013-04-29 04:37:36 +0000
+++ b/lisp/progmodes/octave.el 2013-04-29 20:09:18 +0000
@@ -155,6 +155,17 @@
octave-text-functions))
"\\)\\_>")
'font-lock-keyword-face)
+ ;; Note: 'end' also serves as the last index in an indexing expression.
+ ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html
+ '("\\_<end\\_>" (0 (save-excursion
+ (condition-case nil
+ (progn
+ (goto-char (match-beginning 0))
+ (backward-up-list)
+ (unless (eq (char-after) ?\()
+ font-lock-keyword-face))
+ (error font-lock-keyword-face)))
+ t))
;; Fontify all builtin operators.
(cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)"
(if (boundp 'font-lock-builtin-face)
@@ -321,15 +332,17 @@
"Extra indentation applied to Octave continuation lines."
:type 'integer
:group 'octave)
+
(eval-and-compile
(defconst octave-continuation-marker-regexp "\\\\\\|\\.\\.\\."))
+
(defvar octave-continuation-regexp
(concat "[^#%\n]*\\(" octave-continuation-marker-regexp
"\\)\\s-*\\(\\s<.*\\)?$"))
-(defcustom octave-continuation-string "\\"
- "Character string used for Octave continuation lines. Normally \\."
- :type 'string
- :group 'octave)
+
+;; Char \ is considered a bad decision for continuing a line.
+(defconst octave-continuation-string "..."
+ "Character string used for Octave continuation lines.")
(defvar octave-mode-imenu-generic-expression
(list
@@ -644,9 +657,6 @@
(define-obsolete-variable-alias 'inferior-octave-startup-hook
'inferior-octave-mode-hook "24.4")
-(defvar inferior-octave-complete-impossible nil
- "Non-nil means that `inferior-octave-complete' is impossible.")
-
(defvar inferior-octave-has-built-in-variables nil
"Non-nil means that Octave has built-in variables.")
@@ -778,11 +788,6 @@
'identity inferior-octave-output-list "\n")
"\n"))
inferior-octave-output-string))
- ;; Next, we check whether Octave supports `completion_matches' ...
- (inferior-octave-send-list-and-digest
- (list "exist \"completion_matches\"\n"))
- (setq inferior-octave-complete-impossible
- (not (string-match "5$" (car inferior-octave-output-list))))
;; And finally, everything is back to normal.
(set-process-filter proc 'inferior-octave-output-filter)
@@ -791,13 +796,12 @@
(inferior-octave-resync-dirs)))
(defun inferior-octave-completion-table ()
- (unless inferior-octave-complete-impossible
- (completion-table-dynamic
- (lambda (command)
- (inferior-octave-send-list-and-digest
- (list (concat "completion_matches (\"" command "\");\n")))
- (sort (delete-dups inferior-octave-output-list)
- 'string-lessp)))))
+ (completion-table-dynamic
+ (lambda (command)
+ (inferior-octave-send-list-and-digest
+ (list (concat "completion_matches (\"" command "\");\n")))
+ (sort (delete-dups inferior-octave-output-list)
+ 'string-lessp))))
(defun inferior-octave-completion-at-point ()
"Return the data to complete the Octave symbol at point."
@@ -806,13 +810,8 @@
(save-excursion
(skip-syntax-backward "w_" (comint-line-beginning-position))
(point))))
- (cond ((eq start end) nil)
- (inferior-octave-complete-impossible
- (message (concat
- "Your Octave does not have `completion_matches'. "
- "Please upgrade to version 2.X."))
- nil)
- (t (list start end (inferior-octave-completion-table))))))
+ (when (> end start)
+ (list start end (inferior-octave-completion-table)))))
(define-obsolete-function-alias 'inferior-octave-complete
'completion-at-point "24.1")
@@ -968,22 +967,20 @@
"Beginning and end positions of the function file comment."
(save-excursion
(goto-char (point-min))
- (let ((bound (progn (forward-comment (point-max)) (point))))
- (goto-char (point-min))
- ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634
- (when (save-excursion
- (comment-search-forward bound t)
- (when (eq (char-after) ?\{) ; case of block comment
- (forward-char 1))
- (skip-syntax-forward "-")
- (let ((case-fold-search t))
- (looking-at-p "\\(?:copyright\\|author\\)\\_>")))
- (octave-skip-comment-forward bound))
- (let ((beg (comment-search-forward bound t)))
- (when beg
- (goto-char beg)
- (octave-skip-comment-forward bound)
- (list beg (point)))))))
+ ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634
+ (while (save-excursion
+ (when (comment-search-forward (point-max) t)
+ (when (eq (char-after) ?\{) ; case of block comment
+ (forward-char 1))
+ (skip-syntax-forward "-")
+ (let ((case-fold-search t))
+ (looking-at-p "\\(?:copyright\\|author\\)\\_>"))))
+ (octave-skip-comment-forward (point-max)))
+ (let ((beg (comment-search-forward (point-max) t)))
+ (when beg
+ (goto-char beg)
+ (octave-skip-comment-forward (point-max))
+ (list beg (point))))))
(defun octave-sync-function-file-names ()
"Ensure function name agree with function file name.
@@ -1037,11 +1034,10 @@
(error "Function name not found")))
(old-func (progn
(goto-char beg)
- (when (and (re-search-forward
- "usage:\\|@deftypefn" end t)
- (re-search-forward
- "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"
- (line-end-position) t))
+ (when (re-search-forward
+ "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"
+ (min (line-end-position 4) end)
+ t)
(match-string 1))))
(old-func (read-string (format (if old-func
"Name to replace (default %s): "
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112423: * progmodes/octave.el (octave-font-lock-keywords): Handle 'end' in,
Leo Liu <=