diff options
| author | Richard M. Stallman | 1997-07-26 22:22:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-26 22:22:59 +0000 |
| commit | 6c8499b941f044f78163f6f62f5782b75cc2ffc3 (patch) | |
| tree | 4224528cf4dd28bfa5c1d80f859df090dd08ddd4 | |
| parent | 92304bc8c7a25c417c7ae5b4f4a891d47630f2c5 (diff) | |
| download | emacs-6c8499b941f044f78163f6f62f5782b75cc2ffc3.tar.gz emacs-6c8499b941f044f78163f6f62f5782b75cc2ffc3.zip | |
(line-move): If intangibility moves us to a different line,
adjust the hpos nicely in that line.
| -rw-r--r-- | lisp/simple.el | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index d4166977cb5..00bf4c5d967 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1906,7 +1906,7 @@ Outline mode sets this." | |||
| 1906 | ;; for intermediate positions. | 1906 | ;; for intermediate positions. |
| 1907 | (let ((inhibit-point-motion-hooks t) | 1907 | (let ((inhibit-point-motion-hooks t) |
| 1908 | (opoint (point)) | 1908 | (opoint (point)) |
| 1909 | new) | 1909 | new line-end line-beg) |
| 1910 | (unwind-protect | 1910 | (unwind-protect |
| 1911 | (progn | 1911 | (progn |
| 1912 | (if (not (or (eq last-command 'next-line) | 1912 | (if (not (or (eq last-command 'next-line) |
| @@ -1973,25 +1973,42 @@ Outline mode sets this." | |||
| 1973 | ;; If we are moving into some intangible text, | 1973 | ;; If we are moving into some intangible text, |
| 1974 | ;; look for following text on the same line which isn't intangible | 1974 | ;; look for following text on the same line which isn't intangible |
| 1975 | ;; and move there. | 1975 | ;; and move there. |
| 1976 | (setq line-end (save-excursion (end-of-line) (point))) | ||
| 1977 | (setq line-beg (save-excursion (beginning-of-line) (point))) | ||
| 1976 | (let ((after (and (< new (point-max)) | 1978 | (let ((after (and (< new (point-max)) |
| 1977 | (get-char-property new 'intangible))) | 1979 | (get-char-property new 'intangible))) |
| 1978 | (before (and (> new (point-min)) | 1980 | (before (and (> new (point-min)) |
| 1979 | (get-char-property (1- new) 'intangible))) | 1981 | (get-char-property (1- new) 'intangible)))) |
| 1980 | line-end) | 1982 | (when (and before (eq before after) |
| 1981 | (when (and before (eq before after)) | 1983 | (not (bolp))) |
| 1982 | (setq line-end (save-excursion (end-of-line) (point))) | ||
| 1983 | (goto-char (point-min)) | 1984 | (goto-char (point-min)) |
| 1984 | (let ((inhibit-point-motion-hooks nil)) | 1985 | (let ((inhibit-point-motion-hooks nil)) |
| 1985 | (goto-char new)) | 1986 | (goto-char new)) |
| 1986 | (if (<= new line-end) | 1987 | (if (<= new line-end) |
| 1987 | (setq new (point))))) | 1988 | (setq new (point))))) |
| 1988 | ;; Remember where we moved to, go back home, | 1989 | ;; NEW is where we want to move to. |
| 1989 | ;; then do the motion over again | 1990 | ;; LINE-BEG and LINE-END are the beginning and end of the line. |
| 1990 | ;; in just one step, with intangibility and point-motion hooks | 1991 | ;; Move there in just one step, from our starting position, |
| 1991 | ;; enabled this time. | 1992 | ;; with intangibility and point-motion hooks enabled this time. |
| 1992 | (goto-char opoint) | 1993 | (goto-char opoint) |
| 1993 | (setq inhibit-point-motion-hooks nil) | 1994 | (setq inhibit-point-motion-hooks nil) |
| 1994 | (goto-char new))) | 1995 | (goto-char new) |
| 1996 | ;; If intangibility processing moved us to a different line, | ||
| 1997 | ;; readjust the horizontal position within the line we ended up at. | ||
| 1998 | (when (or (< (point) line-beg) (> (point) line-end)) | ||
| 1999 | (setq new (point)) | ||
| 2000 | (setq inhibit-point-motion-hooks t) | ||
| 2001 | (setq line-end (save-excursion (end-of-line) (point))) | ||
| 2002 | (beginning-of-line) | ||
| 2003 | (setq line-beg (point)) | ||
| 2004 | (let ((buffer-invisibility-spec nil)) | ||
| 2005 | (move-to-column (or goal-column temporary-goal-column))) | ||
| 2006 | (if (<= (point) line-end) | ||
| 2007 | (setq new (point))) | ||
| 2008 | (goto-char (point-min)) | ||
| 2009 | (setq inhibit-point-motion-hooks nil) | ||
| 2010 | (goto-char new) | ||
| 2011 | ))) | ||
| 1995 | nil) | 2012 | nil) |
| 1996 | 2013 | ||
| 1997 | ;;; Many people have said they rarely use this feature, and often type | 2014 | ;;; Many people have said they rarely use this feature, and often type |