comparison lisp/progmodes/ada-mode.el @ 73434:3586ad4a01a1

(ada-in-string-p): Doc fix.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 19 Oct 2006 10:31:48 +0000
parents e1bac685e6a0
children 7e876e4226ed 034f67f59091
comparison
equal deleted inserted replaced
73433:0171e23e0786 73434:3586ad4a01a1
29 29
30 ;;; Commentary: 30 ;;; Commentary:
31 ;;; This mode is a major mode for editing Ada83 and Ada95 source code. 31 ;;; This mode is a major mode for editing Ada83 and Ada95 source code.
32 ;;; This is a major rewrite of the file packaged with Emacs-20. The 32 ;;; This is a major rewrite of the file packaged with Emacs-20. The
33 ;;; ada-mode is composed of four lisp files, ada-mode.el, ada-xref.el, 33 ;;; ada-mode is composed of four lisp files, ada-mode.el, ada-xref.el,
34 ;;; ada-prj.el and ada-stmt.el. Only this file (ada-mode.el) is 34 ;;; ada-prj.el and ada-stmt.el. Only this file (ada-mode.el) is
35 ;;; completely independent from the GNU Ada compiler Gnat, distributed 35 ;;; completely independent from the GNU Ada compiler Gnat, distributed
36 ;;; by Ada Core Technologies. All the other files rely heavily on 36 ;;; by Ada Core Technologies. All the other files rely heavily on
37 ;;; features provided only by Gnat. 37 ;;; features provided only by Gnat.
38 ;;; 38 ;;;
39 ;;; Note: this mode will not work with Emacs 19. If you are on a VMS 39 ;;; Note: this mode will not work with Emacs 19. If you are on a VMS
40 ;;; system, where the latest version of Emacs is 19.28, you will need 40 ;;; system, where the latest version of Emacs is 19.28, you will need
41 ;;; another file, called ada-vms.el, that provides some required 41 ;;; another file, called ada-vms.el, that provides some required
960 (parse-partial-sexp 960 (parse-partial-sexp
961 (line-beginning-position) (point))))) 961 (line-beginning-position) (point)))))
962 962
963 (defsubst ada-in-string-p (&optional parse-result) 963 (defsubst ada-in-string-p (&optional parse-result)
964 "Return t if point is inside a string. 964 "Return t if point is inside a string.
965 If parse-result is non-nil, use is instead of calling `parse-partial-sexp'." 965 If PARSE-RESULT is non-nil, use it instead of calling `parse-partial-sexp'."
966 (nth 3 (or parse-result 966 (nth 3 (or parse-result
967 (parse-partial-sexp 967 (parse-partial-sexp
968 (line-beginning-position) (point))))) 968 (line-beginning-position) (point)))))
969 969
970 (defsubst ada-in-string-or-comment-p (&optional parse-result) 970 (defsubst ada-in-string-or-comment-p (&optional parse-result)
2408 (list (save-excursion (back-to-indentation) (point)) 0))) 2408 (list (save-excursion (back-to-indentation) (point)) 0)))
2409 2409
2410 ;; else 2410 ;; else
2411 2411
2412 ((looking-at "else\\>") 2412 ((looking-at "else\\>")
2413 (if (save-excursion (ada-goto-previous-word) 2413 (if (save-excursion (ada-goto-previous-word)
2414 (looking-at "\\<or\\>")) 2414 (looking-at "\\<or\\>"))
2415 (ada-indent-on-previous-lines nil orgpoint orgpoint) 2415 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2416 (save-excursion 2416 (save-excursion
2417 (ada-goto-matching-start 1 nil t) 2417 (ada-goto-matching-start 1 nil t)
2418 (list (progn (back-to-indentation) (point)) 0)))) 2418 (list (progn (back-to-indentation) (point)) 0))))
2419 2419
4203 (forward-char ada-indent))) 4203 (forward-char ada-indent)))
4204 4204
4205 (defun ada-untab-hard () 4205 (defun ada-untab-hard ()
4206 "Indent current line to previous tab stop." 4206 "Indent current line to previous tab stop."
4207 (interactive) 4207 (interactive)
4208 (let ((bol (save-excursion (progn (beginning-of-line) (point)))) 4208 (let ((bol (save-excursion (progn (beginning-of-line) (point))))
4209 (eol (save-excursion (progn (end-of-line) (point))))) 4209 (eol (save-excursion (progn (end-of-line) (point)))))
4210 (indent-rigidly bol eol (- 0 ada-indent)))) 4210 (indent-rigidly bol eol (- 0 ada-indent))))
4211 4211
4212 4212
4213 4213
4214 ;; ------------------------------------------------------------ 4214 ;; ------------------------------------------------------------
4215 ;; -- Miscellaneous 4215 ;; -- Miscellaneous
4216 ;; ------------------------------------------------------------ 4216 ;; ------------------------------------------------------------
4217 4217
4218 ;; Not needed any more for Emacs 21.2, but still needed for backward 4218 ;; Not needed any more for Emacs 21.2, but still needed for backward
4219 ;; compatibility 4219 ;; compatibility
4220 (defun ada-remove-trailing-spaces () 4220 (defun ada-remove-trailing-spaces ()
4221 "Remove trailing spaces in the whole buffer." 4221 "Remove trailing spaces in the whole buffer."
4222 (interactive) 4222 (interactive)
4223 (save-match-data 4223 (save-match-data
4224 (save-excursion 4224 (save-excursion
4225 (save-restriction 4225 (save-restriction
4902 or the spec otherwise." 4902 or the spec otherwise."
4903 4903
4904 (let ((is-spec nil) 4904 (let ((is-spec nil)
4905 (is-body nil) 4905 (is-body nil)
4906 (suffixes ada-spec-suffixes) 4906 (suffixes ada-spec-suffixes)
4907 (name (buffer-file-name))) 4907 (name (buffer-file-name)))
4908 4908
4909 ;; Guess whether we have a spec or a body, and get the basename of the 4909 ;; Guess whether we have a spec or a body, and get the basename of the
4910 ;; file. Since the extension may not start with '.', we can not use 4910 ;; file. Since the extension may not start with '.', we can not use
4911 ;; file-name-extension 4911 ;; file-name-extension
4912 (while (and (not is-spec) 4912 (while (and (not is-spec)