home *** CD-ROM | disk | FTP | other *** search
-
- Dave Barker (dbarker@mulga.awadi.com.AU ) on June 9:
- > A minor patch to your dired-lucid-highlight package:
- >
- > If you include a subdirectory in a dired display, then the
- > highlighting code goes into an infinite loop.
- >
- >
- > Cheers,
- > Dave.
-
- Thanks to Dave Barker for the patch. I am including the new version below.
-
- Cengiz
-
- ======================================================================
- | Systems Design and Analysis Group
- Cengiz Alaettinoglu | Department of Computer Science
- ca@cs.umd.edu | University of Maryland
- | College Park, MD 20742
- ======================================================================
- ;;; Copyright (C) 1993 Cengiz Alaettinoglu
- ;;; Cengiz Alaettinoglu <ca@cs.umd.edu>
-
- ;;; Copyright (C) 1991 Tim Wilson and Sebastian Kremer
- ;;; Tim.Wilson@cl.cam.ac.uk
- ;;; Sebastian Kremer <sk@thp.uni-koeln.de>
- ;;; Modified to work with Lucid Emacs
-
- ;;; This program is free software; you can redistribute it and/or modify
- ;;; it under the terms of the GNU General Public License as published by
- ;;; the Free Software Foundation; either version 1, or (at your option)
- ;;; any later version.
- ;;;
- ;;; This program is distributed in the hope that it will be useful,
- ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ;;; GNU General Public License for more details.
- ;;;
- ;;; A copy of the GNU General Public License can be obtained from this
- ;;; program's author (send electronic mail to the above address) or from
- ;;; Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- ; How to install
- ; (add-hook 'dired-load-hook '(lambda () (require 'dired-lucid-highlight)) t)
-
- (require 'dired)
- (provide 'dired-lucid-highlight)
-
- (or (find-face 'dired-face-marked)
- (and
- (make-face 'dired-face-marked)
- (if (x-color-display-p)
- (progn
- (set-face-foreground 'dired-face-marked "Black")
- (set-face-background 'dired-face-marked "PaleVioletRed"))
- (progn
- (set-face-underline-p 'dired-face-marked t)))
- ))
-
- (or (find-face 'dired-face-deleted)
- (and
- (make-face 'dired-face-deleted)
- (if (x-color-display-p)
- (progn
- (set-face-foreground 'dired-face-deleted "Black")
- (set-face-background 'dired-face-deleted "LightSlateGray"))
- (progn
- (set-face-underline-p 'dired-face-deleted t)))
- ))
-
- (or (find-face 'dired-face-directory)
- (and
- (make-face 'dired-face-directory)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-directory "Firebrick")
- (make-face-bold-italic 'dired-face-directory))
- ))
-
- (or (find-face 'dired-face-executable)
- (and
- (make-face 'dired-face-executable)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-executable "Purple")
- (make-face-bold 'dired-face-executable))
- ))
-
- (or (find-face 'dired-face-setuid)
- (and
- (make-face 'dired-face-setuid)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-setuid "Red")
- (make-face-bold 'dired-face-setuid))
- ))
-
- (or (find-face 'dired-face-socket)
- (and
- (make-face 'dired-face-socket)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-socket "Gold")
- (make-face-italic 'dired-face-socket))
- ))
-
- (or (find-face 'dired-face-symlink)
- (and
- (make-face 'dired-face-symlink)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-symlink "MediumBlue")
- (make-face-italic 'dired-face-symlink))
- ))
-
- (or (find-face 'dired-face-boring)
- (and
- (make-face 'dired-face-boring)
- (if (x-color-display-p)
- (set-face-foreground 'dired-face-boring "Grey")
- (set-face-background-pixmap 'dired-face-boring
- '(32 2 "\125\125\125\125\252\252\252\252")))
- ))
-
- (defvar dired-x11-re-boring (if (fboundp 'dired-omit-regexp)
- (dired-omit-regexp)
- "^#\\|~$")
- "Regexp to match backup, autosave and otherwise boring files.
- Those files are displayed in a boring color such as grey (see
- variable `dired-x11-boring-color').")
-
- (defvar dired-re-socket
- (concat dired-re-maybe-mark dired-re-inode-size "s"))
-
- (defvar dired-re-setuid;; setuid plain file (even if not executable)
- (concat dired-re-maybe-mark dired-re-inode-size
- "-[-r][-w][Ss][-r][-w][sx][-r][-w][xst]"))
-
- (defvar dired-re-setgid;; setgid plain file (even if not executable)
- (concat dired-re-maybe-mark dired-re-inode-size
- "-[-r][-w][-x][-r][-w][Ss][-r][-w][xst]"))
-
- (defun dired-lucid-highlight-one (face)
- (set-extent-face (make-extent (dired-move-to-filename)
- (dired-move-to-end-of-filename))
- face))
-
- (defun dired-lucid-highlight ()
- ; (message "Highlighting...")
- (save-excursion
- (goto-char (point-min))
- (while (not (eobp))
- (and (not (eolp))
- (progn
- (beginning-of-line)
- (cond
- ((re-search-forward
- dired-x11-re-boring
- (save-excursion
- (end-of-line)
- (point))
- t)
- (dired-lucid-highlight-one 'dired-face-boring))
- ((looking-at dired-re-dir)
- (dired-lucid-highlight-one 'dired-face-directory))
- ((looking-at dired-re-sym)
- (dired-lucid-highlight-one 'dired-face-symlink))
- ((or (looking-at dired-re-setuid)
- (looking-at dired-re-setgid))
- (dired-lucid-highlight-one 'dired-face-setuid))
- ((looking-at dired-re-exe)
- (dired-lucid-highlight-one 'dired-face-executable))
- ((looking-at dired-re-socket)
- (dired-lucid-highlight-one 'dired-face-socket))
- )))
- (forward-line 1))
- ; (message "Highlighting...done")
- ))
-
- (setq font-lock-keywords-dired-mode
- (list (cons "^\\*.*$" 'dired-face-marked)
- (cons "^\\D.*$" 'dired-face-deleted)))
-
- (add-hook 'dired-after-readin-hook 'dired-lucid-highlight)
- (add-hook 'dired-mode-hook
- '(lambda ()
- (font-lock-mode nil)
- (setq font-lock-keywords font-lock-keywords-dired-mode)
- ))
-
-
-
-
-
- Cengiz
-
- ======================================================================
- | Systems Design and Analysis Group
- Cengiz Alaettinoglu | Department of Computer Science
- ca@cs.umd.edu | University of Maryland
- | College Park, MD 20742
- ======================================================================
-
-