Mercurial > hg > xemacs-beta
diff lisp/simple.el @ 265:8efd647ea9ca r20-5b31
Import from CVS: tag r20-5b31
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:25:37 +0200 |
parents | 11cf20601dec |
children | 966663fcf606 |
line wrap: on
line diff
--- a/lisp/simple.el Mon Aug 13 10:24:47 2007 +0200 +++ b/lisp/simple.el Mon Aug 13 10:25:37 2007 +0200 @@ -1686,6 +1686,19 @@ (switch-to-buffer buffer))) +(defcustom signal-error-on-buffer-boundary t + "*Non-nil value causes XEmacs to beep or signal an error when certain interactive commands would move point past (point-min) or (point-max). +The commands that honor this variable are + +forward-char-command +backward-char-command +next-line +previous-line +scroll-up-command +scroll-down-command" + :type 'boolean + :group 'editing-basics) + ;;; After 8 years of waiting ... -sb (defcustom next-line-add-newlines nil ; XEmacs "*If non-nil, `next-line' inserts newline when the point is at end of buffer. @@ -1694,6 +1707,72 @@ :type 'boolean :group 'editing-basics) +(defun forward-char-command (&optional arg buffer) + "Move point right ARG characters (left if ARG negative) in BUFFER. +On attempt to pass end of buffer, stop and signal `end-of-buffer'. +On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'. +Error signaling is suppressed if `signal-error-on-buffer-boundary' +is nil. If BUFFER is nil, the current buffer is assumed." + (interactive "_p") + (if signal-error-on-buffer-boundary + (forward-char arg buffer) + (condition-case nil + (forward-char arg buffer) + (beginning-of-buffer nil) + (end-of-buffer nil)))) + +(defun backward-char-command (&optional arg buffer) + "Move point left ARG characters (right if ARG negative) in BUFFER. +On attempt to pass end of buffer, stop and signal `end-of-buffer'. +On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'. +Error signaling is suppressed if `signal-error-on-buffer-boundary' +is nil. If BUFFER is nil, the current buffer is assumed." + (interactive "_p") + (if signal-error-on-buffer-boundary + (backward-char arg buffer) + (condition-case nil + (backward-char arg buffer) + (beginning-of-buffer nil) + (end-of-buffer nil)))) + +(defun scroll-up-command (&optional n) + "Scroll text of current window upward ARG lines; or near full screen if no ARG. +A near full screen is `next-screen-context-lines' less than a full screen. +Negative ARG means scroll downward. +When calling from a program, supply a number as argument or nil. +On attempt to scroll past end of buffer, `end-of-buffer' is signaled. +On attempt to scroll past beginning of buffer, `beginning-of-buffer' is +signaled. + +If `signal-error-on-buffer-boundary' is nil, attempts to scroll past buffer +boundaries do not cause an error to be signaled." + (interactive "_P") + (if signal-error-on-buffer-boundary + (scroll-up n) + (condition-case nil + (scroll-up n) + (beginning-of-buffer nil) + (end-of-buffer nil)))) + +(defun scroll-down-command (&optional n) + "Scroll text of current window downward ARG lines; or near full screen if no ARG. +A near full screen is `next-screen-context-lines' less than a full screen. +Negative ARG means scroll upward. +When calling from a program, supply a number as argument or nil. +On attempt to scroll past end of buffer, `end-of-buffer' is signaled. +On attempt to scroll past beginning of buffer, `beginning-of-buffer' is +signaled. + +If `signal-error-on-buffer-boundary' is nil, attempts to scroll past buffer +boundaries do not cause an error to be signaled." + (interactive "_P") + (if signal-error-on-buffer-boundary + (scroll-down n) + (condition-case nil + (scroll-down n) + (beginning-of-buffer nil) + (end-of-buffer nil)))) + (defun next-line (arg) "Move cursor vertically down ARG lines. If there is no character in the target line exactly under the current column, @@ -2396,6 +2475,9 @@ The function should take a single optional argument which is a flag indicating whether soft newlines should be inserted.") +;; defined in mule-base/mule-category.el +(defvar word-across-newline) + ;; This function is the auto-fill-function of a buffer ;; when Auto-Fill mode is enabled. ;; It returns t if it really did any work.