From 8343e3380c0eab37b9420d4027536fac6e97fa9f Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 17 Sep 1998 06:52:37 +0000 Subject: [PATCH] (line-beginning-position): New function. (line-end-position): New function. --- poe-xemacs.el | 10 ++++++++++ poe.el | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) 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 ;;; -- 1.7.10.4