[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 34a43ba: Fix infloop in filepos-to-bufferpos
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 34a43ba: Fix infloop in filepos-to-bufferpos |
Date: |
Tue, 16 Jun 2015 14:38:43 +0000 |
branch: master
commit 34a43ba26a049bb966426022ffb2c41ab07841b8
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix infloop in filepos-to-bufferpos
* lisp/international/mule-util.el (filepos-to-bufferpos): Fix EOL
offset calculation, and make it conditional on the eol-type of the
file's encoding. (Bug#20825)
---
lisp/international/mule-util.el | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 92c540c..2b4638b 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -335,9 +335,11 @@ QUALITY can be:
(while
(progn
(setq pos (byte-to-position (+ pm byte (- eol-offset))))
- (setq lines (1- (line-number-at-pos pos)))
- (not (= lines eol-offset)))
- (setq eol-offset (+ eol-offset lines)))
+ ;; Adjust POS for DOS EOL format.
+ (when (= eol 1)
+ (setq lines (1- (line-number-at-pos pos)))
+ (not (= lines eol-offset))))
+ (setq eol-offset lines))
pos))
;; FIXME: What if it's a 2-byte charset? Are there such beasts?
(`charset (+ pm byte))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 34a43ba: Fix infloop in filepos-to-bufferpos,
Eli Zaretskii <=