Mercurial > emacs
comparison lisp/dired.el @ 16454:76b0d4d3371e
Tweak dired-font-lock-keywords.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Wed, 23 Oct 1996 09:26:39 +0000 |
parents | cf84933860ed |
children | 814f54228bf7 |
comparison
equal
deleted
inserted
replaced
16453:90a2c2aebc37 | 16454:76b0d4d3371e |
---|---|
117 | 117 |
118 ;;;###autoload | 118 ;;;###autoload |
119 (defvar dired-copy-preserve-time t | 119 (defvar dired-copy-preserve-time t |
120 "*If non-nil, Dired preserves the last-modified time in a file copy. | 120 "*If non-nil, Dired preserves the last-modified time in a file copy. |
121 \(This works on only some systems.)") | 121 \(This works on only some systems.)") |
122 | |
123 (defvar dired-font-lock-keywords | |
124 '(;; Put directory headers in italics. | |
125 ("^ \\(/.+\\)" 1 font-lock-type-face) | |
126 ;; Put symlinks in bold italics. | |
127 ("\\([^ ]+\\) -> [^ ]+$" . font-lock-function-name-face) | |
128 ;; Put marks in bold. | |
129 ("^[^ ]" . font-lock-reference-face) | |
130 ;; Put files that are subdirectories in bold. | |
131 ("^..d.* \\([^ ]+\\)$" 1 font-lock-keyword-face)) | |
132 "Additional expressions to highlight in Dired mode.") | |
133 | 122 |
134 ;;; Hook variables | 123 ;;; Hook variables |
135 | 124 |
136 (defvar dired-load-hook nil | 125 (defvar dired-load-hook nil |
137 "Run after loading dired. | 126 "Run after loading dired. |
221 Subexpression 1 is the subdirectory proper, no trailing colon. | 210 Subexpression 1 is the subdirectory proper, no trailing colon. |
222 The match starts at the beginning of the line and ends after the end | 211 The match starts at the beginning of the line and ends after the end |
223 of the line (\\n or \\r). | 212 of the line (\\n or \\r). |
224 Subexpression 2 must end right before the \\n or \\r.") | 213 Subexpression 2 must end right before the \\n or \\r.") |
225 | 214 |
215 (defvar dired-font-lock-keywords | |
216 (list | |
217 ;; | |
218 ;; Directory headers. | |
219 (list dired-subdir-regexp '(1 font-lock-type-face)) | |
220 ;; | |
221 ;; We make heavy use of MATCH-ANCHORED, since the regexps don't identify the | |
222 ;; file name itself. We search for Dired defined regexps, and then use the | |
223 ;; Dired defined function `dired-move-to-filename' before searching for the | |
224 ;; simple regexp ".+". It is that regexp which matches the file name. | |
225 ;; | |
226 ;; Dired marks. | |
227 (list dired-re-mark | |
228 '(0 font-lock-reference-face) | |
229 '(".+" (dired-move-to-filename) nil (0 font-lock-warning-face))) | |
230 ;; | |
231 ;; Files that are group or world writable. | |
232 (list (concat dired-re-maybe-mark dired-re-inode-size | |
233 "\\([-d]\\(....w....\\|.......w.\\)\\)") | |
234 '(1 font-lock-comment-face) | |
235 '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face))) | |
236 ;; | |
237 ;; Subdirectories. | |
238 (list dired-re-dir | |
239 '(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face))) | |
240 ;; | |
241 ;; Symbolic links. | |
242 (list dired-re-sym | |
243 '(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face))) | |
244 ;; | |
245 ;; Files suffixed with `completion-ignored-extensions'. | |
246 '(eval . | |
247 (let ((extensions (mapcar 'regexp-quote completion-ignored-extensions))) | |
248 ;; It is quicker to first find just an extension, then go back to the | |
249 ;; start of that file name. So we do this complex MATCH-ANCHORED form. | |
250 (list (concat "\\(" (mapconcat 'identity extensions "\\|") "\\|#\\)$") | |
251 '(".+" (dired-move-to-filename) nil (0 font-lock-string-face)))))) | |
252 "Additional expressions to highlight in Dired mode.") | |
226 | 253 |
227 ;;; Macros must be defined before they are used, for the byte compiler. | 254 ;;; Macros must be defined before they are used, for the byte compiler. |
228 | 255 |
229 ;; Mark all files for which CONDITION evals to non-nil. | 256 ;; Mark all files for which CONDITION evals to non-nil. |
230 ;; CONDITION is evaluated on each line, with point at beginning of line. | 257 ;; CONDITION is evaluated on each line, with point at beginning of line. |