aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2013-04-30 08:31:50 +0200
committerJoakim Verona2013-04-30 08:31:50 +0200
commit7a1bee4a713304afdf8e58f31f59d3572fa00063 (patch)
tree509b38118c25728eb2ea8ebcb2220da706d8459d /lisp
parent23e7d63bcc222e40e6063b6799de50544af8d70b (diff)
parent38d8527bab7f84b94d2e0a759e25a64f33838257 (diff)
downloademacs-7a1bee4a713304afdf8e58f31f59d3572fa00063.tar.gz
emacs-7a1bee4a713304afdf8e58f31f59d3572fa00063.zip
auto upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/calc/calc.el2
-rw-r--r--lisp/progmodes/octave.el134
3 files changed, 97 insertions, 64 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 163f2495849..abfd6153288 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,28 @@
12013-04-29 Leo Liu <sdl.web@gmail.com>
2
3 * progmodes/octave.el (octave-font-lock-keywords): Handle 'end' in
4 indexing expression.
5 (octave-continuation-string): Do not use \.
6 (inferior-octave-complete-impossible): Remove.
7 (inferior-octave-completion-table)
8 (inferior-octave-completion-at-point): Remove its uses.
9 (inferior-octave-startup): completion_matches was introduced to
10 Octave in 1996 so safe to assume it.
11 (octave-function-file-comment): Improve to follow how Octave does it.
12 (octave-update-function-file-comment): Tweak.
13
142013-04-29 Leo Liu <sdl.web@gmail.com>
15
16 * progmodes/octave.el (inferior-octave-startup-hook): Obsolete.
17 (inferior-octave-startup): Remove inferior-octave-startup-hook.
18 (octave-function-file-comment): Fix typo.
19 (octave-sync-function-file-names): Use read-char-choice.
20
212013-04-28 Jay Belanger <jay.p.belanger@gmail.com>
22
23 * calc/calc.el (math-normalize): Don't set `math-normalize-error'
24 to t for the less important warnings.
25
12013-04-27 Darren Hoo <darren.hoo@gmail.com> (tiny change) 262013-04-27 Darren Hoo <darren.hoo@gmail.com> (tiny change)
2 27
3 * isearch.el (isearch-fail-pos): Check for empty `cmds'. (Bug#14268) 28 * isearch.el (isearch-fail-pos): Check for empty `cmds'. (Bug#14268)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index c35e7650254..bd5c9089bcc 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -2701,7 +2701,6 @@ largest Emacs integer.")
2701 (cons (car math-normalize-a) args)) 2701 (cons (car math-normalize-a) args))
2702 nil) 2702 nil)
2703 (wrong-type-argument 2703 (wrong-type-argument
2704 (setq math-normalize-error t)
2705 (or calc-next-why 2704 (or calc-next-why
2706 (calc-record-why "Wrong type of argument" 2705 (calc-record-why "Wrong type of argument"
2707 (cons (car math-normalize-a) args))) 2706 (cons (car math-normalize-a) args)))
@@ -2712,7 +2711,6 @@ largest Emacs integer.")
2712 (cons (car math-normalize-a) args)) 2711 (cons (car math-normalize-a) args))
2713 nil) 2712 nil)
2714 (inexact-result 2713 (inexact-result
2715 (setq math-normalize-error t)
2716 (calc-record-why "No exact representation for result" 2714 (calc-record-why "No exact representation for result"
2717 (cons (car math-normalize-a) args)) 2715 (cons (car math-normalize-a) args))
2718 nil) 2716 nil)
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index b8fbe6a90a7..30b520b75a0 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -155,6 +155,17 @@ parenthetical grouping.")
155 octave-text-functions)) 155 octave-text-functions))
156 "\\)\\_>") 156 "\\)\\_>")
157 'font-lock-keyword-face) 157 'font-lock-keyword-face)
158 ;; Note: 'end' also serves as the last index in an indexing expression.
159 ;; Ref: http://www.mathworks.com/help/matlab/ref/end.html
160 '("\\_<end\\_>" (0 (save-excursion
161 (condition-case nil
162 (progn
163 (goto-char (match-beginning 0))
164 (backward-up-list)
165 (unless (eq (char-after) ?\()
166 font-lock-keyword-face))
167 (error font-lock-keyword-face)))
168 t))
158 ;; Fontify all builtin operators. 169 ;; Fontify all builtin operators.
159 (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)" 170 (cons "\\(&\\||\\|<=\\|>=\\|==\\|<\\|>\\|!=\\|!\\)"
160 (if (boundp 'font-lock-builtin-face) 171 (if (boundp 'font-lock-builtin-face)
@@ -321,15 +332,17 @@ newline or semicolon after an else or end keyword."
321 "Extra indentation applied to Octave continuation lines." 332 "Extra indentation applied to Octave continuation lines."
322 :type 'integer 333 :type 'integer
323 :group 'octave) 334 :group 'octave)
335
324(eval-and-compile 336(eval-and-compile
325 (defconst octave-continuation-marker-regexp "\\\\\\|\\.\\.\\.")) 337 (defconst octave-continuation-marker-regexp "\\\\\\|\\.\\.\\."))
338
326(defvar octave-continuation-regexp 339(defvar octave-continuation-regexp
327 (concat "[^#%\n]*\\(" octave-continuation-marker-regexp 340 (concat "[^#%\n]*\\(" octave-continuation-marker-regexp
328 "\\)\\s-*\\(\\s<.*\\)?$")) 341 "\\)\\s-*\\(\\s<.*\\)?$"))
329(defcustom octave-continuation-string "\\" 342
330 "Character string used for Octave continuation lines. Normally \\." 343;; Char \ is considered a bad decision for continuing a line.
331 :type 'string 344(defconst octave-continuation-string "..."
332 :group 'octave) 345 "Character string used for Octave continuation lines.")
333 346
334(defvar octave-mode-imenu-generic-expression 347(defvar octave-mode-imenu-generic-expression
335 (list 348 (list
@@ -641,10 +654,8 @@ the regular expression `comint-prompt-regexp', a buffer local variable."
641(defvar inferior-octave-output-string nil) 654(defvar inferior-octave-output-string nil)
642(defvar inferior-octave-receive-in-progress nil) 655(defvar inferior-octave-receive-in-progress nil)
643 656
644(defvar inferior-octave-startup-hook nil) 657(define-obsolete-variable-alias 'inferior-octave-startup-hook
645 658 'inferior-octave-mode-hook "24.4")
646(defvar inferior-octave-complete-impossible nil
647 "Non-nil means that `inferior-octave-complete' is impossible.")
648 659
649(defvar inferior-octave-has-built-in-variables nil 660(defvar inferior-octave-has-built-in-variables nil
650 "Non-nil means that Octave has built-in variables.") 661 "Non-nil means that Octave has built-in variables.")
@@ -777,28 +788,20 @@ startup file, `~/.emacs-octave'."
777 'identity inferior-octave-output-list "\n") 788 'identity inferior-octave-output-list "\n")
778 "\n")) 789 "\n"))
779 inferior-octave-output-string)) 790 inferior-octave-output-string))
780 ;; Next, we check whether Octave supports `completion_matches' ...
781 (inferior-octave-send-list-and-digest
782 (list "exist \"completion_matches\"\n"))
783 (setq inferior-octave-complete-impossible
784 (not (string-match "5$" (car inferior-octave-output-list))))
785 791
786 ;; And finally, everything is back to normal. 792 ;; And finally, everything is back to normal.
787 (set-process-filter proc 'inferior-octave-output-filter) 793 (set-process-filter proc 'inferior-octave-output-filter)
788 (run-hooks 'inferior-octave-startup-hook)
789 (run-hooks 'inferior-octave-startup-hook)
790 ;; Just in case, to be sure a cd in the startup file 794 ;; Just in case, to be sure a cd in the startup file
791 ;; won't have detrimental effects. 795 ;; won't have detrimental effects.
792 (inferior-octave-resync-dirs))) 796 (inferior-octave-resync-dirs)))
793 797
794(defun inferior-octave-completion-table () 798(defun inferior-octave-completion-table ()
795 (unless inferior-octave-complete-impossible 799 (completion-table-dynamic
796 (completion-table-dynamic 800 (lambda (command)
797 (lambda (command) 801 (inferior-octave-send-list-and-digest
798 (inferior-octave-send-list-and-digest 802 (list (concat "completion_matches (\"" command "\");\n")))
799 (list (concat "completion_matches (\"" command "\");\n"))) 803 (sort (delete-dups inferior-octave-output-list)
800 (sort (delete-dups inferior-octave-output-list) 804 'string-lessp))))
801 'string-lessp)))))
802 805
803(defun inferior-octave-completion-at-point () 806(defun inferior-octave-completion-at-point ()
804 "Return the data to complete the Octave symbol at point." 807 "Return the data to complete the Octave symbol at point."
@@ -807,13 +810,8 @@ startup file, `~/.emacs-octave'."
807 (save-excursion 810 (save-excursion
808 (skip-syntax-backward "w_" (comint-line-beginning-position)) 811 (skip-syntax-backward "w_" (comint-line-beginning-position))
809 (point)))) 812 (point))))
810 (cond ((eq start end) nil) 813 (when (> end start)
811 (inferior-octave-complete-impossible 814 (list start end (inferior-octave-completion-table)))))
812 (message (concat
813 "Your Octave does not have `completion_matches'. "
814 "Please upgrade to version 2.X."))
815 nil)
816 (t (list start end (inferior-octave-completion-table))))))
817 815
818(define-obsolete-function-alias 'inferior-octave-complete 816(define-obsolete-function-alias 'inferior-octave-complete
819 'completion-at-point "24.1") 817 'completion-at-point "24.1")
@@ -966,25 +964,23 @@ The value is (START END NAME-START NAME-END) of the function."
966 964
967;;; First non-copyright comment block 965;;; First non-copyright comment block
968(defun octave-function-file-comment () 966(defun octave-function-file-comment ()
969 "Beginnning and end positions of the function file comment." 967 "Beginning and end positions of the function file comment."
970 (save-excursion 968 (save-excursion
971 (goto-char (point-min)) 969 (goto-char (point-min))
972 (let ((bound (progn (forward-comment (point-max)) (point)))) 970 ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634
973 (goto-char (point-min)) 971 (while (save-excursion
974 ;; Copyright block: octave/libinterp/parse-tree/lex.ll around line 1634 972 (when (comment-search-forward (point-max) t)
975 (when (save-excursion 973 (when (eq (char-after) ?\{) ; case of block comment
976 (comment-search-forward bound t) 974 (forward-char 1))
977 (when (eq (char-after) ?\{) ; case of block comment 975 (skip-syntax-forward "-")
978 (forward-char 1)) 976 (let ((case-fold-search t))
979 (skip-syntax-forward "-") 977 (looking-at-p "\\(?:copyright\\|author\\)\\_>"))))
980 (let ((case-fold-search t)) 978 (octave-skip-comment-forward (point-max)))
981 (looking-at-p "\\(?:copyright\\|author\\)\\_>"))) 979 (let ((beg (comment-search-forward (point-max) t)))
982 (octave-skip-comment-forward bound)) 980 (when beg
983 (let ((beg (comment-search-forward bound t))) 981 (goto-char beg)
984 (when beg 982 (octave-skip-comment-forward (point-max))
985 (goto-char beg) 983 (list beg (point))))))
986 (octave-skip-comment-forward bound)
987 (list beg (point)))))))
988 984
989(defun octave-sync-function-file-names () 985(defun octave-sync-function-file-names ()
990 "Ensure function name agree with function file name. 986 "Ensure function name agree with function file name.
@@ -994,17 +990,32 @@ See Info node `(octave)Function Files'."
994 (pcase-let ((`(,start ,_end ,name-start ,name-end) 990 (pcase-let ((`(,start ,_end ,name-start ,name-end)
995 (octave-function-file-p))) 991 (octave-function-file-p)))
996 (when (and start name-start) 992 (when (and start name-start)
997 (let ((func (buffer-substring name-start name-end)) 993 (let* ((func (buffer-substring name-start name-end))
998 (file (file-name-sans-extension 994 (file (file-name-sans-extension
999 (file-name-nondirectory buffer-file-name)))) 995 (file-name-nondirectory buffer-file-name)))
1000 (save-excursion 996 (help-form (format "\
1001 (when (and (not (equal file func)) 997a: Use function name `%s'
1002 (progn 998b: Use file name `%s'
1003 (goto-char name-start) 999q: Don't fix\n" func file))
1004 (yes-or-no-p 1000 (c (unless (equal file func)
1005 "Function name different from file name. Fix? "))) 1001 (save-window-excursion
1006 (delete-region name-start name-end) 1002 (help-form-show)
1007 (insert file)))))))) 1003 (read-char-choice
1004 "Which name to use? (a/b/q) " '(?a ?b ?q))))))
1005 (pcase c
1006 (`?a (let ((newname (expand-file-name
1007 (concat func (file-name-extension
1008 buffer-file-name t)))))
1009 (when (or (not (file-exists-p newname))
1010 (yes-or-no-p
1011 (format "Target file %s exists; proceed? " newname)))
1012 (when (file-exists-p buffer-file-name)
1013 (rename-file buffer-file-name newname t))
1014 (set-visited-file-name newname))))
1015 (`?b (save-excursion
1016 (goto-char name-start)
1017 (delete-region name-start name-end)
1018 (insert file)))))))))
1008 1019
1009(defun octave-update-function-file-comment (beg end) 1020(defun octave-update-function-file-comment (beg end)
1010 "Query replace function names in function file comment." 1021 "Query replace function names in function file comment."
@@ -1023,11 +1034,10 @@ See Info node `(octave)Function Files'."
1023 (error "Function name not found"))) 1034 (error "Function name not found")))
1024 (old-func (progn 1035 (old-func (progn
1025 (goto-char beg) 1036 (goto-char beg)
1026 (when (and (re-search-forward 1037 (when (re-search-forward
1027 "usage:\\|@deftypefn" end t) 1038 "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>"
1028 (re-search-forward 1039 (min (line-end-position 4) end)
1029 "[=}]\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" 1040 t)
1030 (line-end-position) t))
1031 (match-string 1)))) 1041 (match-string 1))))
1032 (old-func (read-string (format (if old-func 1042 (old-func (read-string (format (if old-func
1033 "Name to replace (default %s): " 1043 "Name to replace (default %s): "