diff options
| author | Juri Linkov | 2004-04-11 09:51:52 +0000 |
|---|---|---|
| committer | Juri Linkov | 2004-04-11 09:51:52 +0000 |
| commit | 0b0e66513c4084fd19d0e8a795a08751c1af647a (patch) | |
| tree | dce99dd2c5bc5e9bcd6c1acc7ecfc73fb404d307 | |
| parent | dbed3cd3c02a9528123896291d2e849d37053e48 (diff) | |
| download | emacs-0b0e66513c4084fd19d0e8a795a08751c1af647a.tar.gz emacs-0b0e66513c4084fd19d0e8a795a08751c1af647a.zip | |
(dired-faces): New defgroup.
(dired-header, dired-mark, dired-marked, dired-flagged)
(dired-warning, dired-directory, dired-symlink, dired-ignored):
New faces.
(dired-header-face, dired-mark-face, dired-marked-face)
(dired-flagged-face, dired-warning-face, dired-directory-face)
(dired-symlink-face, dired-ignored-face): New face variables.
(dired-font-lock-keywords): Use them instead of font-lock faces.
Split the rule for dired marks into 3 separate rules: for marks,
marked file names and flagged file names.
| -rw-r--r-- | lisp/dired.el | 99 |
1 files changed, 87 insertions, 12 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index fd51f7158fa..f562a0492eb 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -288,21 +288,96 @@ The match starts at the beginning of the line and ends after the end | |||
| 288 | of the line (\\n or \\r). | 288 | of the line (\\n or \\r). |
| 289 | Subexpression 2 must end right before the \\n or \\r.") | 289 | Subexpression 2 must end right before the \\n or \\r.") |
| 290 | 290 | ||
| 291 | (defgroup dired-faces nil | ||
| 292 | "Faces used by dired." | ||
| 293 | :group 'dired | ||
| 294 | :group 'faces) | ||
| 295 | |||
| 296 | (defface dired-header | ||
| 297 | '((t (:inherit font-lock-type-face))) | ||
| 298 | "Face used for directory headers." | ||
| 299 | :group 'dired-faces | ||
| 300 | :version "21.4") | ||
| 301 | (defvar dired-header-face 'dired-header | ||
| 302 | "Face name used for directory headers.") | ||
| 303 | |||
| 304 | (defface dired-mark | ||
| 305 | '((t (:inherit font-lock-constant-face))) | ||
| 306 | "Face used for dired marks." | ||
| 307 | :group 'dired-faces | ||
| 308 | :version "21.4") | ||
| 309 | (defvar dired-mark-face 'dired-mark | ||
| 310 | "Face name used for dired marks.") | ||
| 311 | |||
| 312 | (defface dired-marked | ||
| 313 | '((t (:inherit font-lock-warning-face))) | ||
| 314 | "Face used for marked files." | ||
| 315 | :group 'dired-faces | ||
| 316 | :version "21.4") | ||
| 317 | (defvar dired-marked-face 'dired-marked | ||
| 318 | "Face name used for marked files.") | ||
| 319 | |||
| 320 | (defface dired-flagged | ||
| 321 | '((t (:inherit font-lock-warning-face))) | ||
| 322 | "Face used for flagged files." | ||
| 323 | :group 'dired-faces | ||
| 324 | :version "21.4") | ||
| 325 | (defvar dired-flagged-face 'dired-flagged | ||
| 326 | "Face name used for flagged files.") | ||
| 327 | |||
| 328 | (defface dired-warning | ||
| 329 | '((t (:inherit font-lock-comment-face))) | ||
| 330 | "Face used to highlight a part of a buffer that needs user attention." | ||
| 331 | :group 'dired-faces | ||
| 332 | :version "21.4") | ||
| 333 | (defvar dired-warning-face 'dired-warning | ||
| 334 | "Face name used for a part of a buffer that needs user attention.") | ||
| 335 | |||
| 336 | (defface dired-directory | ||
| 337 | '((t (:inherit font-lock-function-name-face))) | ||
| 338 | "Face used for subdirectories." | ||
| 339 | :group 'dired-faces | ||
| 340 | :version "21.4") | ||
| 341 | (defvar dired-directory-face 'dired-directory | ||
| 342 | "Face name used for subdirectories.") | ||
| 343 | |||
| 344 | (defface dired-symlink | ||
| 345 | '((t (:inherit font-lock-keyword-face))) | ||
| 346 | "Face used for symbolic links." | ||
| 347 | :group 'dired-faces | ||
| 348 | :version "21.4") | ||
| 349 | (defvar dired-symlink-face 'dired-symlink | ||
| 350 | "Face name used for symbolic links.") | ||
| 351 | |||
| 352 | (defface dired-ignored | ||
| 353 | '((t (:inherit font-lock-string-face))) | ||
| 354 | "Face used for files suffixed with `completion-ignored-extensions'." | ||
| 355 | :group 'dired-faces | ||
| 356 | :version "21.4") | ||
| 357 | (defvar dired-ignored-face 'dired-ignored | ||
| 358 | "Face name used for files suffixed with `completion-ignored-extensions'.") | ||
| 359 | |||
| 291 | (defvar dired-font-lock-keywords | 360 | (defvar dired-font-lock-keywords |
| 292 | (list | 361 | (list |
| 293 | ;; | 362 | ;; |
| 294 | ;; Directory headers. | 363 | ;; Directory headers. |
| 295 | (list dired-subdir-regexp '(1 font-lock-type-face)) | 364 | (list dired-subdir-regexp '(1 dired-header-face)) |
| 365 | ;; | ||
| 366 | ;; Dired marks. | ||
| 367 | (list dired-re-mark '(0 dired-mark-face)) | ||
| 296 | ;; | 368 | ;; |
| 297 | ;; We make heavy use of MATCH-ANCHORED, since the regexps don't identify the | 369 | ;; We make heavy use of MATCH-ANCHORED, since the regexps don't identify the |
| 298 | ;; file name itself. We search for Dired defined regexps, and then use the | 370 | ;; file name itself. We search for Dired defined regexps, and then use the |
| 299 | ;; Dired defined function `dired-move-to-filename' before searching for the | 371 | ;; Dired defined function `dired-move-to-filename' before searching for the |
| 300 | ;; simple regexp ".+". It is that regexp which matches the file name. | 372 | ;; simple regexp ".+". It is that regexp which matches the file name. |
| 301 | ;; | 373 | ;; |
| 302 | ;; Dired marks. | 374 | ;; Marked files. |
| 303 | (list dired-re-mark | 375 | (list (concat "^[" (char-to-string dired-marker-char) "]") |
| 304 | '(0 font-lock-constant-face) | 376 | '(".+" (dired-move-to-filename) nil (0 dired-marked-face))) |
| 305 | '(".+" (dired-move-to-filename) nil (0 font-lock-warning-face))) | 377 | ;; |
| 378 | ;; Flagged files. | ||
| 379 | (list (concat "^[" (char-to-string dired-del-marker) "]") | ||
| 380 | '(".+" (dired-move-to-filename) nil (0 dired-flagged-face))) | ||
| 306 | ;; People who are paranoid about security would consider this more | 381 | ;; People who are paranoid about security would consider this more |
| 307 | ;; important than other things such as whether it is a directory. | 382 | ;; important than other things such as whether it is a directory. |
| 308 | ;; But we don't want to encourage paranoia, so our default | 383 | ;; But we don't want to encourage paranoia, so our default |
| @@ -311,33 +386,33 @@ Subexpression 2 must end right before the \\n or \\r.") | |||
| 311 | ;;; ;; Files that are group or world writable. | 386 | ;;; ;; Files that are group or world writable. |
| 312 | ;;; (list (concat dired-re-maybe-mark dired-re-inode-size | 387 | ;;; (list (concat dired-re-maybe-mark dired-re-inode-size |
| 313 | ;;; "\\([-d]\\(....w....\\|.......w.\\)\\)") | 388 | ;;; "\\([-d]\\(....w....\\|.......w.\\)\\)") |
| 314 | ;;; '(1 font-lock-comment-face) | 389 | ;;; '(1 dired-warning-face) |
| 315 | ;;; '(".+" (dired-move-to-filename) nil (0 font-lock-comment-face))) | 390 | ;;; '(".+" (dired-move-to-filename) nil (0 dired-warning-face))) |
| 316 | ;; However, we don't need to highlight the file name, only the | 391 | ;; However, we don't need to highlight the file name, only the |
| 317 | ;; permissions, to win generally. -- fx. | 392 | ;; permissions, to win generally. -- fx. |
| 318 | ;; Fixme: we could also put text properties on the permission | 393 | ;; Fixme: we could also put text properties on the permission |
| 319 | ;; fields with keymaps to frob the permissions, somewhat a la XEmacs. | 394 | ;; fields with keymaps to frob the permissions, somewhat a la XEmacs. |
| 320 | (list (concat dired-re-maybe-mark dired-re-inode-size | 395 | (list (concat dired-re-maybe-mark dired-re-inode-size |
| 321 | "[-d]....\\(w\\)....") ; group writable | 396 | "[-d]....\\(w\\)....") ; group writable |
| 322 | '(1 font-lock-comment-face)) | 397 | '(1 dired-warning-face)) |
| 323 | (list (concat dired-re-maybe-mark dired-re-inode-size | 398 | (list (concat dired-re-maybe-mark dired-re-inode-size |
| 324 | "[-d].......\\(w\\).") ; world writable | 399 | "[-d].......\\(w\\).") ; world writable |
| 325 | '(1 font-lock-comment-face)) | 400 | '(1 dired-warning-face)) |
| 326 | ;; | 401 | ;; |
| 327 | ;; Subdirectories. | 402 | ;; Subdirectories. |
| 328 | (list dired-re-dir | 403 | (list dired-re-dir |
| 329 | '(".+" (dired-move-to-filename) nil (0 font-lock-function-name-face))) | 404 | '(".+" (dired-move-to-filename) nil (0 dired-directory-face))) |
| 330 | ;; | 405 | ;; |
| 331 | ;; Symbolic links. | 406 | ;; Symbolic links. |
| 332 | (list dired-re-sym | 407 | (list dired-re-sym |
| 333 | '(".+" (dired-move-to-filename) nil (0 font-lock-keyword-face))) | 408 | '(".+" (dired-move-to-filename) nil (0 dired-symlink-face))) |
| 334 | ;; | 409 | ;; |
| 335 | ;; Files suffixed with `completion-ignored-extensions'. | 410 | ;; Files suffixed with `completion-ignored-extensions'. |
| 336 | '(eval . | 411 | '(eval . |
| 337 | ;; It is quicker to first find just an extension, then go back to the | 412 | ;; It is quicker to first find just an extension, then go back to the |
| 338 | ;; start of that file name. So we do this complex MATCH-ANCHORED form. | 413 | ;; start of that file name. So we do this complex MATCH-ANCHORED form. |
| 339 | (list (concat "\\(" (regexp-opt completion-ignored-extensions) "\\|#\\)$") | 414 | (list (concat "\\(" (regexp-opt completion-ignored-extensions) "\\|#\\)$") |
| 340 | '(".+" (dired-move-to-filename) nil (0 font-lock-string-face))))) | 415 | '(".+" (dired-move-to-filename) nil (0 dired-ignored-face))))) |
| 341 | "Additional expressions to highlight in Dired mode.") | 416 | "Additional expressions to highlight in Dired mode.") |
| 342 | 417 | ||
| 343 | ;;; Macros must be defined before they are used, for the byte compiler. | 418 | ;;; Macros must be defined before they are used, for the byte compiler. |