[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/pascal.el
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/pascal.el |
Date: |
Fri, 04 Apr 2003 01:22:54 -0500 |
Index: emacs/lisp/progmodes/pascal.el
diff -c emacs/lisp/progmodes/pascal.el:1.39 emacs/lisp/progmodes/pascal.el:1.40
*** emacs/lisp/progmodes/pascal.el:1.39 Fri Sep 6 03:16:42 2002
--- emacs/lisp/progmodes/pascal.el Tue Feb 4 08:24:35 2003
***************
*** 43,49 ****
;; pascal-auto-endcomments t
;; pascal-auto-lineup '(all)
;; pascal-toggle-completions nil
! ;; pascal-type-keywords '("array" "file" "packed" "char"
;; "integer" "real" "string" "record")
;; pascal-start-keywords '("begin" "end" "function" "procedure"
;; "repeat" "until" "while" "read" "readln"
--- 43,49 ----
;; pascal-auto-endcomments t
;; pascal-auto-lineup '(all)
;; pascal-toggle-completions nil
! ;; pascal-type-keywords '("array" "file" "packed" "char"
;; "integer" "real" "string" "record")
;; pascal-start-keywords '("begin" "end" "function" "procedure"
;; "repeat" "until" "while" "read" "readln"
***************
*** 104,112 ****
"Imenu expression for Pascal-mode. See `imenu-generic-expression'.")
(defvar pascal-keywords
! '("and" "array" "begin" "case" "const" "div" "do" "downto" "else" "end"
! "file" "for" "function" "goto" "if" "in" "label" "mod" "nil" "not" "of"
! "or" "packed" "procedure" "program" "record" "repeat" "set" "then" "to"
"type" "until" "var" "while" "with"
;; The following are not standard in pascal, but widely used.
"get" "put" "input" "output" "read" "readln" "reset" "rewrite" "write"
--- 104,112 ----
"Imenu expression for Pascal-mode. See `imenu-generic-expression'.")
(defvar pascal-keywords
! '("and" "array" "begin" "case" "const" "div" "do" "downto" "else" "end"
! "file" "for" "function" "goto" "if" "in" "label" "mod" "nil" "not" "of"
! "or" "packed" "procedure" "program" "record" "repeat" "set" "then" "to"
"type" "until" "var" "while" "with"
;; The following are not standard in pascal, but widely used.
"get" "put" "input" "output" "read" "readln" "reset" "rewrite" "write"
***************
*** 138,144 ****
()
(setq pascal-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\\ "." pascal-mode-syntax-table)
! (modify-syntax-entry ?( "()1" pascal-mode-syntax-table)
(modify-syntax-entry ?) ")(4" pascal-mode-syntax-table)
(modify-syntax-entry ?* ". 23b" pascal-mode-syntax-table)
(modify-syntax-entry ?{ "<" pascal-mode-syntax-table)
--- 138,144 ----
()
(setq pascal-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\\ "." pascal-mode-syntax-table)
! (modify-syntax-entry ?( "()1" pascal-mode-syntax-table)
(modify-syntax-entry ?) ")(4" pascal-mode-syntax-table)
(modify-syntax-entry ?* ". 23b" pascal-mode-syntax-table)
(modify-syntax-entry ?{ "<" pascal-mode-syntax-table)
***************
*** 283,290 ****
(defun pascal-declaration-end ()
(let ((nest 1))
(while (and (> nest 0)
! (re-search-forward
! "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
(save-excursion (end-of-line 2) (point)) t))
(cond ((match-beginning 1) (setq nest (1+ nest)))
((match-beginning 2) (setq nest (1- nest)))
--- 283,290 ----
(defun pascal-declaration-end ()
(let ((nest 1))
(while (and (> nest 0)
! (re-search-forward
! "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
(save-excursion (end-of-line 2) (point)) t))
(cond ((match-beginning 1) (setq nest (1+ nest)))
((match-beginning 2) (setq nest (1- nest)))
***************
*** 300,306 ****
((match-beginning 3) (setq nest (1+ nest)))))
(= nest 0)))
!
(defsubst pascal-within-string ()
(save-excursion
(nth 3 (parse-partial-sexp (pascal-get-beg-of-line) (point)))))
--- 300,306 ----
((match-beginning 3) (setq nest (1+ nest)))))
(= nest 0)))
!
(defsubst pascal-within-string ()
(save-excursion
(nth 3 (parse-partial-sexp (pascal-get-beg-of-line) (point)))))
***************
*** 420,426 ****
(search-forward "*)" (pascal-get-end-of-line) t))))
(setq setstar t))))
;; If last line was a star comment line then this one shall be too.
! (if (null setstar)
(pascal-indent-line)
(insert "* "))))
--- 420,426 ----
(search-forward "*)" (pascal-get-end-of-line) t))))
(setq setstar t))))
;; If last line was a star comment line then this one shall be too.
! (if (null setstar)
(pascal-indent-line)
(insert "* "))))
***************
*** 602,608 ****
(if (not (looking-at (concat "\\s \\|\\s)\\|" pascal-defun-re)))
(forward-sexp 1))
(let ((nest 0) (max -1) (func 0)
! (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (re-search-backward reg nil 'move)
--- 602,608 ----
(if (not (looking-at (concat "\\s \\|\\s)\\|" pascal-defun-re)))
(forward-sexp 1))
(let ((nest 0) (max -1) (func 0)
! (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (re-search-backward reg nil 'move)
***************
*** 634,640 ****
(pascal-beg-of-defun))
(forward-char 1)
(let ((nest 0) (func 1)
! (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (and (/= func 0)
--- 634,640 ----
(pascal-beg-of-defun))
(forward-char 1)
(let ((nest 0) (func 1)
! (reg (concat pascal-beg-block-re "\\|"
pascal-end-block-re "\\|"
pascal-defun-re)))
(while (and (/= func 0)
***************
*** 686,692 ****
(catch 'found
(while t
(re-search-forward regexp nil 'move)
! (setq nest (if (match-end 1)
(1+ nest)
(1- nest)))
(cond ((eobp)
--- 686,692 ----
(catch 'found
(while t
(re-search-forward regexp nil 'move)
! (setq nest (if (match-end 1)
(1+ nest)
(1- nest)))
(cond ((eobp)
***************
*** 939,945 ****
)))))
;; Return type of block and indent level.
! (if (> par 0) ; Unclosed Parenthesis
(list 'contexp par)
(list type (pascal-indent-level))))))
--- 939,945 ----
)))))
;; Return type of block and indent level.
! (if (> par 0) ; Unclosed Parenthesis
(list 'contexp par)
(list type (pascal-indent-level))))))
***************
*** 974,980 ****
(ind 0))
;; Get right indent
(while (< (point) end)
! (if (re-search-forward
"^[ \t]*[^ \t,:]+[ \t]*\\(,[ \t]*[^ \t,:]+[ \t]*\\)*:"
(marker-position end) 'move)
(forward-char -1))
--- 974,980 ----
(ind 0))
;; Get right indent
(while (< (point) end)
! (if (re-search-forward
"^[ \t]*[^ \t,:]+[ \t]*\\(,[ \t]*[^ \t,:]+[ \t]*\\)*:"
(marker-position end) 'move)
(forward-char -1))
***************
*** 1010,1016 ****
(let* ((oldpos (point))
(stpos (progn (goto-char (scan-lists (point) -1 1)) (point)))
(stcol (1+ (current-column)))
! (edpos (progn (pascal-declaration-end)
(search-backward ")" (pascal-get-beg-of-line) t)
(point)))
(usevar (re-search-backward "\\<var\\>" stpos t)))
--- 1010,1016 ----
(let* ((oldpos (point))
(stpos (progn (goto-char (scan-lists (point) -1 1)) (point)))
(stcol (1+ (current-column)))
! (edpos (progn (pascal-declaration-end)
(search-backward ")" (pascal-get-beg-of-line) t)
(point)))
(usevar (re-search-backward "\\<var\\>" stpos t)))
***************
*** 1032,1038 ****
(let ((pos (point-marker)))
(if (and (not (or arg start)) (not (pascal-declaration-beg)))
()
! (let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg
start)
":" "="))
(stpos (if start start
(forward-word 2) (backward-word 1) (point)))
--- 1032,1038 ----
(let ((pos (point-marker)))
(if (and (not (or arg start)) (not (pascal-declaration-beg)))
()
! (let ((lineup (if (or (looking-at "\\<var\\>\\|\\<record\\>") arg start)
":" "="))
(stpos (if start start
(forward-word 2) (backward-word 1) (point)))
***************
*** 1108,1114 ****
(end-of-line)
(skip-chars-backward " \t")
(1+ (current-column))))))
!
;;;
--- 1108,1114 ----
(end-of-line)
(skip-chars-backward " \t")
(1+ (current-column))))))
!
;;;
***************
*** 1146,1152 ****
(t "\\<\\(function\\|procedure\\)\\s +"))
"\\<\\(" pascal-str "[a-zA-Z0-9_.]*\\)\\>"))
match)
!
(if (not (looking-at "\\<\\(function\\|procedure\\)\\>"))
(re-search-backward "\\<\\(function\\|procedure\\)\\>" nil t))
(forward-char 1)
--- 1146,1152 ----
(t "\\<\\(function\\|procedure\\)\\s +"))
"\\<\\(" pascal-str "[a-zA-Z0-9_.]*\\)\\>"))
match)
!
(if (not (looking-at "\\<\\(function\\|procedure\\)\\>"))
(re-search-backward "\\<\\(function\\|procedure\\)\\>" nil t))
(forward-char 1)
***************
*** 1171,1178 ****
(while (< (point) end)
(if (re-search-forward "[:=]" (pascal-get-end-of-line) t)
;; Traverse current line
! (while (and (re-search-backward
! (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
pascal-symbol-re)
(pascal-get-beg-of-line) t)
(not (match-end 1)))
--- 1171,1178 ----
(while (< (point) end)
(if (re-search-forward "[:=]" (pascal-get-end-of-line) t)
;; Traverse current line
! (while (and (re-search-backward
! (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
pascal-symbol-re)
(pascal-get-beg-of-line) t)
(not (match-end 1)))
***************
*** 1232,1238 ****
(defun pascal-keyword-completion (keyword-list)
"Give list of all possible completions of keywords in KEYWORD-LIST."
! (mapcar '(lambda (s)
(if (string-match (concat "\\<" pascal-str) s)
(if (or (null pascal-pred)
(funcall pascal-pred s))
--- 1232,1238 ----
(defun pascal-keyword-completion (keyword-list)
"Give list of all possible completions of keywords in KEYWORD-LIST."
! (mapcar '(lambda (s)
(if (string-match (concat "\\<" pascal-str) s)
(if (or (null pascal-pred)
(funcall pascal-pred s))
***************
*** 1283,1289 ****
(save-excursion (pascal-var-completion))
(pascal-func-completion 'function)
(pascal-keyword-completion pascal-separator-keywords))))
!
;; Now we have built a list of all matches. Give response to caller
(pascal-completion-response))))
--- 1283,1289 ----
(save-excursion (pascal-var-completion))
(pascal-func-completion 'function)
(pascal-keyword-completion pascal-separator-keywords))))
!
;; Now we have built a list of all matches. Give response to caller
(pascal-completion-response))))
***************
*** 1352,1358 ****
(progn
;; Update entry number in list
(setq pascal-last-completions allcomp
! pascal-last-word-numb
(if (>= pascal-last-word-numb (1- (length allcomp)))
0
(1+ pascal-last-word-numb)))
--- 1352,1358 ----
(progn
;; Update entry number in list
(setq pascal-last-completions allcomp
! pascal-last-word-numb
(if (>= pascal-last-word-numb (1- (length allcomp)))
0
(1+ pascal-last-word-numb)))
***************
*** 1374,1380 ****
(if (not (null (cdr allcomp)))
(message "(Complete but not unique)")
(message "(Sole completion)")))
! ;; Display buffer if the current completion didn't help
;; on completing the label.
((and (not (null (cdr allcomp))) (= (length pascal-str)
(length match)))
--- 1374,1380 ----
(if (not (null (cdr allcomp)))
(message "(Complete but not unique)")
(message "(Sole completion)")))
! ;; Display buffer if the current completion didn't help
;; on completing the label.
((and (not (null (cdr allcomp))) (= (length pascal-str)
(length match)))
***************
*** 1447,1453 ****
(setq pascal-str (pascal-build-defun-re "[a-zA-Z_]"))
(setq pascal-str (pascal-build-defun-re pascal-str)))
(goto-char (point-min))
!
;; Build a list of all possible completions
(while (re-search-forward pascal-str nil t)
(setq match (buffer-substring (match-beginning 2) (match-end 2)))
--- 1447,1453 ----
(setq pascal-str (pascal-build-defun-re "[a-zA-Z_]"))
(setq pascal-str (pascal-build-defun-re pascal-str)))
(goto-char (point-min))
!
;; Build a list of all possible completions
(while (re-search-forward pascal-str nil t)
(setq match (buffer-substring (match-beginning 2) (match-end 2)))
***************
*** 1547,1553 ****
(defun pascal-outline-change (b e pascal-flag)
(let ((modp (buffer-modified-p)))
(unwind-protect
! (subst-char-in-region b e (if (= pascal-flag ?\n)
?\^M ?\n) pascal-flag)
(set-buffer-modified-p modp))))
--- 1547,1553 ----
(defun pascal-outline-change (b e pascal-flag)
(let ((modp (buffer-modified-p)))
(unwind-protect
! (subst-char-in-region b e (if (= pascal-flag ?\n)
?\^M ?\n) pascal-flag)
(set-buffer-modified-p modp))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/pascal.el,
Miles Bader <=