aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2019-11-14 23:41:07 +0200
committerDmitry Gutov2019-11-14 23:43:33 +0200
commit6a2a371c288a13060c44fa1af3ab73db611705a4 (patch)
tree55b4ba15f14c2841aaa84a052c576bef6c51d883
parentc455e609bdf065c3177eec29234348809cdc372c (diff)
downloademacs-6a2a371c288a13060c44fa1af3ab73db611705a4.tar.gz
emacs-6a2a371c288a13060c44fa1af3ab73db611705a4.zip
(repos-count-screen-lines): Narrow without changing point-min
* lisp/reposition.el (repos-count-screen-lines): Narrow without changing point-min. It wasn't necessary for vertical-motion to work, and it had some adverse effects on how font-lock rules were applied (https://lists.gnu.org/archive/html/emacs-devel/2019-11/msg00522.html). This can also be an alternative fix for bug#38049.
-rw-r--r--lisp/reposition.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/reposition.el b/lisp/reposition.el
index 22f9986efb5..111bc0841f4 100644
--- a/lisp/reposition.el
+++ b/lisp/reposition.el
@@ -170,12 +170,13 @@ first comment line visible (if point is in a comment)."
170 170
171;;; Auxiliary functions 171;;; Auxiliary functions
172 172
173
173;; Return number of screen lines between START and END. 174;; Return number of screen lines between START and END.
174(defun repos-count-screen-lines (start end) 175(defun repos-count-screen-lines (start end)
175 (save-excursion 176 (save-excursion
176 (save-restriction 177 (save-restriction
177 (narrow-to-region start end) 178 (narrow-to-region (point-min) end)
178 (goto-char (point-min)) 179 (goto-char start)
179 (vertical-motion (- (point-max) (point-min)))))) 180 (vertical-motion (- (point-max) (point-min))))))
180 181
181;; Return number of screen lines between START and END; returns a negative 182;; Return number of screen lines between START and END; returns a negative