diff options
| author | Chong Yidong | 2008-07-12 18:33:47 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-07-12 18:33:47 +0000 |
| commit | 2c80f06bd6fbc1f7f0c28f498377e0e040a37f60 (patch) | |
| tree | 1227e7294b23b7f2cceaa8d15b77ae67553a2c7f | |
| parent | fbb563ca1379041316e0947a916fc9edd71dbf8d (diff) | |
| download | emacs-2c80f06bd6fbc1f7f0c28f498377e0e040a37f60.tar.gz emacs-2c80f06bd6fbc1f7f0c28f498377e0e040a37f60.zip | |
(line-move-visual): Handle null pixel position gracefully.
| -rw-r--r-- | lisp/simple.el | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 93e2818d265..56371ac25e1 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3993,21 +3993,20 @@ into account variable-width characters and line continuation.") | |||
| 3993 | ;; specified number of lines. | 3993 | ;; specified number of lines. |
| 3994 | (defun line-move-visual (arg &optional noerror) | 3994 | (defun line-move-visual (arg &optional noerror) |
| 3995 | (unless (and (floatp temporary-goal-column) | 3995 | (unless (and (floatp temporary-goal-column) |
| 3996 | (or (memq last-command '(next-line previous-line)) | 3996 | (or (memq last-command '(next-line previous-line)) |
| 3997 | ;; In case we're called from some other command. | 3997 | ;; In case we're called from some other command. |
| 3998 | (eq last-command this-command))) | 3998 | (eq last-command this-command))) |
| 3999 | (setq temporary-goal-column | 3999 | (let ((x (car (nth 2 (posn-at-point))))) |
| 4000 | (/ (car (nth 2 (posn-at-point))) 1.0 (frame-char-width)))) | 4000 | (when x |
| 4001 | (let ((moved (vertical-motion | 4001 | (setq temporary-goal-column (/ (float x) (frame-char-width)))))) |
| 4002 | (cons (or goal-column | 4002 | (or (= (vertical-motion |
| 4003 | (truncate temporary-goal-column)) | 4003 | (cons (or goal-column (truncate temporary-goal-column)) arg)) |
| 4004 | arg)))) | 4004 | arg) |
| 4005 | (or (= arg moved) | 4005 | (unless noerror |
| 4006 | (unless noerror | 4006 | (signal (if (< arg 0) |
| 4007 | (signal (if (< arg 0) | 4007 | 'beginning-of-buffer |
| 4008 | 'beginning-of-buffer | 4008 | 'end-of-buffer) |
| 4009 | 'end-of-buffer) | 4009 | nil)))) |
| 4010 | nil))))) | ||
| 4011 | 4010 | ||
| 4012 | ;; This is the guts of next-line and previous-line. | 4011 | ;; This is the guts of next-line and previous-line. |
| 4013 | ;; Arg says how many lines to move. | 4012 | ;; Arg says how many lines to move. |