comparison lisp/progmodes/pascal.el @ 28976:cd57818019f8

(pascal-indent-alist, pascal-indent-comment): Changed the indent-comment function to just return the appropriate indent.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 18 May 2000 18:38:09 +0000
parents 8796c6b4b7c2
children c440fcd3adb0
comparison
equal deleted inserted replaced
28975:8e49fb8ad58b 28976:cd57818019f8
1 ;;; pascal.el --- major mode for editing pascal source in Emacs 1 ;;; pascal.el --- major mode for editing pascal source in Emacs
2 2
3 ;; Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc. 3 ;; Copyright (C) 1993, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation, Inc.
4 4
5 ;; Author: Espen Skoglund <espensk@stud.cs.uit.no> 5 ;; Author: Espen Skoglund <esk@gnu.org>
6 ;; Keywords: languages 6 ;; Keywords: languages
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
9 9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
53 ;; KNOWN BUGS / BUGREPORTS 53 ;; KNOWN BUGS / BUGREPORTS
54 ;; ======================= 54 ;; =======================
55 ;; As far as I know, there are no bugs in the current version of this 55 ;; As far as I know, there are no bugs in the current version of this
56 ;; package. This may not be true however, since I never use this mode 56 ;; package. This may not be true however, since I never use this mode
57 ;; myself and therefore would never notice them anyway. If you do 57 ;; myself and therefore would never notice them anyway. If you do
58 ;; find any bugs, you may submit them to: espensk@stud.cs.uit.no 58 ;; find any bugs, you may submit them to: esk@gnu.org as well as to
59 ;; as well as to bug-gnu-emacs@gnu.org. 59 ;; bug-gnu-emacs@gnu.org.
60 60
61 ;;; Code: 61 ;;; Code:
62 62
63 (defgroup pascal nil 63 (defgroup pascal nil
64 "Major mode for editing Pascal source in Emacs" 64 "Major mode for editing Pascal source in Emacs"
782 '((block . (+ ind pascal-indent-level)) 782 '((block . (+ ind pascal-indent-level))
783 (case . (+ ind pascal-case-indent)) 783 (case . (+ ind pascal-case-indent))
784 (caseblock . ind) (cpp . 0) 784 (caseblock . ind) (cpp . 0)
785 (declaration . (+ ind pascal-indent-level)) 785 (declaration . (+ ind pascal-indent-level))
786 (paramlist . (pascal-indent-paramlist t)) 786 (paramlist . (pascal-indent-paramlist t))
787 (comment . (pascal-indent-comment t)) 787 (comment . (pascal-indent-comment))
788 (defun . ind) (contexp . ind) 788 (defun . ind) (contexp . ind)
789 (unknown . ind) (string . 0) (progbeg . 0))) 789 (unknown . ind) (string . 0) (progbeg . 0)))
790 790
791 (defun pascal-indent-command () 791 (defun pascal-indent-command ()
792 "Indent for special part of code." 792 "Indent for special part of code."
953 (if (looking-at ".*=[ \t]*record\\>") 953 (if (looking-at ".*=[ \t]*record\\>")
954 (search-forward "=" nil t))) 954 (search-forward "=" nil t)))
955 (skip-chars-forward " \t") 955 (skip-chars-forward " \t")
956 (current-column))) 956 (current-column)))
957 957
958 (defun pascal-indent-comment (&optional arg) 958 (defun pascal-indent-comment ()
959 "Indent current line as comment. 959 "Return indent for current comment."
960 If optional arg is non-nil, just return the 960 (save-excursion
961 column number the line should be indented to." 961 (re-search-backward "\\((\\*\\)\\|{" nil t)
962 (let* ((stcol (save-excursion 962 (if (match-beginning 1)
963 (re-search-backward "(\\*\\|{" nil t) 963 (1+ (current-column))
964 (1+ (current-column))))) 964 (current-column))))
965 (if arg stcol
966 (delete-horizontal-space)
967 (indent-to stcol))))
968 965
969 (defun pascal-indent-case () 966 (defun pascal-indent-case ()
970 "Indent within case statements." 967 "Indent within case statements."
971 (let ((savepos (point-marker)) 968 (let ((savepos (point-marker))
972 (end (prog2 969 (end (prog2