[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112128: * lisp/replace.el (list-matc
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112128: * lisp/replace.el (list-matching-lines-prefix-face): New defcustom. |
Date: |
Sun, 24 Mar 2013 23:47:52 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 112128
fixes bug: http://debbugs.gnu.org/14017
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Sun 2013-03-24 23:47:52 +0200
message:
* lisp/replace.el (list-matching-lines-prefix-face): New defcustom.
(occur-1): Pass `list-matching-lines-prefix-face' to the function
`occur-engine' if `face-differs-from-default-p' returns t.
(occur-engine): Add `,' inside backquote construct to evaluate
`prefix-face'. Propertize the prefix with the `prefix-face' face.
Pass `prefix-face' to the functions `occur-context-lines' and
`occur-engine-add-prefix'.
(occur-engine-add-prefix, occur-context-lines): Add optional arg
`prefix-face' and propertize the prefix with `prefix-face'.
modified:
lisp/ChangeLog
lisp/replace.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-03-24 06:42:25 +0000
+++ b/lisp/ChangeLog 2013-03-24 21:47:52 +0000
@@ -1,3 +1,16 @@
+2013-03-24 Juri Linkov <address@hidden>
+
+ * replace.el (list-matching-lines-prefix-face): New defcustom.
+ (occur-1): Pass `list-matching-lines-prefix-face' to the function
+ `occur-engine' if `face-differs-from-default-p' returns t.
+ (occur-engine): Add `,' inside backquote construct to evaluate
+ `prefix-face'. Propertize the prefix with the `prefix-face' face.
+ Pass `prefix-face' to the functions `occur-context-lines' and
+ `occur-engine-add-prefix'.
+ (occur-engine-add-prefix, occur-context-lines): Add optional arg
+ `prefix-face' and propertize the prefix with `prefix-face'.
+ (Bug#14017)
+
2013-03-24 Leo Liu <address@hidden>
* nxml/rng-valid.el (rng-validate-while-idle)
=== modified file 'lisp/replace.el'
--- a/lisp/replace.el 2013-03-10 08:44:07 +0000
+++ b/lisp/replace.el 2013-03-24 21:47:52 +0000
@@ -1125,6 +1125,14 @@
:type 'face
:group 'matching)
+(defcustom list-matching-lines-prefix-face 'shadow
+ "Face used by \\[list-matching-lines] to show the prefix column.
+If the face doesn't differ from the default face,
+don't highlight the prefix with line numbers specially."
+ :type 'face
+ :group 'matching
+ :version "24.4")
+
(defcustom occur-excluded-properties
'(read-only invisible intangible field mouse-face help-echo local-map keymap
yank-handler follow-link)
@@ -1334,7 +1342,9 @@
(isearch-no-upper-case-p regexp t)
case-fold-search)
list-matching-lines-buffer-name-face
- nil list-matching-lines-face
+ (if (face-differs-from-default-p
list-matching-lines-prefix-face)
+ list-matching-lines-prefix-face)
+ list-matching-lines-face
(not (eq occur-excluded-properties t))))))
(let* ((bufcount (length active-bufs))
(diff (- (length bufs) bufcount)))
@@ -1423,7 +1433,7 @@
(apply #'propertize (format "%7d:" lines)
(append
(when prefix-face
- `(font-lock-face prefix-face))
+ `(font-lock-face ,prefix-face))
`(occur-prefix t mouse-face (highlight)
;; Allow insertion of text at
;; the end of the prefix (for
@@ -1447,7 +1457,9 @@
;; of multi-line matches.
(replace-regexp-in-string
"\n"
- "\n :"
+ (if prefix-face
+ (propertize "\n :" 'font-lock-face
prefix-face)
+ "\n :")
match-str)
;; Add marker at eol, but no mouse props.
(propertize "\n" 'occur-target marker)))
@@ -1458,7 +1470,8 @@
;; The complex multi-line display style.
(setq ret (occur-context-lines
out-line nlines keep-props begpt endpt
- lines prev-lines prev-after-lines))
+ lines prev-lines prev-after-lines
+ prefix-face))
;; Set first elem of the returned list to `data',
;; and the second elem to `prev-after-lines'.
(setq prev-after-lines (nth 1 ret))
@@ -1482,7 +1495,7 @@
(when prev-after-lines
(with-current-buffer out-buf
(insert (apply #'concat (occur-engine-add-prefix
- prev-after-lines)))))))
+ prev-after-lines prefix-face)))))))
(when (not (zerop matches)) ;; is the count zero?
(setq globalcount (+ globalcount matches))
(with-current-buffer out-buf
@@ -1537,10 +1550,13 @@
str)
(buffer-substring-no-properties beg end)))
-(defun occur-engine-add-prefix (lines)
+(defun occur-engine-add-prefix (lines &optional prefix-face)
(mapcar
#'(lambda (line)
- (concat " :" line "\n"))
+ (concat (if prefix-face
+ (propertize " :" 'font-lock-face prefix-face)
+ " :")
+ line "\n"))
lines))
(defun occur-accumulate-lines (count &optional keep-props pt)
@@ -1569,7 +1585,8 @@
;; Generate a list of lines, add prefixes to all but OUT-LINE,
;; then concatenate them all together.
(defun occur-context-lines (out-line nlines keep-props begpt endpt
- lines prev-lines prev-after-lines)
+ lines prev-lines prev-after-lines
+ &optional prefix-face)
;; Find after- and before-context lines of the current match.
(let ((before-lines
(nreverse (cdr (occur-accumulate-lines
@@ -1609,10 +1626,13 @@
;; Return a list where the first element is the output line.
(apply #'concat
(append
- (and prev-after-lines
- (occur-engine-add-prefix prev-after-lines))
- (and separator (list separator))
- (occur-engine-add-prefix before-lines)
+ (if prev-after-lines
+ (occur-engine-add-prefix prev-after-lines prefix-face))
+ (if separator
+ (list (if prefix-face
+ (propertize separator 'font-lock-face prefix-face)
+ separator)))
+ (occur-engine-add-prefix before-lines prefix-face)
(list out-line)))
;; And the second element is the list of context after-lines.
(if (> nlines 0) after-lines))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112128: * lisp/replace.el (list-matching-lines-prefix-face): New defcustom.,
Juri Linkov <=