Mercurial > emacs
comparison lisp/simple.el @ 56432:af62749c9497
(inhibit-mark-movement): New defvar.
(beginning-of-buffer, end-of-buffer): Do not push mark if
inhibit-mark-movement is non-nil or C-u prefix is given.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Fri, 16 Jul 2004 10:42:00 +0000 |
parents | cc9dcd357544 |
children | f02b482121bc 3864ee1088e9 97905c4f1a42 |
comparison
equal
deleted
inserted
replaced
56431:d0bec75e8763 | 56432:af62749c9497 |
---|---|
560 (point) | 560 (point) |
561 (progn | 561 (progn |
562 (skip-chars-forward " \t") | 562 (skip-chars-forward " \t") |
563 (constrain-to-field nil orig-pos t))))) | 563 (constrain-to-field nil orig-pos t))))) |
564 | 564 |
565 (defvar inhibit-mark-movement nil | |
566 "If non-nil, \\[beginning-of-buffer] and \\[end-of-buffer] does not set the mark.") | |
567 | |
565 (defun beginning-of-buffer (&optional arg) | 568 (defun beginning-of-buffer (&optional arg) |
566 "Move point to the beginning of the buffer; leave mark at previous position. | 569 "Move point to the beginning of the buffer; leave mark at previous position. |
567 With arg N, put point N/10 of the way from the beginning. | 570 With \\[universal-argument] prefix, do not set mark at previous position. |
571 With numeric arg N, put point N/10 of the way from the beginning. | |
568 | 572 |
569 If the buffer is narrowed, this command uses the beginning and size | 573 If the buffer is narrowed, this command uses the beginning and size |
570 of the accessible part of the buffer. | 574 of the accessible part of the buffer. |
571 | 575 |
572 Don't use this command in Lisp programs! | 576 Don't use this command in Lisp programs! |
573 \(goto-char (point-min)) is faster and avoids clobbering the mark." | 577 \(goto-char (point-min)) is faster and avoids clobbering the mark." |
574 (interactive "P") | 578 (interactive "P") |
575 (push-mark) | 579 (unless (or inhibit-mark-movement (consp arg)) |
580 (push-mark)) | |
576 (let ((size (- (point-max) (point-min)))) | 581 (let ((size (- (point-max) (point-min)))) |
577 (goto-char (if arg | 582 (goto-char (if (and arg (not (consp arg))) |
578 (+ (point-min) | 583 (+ (point-min) |
579 (if (> size 10000) | 584 (if (> size 10000) |
580 ;; Avoid overflow for large buffer sizes! | 585 ;; Avoid overflow for large buffer sizes! |
581 (* (prefix-numeric-value arg) | 586 (* (prefix-numeric-value arg) |
582 (/ size 10)) | 587 (/ size 10)) |
584 (point-min)))) | 589 (point-min)))) |
585 (if arg (forward-line 1))) | 590 (if arg (forward-line 1))) |
586 | 591 |
587 (defun end-of-buffer (&optional arg) | 592 (defun end-of-buffer (&optional arg) |
588 "Move point to the end of the buffer; leave mark at previous position. | 593 "Move point to the end of the buffer; leave mark at previous position. |
589 With arg N, put point N/10 of the way from the end. | 594 With \\[universal-argument] prefix, do not set mark at previous position. |
595 With numeric arg N, put point N/10 of the way from the end. | |
590 | 596 |
591 If the buffer is narrowed, this command uses the beginning and size | 597 If the buffer is narrowed, this command uses the beginning and size |
592 of the accessible part of the buffer. | 598 of the accessible part of the buffer. |
593 | 599 |
594 Don't use this command in Lisp programs! | 600 Don't use this command in Lisp programs! |
595 \(goto-char (point-max)) is faster and avoids clobbering the mark." | 601 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
596 (interactive "P") | 602 (interactive "P") |
597 (push-mark) | 603 (unless (or inhibit-mark-movement (consp arg)) |
604 (push-mark)) | |
598 (let ((size (- (point-max) (point-min)))) | 605 (let ((size (- (point-max) (point-min)))) |
599 (goto-char (if arg | 606 (goto-char (if (and arg (not (consp arg))) |
600 (- (point-max) | 607 (- (point-max) |
601 (if (> size 10000) | 608 (if (> size 10000) |
602 ;; Avoid overflow for large buffer sizes! | 609 ;; Avoid overflow for large buffer sizes! |
603 (* (prefix-numeric-value arg) | 610 (* (prefix-numeric-value arg) |
604 (/ size 10)) | 611 (/ size 10)) |