Mercurial > emacs
changeset 111435:810cef5c0eee
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.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 06 Nov 2010 18:50:52 -0700 |
parents | ec9d8615510e |
children | 606171abfda2 |
files | lisp/ChangeLog lisp/eshell/esh-util.el lisp/net/tramp-compat.el lisp/progmodes/flymake.el lisp/progmodes/pascal.el lisp/progmodes/verilog-mode.el |
diffstat | 6 files changed, 51 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/ChangeLog Sat Nov 06 18:50:52 2010 -0700 @@ -1,5 +1,25 @@ 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):
--- a/lisp/eshell/esh-util.el Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/eshell/esh-util.el Sat Nov 06 18:50:52 2010 -0700 @@ -536,14 +536,6 @@ (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. @@ -802,5 +794,4 @@ (provide 'esh-util) -;; arch-tag: 70159778-5c7a-480a-bae4-3ad332fca19d ;;; esh-util.el ends here
--- a/lisp/net/tramp-compat.el Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/net/tramp-compat.el Sat Nov 06 18:50:52 2010 -0700 @@ -199,6 +199,8 @@ (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 @@ -209,6 +211,8 @@ ((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 @@ -529,5 +533,4 @@ ;;; TODO: -;; arch-tag: 0e724b18-6699-4f87-ad96-640b272e5c85 ;;; tramp-compat.el ends here
--- a/lisp/progmodes/flymake.el Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/progmodes/flymake.el Sat Nov 06 18:50:52 2010 -0700 @@ -106,16 +106,6 @@ '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 @@ -808,8 +798,8 @@ 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))) @@ -1764,5 +1754,4 @@ (provide 'flymake) -;; arch-tag: 8f0d6090-061d-4cac-8862-7c151c4a02dd ;;; flymake.el ends here
--- a/lisp/progmodes/pascal.el Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/progmodes/pascal.el Sat Nov 06 18:50:52 2010 -0700 @@ -1,8 +1,8 @@ ;;; 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 @@ -274,22 +274,12 @@ ;;; 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)))))) @@ -298,7 +288,7 @@ (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))))) @@ -306,8 +296,7 @@ (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 @@ -407,8 +396,7 @@ (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) @@ -727,7 +715,7 @@ (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) () @@ -999,7 +987,7 @@ (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 @@ -1046,7 +1034,7 @@ (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) @@ -1073,7 +1061,7 @@ (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)) @@ -1137,7 +1125,7 @@ ;; 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))) @@ -1154,17 +1142,17 @@ 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))) @@ -1206,7 +1194,7 @@ (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 :-( @@ -1264,8 +1252,7 @@ (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 @@ -1554,5 +1541,4 @@ (provide 'pascal) -;; arch-tag: 04535136-fd93-40b4-a505-c9bebdc051f5 ;;; pascal.el ends here
--- a/lisp/progmodes/verilog-mode.el Sat Nov 06 18:44:13 2010 -0700 +++ b/lisp/progmodes/verilog-mode.el Sat Nov 06 18:50:52 2010 -0700 @@ -1378,19 +1378,8 @@ ;; 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. @@ -1480,7 +1469,7 @@ (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))) @@ -1500,7 +1489,7 @@ (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))) @@ -3925,7 +3914,7 @@ (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) "!" " "))) @@ -3978,7 +3967,7 @@ (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 @@ -4512,7 +4501,7 @@ (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))))) @@ -8272,8 +8261,7 @@ ": 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)))) @@ -11898,7 +11886,7 @@ (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 @@ -12122,5 +12110,4 @@ ;; checkdoc-force-docstrings-flag:nil ;; End: -;; arch-tag: 87923725-57b3-41b5-9494-be21118c6a6f ;;; verilog-mode.el ends here