diff lisp/prim/page.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents 376386a54a3c
children 131b0175ea99
line wrap: on
line diff
--- a/lisp/prim/page.el	Mon Aug 13 08:46:35 2007 +0200
+++ b/lisp/prim/page.el	Mon Aug 13 08:46:56 2007 +0200
@@ -18,9 +18,10 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with XEmacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
 
-;;; Synched up with: FSF 19.30.
+;;; Synched up with: FSF 19.34.
 
 ;;; Commentary:
 
@@ -33,7 +34,7 @@
   "Move forward to page boundary.  With arg, repeat, or go back if negative.
 A page boundary is any line whose beginning matches the regexp
 `page-delimiter'."
-  (interactive "_p")
+  (interactive "_p") ; XEmacs
   (or count (setq count 1))
   (while (and (> count 0) (not (eobp)))
     ;; In case the page-delimiter matches the null string,
@@ -44,26 +45,24 @@
       (goto-char (point-max)))
     (setq count (1- count)))
   (while (and (< count 0) (not (bobp)))
+    ;; In case the page-delimiter matches the null string,
+    ;; don't find a match without moving.
+    (and (save-excursion (re-search-backward page-delimiter nil t))
+	 (= (match-end 0) (point))
+	 (goto-char (match-beginning 0)))
     (forward-char -1)
-    (let (result (end (point)))
-      ;; If we find a match that ends where we started searching,
-      ;; look for another one.
-      (while (and (setq result (re-search-backward page-delimiter nil t))
-		  (= (match-end 0) end))
-	;; Just search again.
-	)
-      (if result
-	  ;; We found one--move to the end of it.
-	  (goto-char (match-end 0))
-	;; We found nothing--go to beg of buffer.
-	(goto-char (point-min))))
+    (if (re-search-backward page-delimiter nil t)
+	;; We found one--move to the end of it.
+	(goto-char (match-end 0))
+      ;; We found nothing--go to beg of buffer.
+      (goto-char (point-min)))
     (setq count (1+ count))))
 
 (defun backward-page (&optional count)
   "Move backward to page boundary.  With arg, repeat, or go fwd if negative.
 A page boundary is any line whose beginning matches the regexp
 `page-delimiter'."
-  (interactive "p")
+  (interactive "_p") ; XEmacs
   (or count (setq count 1))
   (forward-page (- count)))
 
@@ -113,10 +112,11 @@
 			(if (and (eolp) (not (bobp)))
 			    (forward-line 1))
 			(point)))))
+(put 'narrow-to-page 'disabled t)
 
 (defun count-lines-page ()
   "Report number of lines on current page, and how many are before or after point."
-  (interactive "_")
+  (interactive "_") ; XEmacs
   (save-excursion
     (let ((opoint (point)) beg end
 	  total before after)
@@ -134,7 +134,7 @@
 
 (defun what-page ()
   "Print page and line number of point."
-  (interactive "_")
+  (interactive "_") ; XEmacs
   (save-restriction
     (widen)
     (save-excursion