diff options
| author | Juri Linkov | 2010-03-23 09:16:57 +0200 |
|---|---|---|
| committer | Juri Linkov | 2010-03-23 09:16:57 +0200 |
| commit | f14d1172a22ac7127d8e446614b5f2decddbf6d7 (patch) | |
| tree | 9983b039697973530e163d1efe16b797c99d4c01 | |
| parent | 75a3ff20abab33d759ab0d1eb2631778bcf82f86 (diff) | |
| download | emacs-f14d1172a22ac7127d8e446614b5f2decddbf6d7.tar.gz emacs-f14d1172a22ac7127d8e446614b5f2decddbf6d7.zip | |
* replace.el (occur-accumulate-lines, occur-engine):
Use `occur-engine-line' instead of duplicate code.
(occur-engine-line): New function created from duplicate code
in `occur-accumulate-lines' and `occur-engine'.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/replace.el | 37 |
2 files changed, 21 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 77b970789ff..77bd0fa1826 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2010-03-23 Juri Linkov <juri@jurta.org> | 1 | 2010-03-23 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * replace.el (occur-accumulate-lines, occur-engine): | ||
| 4 | Use `occur-engine-line' instead of duplicate code. | ||
| 5 | (occur-engine-line): New function created from duplicate code | ||
| 6 | in `occur-accumulate-lines' and `occur-engine'. | ||
| 7 | |||
| 8 | 2010-03-23 Juri Linkov <juri@jurta.org> | ||
| 9 | |||
| 3 | * finder.el: Remove TODO tasks. | 10 | * finder.el: Remove TODO tasks. |
| 4 | 11 | ||
| 5 | * info.el (Info-finder-find-node): Add node "all" | 12 | * info.el (Info-finder-find-node): Add node "all" |
diff --git a/lisp/replace.el b/lisp/replace.el index 081d5c45f1d..613cced8ea5 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -1016,18 +1016,7 @@ which means to discard all text properties." | |||
| 1016 | (setq count (+ count (if forwardp -1 1))) | 1016 | (setq count (+ count (if forwardp -1 1))) |
| 1017 | (setq beg (line-beginning-position) | 1017 | (setq beg (line-beginning-position) |
| 1018 | end (line-end-position)) | 1018 | end (line-end-position)) |
| 1019 | (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode) | 1019 | (push (occur-engine-line beg end) result) |
| 1020 | (text-property-not-all beg end 'fontified t)) | ||
| 1021 | (if (fboundp 'jit-lock-fontify-now) | ||
| 1022 | (jit-lock-fontify-now beg end))) | ||
| 1023 | (push | ||
| 1024 | (if (and keep-props (not (eq occur-excluded-properties t))) | ||
| 1025 | (let ((str (buffer-substring beg end))) | ||
| 1026 | (remove-list-of-text-properties | ||
| 1027 | 0 (length str) occur-excluded-properties str) | ||
| 1028 | str) | ||
| 1029 | (buffer-substring-no-properties beg end)) | ||
| 1030 | result) | ||
| 1031 | (forward-line (if forwardp 1 -1))) | 1020 | (forward-line (if forwardp 1 -1))) |
| 1032 | (nreverse result)))) | 1021 | (nreverse result)))) |
| 1033 | 1022 | ||
| @@ -1228,17 +1217,7 @@ See also `multi-occur'." | |||
| 1228 | endpt (line-end-position))) | 1217 | endpt (line-end-position))) |
| 1229 | (setq marker (make-marker)) | 1218 | (setq marker (make-marker)) |
| 1230 | (set-marker marker matchbeg) | 1219 | (set-marker marker matchbeg) |
| 1231 | (if (and keep-props | 1220 | (setq curstring (occur-engine-line begpt endpt)) |
| 1232 | (if (boundp 'jit-lock-mode) jit-lock-mode) | ||
| 1233 | (text-property-not-all begpt endpt 'fontified t)) | ||
| 1234 | (if (fboundp 'jit-lock-fontify-now) | ||
| 1235 | (jit-lock-fontify-now begpt endpt))) | ||
| 1236 | (if (and keep-props (not (eq occur-excluded-properties t))) | ||
| 1237 | (progn | ||
| 1238 | (setq curstring (buffer-substring begpt endpt)) | ||
| 1239 | (remove-list-of-text-properties | ||
| 1240 | 0 (length curstring) occur-excluded-properties curstring)) | ||
| 1241 | (setq curstring (buffer-substring-no-properties begpt endpt))) | ||
| 1242 | ;; Highlight the matches | 1221 | ;; Highlight the matches |
| 1243 | (let ((len (length curstring)) | 1222 | (let ((len (length curstring)) |
| 1244 | (start 0)) | 1223 | (start 0)) |
| @@ -1335,6 +1314,18 @@ See also `multi-occur'." | |||
| 1335 | ;; Return the number of matches | 1314 | ;; Return the number of matches |
| 1336 | globalcount))) | 1315 | globalcount))) |
| 1337 | 1316 | ||
| 1317 | (defun occur-engine-line (beg end) | ||
| 1318 | (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode) | ||
| 1319 | (text-property-not-all beg end 'fontified t)) | ||
| 1320 | (if (fboundp 'jit-lock-fontify-now) | ||
| 1321 | (jit-lock-fontify-now beg end))) | ||
| 1322 | (if (and keep-props (not (eq occur-excluded-properties t))) | ||
| 1323 | (let ((str (buffer-substring beg end))) | ||
| 1324 | (remove-list-of-text-properties | ||
| 1325 | 0 (length str) occur-excluded-properties str) | ||
| 1326 | str) | ||
| 1327 | (buffer-substring-no-properties beg end))) | ||
| 1328 | |||
| 1338 | ;; Generate context display for occur. | 1329 | ;; Generate context display for occur. |
| 1339 | ;; OUT-LINE is the line where the match is. | 1330 | ;; OUT-LINE is the line where the match is. |
| 1340 | ;; NLINES and KEEP-PROPS are args to occur-engine. | 1331 | ;; NLINES and KEEP-PROPS are args to occur-engine. |