Mercurial > emacs
annotate lisp/rfn-eshadow.el @ 112013:f11676feb984
Fix up last change.
* lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform): Fix up use of
print-number-table.
* src/print.c (PRINT_NUMBER_OBJECT, PRINT_NUMBER_STATUS): Remove.
(print_preprocess): Fix handling of uninterned symbols in last change.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 22 Dec 2010 19:00:12 -0500 |
parents | 280c8ae2476d |
children | 417b1e4d63cd |
rev | line source |
---|---|
39609 | 1 ;;; rfn-eshadow.el --- Highlight `shadowed' part of read-file-name input text |
2 ;; | |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
39609 | 5 ;; |
6 ;; Author: Miles Bader <miles@gnu.org> | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
7 ;; Keywords: convenience minibuffer |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
8 ;; Package: emacs |
39609 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
39609 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
15 ;; (at your option) any later version. |
39609 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
39609 | 24 |
25 ;;; Commentary: | |
26 ;; | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
27 ;; Defines the mode `file-name-shadow-mode'. |
39609 | 28 ;; |
29 ;; The `read-file-name' function passes its result through | |
30 ;; `substitute-in-file-name', so any part of the string preceding | |
31 ;; multiple slashes (or a drive indicator on MS-DOS/MS-Windows) is | |
32 ;; ignored. | |
33 ;; | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
34 ;; If `file-name-shadow-mode' is active, any part of the |
39609 | 35 ;; minibuffer text that would be ignored because of this is given the |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
36 ;; properties in `file-name-shadow-properties', which may |
39609 | 37 ;; be used to make the ignored text invisible, dim, etc. |
38 ;; | |
39 | |
40 ;;; Code: | |
41 | |
42 | |
43 ;;; Customization | |
44 | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
45 (defconst file-name-shadow-properties-custom-type |
39609 | 46 '(list |
47 (checklist :inline t | |
48 (const :tag "Invisible" | |
49 :doc "Make shadowed part of filename invisible" | |
50 :format "%t%n%h" | |
51 :inline t | |
52 (invisible t intangible t)) | |
53 (list :inline t | |
54 :format "%v" | |
55 :tag "Face" | |
56 :doc "Display shadowed part of filename using a different face" | |
57 (const :format "" face) | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
58 (face :value file-name-shadow)) |
39609 | 59 (list :inline t |
60 :format "%t: %v%h" | |
61 :tag "Brackets" | |
62 ;; Note the 4 leading spaces in the doc string; | |
63 ;; this is hack to get around the fact that the | |
64 ;; newline after the second string widget comes | |
65 ;; from the string widget, and doesn't indent | |
66 ;; correctly. We could use a :size attribute to | |
67 ;; make the second string widget not have a | |
68 ;; terminating newline, but this makes it impossible | |
69 ;; to enter trailing whitespace, and it's desirable | |
70 ;; that it be possible. | |
71 :doc " Surround shadowed part of filename with brackets" | |
72 (const :format "" before-string) | |
73 (string :format "%v" :size 4 :value "{") | |
74 (const :format "" after-string) | |
75 ;; see above about why the 2nd string doesn't use :size | |
76 (string :format " and: %v" :value "} ")) | |
77 (list :inline t | |
78 :format "%t: %v%n%h" | |
79 :tag "String" | |
80 :doc "Display a string instead of the shadowed part of filename" | |
81 (const :format "" display) | |
82 (string :format "%v" :size 15 :value "<...ignored...>")) | |
83 (const :tag "Avoid" | |
84 :doc "Try to keep cursor out of shadowed part of filename" | |
85 :format "%t%n%h" | |
86 :inline t | |
87 (field shadow))) | |
88 (repeat :inline t | |
89 :tag "Other Properties" | |
90 (list :inline t | |
91 :format "%v" | |
92 (symbol :tag "Property") | |
93 (sexp :tag "Value"))))) | |
94 | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
95 (defcustom file-name-shadow-properties |
105870
26baacb565b0
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104990
diff
changeset
|
96 ;; FIXME: should we purecopy this? |
26baacb565b0
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104990
diff
changeset
|
97 '(face file-name-shadow field shadow) |
39609 | 98 "Properties given to the `shadowed' part of a filename in the minibuffer. |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
99 Only used when `file-name-shadow-mode' is active. |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
100 If Emacs is not running under a window system, |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
101 `file-name-shadow-tty-properties' is used instead." |
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
102 :type file-name-shadow-properties-custom-type |
66918
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
103 :group 'minibuffer |
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
104 :version "22.1") |
39609 | 105 |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
106 (defcustom file-name-shadow-tty-properties |
105870
26baacb565b0
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104990
diff
changeset
|
107 (purecopy '(before-string "{" after-string "} " field shadow)) |
39609 | 108 "Properties given to the `shadowed' part of a filename in the minibuffer. |
73750
a8f0f78b5599
(file-name-shadow-tty-properties): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
109 Only used when `file-name-shadow-mode' is active and Emacs |
a8f0f78b5599
(file-name-shadow-tty-properties): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
68651
diff
changeset
|
110 is not running under a window-system; if Emacs is running under a window |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
111 system, `file-name-shadow-properties' is used instead." |
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
112 :type file-name-shadow-properties-custom-type |
66918
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
113 :group 'minibuffer |
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
114 :version "22.1") |
39609 | 115 |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
116 (defface file-name-shadow |
63053
4ef6975cd244
* rfn-eshadow.el (file-name-shadow): Inherit from `shadow' face.
Juri Linkov <juri@jurta.org>
parents:
52401
diff
changeset
|
117 '((t :inherit shadow)) |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
118 "Face used by `file-name-shadow-mode' for the shadow." |
66918
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
119 :group 'minibuffer |
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
120 :version "22.1") |
39609 | 121 |
84739
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
122 (defvar rfn-eshadow-setup-minibuffer-hook nil |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
123 "Minibuffer setup functions from other packages.") |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
124 |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
125 (defvar rfn-eshadow-update-overlay-hook nil |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
126 "Customer overlay functions from other packages") |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
127 |
39609 | 128 |
129 ;;; Internal variables | |
130 | |
131 ;; A list of minibuffers to which we've added a post-command-hook. | |
132 (defvar rfn-eshadow-frobbed-minibufs nil) | |
133 | |
134 ;; An overlay covering the shadowed part of the filename (local to the | |
135 ;; minibuffer). | |
136 (defvar rfn-eshadow-overlay) | |
137 (make-variable-buffer-local 'rfn-eshadow-overlay) | |
138 | |
139 | |
140 ;;; Hook functions | |
141 | |
142 ;; This function goes on minibuffer-setup-hook | |
143 (defun rfn-eshadow-setup-minibuffer () | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
144 "Set up a minibuffer for `file-name-shadow-mode'. |
39609 | 145 The prompt and initial input should already have been inserted." |
146 (when minibuffer-completing-file-name | |
147 (setq rfn-eshadow-overlay | |
148 (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) | |
149 ;; Give rfn-eshadow-overlay the user's props. | |
150 (let ((props | |
151 (if window-system | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
152 file-name-shadow-properties |
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
153 file-name-shadow-tty-properties))) |
39609 | 154 (while props |
155 (overlay-put rfn-eshadow-overlay (pop props) (pop props)))) | |
156 ;; Turn on overlay evaporation so that we don't have to worry about | |
157 ;; odd effects when the overlay sits empty at the beginning of the | |
158 ;; minibuffer. | |
159 (overlay-put rfn-eshadow-overlay 'evaporate t) | |
160 ;; Add our post-command hook, and make sure can remove it later. | |
161 (add-to-list 'rfn-eshadow-frobbed-minibufs (current-buffer)) | |
84739
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
162 (add-hook 'post-command-hook #'rfn-eshadow-update-overlay nil t) |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
163 ;; Run custom hook |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
164 (run-hooks 'rfn-eshadow-setup-minibuffer-hook))) |
39609 | 165 |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
166 (defsubst rfn-eshadow-sifn-equal (goal pos) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
167 (equal goal (condition-case nil |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
168 (substitute-in-file-name |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
169 (buffer-substring-no-properties pos (point-max))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
170 ;; `substitute-in-file-name' can fail on partial input. |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
171 (error nil)))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
172 |
39609 | 173 ;; post-command-hook to update overlay |
174 (defun rfn-eshadow-update-overlay () | |
175 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input. | |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
176 This is intended to be used as a minibuffer `post-command-hook' for |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
177 `file-name-shadow-mode'; the minibuffer should have already |
39609 | 178 been set up by `rfn-eshadow-setup-minibuffer'." |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
179 (condition-case nil |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
180 (let ((goal (substitute-in-file-name (minibuffer-contents))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
181 (mid (overlay-end rfn-eshadow-overlay)) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
182 (start (minibuffer-prompt-end)) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
183 (end (point-max))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
184 (unless |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
185 ;; Catch the common case where the shadow does not need to move. |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
186 (and mid |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
187 (or (eq mid end) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
188 (not (rfn-eshadow-sifn-equal goal (1+ mid)))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
189 (or (eq mid start) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
190 (rfn-eshadow-sifn-equal goal mid))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
191 ;; Binary search for the greatest position still equivalent to |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
192 ;; the whole. |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
193 (while (or (< (1+ start) end) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
194 (if (and (< (1+ end) (point-max)) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
195 (rfn-eshadow-sifn-equal goal (1+ end))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
196 ;; (SIFN end) != goal, but (SIFN (1+end)) == goal, |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
197 ;; We've reached a discontinuity: this can happen |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
198 ;; e.g. if `end' point to "/:...". |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
199 (setq start (1+ end) end (point-max)))) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
200 (setq mid (/ (+ start end) 2)) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
201 (if (rfn-eshadow-sifn-equal goal mid) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
202 (setq start mid) |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
203 (setq end mid))) |
84739
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
204 (move-overlay rfn-eshadow-overlay (minibuffer-prompt-end) start)) |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
205 ;; Run custom hook |
ed643c57fe39
* rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents:
78236
diff
changeset
|
206 (run-hooks 'rfn-eshadow-update-overlay-hook)) |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
207 ;; `substitute-in-file-name' can fail on partial input. |
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
208 (error nil))) |
39609 | 209 |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
210 (define-minor-mode file-name-shadow-mode |
47034 | 211 "Toggle File-Name Shadow mode. |
212 When active, any part of a filename being read in the minibuffer | |
213 that would be ignored (because the result is passed through | |
214 `substitute-in-file-name') is given the properties in | |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
215 `file-name-shadow-properties', which can be used to make |
45177
3cb6d6563fba
rfn-eshadow.el (read-file-name-electric-shadow-mode): Fix typos in
Juanma Barranquero <lekktu@gmail.com>
parents:
43893
diff
changeset
|
216 that portion dim, invisible, or otherwise less visually noticeable. |
39609 | 217 |
218 With prefix argument ARG, turn on if positive, otherwise off. | |
219 Returns non-nil if the new state is enabled." | |
220 :global t | |
104990
f0794252d960
* mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
221 ;; We'd like to use custom-initialize-set here so the setup is done |
f0794252d960
* mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
222 ;; before dumping, but at the point where the defcustom is evaluated, |
f0794252d960
* mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
223 ;; the corresponding function isn't defined yet, so |
f0794252d960
* mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
224 ;; custom-initialize-set signals an error. |
f0794252d960
* mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
225 :initialize 'custom-initialize-delay |
66905
e0955732eb23
(file-name-shadow-mode): Set :init-value to t.
Luc Teirlinck <teirllm@auburn.edu>
parents:
66900
diff
changeset
|
226 :init-value t |
39609 | 227 :group 'minibuffer |
66918
a4fc9278ae05
(file-name-shadow-properties, file-name-shadow-tty-properties)
Luc Teirlinck <teirllm@auburn.edu>
parents:
66911
diff
changeset
|
228 :version "22.1" |
47028
0919c09730ad
(file-name-shadow-properties-custom-type): Renamed from
Miles Bader <miles@gnu.org>
parents:
45177
diff
changeset
|
229 (if file-name-shadow-mode |
39609 | 230 ;; Enable the mode |
231 (add-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer) | |
232 ;; Disable the mode | |
233 (remove-hook 'minibuffer-setup-hook 'rfn-eshadow-setup-minibuffer) | |
234 ;; Remove our entry from any post-command-hook variable's it's still in | |
235 (dolist (minibuf rfn-eshadow-frobbed-minibufs) | |
236 (with-current-buffer minibuf | |
237 (remove-hook 'post-command-hook #'rfn-eshadow-update-overlay t))) | |
238 (setq rfn-eshadow-frobbed-minibufs nil))) | |
239 | |
240 | |
241 (provide 'rfn-eshadow) | |
242 | |
66900
c227619d69d6
(rfn-eshadow-regexp): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
64762
diff
changeset
|
243 ;; arch-tag: dcf70a52-0115-4ec2-b1e3-4f8d3541a888 |
39609 | 244 ;;; rfn-eshadow.el ends here |