From: morioka Date: Thu, 17 Sep 1998 06:52:37 +0000 (+0000) Subject: (line-beginning-position): New function. X-Git-Tag: poe-199811302358~51 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8343e3380c0eab37b9420d4027536fac6e97fa9f;p=elisp%2Fapel.git (line-beginning-position): New function. (line-end-position): New function. --- diff --git a/poe-xemacs.el b/poe-xemacs.el index 77ac80d..475dccc 100644 --- a/poe-xemacs.el +++ b/poe-xemacs.el @@ -134,6 +134,16 @@ ) +;;; @ Emacs 20.3 emulation +;;; + +(or (fboundp 'line-beginning-position) + (defalias 'line-beginning-position 'point-at-bol)) + +(or (fboundp 'line-end-position) + (defalias 'line-end-position 'point-at-eol)) + + ;;; @ end ;;; diff --git a/poe.el b/poe.el index 2c7ca0d..c2a67ae 100644 --- a/poe.el +++ b/poe.el @@ -306,6 +306,34 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"." (nreverse (cons (substring string start) parts)))) +;;; @ Emacs 20.3 emulation +;;; + +(defun-maybe line-beginning-position (&optional n) + "Return the character position of the first character on the current line. +With argument N not nil or 1, move forward N - 1 lines first. +If scan reaches end of buffer, return that position. +This function does not move point." + (save-excursion + (if n + (forward-line (1- n)) + ) + (beginning-of-line) + (point))) + +(defun-maybe line-end-position (&optional n) + "Return the character position of the last character on the current line. +With argument N not nil or 1, move forward N - 1 lines first. +If scan reaches end of buffer, return that position. +This function does not move point." + (save-excursion + (if n + (forward-line (1- n)) + ) + (end-of-line) + (point))) + + ;;; @ XEmacs emulation ;;;