/[emacs]/emacs/lisp/rfn-eshadow.el
ViewVC logotype

Diff of /emacs/lisp/rfn-eshadow.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by lektu, Wed May 8 07:56:59 2002 UTC revision 1.8.2.1 by miles, Fri Apr 4 06:20:10 2003 UTC
# Line 3  Line 3 
3  ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.  ;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
4  ;;  ;;
5  ;; Author: Miles Bader <miles@gnu.org>  ;; Author: Miles Bader <miles@gnu.org>
6  ;; Keywords: convenience  ;; Keywords: convenience minibuffer
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 24  Line 24 
24    
25  ;;; Commentary:  ;;; Commentary:
26  ;;  ;;
27  ;; Defines the mode `read-file-name-electric-shadow-mode'.  ;; Defines the mode `file-name-shadow-mode'.
28  ;;  ;;
29  ;; The `read-file-name' function passes its result through  ;; The `read-file-name' function passes its result through
30  ;; `substitute-in-file-name', so any part of the string preceding  ;; `substitute-in-file-name', so any part of the string preceding
31  ;; multiple slashes (or a drive indicator on MS-DOS/MS-Windows) is  ;; multiple slashes (or a drive indicator on MS-DOS/MS-Windows) is
32  ;; ignored.  ;; ignored.
33  ;;  ;;
34  ;; If `read-file-name-electric-shadow-mode' is active, any part of the  ;; If `file-name-shadow-mode' is active, any part of the
35  ;; minibuffer text that would be ignored because of this is given the  ;; minibuffer text that would be ignored because of this is given the
36  ;; properties in `read-file-name-electric-shadow-properties', which may  ;; properties in `file-name-shadow-properties', which may
37  ;; be used to make the ignored text invisible, dim, etc.  ;; be used to make the ignored text invisible, dim, etc.
38  ;;  ;;
39    
# Line 42  Line 42 
42    
43  ;;; Customization  ;;; Customization
44    
45  (defconst read-file-name-electric-shadow-properties-custom-type  (defconst file-name-shadow-properties-custom-type
46    '(list    '(list
47      (checklist :inline t      (checklist :inline t
48                 (const :tag "Invisible"                 (const :tag "Invisible"
# Line 55  Line 55 
55                       :tag "Face"                       :tag "Face"
56                       :doc "Display shadowed part of filename using a different face"                       :doc "Display shadowed part of filename using a different face"
57                       (const :format "" face)                       (const :format "" face)
58                       (face :value read-file-name-electric-shadow))                       (face :value file-name-shadow))
59                 (list :inline t                 (list :inline t
60                       :format "%t: %v%h"                       :format "%t: %v%h"
61                       :tag "Brackets"                       :tag "Brackets"
# Line 93  Line 93 
93                    (sexp :tag "Value")))))                    (sexp :tag "Value")))))
94    
95  ;;;###autoload  ;;;###autoload
96  (defcustom read-file-name-electric-shadow-properties  (defcustom file-name-shadow-properties
97    '(face read-file-name-electric-shadow field shadow)    '(face file-name-shadow field shadow)
98    "Properties given to the `shadowed' part of a filename in the minibuffer.    "Properties given to the `shadowed' part of a filename in the minibuffer.
99  Only used when `read-file-name-electric-shadow-mode' is active.  Only used when `file-name-shadow-mode' is active.
100  If emacs is not running under a window system,  If emacs is not running under a window system,
101  `read-file-name-electric-shadow-tty-properties' is used instead."  `file-name-shadow-tty-properties' is used instead."
102    :type read-file-name-electric-shadow-properties-custom-type    :type file-name-shadow-properties-custom-type
103    :group 'minibuffer)    :group 'minibuffer)
104    
105  ;;;###autoload  ;;;###autoload
106  (defcustom read-file-name-electric-shadow-tty-properties  (defcustom file-name-shadow-tty-properties
107    '(before-string "{" after-string "} " field shadow)    '(before-string "{" after-string "} " field shadow)
108    "Properties given to the `shadowed' part of a filename in the minibuffer.    "Properties given to the `shadowed' part of a filename in the minibuffer.
109  Only used when `read-file-name-electric-shadow-mode' is active and emacs  Only used when `file-name-shadow-mode' is active and emacs
110  is not running under a window-system; if emacs is running under a window  is not running under a window-system; if emacs is running under a window
111  system, `read-file-name-electric-shadow-properties' is used instead."  system, `file-name-shadow-properties' is used instead."
112    :type read-file-name-electric-shadow-properties-custom-type    :type file-name-shadow-properties-custom-type
113    :group 'minibuffer)    :group 'minibuffer)
114    
115  (defface read-file-name-electric-shadow  (defface file-name-shadow
116    '((((background dark))    '((((background dark))
117       :foreground "grey50")       :foreground "grey50")
118      (t      (t
119       :foreground "grey70"))       :foreground "grey70"))
120    "Face used by `read-file-name-electric-shadow-mode' for the shadow."    "Face used by `file-name-shadow-mode' for the shadow."
121    :group 'minibuffer)    :group 'minibuffer)
122    
123    
# Line 150  is used as the end of the shadowed porti Line 150  is used as the end of the shadowed porti
150    
151  ;; This function goes on minibuffer-setup-hook  ;; This function goes on minibuffer-setup-hook
152  (defun rfn-eshadow-setup-minibuffer ()  (defun rfn-eshadow-setup-minibuffer ()
153    "Set up a minibuffer for `read-file-name-electric-shadow-mode'.    "Set up a minibuffer for `file-name-shadow-mode'.
154  The prompt and initial input should already have been inserted."  The prompt and initial input should already have been inserted."
155    (when minibuffer-completing-file-name    (when minibuffer-completing-file-name
156      (setq rfn-eshadow-overlay      (setq rfn-eshadow-overlay
# Line 158  The prompt and initial input should alre Line 158  The prompt and initial input should alre
158      ;; Give rfn-eshadow-overlay the user's props.      ;; Give rfn-eshadow-overlay the user's props.
159      (let ((props      (let ((props
160             (if window-system             (if window-system
161                 read-file-name-electric-shadow-properties                 file-name-shadow-properties
162               read-file-name-electric-shadow-tty-properties)))               file-name-shadow-tty-properties)))
163        (while props        (while props
164          (overlay-put rfn-eshadow-overlay (pop props) (pop props))))          (overlay-put rfn-eshadow-overlay (pop props) (pop props))))
165      ;; Turn on overlay evaporation so that we don't have to worry about      ;; Turn on overlay evaporation so that we don't have to worry about
# Line 174  The prompt and initial input should alre Line 174  The prompt and initial input should alre
174  (defun rfn-eshadow-update-overlay ()  (defun rfn-eshadow-update-overlay ()
175    "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.    "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
176  This is intended to be used as a minibuffer post-command-hook for  This is intended to be used as a minibuffer post-command-hook for
177  `read-file-name-electric-shadow-mode'; the minibuffer should have already  `file-name-shadow-mode'; the minibuffer should have already
178  been set up by `rfn-eshadow-setup-minibuffer'."  been set up by `rfn-eshadow-setup-minibuffer'."
179    ;; This is not really a correct implementation; it won't always do the    ;; This is not really a correct implementation; it won't always do the
180    ;; right thing in the presence of environment variables that    ;; right thing in the presence of environment variables that
# Line 196  been set up by `rfn-eshadow-setup-minibu Line 196  been set up by `rfn-eshadow-setup-minibu
196  ;;; associated variable is non-nil, which requires that all needed  ;;; associated variable is non-nil, which requires that all needed
197  ;;; functions be already defined.  [This is arguably a bug in d-m-m]  ;;; functions be already defined.  [This is arguably a bug in d-m-m]
198  ;;;###autoload  ;;;###autoload
199  (define-minor-mode read-file-name-electric-shadow-mode  (define-minor-mode file-name-shadow-mode
200    "Toggle Read-File-Name Electric Shadow mode.    "Toggle File-Name Shadow mode.
201  When active, any part of the filename being read in the minibuffer  When active, any part of a filename being read in the minibuffer
202  that would be ignored because the result is passed through  that would be ignored (because the result is passed through
203  `substitute-in-file-name' is given the properties in  `substitute-in-file-name') is given the properties in
204  `read-file-name-electric-shadow-properties', which can be used to make  `file-name-shadow-properties', which can be used to make
205  that portion dim, invisible, or otherwise less visually noticeable.  that portion dim, invisible, or otherwise less visually noticeable.
206    
207  With prefix argument ARG, turn on if positive, otherwise off.  With prefix argument ARG, turn on if positive, otherwise off.
208  Returns non-nil if the new state is enabled."  Returns non-nil if the new state is enabled."
209    :global t    :global t
210    :group 'minibuffer    :group 'minibuffer
211    (if read-file-name-electric-shadow-mode    (if file-name-shadow-mode
212        ;; Enable the mode        ;; Enable the mode
213        (add-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer)        (add-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer)
214      ;; Disable the mode      ;; Disable the mode

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.8.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26