aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/pascal.el
diff options
context:
space:
mode:
authorGlenn Morris2010-11-06 18:50:52 -0700
committerGlenn Morris2010-11-06 18:50:52 -0700
commit3ba6b2ee6aa77f5a05dc91e8a46ac559f352fee7 (patch)
tree7e902b5b04507bc639e966b1a3f3ca4e7ebe8e0f /lisp/progmodes/pascal.el
parent76fc02b654eda5dfa1e83b0b9909b097a105785d (diff)
downloademacs-3ba6b2ee6aa77f5a05dc91e8a46ac559f352fee7.tar.gz
emacs-3ba6b2ee6aa77f5a05dc91e8a46ac559f352fee7.zip
Replace unneeded compatibility definitions with point-at-bol, point-at-eol.
* lisp/progmodes/verilog-mode.el (verilog-get-beg-of-line) (verilog-get-end-of-line): Remove. (verilog-within-string, verilog-re-search-forward-substr) (verilog-re-search-backward-substr, verilog-set-auto-endcomments) (verilog-surelint-off, verilog-getopt-file, verilog-highlight-region): Use point-at-bol, point-at-eol. * lisp/progmodes/pascal.el (pascal-get-beg-of-line, pascal-get-end-of-line): Remove. (pascal-declaration-end, pascal-declaration-beg, pascal-within-string) (electric-pascal-terminate-line, pascal-set-auto-comments) (pascal-indent-paramlist, pascal-indent-declaration) (pascal-get-lineup-indent, pascal-func-completion) (pascal-get-completion-decl, pascal-var-completion, pascal-completion): Use point-at-bol, point-at-eol. * lisp/progmodes/flymake.el (flymake-line-beginning-position) (flymake-line-end-position): Remove. (flymake-highlight-line): Use point-at-bol, point-at-eol. * lisp/eshell/esh-util.el (line-end-position, line-beginning-position): Remove compat definitions. * net/tramp/tramp-compat.el: Comment.
Diffstat (limited to 'lisp/progmodes/pascal.el')
-rw-r--r--lisp/progmodes/pascal.el48
1 files changed, 17 insertions, 31 deletions
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index acd49e71dd8..a93e97efed9 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -1,8 +1,8 @@
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, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 3;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
4;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4;; 2002 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5;; Free Software Foundation, Inc. 5;; Free Software Foundation, Inc.
6 6
7;; Author: Espen Skoglund <esk@gnu.org> 7;; Author: Espen Skoglund <esk@gnu.org>
8;; Keywords: languages 8;; Keywords: languages
@@ -274,22 +274,12 @@ are handled in another way, and should not be added to this list."
274;;; Macros 274;;; Macros
275;;; 275;;;
276 276
277(defsubst pascal-get-beg-of-line (&optional arg)
278 (save-excursion
279 (beginning-of-line arg)
280 (point)))
281
282(defsubst pascal-get-end-of-line (&optional arg)
283 (save-excursion
284 (end-of-line arg)
285 (point)))
286
287(defun pascal-declaration-end () 277(defun pascal-declaration-end ()
288 (let ((nest 1)) 278 (let ((nest 1))
289 (while (and (> nest 0) 279 (while (and (> nest 0)
290 (re-search-forward 280 (re-search-forward
291 "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)" 281 "[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
292 (save-excursion (end-of-line 2) (point)) t)) 282 (point-at-eol 2) t))
293 (cond ((match-beginning 1) (setq nest (1+ nest))) 283 (cond ((match-beginning 1) (setq nest (1+ nest)))
294 ((match-beginning 2) (setq nest (1- nest))) 284 ((match-beginning 2) (setq nest (1- nest)))
295 ((looking-at "[^(\n]+)") (setq nest 0)))))) 285 ((looking-at "[^(\n]+)") (setq nest 0))))))
@@ -298,7 +288,7 @@ are handled in another way, and should not be added to this list."
298(defun pascal-declaration-beg () 288(defun pascal-declaration-beg ()
299 (let ((nest 1)) 289 (let ((nest 1))
300 (while (and (> nest 0) 290 (while (and (> nest 0)
301 (re-search-backward "[:=]\\|\\<\\(type\\|var\\|label\\|const\\)\\>\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)" (pascal-get-beg-of-line 0) t)) 291 (re-search-backward "[:=]\\|\\<\\(type\\|var\\|label\\|const\\)\\>\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)" (point-at-bol 0) t))
302 (cond ((match-beginning 1) (setq nest 0)) 292 (cond ((match-beginning 1) (setq nest 0))
303 ((match-beginning 2) (setq nest (1- nest))) 293 ((match-beginning 2) (setq nest (1- nest)))
304 ((match-beginning 3) (setq nest (1+ nest))))) 294 ((match-beginning 3) (setq nest (1+ nest)))))
@@ -306,8 +296,7 @@ are handled in another way, and should not be added to this list."
306 296
307 297
308(defsubst pascal-within-string () 298(defsubst pascal-within-string ()
309 (save-excursion 299 (nth 3 (parse-partial-sexp (point-at-bol) (point))))
310 (nth 3 (parse-partial-sexp (pascal-get-beg-of-line) (point)))))
311 300
312 301
313;;;###autoload 302;;;###autoload
@@ -407,8 +396,7 @@ no args, if that value is non-nil."
407 (forward-char 1) 396 (forward-char 1)
408 (delete-horizontal-space)) 397 (delete-horizontal-space))
409 ((and (looking-at "(\\*\\|\\*[^)]") 398 ((and (looking-at "(\\*\\|\\*[^)]")
410 (not (save-excursion 399 (not (save-excursion (search-forward "*)" (point-at-eol) t))))
411 (search-forward "*)" (pascal-get-end-of-line) t))))
412 (setq setstar t)))) 400 (setq setstar t))))
413 ;; If last line was a star comment line then this one shall be too. 401 ;; If last line was a star comment line then this one shall be too.
414 (if (null setstar) 402 (if (null setstar)
@@ -727,7 +715,7 @@ on the line which ends a function or procedure named NAME."
727 (if (and (looking-at "\\<end;") 715 (if (and (looking-at "\\<end;")
728 (not (save-excursion 716 (not (save-excursion
729 (end-of-line) 717 (end-of-line)
730 (search-backward "{" (pascal-get-beg-of-line) t)))) 718 (search-backward "{" (point-at-bol) t))))
731 (let ((type (car (pascal-calculate-indent)))) 719 (let ((type (car (pascal-calculate-indent))))
732 (if (eq type 'declaration) 720 (if (eq type 'declaration)
733 () 721 ()
@@ -999,7 +987,7 @@ indent of the current line in parameterlist."
999 (stpos (progn (goto-char (scan-lists (point) -1 1)) (point))) 987 (stpos (progn (goto-char (scan-lists (point) -1 1)) (point)))
1000 (stcol (1+ (current-column))) 988 (stcol (1+ (current-column)))
1001 (edpos (progn (pascal-declaration-end) 989 (edpos (progn (pascal-declaration-end)
1002 (search-backward ")" (pascal-get-beg-of-line) t) 990 (search-backward ")" (point-at-bol) t)
1003 (point))) 991 (point)))
1004 (usevar (re-search-backward "\\<var\\>" stpos t))) 992 (usevar (re-search-backward "\\<var\\>" stpos t)))
1005 (if arg (progn 993 (if arg (progn
@@ -1046,7 +1034,7 @@ indent of the current line in parameterlist."
1046 (setq ind (pascal-get-lineup-indent stpos edpos lineup)) 1034 (setq ind (pascal-get-lineup-indent stpos edpos lineup))
1047 (goto-char stpos) 1035 (goto-char stpos)
1048 (while (and (<= (point) edpos) (not (eobp))) 1036 (while (and (<= (point) edpos) (not (eobp)))
1049 (if (search-forward lineup (pascal-get-end-of-line) 'move) 1037 (if (search-forward lineup (point-at-eol) 'move)
1050 (forward-char -1)) 1038 (forward-char -1))
1051 (delete-horizontal-space) 1039 (delete-horizontal-space)
1052 (indent-to ind) 1040 (indent-to ind)
@@ -1073,7 +1061,7 @@ indent of the current line in parameterlist."
1073 (goto-char b) 1061 (goto-char b)
1074 ;; Get rightmost position 1062 ;; Get rightmost position
1075 (while (< (point) e) 1063 (while (< (point) e)
1076 (and (re-search-forward reg (min e (pascal-get-end-of-line 2)) 'move) 1064 (and (re-search-forward reg (min e (point-at-eol 2)) 'move)
1077 (cond ((match-beginning 1) 1065 (cond ((match-beginning 1)
1078 ;; Skip record blocks 1066 ;; Skip record blocks
1079 (pascal-declaration-end)) 1067 (pascal-declaration-end))
@@ -1137,7 +1125,7 @@ indent of the current line in parameterlist."
1137 1125
1138 ;; Search through all reachable functions 1126 ;; Search through all reachable functions
1139 (while (pascal-beg-of-defun) 1127 (while (pascal-beg-of-defun)
1140 (if (re-search-forward pascal-str (pascal-get-end-of-line) t) 1128 (if (re-search-forward pascal-str (point-at-eol) t)
1141 (progn (setq match (buffer-substring (match-beginning 2) 1129 (progn (setq match (buffer-substring (match-beginning 2)
1142 (match-end 2))) 1130 (match-end 2)))
1143 (push match pascal-all))) 1131 (push match pascal-all)))
@@ -1154,17 +1142,17 @@ indent of the current line in parameterlist."
1154 match) 1142 match)
1155 ;; Traverse lines 1143 ;; Traverse lines
1156 (while (< (point) end) 1144 (while (< (point) end)
1157 (if (re-search-forward "[:=]" (pascal-get-end-of-line) t) 1145 (if (re-search-forward "[:=]" (point-at-eol) t)
1158 ;; Traverse current line 1146 ;; Traverse current line
1159 (while (and (re-search-backward 1147 (while (and (re-search-backward
1160 (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|" 1148 (concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
1161 pascal-symbol-re) 1149 pascal-symbol-re)
1162 (pascal-get-beg-of-line) t) 1150 (point-at-bol) t)
1163 (not (match-end 1))) 1151 (not (match-end 1)))
1164 (setq match (buffer-substring (match-beginning 0) (match-end 0))) 1152 (setq match (buffer-substring (match-beginning 0) (match-end 0)))
1165 (if (string-match (concat "\\<" pascal-str) match) 1153 (if (string-match (concat "\\<" pascal-str) match)
1166 (push match pascal-all)))) 1154 (push match pascal-all))))
1167 (if (re-search-forward "\\<record\\>" (pascal-get-end-of-line) t) 1155 (if (re-search-forward "\\<record\\>" (point-at-eol) t)
1168 (pascal-declaration-end) 1156 (pascal-declaration-end)
1169 (forward-line 1))) 1157 (forward-line 1)))
1170 1158
@@ -1206,7 +1194,7 @@ indent of the current line in parameterlist."
1206 (if (> start (prog1 (save-excursion (pascal-end-of-defun) 1194 (if (> start (prog1 (save-excursion (pascal-end-of-defun)
1207 (point)))) 1195 (point))))
1208 () ; Declarations not reachable 1196 () ; Declarations not reachable
1209 (if (search-forward "(" (pascal-get-end-of-line) t) 1197 (if (search-forward "(" (point-at-eol) t)
1210 ;; Check parameterlist 1198 ;; Check parameterlist
1211 ;; FIXME: pascal-get-completion-decl doesn't understand 1199 ;; FIXME: pascal-get-completion-decl doesn't understand
1212 ;; the var declarations in parameter lists :-( 1200 ;; the var declarations in parameter lists :-(
@@ -1264,8 +1252,7 @@ indent of the current line in parameterlist."
1264 (or (eq state 'declaration) (eq state 'paramlist) 1252 (or (eq state 'declaration) (eq state 'paramlist)
1265 (and (eq state 'defun) 1253 (and (eq state 'defun)
1266 (save-excursion 1254 (save-excursion
1267 (re-search-backward ")[ \t]*:" 1255 (re-search-backward ")[ \t]*:" (point-at-bol) t))))
1268 (pascal-get-beg-of-line) t))))
1269 (if (or (eq state 'paramlist) (eq state 'defun)) 1256 (if (or (eq state 'paramlist) (eq state 'defun))
1270 (pascal-beg-of-defun)) 1257 (pascal-beg-of-defun))
1271 (nconc 1258 (nconc
@@ -1554,5 +1541,4 @@ Pascal Outline mode provides some additional commands.
1554 1541
1555(provide 'pascal) 1542(provide 'pascal)
1556 1543
1557;; arch-tag: 04535136-fd93-40b4-a505-c9bebdc051f5
1558;;; pascal.el ends here 1544;;; pascal.el ends here