878 |
:type 'face |
:type 'face |
879 |
:group 'matching) |
:group 'matching) |
880 |
|
|
881 |
|
(defcustom occur-excluded-properties |
882 |
|
'(read-only invisible intangible field mouse-face help-echo local-map keymap |
883 |
|
yank-handler follow-link) |
884 |
|
"*Text properties to discard when copying lines to the *Occur* buffer. |
885 |
|
The value should be a list of text properties to discard or t, |
886 |
|
which means to discard all text properties." |
887 |
|
:type '(choice (const :tag "All" t) (repeat symbol)) |
888 |
|
:group 'matching |
889 |
|
:version "22.1") |
890 |
|
|
891 |
(defun occur-accumulate-lines (count &optional keep-props) |
(defun occur-accumulate-lines (count &optional keep-props) |
892 |
(save-excursion |
(save-excursion |
893 |
(let ((forwardp (> count 0)) |
(let ((forwardp (> count 0)) |
904 |
(if (fboundp 'jit-lock-fontify-now) |
(if (fboundp 'jit-lock-fontify-now) |
905 |
(jit-lock-fontify-now beg end))) |
(jit-lock-fontify-now beg end))) |
906 |
(push |
(push |
907 |
(funcall (if keep-props |
(if (and keep-props (not (eq occur-excluded-properties t))) |
908 |
#'buffer-substring |
(let ((str (buffer-substring beg end))) |
909 |
#'buffer-substring-no-properties) |
(remove-list-of-text-properties |
910 |
beg end) |
0 (length str) occur-excluded-properties str) |
911 |
|
str) |
912 |
|
(buffer-substring-no-properties beg end)) |
913 |
result) |
result) |
914 |
(forward-line (if forwardp 1 -1))) |
(forward-line (if forwardp 1 -1))) |
915 |
(nreverse result)))) |
(nreverse result)))) |
1045 |
(and case-fold-search |
(and case-fold-search |
1046 |
(isearch-no-upper-case-p regexp t)) |
(isearch-no-upper-case-p regexp t)) |
1047 |
list-matching-lines-buffer-name-face |
list-matching-lines-buffer-name-face |
1048 |
nil list-matching-lines-face t))) |
nil list-matching-lines-face |
1049 |
|
(not (eq occur-excluded-properties t))))) |
1050 |
(let* ((bufcount (length active-bufs)) |
(let* ((bufcount (length active-bufs)) |
1051 |
(diff (- (length bufs) bufcount))) |
(diff (- (length bufs) bufcount))) |
1052 |
(message "Searched %d buffer%s%s; %s match%s for `%s'" |
(message "Searched %d buffer%s%s; %s match%s for `%s'" |
1115 |
(text-property-not-all begpt endpt 'fontified t)) |
(text-property-not-all begpt endpt 'fontified t)) |
1116 |
(if (fboundp 'jit-lock-fontify-now) |
(if (fboundp 'jit-lock-fontify-now) |
1117 |
(jit-lock-fontify-now begpt endpt))) |
(jit-lock-fontify-now begpt endpt))) |
1118 |
(setq curstring (buffer-substring begpt endpt)) |
(if (and keep-props (not (eq occur-excluded-properties t))) |
1119 |
;; Depropertize the string, and maybe |
(progn |
1120 |
;; highlight the matches |
(setq curstring (buffer-substring begpt endpt)) |
1121 |
|
(remove-list-of-text-properties |
1122 |
|
0 (length curstring) occur-excluded-properties curstring)) |
1123 |
|
(setq curstring (buffer-substring-no-properties begpt endpt))) |
1124 |
|
;; Highlight the matches |
1125 |
(let ((len (length curstring)) |
(let ((len (length curstring)) |
1126 |
(start 0)) |
(start 0)) |
|
(unless keep-props |
|
|
(set-text-properties 0 len nil curstring)) |
|
1127 |
(while (and (< start len) |
(while (and (< start len) |
1128 |
(string-match regexp curstring start)) |
(string-match regexp curstring start)) |
1129 |
(add-text-properties |
(add-text-properties |