[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/ada-mode.el
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/ada-mode.el |
Date: |
Fri, 04 Apr 2003 01:22:48 -0500 |
Index: emacs/lisp/progmodes/ada-mode.el
diff -c emacs/lisp/progmodes/ada-mode.el:1.51
emacs/lisp/progmodes/ada-mode.el:1.52
*** emacs/lisp/progmodes/ada-mode.el:1.51 Thu Jun 20 13:40:38 2002
--- emacs/lisp/progmodes/ada-mode.el Tue Feb 4 08:24:33 2003
***************
*** 303,309 ****
Value_1,
Value_2);"
:type 'boolean :group 'ada)
!
(defcustom ada-indent-is-separate t
"*Non-nil means indent 'is separate' or 'is abstract' if on a single line."
:type 'boolean :group 'ada)
--- 303,309 ----
Value_1,
Value_2);"
:type 'boolean :group 'ada)
!
(defcustom ada-indent-is-separate t
"*Non-nil means indent 'is separate' or 'is abstract' if on a single line."
:type 'boolean :group 'ada)
***************
*** 1322,1328 ****
(modes . '(ada-mode))))
(setq ada-align-modes nil)
!
(add-to-list 'ada-align-modes
'(ada-declaration-assign
(regexp . "[^:]\\(\\s-*\\):[^:]")
--- 1322,1328 ----
(modes . '(ada-mode))))
(setq ada-align-modes nil)
!
(add-to-list 'ada-align-modes
'(ada-declaration-assign
(regexp . "[^:]\\(\\s-*\\):[^:]")
***************
*** 1348,1357 ****
(regexp . "\\(\\s-+\\)at\\>")
(modes . '(ada-mode))))
!
(setq align-mode-rules-list ada-align-modes)
))
!
;; Set up the contextual menu
(if ada-popup-key
(define-key ada-mode-map ada-popup-key 'ada-popup-menu))
--- 1348,1357 ----
(regexp . "\\(\\s-+\\)at\\>")
(modes . '(ada-mode))))
!
(setq align-mode-rules-list ada-align-modes)
))
!
;; Set up the contextual menu
(if ada-popup-key
(define-key ada-mode-map ada-popup-key 'ada-popup-menu))
***************
*** 1366,1376 ****
;; beginning of subprograms, not the end.
;; Fix is: redefine a new function ada-which-function, and call it when the
;; major-mode is ada-mode.
!
(unless ada-xemacs
;; This function do not require that we load which-func now.
;; This can be done by the user if he decides to use which-func-mode
!
(defadvice which-function (around ada-which-function activate)
"In Ada buffers, should work with overloaded subprograms, and does not
use imenu."
--- 1366,1376 ----
;; beginning of subprograms, not the end.
;; Fix is: redefine a new function ada-which-function, and call it when the
;; major-mode is ada-mode.
!
(unless ada-xemacs
;; This function do not require that we load which-func now.
;; This can be done by the user if he decides to use which-func-mode
!
(defadvice which-function (around ada-which-function activate)
"In Ada buffers, should work with overloaded subprograms, and does not
use imenu."
***************
*** 1412,1418 ****
(if ada-fill-comment-prefix
(set 'comment-start ada-fill-comment-prefix)
(set 'comment-start "-- "))
!
;; Run this after the hook to give the users a chance to activate
;; font-lock-mode
--- 1412,1418 ----
(if ada-fill-comment-prefix
(set 'comment-start ada-fill-comment-prefix)
(set 'comment-start "-- "))
!
;; Run this after the hook to give the users a chance to activate
;; font-lock-mode
***************
*** 1461,1467 ****
(defun ada-save-exceptions-to-file (file-name)
"Save the exception lists `ada-case-exception' and
`ada-case-exception-substring' to the file FILE-NAME."
!
;; Save the list in the file
(find-file (expand-file-name file-name))
(erase-buffer)
--- 1461,1467 ----
(defun ada-save-exceptions-to-file (file-name)
"Save the exception lists `ada-case-exception' and
`ada-case-exception-substring' to the file FILE-NAME."
!
;; Save the list in the file
(find-file (expand-file-name file-name))
(erase-buffer)
***************
*** 1474,1480 ****
(save-buffer)
(kill-buffer nil)
)
!
(defun ada-create-case-exception (&optional word)
"Defines WORD as an exception for the casing system.
If WORD is not given, then the current word in the buffer is used instead.
--- 1474,1480 ----
(save-buffer)
(kill-buffer nil)
)
!
(defun ada-create-case-exception (&optional word)
"Defines WORD as an exception for the casing system.
If WORD is not given, then the current word in the buffer is used instead.
***************
*** 1625,1638 ****
(save-excursion
(forward-word -1)
!
(unwind-protect
(progn
(modify-syntax-entry ?_ "." (syntax-table))
!
(while substrings
(setq re (concat "\\b" (regexp-quote (caar substrings)) "\\b"))
!
(save-excursion
(while (re-search-forward re max t)
(replace-match (caar substrings))))
--- 1625,1638 ----
(save-excursion
(forward-word -1)
!
(unwind-protect
(progn
(modify-syntax-entry ?_ "." (syntax-table))
!
(while substrings
(setq re (concat "\\b" (regexp-quote (caar substrings)) "\\b"))
!
(save-excursion
(while (re-search-forward re max t)
(replace-match (caar substrings))))
***************
*** 2359,2365 ****
(goto-char column)
(skip-chars-backward " \t")
(list (1- (point)) 0))
!
(if (and (skip-chars-backward " \t")
(= (char-before) ?\n)
(not (forward-comment -10000))
--- 2359,2365 ----
(goto-char column)
(skip-chars-backward " \t")
(list (1- (point)) 0))
!
(if (and (skip-chars-backward " \t")
(= (char-before) ?\n)
(not (forward-comment -10000))
***************
*** 2378,2387 ****
;; or else D) -- indenting this line.
;; ??? This is really a hack, we should have a proper way to go to
;; ??? the beginning of the statement
!
(if (= (char-before) ?\))
(backward-sexp))
!
(if (memq (char-before) '(?, ?\; ?\( ?\)))
(list column 0)
(list column 'ada-continuation-indent)
--- 2378,2387 ----
;; or else D) -- indenting this line.
;; ??? This is really a hack, we should have a proper way to go to
;; ??? the beginning of the statement
!
(if (= (char-before) ?\))
(backward-sexp))
!
(if (memq (char-before) '(?, ?\; ?\( ?\)))
(list column 0)
(list column 'ada-continuation-indent)
***************
*** 2431,2437 ****
(beginning-of-line)
(if (looking-at ada-named-block-re)
(setq label (- ada-label-indent))))))))
!
;; found 'record' =>
;; if the keyword is found at the beginning of a line (or just
;; after limited, we indent on it, otherwise we indent on the
--- 2431,2437 ----
(beginning-of-line)
(if (looking-at ada-named-block-re)
(setq label (- ada-label-indent))))))))
!
;; found 'record' =>
;; if the keyword is found at the beginning of a line (or just
;; after limited, we indent on it, otherwise we indent on the
***************
*** 2469,2475 ****
(list (progn (back-to-indentation) (point)) 0))))
;; elsif
!
((looking-at "elsif\\>")
(save-excursion
(ada-goto-matching-start 1 nil t)
--- 2469,2475 ----
(list (progn (back-to-indentation) (point)) 0))))
;; elsif
!
((looking-at "elsif\\>")
(save-excursion
(ada-goto-matching-start 1 nil t)
***************
*** 2480,2486 ****
;;---------------------------
;; starting with w (when)
;;---------------------------
!
((and (= (downcase (char-after)) ?w)
(looking-at "when\\>"))
(save-excursion
--- 2480,2486 ----
;;---------------------------
;; starting with w (when)
;;---------------------------
!
((and (= (downcase (char-after)) ?w)
(looking-at "when\\>"))
(save-excursion
***************
*** 2507,2513 ****
;;---------------------------
;; starting with l (loop)
;;---------------------------
!
((and (= (downcase (char-after)) ?l)
(looking-at "loop\\>"))
(setq pos (point))
--- 2507,2513 ----
;;---------------------------
;; starting with l (loop)
;;---------------------------
!
((and (= (downcase (char-after)) ?l)
(looking-at "loop\\>"))
(setq pos (point))
***************
*** 2526,2532 ****
;;----------------------------
;; starting with l (limited) or r (record)
;;----------------------------
!
((or (and (= (downcase (char-after)) ?l)
(looking-at "limited\\>"))
(and (= (downcase (char-after)) ?r)
--- 2526,2532 ----
;;----------------------------
;; starting with l (limited) or r (record)
;;----------------------------
!
((or (and (= (downcase (char-after)) ?l)
(looking-at "limited\\>"))
(and (= (downcase (char-after)) ?r)
***************
*** 2580,2586 ****
((and (= (downcase (char-after)) ?r)
(looking-at "re\\(turn\\|names\\)\\>"))
!
(save-excursion
(let ((var 'ada-indent-return))
;; If looking at a renames, skip the 'return' statement too
--- 2580,2586 ----
((and (= (downcase (char-after)) ?r)
(looking-at "re\\(turn\\|names\\)\\>"))
!
(save-excursion
(let ((var 'ada-indent-return))
;; If looking at a renames, skip the 'return' statement too
***************
*** 2592,2603 ****
(= (downcase (char-after (car pos))) ?r))
(goto-char (car pos)))
(set 'var 'ada-indent-renames)))
!
(forward-comment -1000)
(if (= (char-before) ?\))
(forward-sexp -1)
(forward-word -1))
!
;; If there is a parameter list, and we have a function declaration
;; or a access to subprogram declaration
(let ((num-back 1))
--- 2592,2603 ----
(= (downcase (char-after (car pos))) ?r))
(goto-char (car pos)))
(set 'var 'ada-indent-renames)))
!
(forward-comment -1000)
(if (= (char-before) ?\))
(forward-sexp -1)
(forward-word -1))
!
;; If there is a parameter list, and we have a function declaration
;; or a access to subprogram declaration
(let ((num-back 1))
***************
*** 2610,2622 ****
(backward-word 1)
(set 'num-back 2)
(looking-at "\\(function\\|procedure\\)\\>")))))
!
;; The indentation depends of the value of ada-indent-return
(if (<= (eval var) 0)
(list (point) (list '- var))
(list (progn (backward-word num-back) (point))
var))
!
;; Else there is no parameter list, but we have a function
;; Only do something special if the user want to indent
;; relative to the "function" keyword
--- 2610,2622 ----
(backward-word 1)
(set 'num-back 2)
(looking-at "\\(function\\|procedure\\)\\>")))))
!
;; The indentation depends of the value of ada-indent-return
(if (<= (eval var) 0)
(list (point) (list '- var))
(list (progn (backward-word num-back) (point))
var))
!
;; Else there is no parameter list, but we have a function
;; Only do something special if the user want to indent
;; relative to the "function" keyword
***************
*** 2624,2633 ****
(save-excursion (forward-word -1)
(looking-at "function\\>")))
(list (progn (forward-word -1) (point)) var)
!
;; Else...
(ada-indent-on-previous-lines nil orgpoint orgpoint)))))))
!
;;--------------------------------
;; starting with 'o' or 'p'
;; 'or' as statement-start
--- 2624,2633 ----
(save-excursion (forward-word -1)
(looking-at "function\\>")))
(list (progn (forward-word -1) (point)) var)
!
;; Else...
(ada-indent-on-previous-lines nil orgpoint orgpoint)))))))
!
;;--------------------------------
;; starting with 'o' or 'p'
;; 'or' as statement-start
***************
*** 2817,2823 ****
((looking-at "<<")
(list (+ (save-excursion (back-to-indentation) (point))
(- ada-label-indent))))
!
;;
((looking-at "with\\>\\|use\\>")
;; Are we still in that statement, or are we in fact looking at
--- 2817,2823 ----
((looking-at "<<")
(list (+ (save-excursion (back-to-indentation) (point))
(- ada-label-indent))))
!
;;
((looking-at "with\\>\\|use\\>")
;; Are we still in that statement, or are we in fact looking at
***************
*** 3432,3438 ****
(goto-char (car match-dat))
(unless (ada-in-open-paren-p)
(cond
!
((and (looking-at
"\\<\\(record\\|loop\\|select\\|else\\|then\\)\\>")
(save-excursion
--- 3432,3438 ----
(goto-char (car match-dat))
(unless (ada-in-open-paren-p)
(cond
!
((and (looking-at
"\\<\\(record\\|loop\\|select\\|else\\|then\\)\\>")
(save-excursion
***************
*** 3445,3451 ****
(and (save-excursion (ada-goto-previous-word)
(ada-goto-previous-word)
(not (looking-at "subtype")))
!
(save-excursion (goto-char (cdr match-dat))
(ada-goto-next-non-ws)
;; words that can go after an 'is'
--- 3445,3451 ----
(and (save-excursion (ada-goto-previous-word)
(ada-goto-previous-word)
(not (looking-at "subtype")))
!
(save-excursion (goto-char (cdr match-dat))
(ada-goto-next-non-ws)
;; words that can go after an 'is'
***************
*** 3456,3462 ****
'("separate" "access" "array"
"abstract" "new") t)
"\\>\\|("))))))))
!
(t
(setq found t))
)))
--- 3456,3462 ----
'("separate" "access" "array"
"abstract" "new") t)
"\\>\\|("))))))))
!
(t
(setq found t))
)))
***************
*** 3779,3785 ****
;; it ends a block => increase nest depth
(setq nest-count (1+ nest-count)
pos (point))
!
;; it starts a block => decrease nest depth
(setq nest-count (1- nest-count))))
(goto-char pos))
--- 3779,3785 ----
;; it ends a block => increase nest depth
(setq nest-count (1+ nest-count)
pos (point))
!
;; it starts a block => decrease nest depth
(setq nest-count (1- nest-count))))
(goto-char pos))
***************
*** 3869,3875 ****
(back-to-indentation)
(looking-at "\\<then\\>")))
(goto-char (match-beginning 0)))
!
;;
;; found 'do' => skip back to 'accept'
;;
--- 3869,3875 ----
(back-to-indentation)
(looking-at "\\<then\\>")))
(goto-char (match-beginning 0)))
!
;;
;; found 'do' => skip back to 'accept'
;;
***************
*** 3879,3885 ****
'word-search-backward)
(error "missing 'accept' in front of 'do'"))))
(point))
!
(if noerror
nil
(error "no matching start"))))))
--- 3879,3885 ----
'word-search-backward)
(error "missing 'accept' in front of 'do'"))))
(point))
!
(if noerror
nil
(error "no matching start"))))))
***************
*** 3936,3942 ****
;; handling.
;; Nothing should be done if we have only the specs or a
;; generic instantion.
!
((and (looking-at "\\<procedure\\|function\\>"))
(if first
(forward-word 1)
--- 3936,3942 ----
;; handling.
;; Nothing should be done if we have only the specs or a
;; generic instantion.
!
((and (looking-at "\\<procedure\\|function\\>"))
(if first
(forward-word 1)
***************
*** 3944,3950 ****
(ada-goto-next-non-ws)
(unless (looking-at "\\<new\\>")
(ada-goto-matching-end 0 t))))
!
;; found block end => decrease nest depth
((looking-at "\\<end\\>")
(setq nest-count (1- nest-count)
--- 3944,3950 ----
(ada-goto-next-non-ws)
(unless (looking-at "\\<new\\>")
(ada-goto-matching-end 0 t))))
!
;; found block end => decrease nest depth
((looking-at "\\<end\\>")
(setq nest-count (1- nest-count)
***************
*** 3955,3961 ****
(ada-goto-next-non-ws)
(looking-at "\\<\\(loop\\|select\\|record\\|case\\|if\\)\\>"))
(forward-word 1)))
!
;; found package start => check if it really starts a block, and is not
;; in fact a generic instantiation for instance
((looking-at "\\<package\\>")
--- 3955,3961 ----
(ada-goto-next-non-ws)
(looking-at "\\<\\(loop\\|select\\|record\\|case\\|if\\)\\>"))
(forward-word 1)))
!
;; found package start => check if it really starts a block, and is not
;; in fact a generic instantiation for instance
((looking-at "\\<package\\>")
***************
*** 3967,3973 ****
(goto-char (match-end 0))
(setq nest-count (1+ nest-count)
found (<= nest-count 0))))
!
;; all the other block starts
(t
(setq nest-count (1+ nest-count)
--- 3967,3973 ----
(goto-char (match-end 0))
(setq nest-count (1+ nest-count)
found (<= nest-count 0))))
!
;; all the other block starts
(t
(setq nest-count (1+ nest-count)
***************
*** 4188,4194 ****
;; Value_1);
;; type B is ( -- comment
;; Value_2);
!
(if (or (not ada-indent-handle-comment-special)
(not (looking-at "[ \t]+--")))
(skip-chars-forward " \t"))
--- 4188,4194 ----
;; Value_1);
;; type B is ( -- comment
;; Value_2);
!
(if (or (not ada-indent-handle-comment-special)
(not (looking-at "[ \t]+--")))
(skip-chars-forward " \t"))
***************
*** 4279,4285 ****
(replace-match "-- \\1")
(forward-line 1)
(beginning-of-line))
!
(goto-char (point-min))
(while (re-search-forward "\\>(" nil t)
(if (not (ada-in-string-or-comment-p))
--- 4279,4285 ----
(replace-match "-- \\1")
(forward-line 1)
(beginning-of-line))
!
(goto-char (point-min))
(while (re-search-forward "\\>(" nil t)
(if (not (ada-in-string-or-comment-p))
***************
*** 4405,4411 ****
(skip-syntax-backward "w")
(looking-at "\\<begin\\>"))
(ada-goto-matching-end 1))
!
;; on first line of subprogram body
;; Do nothing for specs or generic instantion, since these are
;; handled as the general case (find the enclosing block)
--- 4405,4411 ----
(skip-syntax-backward "w")
(looking-at "\\<begin\\>"))
(ada-goto-matching-end 1))
!
;; on first line of subprogram body
;; Do nothing for specs or generic instantion, since these are
;; handled as the general case (find the enclosing block)
***************
*** 4418,4424 ****
))
(skip-syntax-backward "w")
(ada-goto-matching-end 0 t))
!
;; on first line of task declaration
((save-excursion
(and (ada-goto-stmt-start)
--- 4418,4424 ----
))
(skip-syntax-backward "w")
(ada-goto-matching-end 0 t))
!
;; on first line of task declaration
((save-excursion
(and (ada-goto-stmt-start)
***************
*** 4444,4455 ****
(skip-syntax-backward "w")
(looking-at "\\<declare\\>"))
(ada-goto-matching-end 0 t))
!
;; inside a 'begin' ... 'end' block
(decl-start
(goto-char decl-start)
(ada-goto-matching-end 0 t))
!
;; (hopefully ;-) everything else
(t
(ada-goto-matching-end 1)))
--- 4444,4455 ----
(skip-syntax-backward "w")
(looking-at "\\<declare\\>"))
(ada-goto-matching-end 0 t))
!
;; inside a 'begin' ... 'end' block
(decl-start
(goto-char decl-start)
(ada-goto-matching-end 0 t))
!
;; (hopefully ;-) everything else
(t
(ada-goto-matching-end 1)))
***************
*** 4831,4837 ****
;; If we are using project file, search for the other file in all
;; the possible src directories.
!
(if (functionp 'ada-find-src-file-in-dir)
(let ((other
(ada-find-src-file-in-dir
--- 4831,4837 ----
;; If we are using project file, search for the other file in all
;; the possible src directories.
!
(if (functionp 'ada-find-src-file-in-dir)
(let ((other
(ada-find-src-file-in-dir
***************
*** 4888,4894 ****
;; Are we looking at "function Foo\n (paramlist)"
(skip-chars-forward " \t\n(")
!
(condition-case nil
(up-list 1)
(error nil))
--- 4888,4894 ----
;; Are we looking at "function Foo\n (paramlist)"
(skip-chars-forward " \t\n(")
!
(condition-case nil
(up-list 1)
(error nil))
***************
*** 4899,4905 ****
(forward-word 1)
(skip-chars-forward " \t\n")
(skip-chars-forward "a-zA-Z0-9_'")))
!
;; Can't simply do forward-word, in case the "is" is not on the
;; same line as the closing parenthesis
(skip-chars-forward "is \t\n")
--- 4899,4905 ----
(forward-word 1)
(skip-chars-forward " \t\n")
(skip-chars-forward "a-zA-Z0-9_'")))
!
;; Can't simply do forward-word, in case the "is" is not on the
;; same line as the closing parenthesis
(skip-chars-forward "is \t\n")
***************
*** 5088,5094 ****
;; Ada unnamed numerical constants
(list "\\W\\([-+]?[0-9._]+\\)\\>" '(1 font-lock-constant-face))
!
))
"Default expressions to highlight in Ada mode.")
--- 5088,5094 ----
;; Ada unnamed numerical constants
(list "\\W\\([-+]?[0-9._]+\\)\\>" '(1 font-lock-constant-face))
!
))
"Default expressions to highlight in Ada mode.")
- [Emacs-diffs] Changes to emacs/lisp/progmodes/ada-mode.el,
Miles Bader <=