2010-11-07 Glenn Morris <rgm@gnu.org>
+ * 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.
+ * 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.
+ * progmodes/flymake.el (flymake-line-beginning-position)
+ (flymake-line-end-position): Remove.
+ (flymake-highlight-line): Use point-at-bol, point-at-eol.
+ * eshell/esh-util.el (line-end-position, line-beginning-position):
+ Remove compat definitions.
+
* emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Use end-of-line N.
(checkdoc-this-string-valid-engine, checkdoc-file-comments-engine):
(eshell-read-hosts eshell-hosts-file 'eshell-host-names
'eshell-host-timestamp)))
-(unless (fboundp 'line-end-position)
- (defsubst line-end-position (&optional N)
- (save-excursion (end-of-line N) (point))))
-
-(unless (fboundp 'line-beginning-position)
- (defsubst line-beginning-position (&optional N)
- (save-excursion (beginning-of-line N) (point))))
-
(unless (fboundp 'subst-char-in-string)
(defun subst-char-in-string (fromchar tochar string &optional inplace)
"Replace FROMCHAR with TOCHAR in STRING each time it occurs.
(provide 'esh-util)
-;; arch-tag: 70159778-5c7a-480a-bae4-3ad332fca19d
;;; esh-util.el ends here
(ignore-errors
(tramp-compat-funcall 'font-lock-add-keywords mode keywords how)))
+;; FIXME is this really necessary? Eg Emacs has both l-b-p and p-at-b
+;; since at least 21.1.
(defsubst tramp-compat-line-beginning-position ()
"Return point at beginning of line (compat function).
Calls `line-beginning-position' or `point-at-bol' if defined, else
((fboundp 'point-at-bol) (tramp-compat-funcall 'point-at-bol))
(t (save-excursion (beginning-of-line) (point)))))
+;; FIXME is this really necessary? Eg Emacs has both l-e-p and p-at-e
+;; since at least 21.1.
(defsubst tramp-compat-line-end-position ()
"Return point at end of line (compat function).
Calls `line-end-position' or `point-at-eol' if defined, else
;;; TODO:
-;; arch-tag: 0e724b18-6699-4f87-ad96-640b272e5c85
;;; tramp-compat.el ends here
'temp-directory
(lambda () temporary-file-directory)))
-(defalias 'flymake-line-beginning-position
- (if (fboundp 'line-beginning-position)
- 'line-beginning-position
- (lambda (&optional arg) (save-excursion (beginning-of-line arg) (point)))))
-
-(defalias 'flymake-line-end-position
- (if (fboundp 'line-end-position)
- 'line-end-position
- (lambda (&optional arg) (save-excursion (end-of-line arg) (point)))))
-
(defun flymake-posn-at-point-as-event (&optional position window dx dy)
"Return pixel position of top left corner of glyph at POSITION,
relative to top left corner of WINDOW, as a mouse-1 click
Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
(goto-char (point-min))
(forward-line (1- line-no))
- (let* ((line-beg (flymake-line-beginning-position))
- (line-end (flymake-line-end-position))
+ (let* ((line-beg (point-at-bol))
+ (line-end (poin-at-eol))
(beg line-beg)
(end line-end)
(tooltip-text (flymake-ler-text (nth 0 line-err-info-list)))
(provide 'flymake)
-;; arch-tag: 8f0d6090-061d-4cac-8862-7c151c4a02dd
;;; flymake.el ends here
;;; pascal.el --- major mode for editing pascal source in Emacs
-;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+;; 2002 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Free Software Foundation, Inc.
;; Author: Espen Skoglund <esk@gnu.org>
;; Keywords: languages
;;; Macros
;;;
-(defsubst pascal-get-beg-of-line (&optional arg)
- (save-excursion
- (beginning-of-line arg)
- (point)))
-
-(defsubst pascal-get-end-of-line (&optional arg)
- (save-excursion
- (end-of-line arg)
- (point)))
-
(defun pascal-declaration-end ()
(let ((nest 1))
(while (and (> nest 0)
(re-search-forward
"[:=]\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)"
- (save-excursion (end-of-line 2) (point)) t))
+ (point-at-eol 2) t))
(cond ((match-beginning 1) (setq nest (1+ nest)))
((match-beginning 2) (setq nest (1- nest)))
((looking-at "[^(\n]+)") (setq nest 0))))))
(defun pascal-declaration-beg ()
(let ((nest 1))
(while (and (> nest 0)
- (re-search-backward "[:=]\\|\\<\\(type\\|var\\|label\\|const\\)\\>\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)" (pascal-get-beg-of-line 0) t))
+ (re-search-backward "[:=]\\|\\<\\(type\\|var\\|label\\|const\\)\\>\\|\\(\\<record\\>\\)\\|\\(\\<end\\>\\)" (point-at-bol 0) t))
(cond ((match-beginning 1) (setq nest 0))
((match-beginning 2) (setq nest (1- nest)))
((match-beginning 3) (setq nest (1+ nest)))))
(defsubst pascal-within-string ()
- (save-excursion
- (nth 3 (parse-partial-sexp (pascal-get-beg-of-line) (point)))))
+ (nth 3 (parse-partial-sexp (point-at-bol) (point))))
;;;###autoload
(forward-char 1)
(delete-horizontal-space))
((and (looking-at "(\\*\\|\\*[^)]")
- (not (save-excursion
- (search-forward "*)" (pascal-get-end-of-line) t))))
+ (not (save-excursion (search-forward "*)" (point-at-eol) t))))
(setq setstar t))))
;; If last line was a star comment line then this one shall be too.
(if (null setstar)
(if (and (looking-at "\\<end;")
(not (save-excursion
(end-of-line)
- (search-backward "{" (pascal-get-beg-of-line) t))))
+ (search-backward "{" (point-at-bol) t))))
(let ((type (car (pascal-calculate-indent))))
(if (eq type 'declaration)
()
(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)
+ (search-backward ")" (point-at-bol) t)
(point)))
(usevar (re-search-backward "\\<var\\>" stpos t)))
(if arg (progn
(setq ind (pascal-get-lineup-indent stpos edpos lineup))
(goto-char stpos)
(while (and (<= (point) edpos) (not (eobp)))
- (if (search-forward lineup (pascal-get-end-of-line) 'move)
+ (if (search-forward lineup (point-at-eol) 'move)
(forward-char -1))
(delete-horizontal-space)
(indent-to ind)
(goto-char b)
;; Get rightmost position
(while (< (point) e)
- (and (re-search-forward reg (min e (pascal-get-end-of-line 2)) 'move)
+ (and (re-search-forward reg (min e (point-at-eol 2)) 'move)
(cond ((match-beginning 1)
;; Skip record blocks
(pascal-declaration-end))
;; Search through all reachable functions
(while (pascal-beg-of-defun)
- (if (re-search-forward pascal-str (pascal-get-end-of-line) t)
+ (if (re-search-forward pascal-str (point-at-eol) t)
(progn (setq match (buffer-substring (match-beginning 2)
(match-end 2)))
(push match pascal-all)))
match)
;; Traverse lines
(while (< (point) end)
- (if (re-search-forward "[:=]" (pascal-get-end-of-line) t)
+ (if (re-search-forward "[:=]" (point-at-eol) t)
;; Traverse current line
(while (and (re-search-backward
(concat "\\((\\|\\<\\(var\\|type\\|const\\)\\>\\)\\|"
pascal-symbol-re)
- (pascal-get-beg-of-line) t)
+ (point-at-bol) t)
(not (match-end 1)))
(setq match (buffer-substring (match-beginning 0) (match-end 0)))
(if (string-match (concat "\\<" pascal-str) match)
(push match pascal-all))))
- (if (re-search-forward "\\<record\\>" (pascal-get-end-of-line) t)
+ (if (re-search-forward "\\<record\\>" (point-at-eol) t)
(pascal-declaration-end)
(forward-line 1)))
(if (> start (prog1 (save-excursion (pascal-end-of-defun)
(point))))
() ; Declarations not reachable
- (if (search-forward "(" (pascal-get-end-of-line) t)
+ (if (search-forward "(" (point-at-eol) t)
;; Check parameterlist
;; FIXME: pascal-get-completion-decl doesn't understand
;; the var declarations in parameter lists :-(
(or (eq state 'declaration) (eq state 'paramlist)
(and (eq state 'defun)
(save-excursion
- (re-search-backward ")[ \t]*:"
- (pascal-get-beg-of-line) t))))
+ (re-search-backward ")[ \t]*:" (point-at-bol) t))))
(if (or (eq state 'paramlist) (eq state 'defun))
(pascal-beg-of-defun))
(nconc
(provide 'pascal)
-;; arch-tag: 04535136-fd93-40b4-a505-c9bebdc051f5
;;; pascal.el ends here
;; Macros
;;
-(defsubst verilog-get-beg-of-line (&optional arg)
- (save-excursion
- (beginning-of-line arg)
- (point)))
-
-(defsubst verilog-get-end-of-line (&optional arg)
- (save-excursion
- (end-of-line arg)
- (point)))
-
(defsubst verilog-within-string ()
- (save-excursion
- (nth 3 (parse-partial-sexp (verilog-get-beg-of-line) (point)))))
+ (nth 3 (parse-partial-sexp (point-at-bol) (point))))
(defsubst verilog-string-replace-matches (from-string to-string fixedcase literal string)
"Replace occurrences of FROM-STRING with TO-STRING.
(search-forward substr bound noerror))
(save-excursion
(beginning-of-line)
- (setq done (re-search-forward regexp (verilog-get-end-of-line) noerror)))
+ (setq done (re-search-forward regexp (point-at-eol) noerror)))
(unless (and (<= (match-beginning 0) (point))
(>= (match-end 0) (point)))
(setq done nil)))
(search-backward substr bound noerror))
(save-excursion
(end-of-line)
- (setq done (re-search-backward regexp (verilog-get-beg-of-line) noerror)))
+ (setq done (re-search-backward regexp (point-at-bol) noerror)))
(unless (and (<= (match-beginning 0) (point))
(>= (match-end 0) (point)))
(setq done nil)))
(or kill-existing-comment
(not (save-excursion
(end-of-line)
- (search-backward "//" (verilog-get-beg-of-line) t)))))
+ (search-backward "//" (point-at-bol) t)))))
(let ((nest 1) b e
m
(else (if (match-end 2) "!" " ")))
(or kill-existing-comment
(not (save-excursion
(end-of-line)
- (search-backward "//" (verilog-get-beg-of-line) t)))))
+ (search-backward "//" (point-at-bol) t)))))
(let ((type (car indent-str)))
(unless (eq type 'declaration)
(unless (looking-at (concat "\\(" verilog-end-block-ordered-re "\\)[ \t]*:")) ;; ignore named ends
(cond
((looking-at "// surefire lint_off_line ")
(goto-char (match-end 0))
- (let ((lim (save-excursion (end-of-line) (point))))
+ (let ((lim (point-at-eol)))
(if (re-search-forward code lim 'move)
(throw 'already t)
(insert (concat " " code)))))
": Can't find verilog-getopt-file -f file: " filename)))
(goto-char (point-min))
(while (not (eobp))
- (setq line (buffer-substring (point)
- (save-excursion (end-of-line) (point))))
+ (setq line (buffer-substring (point) (point-at-eol)))
(forward-line 1)
(when (string-match "//" line)
(setq line (substring line 0 (match-beginning 0))))
(verilog-save-scan-cache
(let (end-point)
(goto-char end)
- (setq end-point (verilog-get-end-of-line))
+ (setq end-point (point-at-eol))
(goto-char beg)
(beginning-of-line) ; scan entire line
;; delete overlays existing on this line
;; checkdoc-force-docstrings-flag:nil
;; End:
-;; arch-tag: 87923725-57b3-41b5-9494-be21118c6a6f
;;; verilog-mode.el ends here