[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117986: * lisp/ses.el (ses-setup): Don't assume mod
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] trunk r117986: * lisp/ses.el (ses-setup): Don't assume modifying the iteration var of |
Date: |
Tue, 30 Sep 2014 15:33:07 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117986
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18191
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2014-09-30 11:33:03 -0400
message:
* lisp/ses.el (ses-setup): Don't assume modifying the iteration var of
dotimes affects the iteration.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/ses.el ses.el-20091113204419-o5vbwnq5f7feedwu-2447
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-09-30 08:06:28 +0000
+++ b/lisp/ChangeLog 2014-09-30 15:33:03 +0000
@@ -1,3 +1,8 @@
+2014-09-30 Stefan Monnier <address@hidden>
+
+ * ses.el (ses-setup): Don't assume modifying the iteration var of
+ dotimes affects the iteration (bug#18191).
+
2014-09-30 Vincent Belaïche <address@hidden>
* ses.el (ses-calculate-cell): bind row and col dynamically to
=== modified file 'lisp/ses.el'
--- a/lisp/ses.el 2014-09-30 08:06:28 +0000
+++ b/lisp/ses.el 2014-09-30 15:33:03 +0000
@@ -1870,45 +1870,42 @@
`intangible' properties. Sets up highlighting for current cell."
(interactive)
(let ((end (point-min))
- (inhibit-read-only t)
(inhibit-point-motion-hooks t)
- (was-modified (buffer-modified-p))
pos sym)
- (ses-goto-data 0 0) ; Include marker between print-area and data-area.
- (set-text-properties (point) (point-max) nil) ; Delete garbage props.
- (mapc 'delete-overlay (overlays-in (point-min) (point-max)))
- ;; The print area is read-only (except for our special commands) and uses a
- ;; special keymap.
- (put-text-property (point-min) (1- (point)) 'read-only 'ses)
- (put-text-property (point-min) (1- (point)) 'keymap 'ses-mode-print-map)
- ;; For the beginning of the buffer, we want the read-only and keymap
- ;; attributes to be inherited from the first character.
- (put-text-property (point-min) (1+ (point-min)) 'front-sticky t)
- ;; Create intangible properties, which also indicate which cell the text
- ;; came from.
- (dotimes-with-progress-reporter (row ses--numrows) "Finding cells..."
- (dotimes (col ses--numcols)
- (setq pos end
- sym (ses-cell-symbol row col))
- ;; Include skipped cells following this one.
- (while (and (< col (1- ses--numcols))
- (eq (ses-cell-value row (1+ col)) '*skip*))
- (setq end (+ end (ses-col-width col) 1)
- col (1+ col)))
- (setq end (save-excursion
- (goto-char pos)
- (move-to-column (+ (current-column) (- end pos)
- (ses-col-width col)))
- (if (eolp)
- (+ end (ses-col-width col) 1)
- (forward-char)
- (point))))
- (put-text-property pos end 'intangible sym)))
- ;; Adding these properties did not actually alter the text.
- (unless was-modified
- (restore-buffer-modified-p nil)
- (buffer-disable-undo)
- (buffer-enable-undo)))
+ (with-silent-modifications
+ (ses-goto-data 0 0) ; Include marker between print-area and data-area.
+ (set-text-properties (point) (point-max) nil) ; Delete garbage props.
+ (mapc 'delete-overlay (overlays-in (point-min) (point-max)))
+ ;; The print area is read-only (except for our special commands) and
+ ;; uses a special keymap.
+ (put-text-property (point-min) (1- (point)) 'read-only 'ses)
+ (put-text-property (point-min) (1- (point)) 'keymap 'ses-mode-print-map)
+ ;; For the beginning of the buffer, we want the read-only and keymap
+ ;; attributes to be inherited from the first character.
+ (put-text-property (point-min) (1+ (point-min)) 'front-sticky t)
+ ;; Create intangible properties, which also indicate which cell the text
+ ;; came from.
+ (dotimes-with-progress-reporter (row ses--numrows) "Finding cells..."
+ (dotimes (col ses--numcols)
+ (setq pos end
+ sym (ses-cell-symbol row col))
+ (unless (eq (symbol-value sym) '*skip*)
+ ;; Include skipped cells following this one.
+ (while (and (< col (1- ses--numcols))
+ (eq (ses-cell-value row (1+ col)) '*skip*))
+ (setq end (+ end (ses-col-width col) 1)
+ ;; Beware: Modifying the iteration variable of `dotimes'
+ ;; may or may not affect the iteration!
+ col (1+ col)))
+ (setq end (save-excursion
+ (goto-char pos)
+ (move-to-column (+ (current-column) (- end pos)
+ (ses-col-width col)))
+ (if (eolp)
+ (+ end (ses-col-width col) 1)
+ (forward-char)
+ (point))))
+ (put-text-property pos end 'intangible sym))))))
;; Create the underlining overlay. It's impossible for (point) to be 2,
;; because column A must be at least 1 column wide.
(setq ses--curcell-overlay (make-overlay (1+ (point-min)) (1+ (point-min))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117986: * lisp/ses.el (ses-setup): Don't assume modifying the iteration var of,
Stefan Monnier <=