aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorSimon Marshall1996-10-23 09:26:39 +0000
committerSimon Marshall1996-10-23 09:26:39 +0000
commit2439570dc3a97187fc173367f4427ac35638b36a (patch)
treeb12ce7b84cef89809ab61d039bf498fff9841767 /lisp
parentf1052d2e63548d29bb7d844b27cbbe32613eb43b (diff)
downloademacs-2439570dc3a97187fc173367f4427ac35638b36a.tar.gz
emacs-2439570dc3a97187fc173367f4427ac35638b36a.zip
Tweak dired-font-lock-keywords.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el49
1 files changed, 38 insertions, 11 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 2e1d706a6eb..a0d0bb9f74d 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -120,17 +120,6 @@ The target is used in the prompt for file copy, rename etc.")
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 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
134;;; Hook variables 123;;; Hook variables
135 124
136(defvar dired-load-hook nil 125(defvar dired-load-hook nil
@@ -223,6 +212,44 @@ The match starts at the beginning of the line and ends after the end
223of the line (\\n or \\r). 212of the line (\\n or \\r).
224Subexpression 2 must end right before the \\n or \\r.") 213Subexpression 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