/[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.9 by miles, Sun Aug 25 08:25:00 2002 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    ;; backwards compatibility
105    (make-obsolete-variable 'read-file-name-electric-shadow-properties
106                            'file-name-shadow-properties "21.4")
107    (defvaralias 'read-file-name-electric-shadow-properties
108      'file-name-shadow-properties)
109    
110  ;;;###autoload  ;;;###autoload
111  (defcustom read-file-name-electric-shadow-tty-properties  (defcustom file-name-shadow-tty-properties
112    '(before-string "{" after-string "} " field shadow)    '(before-string "{" after-string "} " field shadow)
113    "Properties given to the `shadowed' part of a filename in the minibuffer.    "Properties given to the `shadowed' part of a filename in the minibuffer.
114  Only used when `read-file-name-electric-shadow-mode' is active and emacs  Only used when `file-name-shadow-mode' is active and emacs
115  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
116  system, `read-file-name-electric-shadow-properties' is used instead."  system, `file-name-shadow-properties' is used instead."
117    :type read-file-name-electric-shadow-properties-custom-type    :type file-name-shadow-properties-custom-type
118    :group 'minibuffer)    :group 'minibuffer)
119    ;; backwards compatibility
120    (make-obsolete-variable 'read-file-name-electric-shadow-tty-properties
121                            'file-name-shadow-tty-properties "21.4")
122    (defvaralias 'read-file-name-electric-shadow-tty-properties
123      'file-name-shadow-tty-properties)
124    
125  (defface read-file-name-electric-shadow  (defface file-name-shadow
126    '((((background dark))    '((((background dark))
127       :foreground "grey50")       :foreground "grey50")
128      (t      (t
129       :foreground "grey70"))       :foreground "grey70"))
130    "Face used by `read-file-name-electric-shadow-mode' for the shadow."    "Face used by `file-name-shadow-mode' for the shadow."
131    :group 'minibuffer)    :group 'minibuffer)
132    
133    
# Line 150  is used as the end of the shadowed porti Line 160  is used as the end of the shadowed porti
160    
161  ;; This function goes on minibuffer-setup-hook  ;; This function goes on minibuffer-setup-hook
162  (defun rfn-eshadow-setup-minibuffer ()  (defun rfn-eshadow-setup-minibuffer ()
163    "Set up a minibuffer for `read-file-name-electric-shadow-mode'.    "Set up a minibuffer for `file-name-shadow-mode'.
164  The prompt and initial input should already have been inserted."  The prompt and initial input should already have been inserted."
165    (when minibuffer-completing-file-name    (when minibuffer-completing-file-name
166      (setq rfn-eshadow-overlay      (setq rfn-eshadow-overlay
# Line 158  The prompt and initial input should alre Line 168  The prompt and initial input should alre
168      ;; Give rfn-eshadow-overlay the user's props.      ;; Give rfn-eshadow-overlay the user's props.
169      (let ((props      (let ((props
170             (if window-system             (if window-system
171                 read-file-name-electric-shadow-properties                 file-name-shadow-properties
172               read-file-name-electric-shadow-tty-properties)))               file-name-shadow-tty-properties)))
173        (while props        (while props
174          (overlay-put rfn-eshadow-overlay (pop props) (pop props))))          (overlay-put rfn-eshadow-overlay (pop props) (pop props))))
175      ;; 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 184  The prompt and initial input should alre
184  (defun rfn-eshadow-update-overlay ()  (defun rfn-eshadow-update-overlay ()
185    "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.    "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
186  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
187  `read-file-name-electric-shadow-mode'; the minibuffer should have already  `file-name-shadow-mode'; the minibuffer should have already
188  been set up by `rfn-eshadow-setup-minibuffer'."  been set up by `rfn-eshadow-setup-minibuffer'."
189    ;; 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
190    ;; 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 206  been set up by `rfn-eshadow-setup-minibu
206  ;;; associated variable is non-nil, which requires that all needed  ;;; associated variable is non-nil, which requires that all needed
207  ;;; 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]
208  ;;;###autoload  ;;;###autoload
209  (define-minor-mode read-file-name-electric-shadow-mode  (define-minor-mode file-name-shadow-mode
210    "Toggle Read-File-Name Electric Shadow mode.    "Toggle Read-File-Name Electric Shadow mode.
211  When active, any part of the filename being read in the minibuffer  When active, any part of the filename being read in the minibuffer
212  that would be ignored because the result is passed through  that would be ignored because the result is passed through
213  `substitute-in-file-name' is given the properties in  `substitute-in-file-name' is given the properties in
214  `read-file-name-electric-shadow-properties', which can be used to make  `file-name-shadow-properties', which can be used to make
215  that portion dim, invisible, or otherwise less visually noticeable.  that portion dim, invisible, or otherwise less visually noticeable.
216    
217  With prefix argument ARG, turn on if positive, otherwise off.  With prefix argument ARG, turn on if positive, otherwise off.
218  Returns non-nil if the new state is enabled."  Returns non-nil if the new state is enabled."
219    :global t    :global t
220    :group 'minibuffer    :group 'minibuffer
221    (if read-file-name-electric-shadow-mode    (if file-name-shadow-mode
222        ;; Enable the mode        ;; Enable the mode
223        (add-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer)        (add-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer)
224      ;; Disable the mode      ;; Disable the mode
# Line 219  Returns non-nil if the new state is enab Line 229  Returns non-nil if the new state is enab
229          (remove-hook 'post-command-hook #'rfn-eshadow-update-overlay t)))          (remove-hook 'post-command-hook #'rfn-eshadow-update-overlay t)))
230      (setq rfn-eshadow-frobbed-minibufs nil)))      (setq rfn-eshadow-frobbed-minibufs nil)))
231    
232    ;; backwards compatibility
233    (make-obsolete 'read-file-name-electric-shadow-mode 'file-name-shadow-mode
234                   "21.4")
235    (defalias 'read-file-name-electric-shadow-mode 'file-name-shadow-mode)
236    (make-obsolete-variable 'read-file-name-electric-shadow-mode
237                            'file-name-shadow-mode "21.4")
238    (defvaralias 'read-file-name-electric-shadow-mode 'file-name-shadow-mode)
239    
240    
241  (provide 'rfn-eshadow)  (provide 'rfn-eshadow)
242    

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

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