# HG changeset patch # User Mike Sperber # Date 1420298696 -3600 # Node ID 9e5f3a0d4e662ed7fe8e78e87630c5b24bbf4953 # Parent bf1e138111599472684358473453aa7922d4a59a Add `noerror' optional argument to `live-move'. 2014-12-31 Michael Sperber * simple.el (line-move): Add `noerror' optional argument, as in GNU Emacs. diff -r bf1e13811159 -r 9e5f3a0d4e66 lisp/ChangeLog --- a/lisp/ChangeLog Fri Dec 19 15:01:46 2014 -0700 +++ b/lisp/ChangeLog Sat Jan 03 16:24:56 2015 +0100 @@ -1,3 +1,8 @@ +2014-12-31 Michael Sperber + + * simple.el (line-move): Add `noerror' optional argument, as in + GNU Emacs. + 2014-11-10 Michael Sperber * custom.el (custom-add-package-version): The car of a diff -r bf1e13811159 -r 9e5f3a0d4e66 lisp/simple.el --- a/lisp/simple.el Fri Dec 19 15:01:46 2014 -0700 +++ b/lisp/simple.el Sat Jan 03 16:24:56 2015 +0100 @@ -2441,7 +2441,7 @@ ;; This is the guts of next-line and previous-line. ;; Count says how many lines to move. -(defun line-move (count) +(defun line-move (count &optional noerror) ;; Don't run any point-motion hooks, and disregard intangibility, ;; for intermediate positions. (let ((inhibit-point-motion-hooks t) @@ -2470,14 +2470,16 @@ (zerop (forward-line 1))) (and (zerop (forward-line count)) (bolp))) - (signal (if (< count 0) - 'beginning-of-buffer - 'end-of-buffer) - nil)) + (if (not noerror) + (signal (if (< count 0) + 'beginning-of-buffer + 'end-of-buffer) + nil))) ;; Move by count lines, but ignore invisible ones. (while (> count 0) (end-of-line) (and (zerop (vertical-motion 1)) + (not noerror) (signal 'end-of-buffer nil)) ;; If the following character is currently invisible, ;; skip all characters with that same `invisible' property value. @@ -2495,6 +2497,7 @@ (while (< count 0) (beginning-of-line) (and (zerop (vertical-motion -1)) + (not noerror) (signal 'beginning-of-buffer nil)) (while (and (not (bobp)) (let ((prop