annotate lisp/filesets.el @ 110149:4ac2b883320e

Forgor to save ChangeLog for previous commit.
author Jan D. <jan.h.d@swipnet.se>
date Thu, 02 Sep 2010 12:20:20 +0200
parents 1d1d5d9bd884
children bc1aa8d4c8dd 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; filesets.el --- handle group of files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105994
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
4 ;; Free Software Foundation, Inc.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
99093
23878214a628 Update author email.
Chong Yidong <cyd@stupidchicken.com>
parents: 98441
diff changeset
6 ;; Author: Thomas Link <sanobast-emacs@yahoo.de>
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
7 ;; Maintainer: FSF
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Keywords: filesets convenience
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
10 ;; This file is part of GNU Emacs.
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
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
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
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.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
22 ;; You should have received a copy of the GNU General Public License
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/>.
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
24
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
25 ;;; Code:
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
27 (defvar filesets-version "1.8.4")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 (defvar filesets-homepage
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 "http://members.a1.net/t.link/CompEmacsFilesets.html")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; Commentary:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
44973
73e9132139f2 Fix typo.
Pavel Janík <Pavel@Janik.cz>
parents: 44959
diff changeset
33 ;; Define filesets, which can be opened or saved with the power of one or
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
34 ;; two mouse clicks only. A fileset is either a list of files, a file
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
35 ;; pattern, a base directory and a search pattern (for files), or an
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
36 ;; inclusion group (i.e. a base file including other files).
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
50683
11093cda819e Don't call filesets-init.
Richard M. Stallman <rms@gnu.org>
parents: 49475
diff changeset
38 ;; Usage:
11093cda819e Don't call filesets-init.
Richard M. Stallman <rms@gnu.org>
parents: 49475
diff changeset
39 ;; 1. Put (require 'filesets) and (filesets-init) in your .emacs file.
11093cda819e Don't call filesets-init.
Richard M. Stallman <rms@gnu.org>
parents: 49475
diff changeset
40 ;; 2. Type ;; M-x filesets-edit or choose "Edit Filesets" from the menu.
11093cda819e Don't call filesets-init.
Richard M. Stallman <rms@gnu.org>
parents: 49475
diff changeset
41 ;; 3. Save your customizations.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
43 ;; Caveat: Fileset names have to be unique.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
45 ;; Filesets.el adds a nifty filesets menu to your menubar. If you change
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
46 ;; your filesets on the fly, don't forget to select "Save Filesets" from
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
47 ;; the menu.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
49 ;; Pressing on the first item in the submenu will open all files at once.
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
50 ;; Define your own function, e.g. browse-url, for opening a fileset's
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
51 ;; files. Or define external viewers for opening files with other
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
52 ;; programs. See `filesets-external-viewers'.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
54 ;; BTW, if you close a fileset, files, which have been changed, will
96376
c3309dba6542 American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
55 ;; be silently saved. Change this behavior by setting
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
56 ;; `filesets-save-buffer-fn'.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;;; Supported modes for inclusion groups (`filesets-ingroup-patterns'):
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; - Elisp
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; - Emacs-Wiki (simple names only)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; - LaTeX
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;;; Known bugs:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;;; To do:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;;- better handling of different customization scenarios
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
72 ;; Data gathering should be better separated from building the menu
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
73 ;; so that one could (1) use filesets without installing the menu
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
74 ;; and (2) create new "frontends" to speedbar and others.
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
75
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
76 ;; The functionality to call external viewers should be isolated in
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
77 ;; an extra package and possibly integrated with the MIME
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
78 ;; handling.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;;; Credits:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; Helpful suggestions (but no significant code) were contributed by
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;;- Christoph Conrad (at gmx de)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;;- Christian Ohler (at Informatik Uni-Oldenburg DE)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;;- Richard Stallman aka RMS (at gnu org)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;;- Per Abrahamsen aka abraham (at dina kvl dk)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;;; Code:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (eval-when-compile
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (require 'cl))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ;;; Some variables
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (defvar filesets-menu-cache nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 "The whole filesets menu.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (defvar filesets-cache-version nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 "Filesets' cached version number.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (defvar filesets-cache-hostname nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 "Filesets' cached system name.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (defvar filesets-ingroup-cache nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 "A plist containing files and their ingroup data.")
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
107 (defvar filesets-ingroup-files nil
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
108 "List of files already processed when searching for included files.")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (defvar filesets-has-changed-flag t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 "Non-nil means some fileset definition has changed.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (defvar filesets-submenus nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 "An association list with filesets menu data.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (defvar filesets-updated-buffers nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 "A list of buffers with updated menu bars.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (defvar filesets-menu-use-cached-flag nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
117 "Use cached data. See `filesets-menu-ensure-use-cached' for details.")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (defvar filesets-update-cache-file-flag nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 "Non-nil means the cache needs updating.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (defvar filesets-ignore-next-set-default nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
121 "List of custom variables for which the next `set-default' will be ignored.")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (defvar filesets-output-buffer-flag nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 "Non-nil means the current buffer is an output buffer created by filesets.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 Is buffer local variable.")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defvar filesets-verbosity 1
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
128 "An integer defining the level of verbosity.
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
129 0 means no messages at all.")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (defvar filesets-menu-ensure-use-cached
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
132 (and (featurep 'xemacs)
62888
df1894ffb13c (filesets-menu-ensure-use-cached):
Richard M. Stallman <rms@gnu.org>
parents: 61583
diff changeset
133 (if (fboundp 'emacs-version>=)
df1894ffb13c (filesets-menu-ensure-use-cached):
Richard M. Stallman <rms@gnu.org>
parents: 61583
diff changeset
134 (not (emacs-version>= 21 5))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 "Make sure (X)Emacs uses filesets' cache.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 Well, if you use XEmacs (prior to 21.5?) custom.el is loaded after
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 init.el. This means that settings saved in the cache file (see
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 `filesets-menu-cache-file') will be overwritten by custom.el. In order
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 to ensure the use of the cache file, set this variable to t -- which is
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 the default for XEmacs prior to 21.5. If you want to change this value
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 put \"(setq filesets-menu-ensure-use-cached VALUE)\" into your startup
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 file -- before loading filesets.el.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 So, when should you think about setting this value to t? If filesets.el
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 is loaded before user customizations. Thus, if (require 'filesets)
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
147 precedes the `custom-set-variables' command or, for XEmacs, if init.el
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
148 is loaded before custom.el, set this variable to t.")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 ;;; utils
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (defun filesets-filter-list (lst cond-fn)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 "Remove all elements not conforming to COND-FN from list LST.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 COND-FN takes one argument: the current element."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ; (remove* 'dummy lst :test (lambda (dummy elt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ; (not (funcall cond-fn elt)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (let ((rv nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (dolist (elt lst rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (when (funcall cond-fn elt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (setq rv (append rv (list elt)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
162 (defun filesets-ormap (fsom-pred lst)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
163 "Return the tail of LST for the head of which FSOM-PRED is non-nil."
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
164 (let ((fsom-lst lst)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
165 (fsom-rv nil))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
166 (while (and (not (null fsom-lst))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
167 (null fsom-rv))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
168 (if (funcall fsom-pred (car fsom-lst))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
169 (setq fsom-rv fsom-lst)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
170 (setq fsom-lst (cdr fsom-lst))))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
171 fsom-rv))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
172
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
173 (defun filesets-some (fss-pred fss-lst)
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
174 "Return non-nil if FSS-PRED is non-nil for any element of FSS-LST.
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
175 Like `some', return the first value of FSS-PRED that is non-nil."
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
176 (catch 'exit
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
177 (dolist (fss-this fss-lst nil)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
178 (let ((fss-rv (funcall fss-pred fss-this)))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
179 (when fss-rv
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
180 (throw 'exit fss-rv))))))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
181 ;(fset 'filesets-some 'some) ;; or use the cl function
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
182
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
183 (defun filesets-member (fsm-item fsm-lst &rest fsm-keys)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
184 "Find the first occurrence of FSM-ITEM in FSM-LST.
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
185 It is supposed to work like cl's `member*'. At the moment only the :test
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
186 key is supported."
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
187 (let ((fsm-test (or (plist-get fsm-keys ':test)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
188 (function equal))))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
189 (filesets-ormap (lambda (fsm-this)
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
190 (funcall fsm-test fsm-item fsm-this))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
191 fsm-lst)))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
192 ;(fset 'filesets-member 'member*) ;; or use the cl function
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
193
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (defun filesets-sublist (lst beg &optional end)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 "Get the sublist of LST from BEG to END - 1."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (let ((rv nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (i beg)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (top (or end
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (length lst))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (while (< i top)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (setq rv (append rv (list (nth i lst))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (setq i (+ i 1)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 rv))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 (defun filesets-select-command (cmd-list)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 "Select one command from CMD-LIST -- a string with space separated names."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (let ((this (shell-command-to-string
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 (format "which --skip-alias %s 2> /dev/null | head -n 1"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 cmd-list))))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
210 (if (equal this "")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 (file-name-nondirectory (substring this 0 (- (length this) 1))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 (defun filesets-which-command (cmd)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
215 "Call \"which CMD\"."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (shell-command-to-string (format "which %s" cmd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (defun filesets-which-command-p (cmd)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
219 "Call \"which CMD\" and return non-nil if the command was found."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (when (string-match (format "\\(/[^/]+\\)?/%s" cmd)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 (filesets-which-command cmd))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 cmd))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 (defun filesets-message (level &rest args)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 "Show a message only if LEVEL is greater or equal then `filesets-verbosity'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (when (<= level (abs filesets-verbosity))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 (apply 'message args)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;;; config file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (defun filesets-save-config ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 "Save filesets' customizations."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 (customize-save-customized))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (defun filesets-reset-fileset (&optional fileset no-cache)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 "Reset the cached values for one or all filesets."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 (if fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (setq filesets-submenus (lax-plist-put filesets-submenus fileset nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (setq filesets-submenus nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (setq filesets-has-changed-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 (setq filesets-update-cache-file-flag (or filesets-update-cache-file-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (not no-cache))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (defun filesets-set-config (fileset var val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 "Set-default wrapper function."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (filesets-reset-fileset fileset)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (set-default var val))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ; (customize-set-variable var val))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ; (filesets-build-menu))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
61238
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
252 ;; It seems this is a workaround for the XEmacs issue described in the
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
253 ;; doc-string of filesets-menu-ensure-use-cached. Under Emacs this is
61238
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
254 ;; essentially just `set-default'.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 (defun filesets-set-default (sym val &optional init-flag)
61238
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
256 "Set-default wrapper function used in conjunction with `defcustom'.
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
257 If SYM is in the list `filesets-ignore-next-set-default', delete
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
258 it from that list, and return nil. Otherwise, set the value of
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
259 SYM to VAL and return t. If INIT-FLAG is non-nil, set with
e7c23f9a917c (filesets-set-default): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 61138
diff changeset
260 `custom-initialize-set', otherwise with `set-default'."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 (let ((ignore-flag (member sym filesets-ignore-next-set-default)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (if ignore-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 (setq filesets-ignore-next-set-default
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (delete sym filesets-ignore-next-set-default))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (if init-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (custom-initialize-set sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (set-default sym val)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 (not ignore-flag)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (defun filesets-set-default! (sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 "Call `filestes-set-default' and reset cached data (i.e. rebuild menu)."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (when (filesets-set-default sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (filesets-reset-fileset)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 (defun filesets-set-default+ (sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 "Call `filestes-set-default' and reset filesets' standard menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (when (filesets-set-default sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (setq filesets-has-changed-flag t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ; (filesets-reset-fileset nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
281 (defvar filesets-data)
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
282
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (defun filesets-data-set-default (sym val)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 "Set the default for `filesets-data'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (if filesets-menu-use-cached-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (setq filesets-menu-use-cached-flag nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (when (default-boundp 'filesets-data)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (let ((modified-filesets
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (filesets-filter-list val
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (let ((name (car x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (data (cdr x)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (let ((elt (assoc name filesets-data)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (or (not elt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (not (equal data (cdr elt))))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (dolist (x modified-filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (filesets-reset-fileset (car x))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (filesets-set-default sym val))
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
299
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 ;;; configuration
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (defgroup filesets nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 "The fileset swapper."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 :prefix "filesets-"
57925
cb0a9c84d565 (filesets group): Add :version.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
304 :group 'convenience
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 58039
diff changeset
305 :version "22.1")
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (defcustom filesets-menu-name "Filesets"
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
308 "Filesets' menu name."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 :set (function filesets-set-default)
98441
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
310 :type 'string
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312
98441
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
313 (defcustom filesets-menu-path '("File") ; cf recentf-menu-path
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
314 "The menu under which the filesets menu should be inserted.
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
315 See `add-submenu' for documentation."
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
316 :set (function filesets-set-default)
98441
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
317 :type '(choice (const :tag "Top Level" nil)
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
318 (sexp :tag "Menu Path"))
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
319 :version "23.1" ; was nil
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
320 :group 'filesets)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321
98441
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
322 (defcustom filesets-menu-before "Open File..." ; cf recentf-menu-before
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
323 "The name of a menu before which this menu should be added.
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
324 See `add-submenu' for documentation."
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
325 :set (function filesets-set-default)
98441
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
326 :type '(choice (string :tag "Name")
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
327 (const :tag "Last" nil))
38ad371acd1d (filesets-menu-name): Fix type.
Glenn Morris <rgm@gnu.org>
parents: 97155
diff changeset
328 :version "23.1" ; was "File"
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
329 :group 'filesets)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
331 (defcustom filesets-menu-in-menu nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
332 "Use that instead of `current-menubar' as the menu to change.
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
333 See `add-submenu' for documentation."
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
334 :set (function filesets-set-default)
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
335 :type 'sexp
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
336 :group 'filesets)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (defcustom filesets-menu-shortcuts-flag t
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
339 "Non-nil means to prepend menus with hopefully unique shortcuts."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 :set (function filesets-set-default!)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (defcustom filesets-menu-shortcuts-marker "%_"
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
345 "String for marking menu shortcuts."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 :set (function filesets-set-default!)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 :type 'string
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
350 ;;(defcustom filesets-menu-cnvfp-flag nil
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
351 ;; "*Non-nil means show \"Convert :pattern to :files\" entry for :pattern menus."
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
352 ;; :set (function filesets-set-default!)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
353 ;; :type 'boolean
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
354 ;; :group 'filesets)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (defcustom filesets-menu-cache-file
99106
814d2d823dd7 New function `locate-user-emacs-file'.
Juanma Barranquero <lekktu@gmail.com>
parents: 99095
diff changeset
357 (locate-user-emacs-file "filesets-cache.el")
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
358 "File to be used for saving the filesets menu between sessions.
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
359 Set this to \"\", to disable caching of menus.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 Don't forget to check out `filesets-menu-ensure-use-cached'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 :type 'file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 :group 'filesets)
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
364 (put 'filesets-menu-cache-file 'risky-local-variable t)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 (defcustom filesets-menu-cache-contents
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 '(filesets-be-docile-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 filesets-submenus
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
369 filesets-menu-cache
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 filesets-ingroup-cache)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
371 "Stuff we want to save in `filesets-menu-cache-file'.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 Possible uses: don't save configuration data in the main startup files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 but in filesets's own cache. In this case add `filesets-data' to this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 list.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
377 There is a second reason for putting `filesets-data' on this list. If
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 you frequently add and remove buffers on the fly to :files filesets, you
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 don't need to save your customizations if `filesets-data' is being
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
380 mirrored in the cache file. In this case the version in the cache file
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 is the current one, and the version in your startup file will be
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 silently updated later on.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 If you want caching to work properly, at least `filesets-submenus',
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 `filesets-menu-cache', and `filesets-ingroup-cache' should be in this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 list.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 Don't forget to check out `filesets-menu-ensure-use-cached'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 :type '(repeat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (choice :tag "Variable"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (const :tag "filesets-submenus"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 :value filesets-submenus)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 (const :tag "filesets-menu-cache"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 :value filesets-menu-cache)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (const :tag "filesets-ingroup-cache"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 :value filesets-ingroup-cache)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (const :tag "filesets-data"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 :value filesets-data)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (const :tag "filesets-external-viewers"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 :value filesets-external-viewers)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (const :tag "filesets-ingroup-patterns"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 :value filesets-ingroup-patterns)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (const :tag "filesets-be-docile-flag"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 :value filesets-be-docile-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (sexp :tag "Other" :value nil)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (defcustom filesets-cache-fill-content-hooks nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
410 "Hooks to run when writing the contents of filesets' cache file.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 The hook is called with the cache file as current buffer and the cursor
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 at the last position. I.e. each hook has to make sure that the cursor is
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 at the last position.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 Possible uses: If you don't want to save `filesets-data' in your normal
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 configuration file, you can add a something like this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 \(lambda ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 \(insert (format \"(setq-default filesets-data '%S)\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 filesets-data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 \(newline 2))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 to this hook.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 Don't forget to check out `filesets-menu-ensure-use-cached'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 :type 'hook
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (defcustom filesets-cache-hostname-flag nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
432 "Non-nil means cache the hostname.
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
433 If the current name differs from the cached one,
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
434 rebuild the menu and create a new cache file."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (defcustom filesets-cache-save-often-flag nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
440 "Non-nil means save buffer on every change of the filesets menu.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 If this variable is set to nil and if Emacs crashes, the cache and
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
442 filesets-data could get out of sync. Set this to t if this happens from
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 time to time or if the fileset cache causes troubles."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (defcustom filesets-max-submenu-length 25
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
449 "Maximum length of submenus.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 Set this value to 0 to turn menu splitting off. BTW, parts of submenus
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 will not be rewrapped if their length exceeds this value."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 :type 'integer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (defcustom filesets-max-entry-length 50
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
457 "Truncate names of splitted submenus to this length."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 :type 'integer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
462 (defcustom filesets-browse-dir-function 'dired
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
463 "A function or command used for browsing directories.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 When using an external command, \"%s\" will be replaced with the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 directory's name.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 Note: You have to manually rebuild the menu if you change this value."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 :type '(choice :tag "Function:"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (const :tag "dired"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 :value dired)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (list :tag "Command"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 :value ("" "%s")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (string :tag "Name")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (string :tag "Arguments"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (function :tag "Function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 :value nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
480 (defcustom filesets-open-file-function 'filesets-find-or-display-file
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
481 "The function used for opening files.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 `filesets-find-or-display-file' ... Filesets' default function for
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 visiting files. This function checks if an external viewer is defined
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 for a specific file type. Either this viewer, if defined, or
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 `find-file' will be used to visit a file.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 `filesets-find-file' ... An alternative function that always uses
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
489 `find-file'. If `filesets-be-docile-flag' is true, a file, which isn't
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 readable, will not be opened.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 Caveat: Changes will take effect only after rebuilding the menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 :type '(choice :tag "Function:"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 (const :tag "filesets-find-or-display-file"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 :value filesets-find-or-display-file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (const :tag "filesets-find-file"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 :value filesets-find-file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (function :tag "Function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 :value nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
503 (defcustom filesets-save-buffer-function 'save-buffer
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
504 "The function used to save a buffer.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 Caveat: Changes will take effect after rebuilding the menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 :type '(choice :tag "Function:"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (const :tag "save-buffer"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 :value save-buffer)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (function :tag "Function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 :value nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (defcustom filesets-find-file-delay
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
515 (if (and (featurep 'xemacs) gutter-buffers-tab-visible-p)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 0.5
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 0)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
518 "Delay before calling `find-file'.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 This is for calls via `filesets-find-or-display-file'
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 or `filesets-find-file'.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 Set this to 0, if you don't use XEmacs' buffer tabs."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 :type 'number
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 (defcustom filesets-be-docile-flag nil
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
528 "Non-nil means don't complain if a file or a directory doesn't exist.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 This is useful if you want to use the same startup files in different
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 computer environments."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 (defcustom filesets-sort-menu-flag t
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
536 "Non-nil means sort the filesets menu alphabetically."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (defcustom filesets-sort-case-sensitive-flag t
85317
e55429fe2239 (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 84660
diff changeset
542 "Non-nil means sorting of the filesets menu is case sensitive."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 :type 'boolean
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (defcustom filesets-tree-max-level 3
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
548 "Maximum scan depth for directory trees.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 A :tree fileset is defined by a base directory the contents of which
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
550 will be recursively added to the menu. `filesets-tree-max-level' tells up
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 to which level the directory structure should be scanned/listed,
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 i.e. how deep the menu should be. Try something like
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 \(\"HOME -- only one level\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 \(:tree \"~\" \"^[^.].*[^~]$\")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 \(:tree-max-level 1)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 \(:filter-dirs-flag t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 \(\"HOME -- up to 3 levels\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 \(:tree \"~\" \"^[^.].*[^~]$\")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 \(:tree-max-level 3)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 \(:filter-dirs-flag t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 and it should become clear what this option is about. In any case,
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 including directory trees to the menu can take a lot of memory."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 :type 'integer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 :group 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (defcustom filesets-commands
96958
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
570 `(("Isearch"
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
571 multi-isearch-files
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
572 (filesets-cmd-isearch-getargs))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
573 ("Isearch (regexp)"
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
574 multi-isearch-files-regexp
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
575 (filesets-cmd-isearch-getargs))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
576 ("Query Replace"
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
577 perform-replace
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (filesets-cmd-query-replace-getargs))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 ("Query Replace (regexp)"
96958
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
580 perform-replace
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
581 (filesets-cmd-query-replace-regexp-getargs))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 ("Grep <<selection>>"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 "grep"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 ("-n " filesets-get-quoted-selection " " "<<file-name>>"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 ("Run Shell Command"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 filesets-cmd-shell-command
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 (filesets-cmd-shell-command-getargs)))
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
588 "Commands to run on filesets.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 An association list of names, functions, and an argument list (or a
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 function that returns one) to be run on a filesets' files.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 The argument <file-name> or <<file-name>> (quoted) will be replaced with
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 the filename."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 :set (function filesets-set-default+)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 :type '(repeat :tag "Commands"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (list :tag "Definition" :value ("")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (string "Name")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 (choice :tag "Command"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 (string :tag "String")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (repeat :tag "Argument List"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 (choice :tag "Arguments"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 (sexp :tag "Sexp"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 :value nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (string :tag "File Name"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 :value "<file-name>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 (string :tag "Quoted File Name"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 :value "<<file-name>>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (function :tag "Function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 :value nil)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 :group 'filesets)
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
612 (put 'filesets-commands 'risky-local-variable t)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 (defcustom filesets-external-viewers
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (let
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
616 ;; ((ps-cmd (or (and (boundp 'my-ps-viewer) my-ps-viewer)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
617 ;; (filesets-select-command "ggv gv")))
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
618 ;; (pdf-cmd (or (and (boundp 'my-ps-viewer) my-pdf-viewer)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
619 ;; (filesets-select-command "xpdf acroread")))
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
620 ;; (dvi-cmd (or (and (boundp 'my-ps-viewer) my-dvi-viewer)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
621 ;; (filesets-select-command "xdvi tkdvi")))
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
622 ;; (doc-cmd (or (and (boundp 'my-ps-viewer) my-doc-viewer)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
623 ;; (filesets-select-command "antiword")))
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
624 ;; (pic-cmd (or (and (boundp 'my-ps-viewer) my-pic-viewer)
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
625 ;; (filesets-select-command "gqview ee display"))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 ((ps-cmd "ggv")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 (pdf-cmd "xpdf")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 (dvi-cmd "xdvi")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (doc-cmd "antiword")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (pic-cmd "gqview"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 `(("^.+\\..?html?$" browse-url
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 ((:ignore-on-open-all t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 ("^.+\\.pdf$" ,pdf-cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 ((:ignore-on-open-all t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (:constraint-flag ,pdf-cmd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 ("^.+\\.e?ps\\(.gz\\)?$" ,ps-cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 ((:ignore-on-open-all t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 (:constraint-flag ,ps-cmd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 ("^.+\\.dvi$" ,dvi-cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 ((:ignore-on-open-all t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 (:constraint-flag ,dvi-cmd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 ("^.+\\.doc$" ,doc-cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 ((:capture-output t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (:constraint-flag ,doc-cmd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 ("^.+\\.\\(tiff\\|xpm\\|gif\\|pgn\\)$" ,pic-cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 ((:ignore-on-open-all t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (:constraint-flag ,pic-cmd)))))
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
653 "Association list of file patterns and external viewers for use with
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 `filesets-find-or-display-file'.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 function or a command name as string.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658
63251
9a8c8a29b2b7 (filesets-external-viewers): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 62888
diff changeset
659 Properties is an association list determining filesets' behavior in
9a8c8a29b2b7 (filesets-external-viewers): Fix spellings in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 62888
diff changeset
660 several conditions. Choose one from this list:
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 :ignore-on-open-all ... Don't open files of this type automatically --
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 i.e. on open-all-files-events or when running commands
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 :capture-output ... capture an external viewer output
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 :constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
669 :constraint-flag SEXP ... use this viewer only if SEXP evaluates to non-nil
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 :open-hook HOOK ... run hooks after spawning the viewer -- mainly useful
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 in conjunction with :capture-output
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 :args (FORMAT-STRING or SYMBOL or FUNCTION) ... a list of arguments
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 \(defaults to (list \"%S\")) when using shell commands
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 Avoid modifying this variable and achieve minor speed-ups by setting the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 variables my-ps-viewer, my-pdf-viewer, my-dvi-viewer, my-pic-viewer.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 In order to view pdf or rtf files in an Emacs buffer, you could use these:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
683 \(\"^.+\\\\.pdf\\\\'\" \"pdftotext\"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 \((:capture-output t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 \(:args (\"%S - | fmt -w \" window-width))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 \(:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 \(:constraintp (lambda ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 \(and \(filesets-which-command-p \"pdftotext\")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 \(filesets-which-command-p \"fmt\"))))))
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
690 \(\"^.+\\\\.rtf\\\\'\" \"rtf2htm\"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 \((:capture-output t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 \(:args (\"%S 2> /dev/null | w3m -dump -T text/html\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 \(:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 \(:constraintp (lambda ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 \(and (filesets-which-command-p \"rtf2htm\")
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
696 \(filesets-which-command-p \"w3m\"))))))"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 :type '(repeat :tag "Viewer"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (list :tag "Definition"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 :value ("^.+\\.suffix$" "")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (regexp :tag "Pattern")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (choice :tag "Viewer"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (symbol :tag "Function" :value nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 (string :tag "Program" :value ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (repeat :tag "Properties"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 (choice
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (list :tag ":constraintp"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 :value (:constraintp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 :value :constraintp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 (list :tag ":constraint-flag"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 :value (:constraint-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 :value :constraint-flag)
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
716 (sexp :tag "Symbol"))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (list :tag ":ignore-on-open-all"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 :value (:ignore-on-open-all t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 :value :ignore-on-open-all)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 (boolean :tag "Boolean"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (list :tag ":ignore-on-read-text"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 :value (:ignore-on-read-text t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 :value :ignore-on-read-text)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (boolean :tag "Boolean"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 (list :tag ":args"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 :value (:args)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 :value :args)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 (repeat :tag "List"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 (choice :tag "Arguments"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 (string :tag "String"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 :value "")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (symbol :tag "Symbol"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 :value nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 (function :tag "Function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 :value nil))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 (list :tag ":open-hook"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 :value (:open-hook)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 :value :open-hook)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 (hook :tag "Hook"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 ; (list :tag ":close-hook"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 ; :value (:close-hook)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 ; (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 ; :value :close-hook)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 ; (hook :tag "Hook"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (list :tag ":capture-output"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 :value (:capture-output t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 (const :format ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 :value :capture-output)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 (boolean :tag "Boolean"))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 :group 'filesets)
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
755 (put 'filesets-external-viewers 'risky-local-variable t)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 (defcustom filesets-ingroup-patterns
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 '(("^.+\\.tex$" t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 (((:name "Package")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 (:pattern "\\\\usepackage\\W*\\(\\[[^\]]*\\]\\W*\\)?{\\W*\\(.+\\)\\W*}")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 (:match-number 2)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 (:stub-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 (filesets-which-file master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 (concat file ".sty")
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
766 (filesets-convert-path-list
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 (or (getenv "MY_TEXINPUTS")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 (getenv "TEXINPUTS")))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 ((:name "Include")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (:pattern "\\\\include\\W*{\\W*\\(.+\\)\\W*}")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 (filesets-which-file master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 (concat file ".tex")
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
774 (filesets-convert-path-list
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 (or (getenv "MY_TEXINPUTS")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 (getenv "TEXINPUTS"))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777 (:scan-depth 5))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778 ((:name "Input")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 (:pattern "\\\\input\\W*{\\W*\\(.+\\)\\W*}")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780 (:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 (filesets-which-file master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 (concat file ".tex")
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
784 (filesets-convert-path-list
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 (or (getenv "MY_TEXINPUTS")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 (getenv "TEXINPUTS"))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787 (:scan-depth 5))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 ((:name "Bibliography")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 (:pattern "\\\\bibliography\\W*{\\W*\\(.+\\)\\W*}")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 (filesets-which-file master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 (concat file ".bib")
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
793 (filesets-convert-path-list
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 (or (getenv "MY_BIBINPUTS")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 (getenv "BIBINPUTS")))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796 ("^.+\\.el$" t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 (((:name "Require")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798 (:pattern "(require\\W+'\\(.+\\))")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 (:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 (filesets-which-file master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 (concat file ".el")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 load-path))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 ((:name "Load")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 (:pattern "(load\\(-library\\)?\\W+\"\\(.+\\)\")")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 (:match-number 2)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 (filesets-which-file master file load-path))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 ("^\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)$" t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810 (((:pattern "\\<\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)\\>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
811 (:scan-depth 5)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
812 (:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
813 (:case-sensitive t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
814 (:get-file-name (lambda (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
815 (filesets-which-file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816 master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
817 file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
818 (if (boundp 'emacs-wiki-directories)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 emacs-wiki-directories
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 nil))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
822 "Inclusion group definitions.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 Define how to find included file according to a file's mode (being
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 defined by a file pattern).
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 A valid entry has the form (FILE-PATTERN REMOVE-DUPLICATES-FLAG
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 CMD-DEF1 ...), CMD-DEF1 being a plist containing the fields :pattern
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 \(mandatory), :name, :get-file-name, :match-number, :scan-depth,
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 :preprocess, :case-sensitive.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 File Pattern ... A regexp matching the file's name for which the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 following rules should be applied.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
835 Remove Duplicates ... If t, only the first occurrence of an included
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
836 file is retained. (See below for a full explanation.)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 :name STRING ... This pattern's name.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 :pattern REGEXP ... A regexp matching the command. This regexp has to
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 include a group that holds the name of the included file.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 :get-file-name FUNCTION (default: `filesets-which-file') ... A function
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 that takes two arguments (the path of the master file and the name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 of the included file) and returns a valid path or nil -- if the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 subfile can't be found.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 :match-number INTEGER (default: 1) ... The number of the match/group
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 in the pattern holding the subfile's name. 0 refers the whole
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 match, 1 to the first group.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
852 :stubp FUNCTION ... If (FUNCTION MASTER INCLUDED-FILE) returns non-nil,
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 INCLUDED-FILE is a stub -- see below.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
855 :stub-flag ... Files of this type are stubs -- see below.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 :scan-depth INTEGER (default: 0) ... Whether included files should be
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 rescanned. Set this to 0 to disable re-scanning of included file.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 :preprocess FUNCTION ... A function modifying a buffer holding the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 master file so that pattern matching becomes easier. This is usually
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 used to narrow a buffer to the relevant region. This function could also
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 be destructive and simply delete non-relevant text.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865 :case-sensitive BOOLEAN (default: nil) ... Whether a pattern is
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866 case-sensitive or not.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
869 Stubs:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
870
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
871 First, a stub is a file that shows up in the menu but will not be
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872 included in an ingroup's file listing -- i.e. filesets will never
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
873 operate on this file automatically. Secondly, in opposition to normal
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
874 files stubs are not scanned for new inclusion groups. This is useful if
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875 you want to have quick access to library headers.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 In the menu, an asterisk is appended to the stub's name.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 Remove Duplicates:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 E.g. File A and file B refer to file X; X refers to A. If
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 you choose not to remove duplicates the tree would look like:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 M + A - X - A ...
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 B - X - A ...
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 As you can see, there is some chance that you run in circles.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 Nevertheless, up to some degree this could still be what you want.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 With duplicates removed, it would be:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 M + A - X
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 B"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 :type '(repeat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
897 :tag "Include"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 (list
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899 :tag "Definition" :value ("^.+\\.suffix$" t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 (regexp :tag "File Pattern" :value "^.+\\.suffix$")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 (boolean :tag "Remove Duplicates" :value t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
902 (repeat :tag "Commands"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 (repeat :tag "Command"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 (choice
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 :tag "Definition"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906 (list :tag ":name"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907 :value (:name "")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
908 (const :format "" :value :name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
909 (string :tag "String"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
910 (list :tag ":pattern"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
911 :value (:pattern "\\<CMD\\W*\\(.+\\)\\>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
912 (const :format "" :value :pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
913 (regexp :tag "RegExp"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
914 (list :tag ":get-file-name"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915 :value (:get-file-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916 (const :format "" :value :get-file-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918 (list :tag ":match-number"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 :value (:match-number 1)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 (const :format "" :value :match-number)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 (integer :tag "Integer"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922 (list :tag ":stub-flag"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 :value (:stub-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
924 (const :format "" :value :stub-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925 (boolean :tag "Boolean"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926 (list :tag ":stubp"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 :value (:stubp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 (const :format "" :value :stubp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930 (list :tag ":scan-depth"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
931 :value (:scan-depth 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932 (const :format "" :value :scan-depth)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 (integer :tag "Integer"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934 (list :tag ":case-sensitive"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 :value (:case-sensitive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 (const :format "" :value :case-sensitive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
937 (boolean :tag "Boolean"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938 (list :tag ":preprocess"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939 :value (:preprocess)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940 (const :format "" :value :preprocess)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941 (function :tag "Function")))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 :group 'filesets)
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
943 (put 'filesets-ingroup-patterns 'risky-local-variable t)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
944
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
945 (defcustom filesets-data nil
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
946 "Fileset definitions.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
947
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
948 A fileset is either a list of files, a file pattern, a base directory
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
949 and a search pattern (for files), or a base file. Changes to this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950 variable will take effect after rebuilding the menu.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 Caveat: Fileset names have to be unique.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
953
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
954 Example definition:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 '\(\(\"My Wiki\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
956 \(:ingroup \"~/Etc/My-Wiki/WikiContents\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
957 \(\"My Homepage\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
958 \(:pattern \"~/public_html/\" \"^.+\\\\.html$\")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959 \(:open filesets-find-file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960 \(\"User Configuration\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961 \(:files \"~/.xinitrc\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962 \"~/.bashrc\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 \"~/.bash_profile\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 \(\"HOME\"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965 \(:tree \"~\" \"^[^.].*[^~]$\")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 \(:filter-dirs-flag t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 `filesets-data' is a list of (NAME-AS-STRING . DEFINITION), DEFINITION
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 being an association list with the fields:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 :files FILE-1 .. FILE-N ... a list of files belonging to a fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 :ingroup FILE-NAME ... an inclusion group's base file.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 :tree ROOT-DIR PATTERN ... a base directory and a file pattern
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976
99095
aeeae910bf89 (filesets-data): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 99093
diff changeset
977 :pattern DIR PATTERN ... a base directory and a regexp matching
aeeae910bf89 (filesets-data): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 99093
diff changeset
978 files in that directory. Usually,
aeeae910bf89 (filesets-data): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 99093
diff changeset
979 PATTERN has the form '^REGEXP$'. Unlike
aeeae910bf89 (filesets-data): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 99093
diff changeset
980 :tree, this form does not descend
aeeae910bf89 (filesets-data): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 99093
diff changeset
981 recursively into subdirectories.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 :filter-dirs-flag BOOLEAN ... is only used in conjunction with :tree.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 :tree-max-level INTEGER ... recurse into directories this many levels
44959
f23f11648559 (filesets-data): Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 44934
diff changeset
986 \(see `filesets-tree-max-level' for a full explanation)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 :dormant-flag BOOLEAN ... non-nil means don't show this item in the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 menu; dormant filesets can still be manipulated via commands available
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990 from the minibuffer -- e.g. `filesets-open', `filesets-close', or
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
991 `filesets-run-cmd'
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
992
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
993 :dormant-p FUNCTION ... a function returning :dormant-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
994
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 :open FUNCTION ... the function used to open file belonging to this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 fileset. The function takes a file name as argument
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 :save FUNCTION ... the function used to save file belonging to this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 fileset; it takes no arguments, but works on the current buffer.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 Either :files, :pattern, :tree, or :ingroup must be supplied. :files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 overrules :tree, :tree overrules :pattern, :pattern overrules :ingroup,
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003 i.e. these tags are mutually exclusive. The fields :open and :save are
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 optional.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 In conjunction with the :tree tag, :save is void. :open refers to the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007 function used for opening files in a directory, not for opening the
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1008 directory. For browsing directories, `filesets-browse-dir-function' is used.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 Before using :ingroup, make sure that the file type is already
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1011 defined in `filesets-ingroup-patterns'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1012 :group 'filesets
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 :set (function filesets-data-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014 :type '(repeat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015 (cons :tag "Fileset"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 (string :tag "Name" :value "")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 (repeat :tag "Data"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018 (choice
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1019 :tag "Type" :value nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 (list :tag "Pattern"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 :value (:pattern "~/" "^.+\\.suffix$")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022 (const :format "" :value :pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 (directory :tag "Dir")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 (regexp :tag "Pattern"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025 (cons :tag "Files"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026 :value (:files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027 (const :format "" :value :files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1028 (repeat :tag "Files" file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1029 (list :tag "Single File"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1030 :value (:file "~/")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1031 (const :format "" :value :file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1032 (file :tag "File"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1033 (list :tag "Inclusion group"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1034 :value (:ingroup "~/")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (const :format "" :value :ingroup)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 (file :tag "File" :value "~/"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 (list :tag "Directory Tree"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038 :value (:tree "~/" "^.+\\.suffix$")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 (const :format "" :value :tree)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 (directory :tag "Dir")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 (regexp :tag "Pattern"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 (list :tag "Filter directories"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 :value (:filter-dirs-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 (const :format "" :value :filter-dirs-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1045 (boolean :tag "Boolean" :value nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1046 (list :tag "Scanning depth"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047 :value (:tree-max-level 3)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048 (const :format "" :value :tree-max-level)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 (integer :tag "Integer"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050 (list :tag "Verbosity"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1051 :value (:verbosity 1)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1052 (const :format "" :value :verbosity)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1053 (integer :tag "Integer"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1054 (list :tag "Conceal fileset (Flag)"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1055 :value (:dormant-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1056 (const :format "" :value :dormant-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1057 (boolean :tag "Boolean"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1058 (list :tag "Conceal fileset (Function)"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1059 :value (:dormant-p)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1060 (const :format "" :value :dormant-p)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1061 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1062 (list :tag "Save function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063 :value (:save)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1064 (const :format "" :value :save)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065 (function :tag "Function"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1066 (list :tag "Open function"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1067 :value (:open)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1068 (const :format "" :value :open)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1069 (function :tag "Function")))))))
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1070 (put 'filesets-data 'risky-local-variable t)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1073 (defcustom filesets-query-user-limit 15
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1074 "Query the user before opening a fileset with that many files."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075 :set (function filesets-set-default)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 :type 'integer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 :group 'filesets)
50782
1b22075b3bb5 (filesets-data): Add another defvar.
Richard M. Stallman <rms@gnu.org>
parents: 50683
diff changeset
1078
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 ;;; Emacs compatibility
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080 (eval-and-compile
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1081 (if (featurep 'xemacs)
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
1082 (fset 'filesets-error 'error)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1083
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
1084 (require 'easymenu)
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1085
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
1086 (defun filesets-error (class &rest args)
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
1087 "`error' wrapper."
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1088 (error "%s" (mapconcat 'identity args " ")))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1089
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
1090 ))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092 (defun filesets-filter-dir-names (lst &optional negative)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1093 "Remove non-directory names from a list of strings.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1094 If NEGATIVE is non-nil, remove all directory names."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 (filesets-filter-list lst
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1096 (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1097 (and (not (string-match "^\\.+/$" x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1098 (if negative
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1099 (not (string-match "[:/\\]$" x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1100 (string-match "[:/\\]$" x))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1101
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1102 (defun filesets-conditional-sort (lst &optional access-fn)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1103 "Return a sorted copy of LST, LST being a list of strings.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1104 If `filesets-sort-menu-flag' is nil, return LST itself.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1105
85317
e55429fe2239 (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 84660
diff changeset
1106 ACCESS-FN ... function to get the string value of LST's elements."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1107 (if filesets-sort-menu-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1108 (let* ((fni (or access-fn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1109 (function identity)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1110 (fn (if filesets-sort-case-sensitive-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1111 (lambda (a b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1112 (string< (funcall fni a)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1113 (funcall fni b)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1114 (lambda (a b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1115 (string< (upcase (funcall fni a))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1116 (upcase (funcall fni b)))))))
45186
aa4f6ae8b6a9 (filesets-conditional-sort): Use copy-sequence, not copy-list.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 45164
diff changeset
1117 (sort (copy-sequence lst) fn))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1118 lst))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1119
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120 (defun filesets-directory-files (dir &optional
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1121 pattern what full-flag match-dirs-flag)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1122 "Get WHAT (:files or :dirs) in DIR.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1123 If PATTERN is provided return only those entries matching this
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1124 regular expression.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1125 If MATCH-DIRS-FLAG is non-nil, also match directory entries.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1126 Return full path if FULL-FLAG is non-nil."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1127 (filesets-message 2 "Filesets: scanning %S" dir)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 ((file-exists-p dir)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 (let ((files nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 (dirs nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 (dolist (this (file-name-all-completions "" dir))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1133 (cond
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 ((string-match "^\\.+/$" this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 ((string-match "[:/\\]$" this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137 (when (or (not match-dirs-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (not pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1139 (string-match pattern this))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1140 (filesets-message 5 "Filesets: matched dir %S with pattern %S"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1141 this pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142 (setq dirs (cons this dirs))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 (when (or (not pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1145 (string-match pattern this))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1146 (filesets-message 5 "Filesets: matched file %S with pattern %S"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1147 this pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 (setq files (cons (if full-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (concat (file-name-as-directory dir) this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1151 files))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 ((equal what ':dirs)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (filesets-conditional-sort dirs))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 ((equal what ':files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 (filesets-conditional-sort files))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 (append (filesets-conditional-sort files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159 (filesets-conditional-sort dirs))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1160 (filesets-be-docile-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1161 (filesets-message 1 "Filesets: %S doesn't exist" dir)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1162 nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1164 (filesets-error 'error "Filesets: " dir " does not exist"))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 (defun filesets-quote (txt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1167 "Return TXT in quotes."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168 (concat "\"" txt "\""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1169
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (defun filesets-get-selection ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1171 "Get the text between mark and point -- i.e. the selection or region."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (let ((m (mark))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1173 (p (point)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (if m
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 (buffer-substring (min m p) (max m p))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1176 (filesets-error 'error "No selection."))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1177
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1178 (defun filesets-get-quoted-selection ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1179 "Return the currently selected text in quotes."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1180 (filesets-quote (filesets-get-selection)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1181
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1182 (defun filesets-get-shortcut (n)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1183 "Create menu shortcuts based on number N."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 (let ((n (mod (- n 1) 51)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1185 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1186 ((not filesets-menu-shortcuts-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1187 "")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1188 ((<= n 9)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1189 (concat (number-to-string n) " "))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1190 ((<= n 35)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1191 (format "%c " (+ 87 n)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1192 ((<= n 51)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1193 (format "%c " (+ -3 n))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1194
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 (defun filesets-files-equalp (a b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196 "Compare two filenames A and B after expansion."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1197 (equal (expand-file-name a) (expand-file-name b)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1198
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1199 (defun filesets-files-in-same-directory-p (a b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1200 "Compare two filenames A and B after expansion."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1201 (let ((ad (file-name-directory (expand-file-name a)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1202 (bd (file-name-directory (expand-file-name b))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1203 (equal ad bd)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1204
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1205 (defun filesets-convert-path-list (string)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206 "Return a path-list given as STRING as list."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1207 (if string
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 (mapcar (lambda (x) (file-name-as-directory x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 (split-string string path-separator))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210 nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1211
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1212 (defun filesets-which-file (master filename &optional path-list)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213 "Search for a FILENAME relative to a MASTER file in PATH-LIST."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214 (let ((f (concat (file-name-directory master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1215 filename)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1216 (if (file-exists-p f)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1217 f
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1218 (filesets-some
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1219 (lambda (dir)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1220 (let ((dir (file-name-as-directory dir))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1221 (files (if (file-exists-p dir)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1222 (filesets-directory-files dir nil ':files)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1223 nil)))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1224 (filesets-some (lambda (file)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1225 (if (equal filename (file-name-nondirectory file))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1226 (concat dir file)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1227 nil))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1228 files)))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1229 path-list))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (defun filesets-eviewer-get-props (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 "Get ENTRY's (representing an external viewer) properties."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 (nth 2 entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1235
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236 (defun filesets-eviewer-constraint-p (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237 (let* ((props (filesets-eviewer-get-props entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 (constraint (assoc ':constraintp props))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 (constraint-flag (assoc ':constraint-flag props)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 (constraint
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 (funcall (cadr constraint)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 (constraint-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (eval (cadr constraint-flag)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248 (defun filesets-get-external-viewer (file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249 "Find an external viewer for FILE."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250 (let ((filename (file-name-nondirectory file)))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1251 (filesets-some
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1252 (lambda (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253 (when (and (string-match (nth 0 entry) filename)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 (filesets-eviewer-constraint-p entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1255 entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 filesets-external-viewers)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 (defun filesets-get-external-viewer-by-name (name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1259 "Get the external viewer definition called NAME."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260 (when name
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1261 (filesets-some
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 (lambda (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (when (and (string-equal (nth 1 entry) name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 (filesets-eviewer-constraint-p entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266 filesets-external-viewers)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268 (defun filesets-filetype-property (filename event &optional entry)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1269 "Return non-nil if a file of a specific type has special flags/tags.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1271 Events (corresponding tag):
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 on-open-all (:ignore-on-open-all) ... Exclude files of this when opening
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1274 a fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276 on-grep (:ignore-on-read-text) ... Exclude files of this when running
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 the \"Grep <<selection>>\" command
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 on-capture-output (:capture-output) ... Capture output of an external viewer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
1281 on-ls ... Not used
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
1283 on-cmd ... Not used
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284
99116
2e0e3e5cbd97 * completion.el (add-completion-to-head, add-completion): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents: 99106
diff changeset
1285 on-close-all ... Not used"
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1286 (let ((def (filesets-eviewer-get-props
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1287 (or entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 (filesets-get-external-viewer filename)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (filesets-alist-get def
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290 (case event
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 ((on-open-all) ':ignore-on-open-all)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 ((on-grep) ':ignore-on-read-text)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 ((on-cmd) nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294 ((on-close-all) nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 (defun filesets-filetype-get-prop (property filename &optional entry)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1298 "Return PROPERTY for filename -- use ENTRY if provided."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299 (let ((def (filesets-eviewer-get-props
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300 (or entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1301 (filesets-get-external-viewer filename)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 (when def
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 (filesets-alist-get def property nil t))))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1304
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305 (defun filesets-reset-filename-on-change ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 "Reset a buffer's filename if the buffer is being modified."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307 (when filesets-output-buffer-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1308 (set-visited-file-name nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1309
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 (defun filesets-spawn-external-viewer (file &optional ev-entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1311 "Start an external viewer for FILE.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312 Use the viewer defined in EV-ENTRY (a valid element of
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 `filesets-external-viewers') if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314 (let* ((file (expand-file-name file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315 (entry (or ev-entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316 (filesets-get-external-viewer file))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317 (if entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1318 (let* ((vwr (cadr entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1319 (co-flag (filesets-filetype-get-prop ':capture-output file entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (oh (filesets-filetype-get-prop ':open-hook file entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 (args (let ((fmt (filesets-filetype-get-prop ':args file entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322 (if fmt
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1323 (let ((rv ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1324 (dolist (this fmt rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 (setq rv (concat rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1326 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1327 ((stringp this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328 (format this file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329 ((and (symbolp this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330 (fboundp this))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 (format "%S" (funcall this)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (format "%S" this)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334 (format "%S" file))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335 (output
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 ((and (functionp vwr) co-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338 (funcall vwr file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339 ((functionp vwr)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 (funcall vwr file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 (co-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 (shell-command-to-string (format "%s %s" vwr args)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1344 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1345 (shell-command (format "%s %s&" vwr args))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 nil))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (if co-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 (progn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1349 (switch-to-buffer (format "Filesets: %s %s" vwr file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 (insert output)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1351 (make-local-variable 'filesets-output-buffer-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1352 (setq filesets-output-buffer-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1353 (set-visited-file-name file t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1354 (when oh
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355 (run-hooks 'oh))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356 (set-buffer-modified-p nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357 (setq buffer-read-only t)
58039
5bf48738f9ab (filesets-spawn-external-viewer, filesets-run-cmd):
Richard M. Stallman <rms@gnu.org>
parents: 57925
diff changeset
1358 (goto-char (point-min)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1359 (when oh
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360 (run-hooks 'oh))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361 (filesets-error 'error
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1362 "Filesets: general error when spawning external viewer"))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1364 (defun filesets-find-file (file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365 "Call `find-file' after a possible delay (see `filesets-find-file-delay').
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1366 If `filesets-be-docile-flag' is true, a file, which isn't readable, will
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 not be opened."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368 ; (sleep-for filesets-find-file-delay)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 (when (or (file-readable-p file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1370 (not filesets-be-docile-flag))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371 (sit-for filesets-find-file-delay)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1372 (find-file file)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374 (defun filesets-find-or-display-file (&optional file viewer)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1375 "Visit FILE using an external VIEWER or open it in an Emacs buffer."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377 (let* ((file (or file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (read-file-name "Find file: " nil nil viewer)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379 (external-viewer-def (or
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 (filesets-get-external-viewer-by-name viewer)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 (filesets-get-external-viewer file))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382 (filesets-message 3 "Filesets: view %S using %s" file external-viewer-def)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1383 (if external-viewer-def
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1384 (filesets-spawn-external-viewer file external-viewer-def)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385 (filesets-find-file file))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1386
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
1387 (defun filesets-find-file-using ()
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388 "Select a viewer and call `filesets-find-or-display-file'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1389 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1390 (let* ((lst (mapcar (lambda (this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1391 (let ((a (cadr this)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1392 (list (format "%s" a) a)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1393 filesets-external-viewers))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 (viewer (completing-read "Using viewer: " lst nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395 (when viewer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1396 (filesets-find-or-display-file nil (cadr (assoc viewer lst))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1397
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1398 (defun filesets-browser-name ()
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1399 "Get the directory browser's name as defined in `filesets-browse-dir-function'."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400 (cond
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1401 ((listp filesets-browse-dir-function)
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1402 (car filesets-browse-dir-function))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1403 (t
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1404 filesets-browse-dir-function)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1405
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1406 (defun filesets-browse-dir (dir)
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1407 "Browse DIR using `filesets-browse-dir-function'."
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1408 (if (functionp filesets-browse-dir-function)
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1409 (funcall filesets-browse-dir-function dir)
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1410 (let ((name (car filesets-browse-dir-function))
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1411 (args (format (cadr filesets-browse-dir-function) (expand-file-name dir))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412 (with-temp-buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413 (start-process (concat "Filesets:" name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 "*Filesets external directory browser*"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 name args)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417 (defun filesets-get-fileset-name (something)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1418 "Get SOMETHING's name (Don't ask)."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 ((listp something)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (car something))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 something)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 (defun filesets-data-get-name (entry)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1426 "Access to `filesets-data'. Get the ENTRY's name."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1427 (car entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 (defun filesets-data-get-data (entry)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1430 "Access to `filesets-data'. Get the ENTRY's data section."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1431 (cdr entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1433 (defun filesets-alist-get (alist key &optional default carp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434 "Get KEY's value in the association list ALIST.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1435 Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1436 (let ((elt (assoc key alist)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1437 (cond
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1438 (elt
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1439 (if carp
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1440 (cadr elt)
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1441 (cdr elt)))
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1442 (default default)
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1443 (t nil))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1445 (defun filesets-data-get (entry key &optional default carp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1446 "Extract the value for KEY in the data part of fileset ENTRY.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1447 Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1448 (filesets-alist-get (filesets-data-get-data entry) key default carp))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450 (defun filesets-data-set (entry key value)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1451 "Set the VALUE for KEY in the data part of fileset ENTRY."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452 (let* ((alist (filesets-data-get-data entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1453 (elt (assoc key alist)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1454 (if elt
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1455 (setcdr elt value)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1456 (setcdr entry (cons (cons key value) alist)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1458 (defun filesets-entry-mode (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1459 "Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1460 See `filesets-data'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1461 (let ((data (filesets-data-get-data entry)))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1462 (filesets-some
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1463 (lambda (x)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1464 (if (assoc x data)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1465 x))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1466 '(:files :tree :pattern :ingroup :file))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 (defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469 "Get the open-function for FILESET-NAME.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 Use FILESET-ENTRY for finding the open function, if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 (filesets-data-get (or fileset-entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 (filesets-get-fileset-from-name fileset-name))
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1473 ':open filesets-open-file-function t))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1475 (defun filesets-entry-get-save-fn (fileset-name &optional fileset-entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1476 "Get the save-function for FILESET-NAME.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 Use FILESET-ENTRY for finding the save function, if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1478 (filesets-data-get (or fileset-entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1479 (filesets-get-fileset-from-name fileset-name))
45132
c26266baaba5 (filesets-browse-dir-function): Renamed from ...-fn.
Richard M. Stallman <rms@gnu.org>
parents: 45130
diff changeset
1480 ':save filesets-save-buffer-function t))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1481
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 (defun filesets-entry-get-files (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 "Get the file list for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1484 (filesets-data-get entry ':files))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1485
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 (defun filesets-entry-set-files (entry data &optional anyways)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 "Set the file list for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 (let ((files (filesets-entry-get-files entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 (if (or anyways files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (filesets-data-set entry ':files data))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (defun filesets-entry-get-verbosity (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493 "Get verbosity level for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1494 (filesets-data-get entry ':verbosity 1 t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1496 (defun filesets-entry-get-file (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1497 "Get the single file for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498 (filesets-data-get entry ':file nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500 (defun filesets-entry-get-pattern (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1501 "Get the base directory + file pattern for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1502 ; (filesets-data-get entry ':pattern nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503 (filesets-data-get entry ':pattern))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1505 (defun filesets-entry-get-pattern--pattern (list)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1506 "Get the file pattern for LIST."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507 (if (= (length list) 1) ;; for compatibility with filesets < v1.5.5
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 (file-name-nondirectory (car list))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509 (cadr list)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1511 (defun filesets-entry-get-pattern--dir (list)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1512 "Get a file pattern's base directory for LIST."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513 (if (= (length list) 1) ;; for compatibility with filesets < v1.5.5
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 (file-name-directory (car list))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515 (car list)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517 (defun filesets-entry-get-tree (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518 "Get the tree pattern for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1519 (filesets-data-get entry ':tree))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1520
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1521 (defun filesets-entry-get-dormant-flag (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 "Get dormant flag for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 (let ((fn (filesets-data-get entry ':dormant-p nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524 (if fn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 (funcall fn)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 (filesets-data-get entry ':dormant-flag nil t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 (defun filesets-entry-get-filter-dirs-flag (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 "Get filter-dirs-flag for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 (filesets-data-get entry ':filter-dirs-flag nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 (defun filesets-entry-get-tree-max-level (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 "Get maximal tree scanning depth for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 (filesets-data-get entry ':tree-max-level nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536 (defun filesets-entry-get-master (entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 "Get the base file for fileset ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (filesets-data-get entry ':ingroup nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (defun filesets-file-open (open-function file-name &optional fileset-name)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1541 "Open FILE-NAME using OPEN-FUNCTION.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1542 If OPEN-FUNCTION is nil, its value will be deduced from FILESET-NAME."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543 (let ((open-function (or open-function
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (filesets-entry-get-open-fn fileset-name))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 (if (file-readable-p file-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546 (funcall open-function file-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (message "Filesets: Couldn't open `%s'" file-name))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549 (defun filesets-file-close (save-function buffer)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 "Close BUFFER.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 First, save the buffer's contents using SAVE-FUNCTION. Then, kill buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552 if `buffer-modified-p' returns nil.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 SAVE-FUNCTION takes no argument, but works on the current buffer."
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 104993
diff changeset
1555 (with-current-buffer buffer
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 (if (buffer-modified-p)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (funcall save-function))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 (if (not (buffer-modified-p))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 (kill-buffer buffer))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561 (defun filesets-get-fileset-from-name (name &optional mode)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 "Get fileset definition for NAME."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563 (case mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564 ((:ingroup :tree)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565 name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567 (assoc name filesets-data))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 ;;; commands
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571 (defun filesets-cmd-get-def (cmd-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1572 "Get `filesets-commands' entry for CMD-NAME."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573 (assoc cmd-name filesets-commands))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575 (defun filesets-cmd-get-args (cmd-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 (let ((args (let ((def (filesets-cmd-get-def cmd-name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 (nth 2 def)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (rv nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 (dolist (this args rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581 ((and (symbolp this) (fboundp this))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1582 (let ((x (funcall this)))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1583 (setq rv (append rv (if (listp x) x (list x))))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 (setq rv (append rv (list this))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 (defun filesets-cmd-get-fn (cmd-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588 (let ((def (filesets-cmd-get-def cmd-name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1589 (nth 1 def)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1590
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1591 (defun filesets-cmd-show-result (cmd output)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1592 "Show OUTPUT of CMD (a shell command)."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1593 (pop-to-buffer "*Filesets: Shell Command Output*")
58039
5bf48738f9ab (filesets-spawn-external-viewer, filesets-run-cmd):
Richard M. Stallman <rms@gnu.org>
parents: 57925
diff changeset
1594 (with-no-warnings
5bf48738f9ab (filesets-spawn-external-viewer, filesets-run-cmd):
Richard M. Stallman <rms@gnu.org>
parents: 57925
diff changeset
1595 (end-of-buffer))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 (insert "*** ")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597 (insert cmd)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598 (newline)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599 (insert output)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 (newline))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602 (defun filesets-run-cmd--repl-fn (arg &optional format-fn)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1603 "Helper function for `filesets-run-cmd'. Apply FORMAT-FN to arg.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1604 Replace <file-name> or <<file-name>> with filename."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1605 (funcall format-fn (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1606 ((equal arg "<file-name>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1607 (buffer-file-name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 ((equal arg "<<file-name>>")
73369
8ab1128eef12 (filesets-run-cmd--repl-fn): Use shell-quote-argument.
Kim F. Storm <storm@cua.dk>
parents: 73366
diff changeset
1609 (shell-quote-argument (buffer-file-name)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 arg))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 (defun filesets-run-cmd (&optional cmd-name fileset mode)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 "Run CMD-NAME (see `filesets-commands') on FILESET."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1615 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 (let* ((cmd-name (or cmd-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 (completing-read "Select command: " filesets-commands
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618 nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 (name (or fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 (completing-read "Select fileset: " filesets-data nil t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1621 (when (and cmd-name name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1622 (let* ((event (if (equal cmd-name "Grep <<selection>>")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 'on-grep
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 'on-cmd))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625 (files (if (and fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 (or (equal mode ':ingroup)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 (equal mode ':tree)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628 (filesets-get-filelist fileset mode event)
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1629 (filesets-get-filelist
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 (filesets-get-fileset-from-name name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1631 mode event))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 (when files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 (let ((fn (filesets-cmd-get-fn cmd-name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1634 (args (filesets-cmd-get-args cmd-name)))
96958
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1635 (if (memq fn '(multi-isearch-files multi-isearch-files-regexp))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1636 (apply fn args)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1637 (dolist (this files nil)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1638 (save-excursion
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1639 (save-restriction
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1640 (let ((buffer (filesets-find-file this)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1641 (when buffer
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1642 (goto-char (point-min))
104993
403125cdfb24 Replace empty `let's with `progn'.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
1643 (progn
96958
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1644 (cond
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1645 ((stringp fn)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1646 (let* ((args
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1647 (let ((txt ""))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1648 (dolist (this args txt)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1649 (setq txt
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1650 (concat txt
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1651 (filesets-run-cmd--repl-fn
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1652 this
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1653 (lambda (this)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1654 (if (equal txt "") "" " ")
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1655 (format "%s" this))))))))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1656 (cmd (concat fn " " args)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1657 (filesets-cmd-show-result
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1658 cmd (shell-command-to-string cmd))))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1659 ((symbolp fn)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1660 (let ((args
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1661 (let ((argl nil))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1662 (dolist (this args argl)
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1663 (setq argl
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1664 (append argl
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1665 (filesets-run-cmd--repl-fn
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1666 this
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1667 'list)))))))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1668 (apply fn args)))))))))))))))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1669
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670 (defun filesets-get-cmd-menu ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 "Create filesets command menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 `("+ Commands"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1673 . ,(mapcar (lambda (this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 (let ((name (car this)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 `[,name (filesets-run-cmd ,name)]))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676 filesets-commands)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1679 ;;; sample commands
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 (defun filesets-cmd-query-replace-getargs ()
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1681 "Get arguments for `query-replace' and `query-replace-regexp'."
96958
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1682 (let ((common (query-replace-read-args "Filesets query replace" nil t)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1683 (list (nth 0 common) (nth 1 common) t nil (nth 2 common) nil
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1684 multi-query-replace-map)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1685
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1686 (defun filesets-cmd-query-replace-regexp-getargs ()
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1687 "Get arguments for `query-replace' and `query-replace-regexp'."
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1688 (let ((common (query-replace-read-args "Filesets query replace" t t)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1689 (list (nth 0 common) (nth 1 common) t t (nth 2 common) nil
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1690 multi-query-replace-map)))
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1691
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1692 (defun filesets-cmd-isearch-getargs ()
0de86dd9427f (filesets-commands): Add commands for "Isearch" and
Juri Linkov <juri@jurta.org>
parents: 96376
diff changeset
1693 "Get arguments for `multi-isearch-files' and `multi-isearch-files-regexp'."
97155
b4faea6c6c00 (filesets-cmd-isearch-getargs): Check if the
Juri Linkov <juri@jurta.org>
parents: 96958
diff changeset
1694 (and (boundp 'files) (list files)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1695
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 (defun filesets-cmd-shell-command-getargs ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697 "Get arguments for `filesets-cmd-shell-command'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 (let* ((arg (read-string "Shell command (%s = file): "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 "%s"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 'shell-command-history)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701 arg))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1702
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1703 (defun filesets-cmd-shell-command (txt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1704 "Wrapper function for `shell-command'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 (let ((ok (if (buffer-modified-p)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706 (let ((ok (y-or-n-p "Save buffer? ")))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 (when ok
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708 (save-buffer))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1709 ok)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710 t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 (when ok
73366
d0dd803ef151 (filesets-cmd-shell-command): Quote buffer-file-name to protect whitespace and
Eli Zaretskii <eliz@gnu.org>
parents: 72386
diff changeset
1712 (let ((cmd (format txt (shell-quote-argument (buffer-file-name)))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713 (message "Filesets: %s" cmd)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1714 (filesets-cmd-show-result cmd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715 (shell-command-to-string cmd))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1718 ;;; body
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1719 (defun filesets-get-filelist (entry &optional mode event)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 "Get all files for fileset ENTRY.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1721 Assume MODE (see `filesets-entry-mode'), if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722 (let* ((mode (or mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1723 (filesets-entry-mode entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1724 (fl (case mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1725 ((:files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1726 (filesets-entry-get-files entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1727 ((:file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1728 (list (filesets-entry-get-file entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 ((:ingroup)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1730 (let ((entry (expand-file-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 (if (stringp entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1732 entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1733 (filesets-entry-get-master entry)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1734 (cons entry (filesets-ingroup-cache-get entry))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1735 ((:tree)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1736 (let ((dir (nth 0 entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1737 (patt (nth 1 entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738 (filesets-directory-files dir patt ':files t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1739 ((:pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1740 (let ((dirpatt (filesets-entry-get-pattern entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1741 (if dirpatt
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1742 (let ((dir (filesets-entry-get-pattern--dir dirpatt))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1743 (patt (filesets-entry-get-pattern--pattern dirpatt)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744 ;;(filesets-message 3 "Filesets: scanning %s" dirpatt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745 (filesets-directory-files dir patt ':files t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 ;; (message "Filesets: malformed entry: %s" entry)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747 (filesets-error 'error "Filesets: malformed entry: "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1748 entry)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 (filesets-filter-list fl
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 (lambda (file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 (not (filesets-filetype-property file event))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753 (defun filesets-open (&optional mode name lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1754 "Open the fileset called NAME.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 Use LOOKUP-NAME for searching additional data if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 (let* ((name (or name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1758 (completing-read "Open fileset: " filesets-data nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 (fileset (filesets-get-fileset-from-name name mode))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1760 (lookup-fs (if lookup-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761 (filesets-get-fileset-from-name lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 fileset))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 (mode (or mode (filesets-entry-mode lookup-fs))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764 (if fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765 (let* ((files (filesets-get-filelist fileset mode 'on-open-all))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1766 (n (length files))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767 (open-function (filesets-entry-get-open-fn nil lookup-fs)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768 (if (or (<= n filesets-query-user-limit)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769 (y-or-n-p (format "Filesets: Open all %d files in %s? "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1770 n name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771 (dolist (this files nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772 (filesets-file-open open-function this))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773 (message "Filesets: cancelled")))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 (filesets-error 'error "Filesets: Unknown fileset: " name))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 (defun filesets-close (&optional mode name lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 "Close all buffers belonging to the fileset called NAME.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778 Use LOOKUP-NAME for deducing the save-function, if provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1779 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 (let* ((name (or name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781 (completing-read "Close fileset: " filesets-data nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 (fileset (filesets-get-fileset-from-name name mode))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 (lookup-fs (if lookup-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784 (filesets-get-fileset-from-name lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 fileset))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786 (mode (or mode (filesets-entry-mode lookup-fs))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1787 (if fileset
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1788 (let ((files (filesets-get-filelist fileset mode 'on-close-all))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1789 (save-function (filesets-entry-get-save-fn nil lookup-fs)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1790 (dolist (file-name files nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1791 (let* ((buffer (get-file-buffer file-name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1792 (if buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1793 (filesets-file-close save-function buffer)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1794 ; (message "Filesets: Unknown fileset: `%s'" name))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1795 (filesets-error 'error "Filesets: Unknown fileset: " name))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797 (defun filesets-add-buffer (&optional name buffer)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1798 "Add BUFFER (or current buffer) to the fileset called NAME.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799 User will be queried, if no fileset name is provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801 (let* ((buffer (or buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 (current-buffer)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 (name (or name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804 (completing-read
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 (format "Add '%s' to fileset: " buffer)
61583
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1806 filesets-data nil)))
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1807 (entry (or (assoc name filesets-data)
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1808 (when (y-or-n-p
72386
2ce9bf47e864 * cus-theme.el (customize-create-theme)
Romain Francoise <romain@orebokech.com>
parents: 68651
diff changeset
1809 (format "Fileset %s does not exist. Create it? "
61583
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1810 name))
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1811 (progn
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1812 (add-to-list 'filesets-data (list name '(:files)))
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1813 (message
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1814 "Fileset %s created. Call `M-x filesets-save-config' to save."
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1815 name)
63a08bfc0b0d (filesets-add-buffer): If user supplies a name of a
Eli Zaretskii <eliz@gnu.org>
parents: 61238
diff changeset
1816 (car filesets-data))))))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817 (if entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818 (let* ((files (filesets-entry-get-files entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 (this (buffer-file-name buffer))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1820 (inlist (filesets-member this files
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1821 :test 'filesets-files-equalp)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 (inlist
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 (message "Filesets: '%s' is already in '%s'" this name))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1825 ((and (equal (filesets-entry-mode entry) ':files)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 (filesets-entry-set-files entry (cons this files) t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828 (filesets-set-config name 'filesets-data filesets-data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 (message "Filesets: Can't add '%s' to fileset '%s'" this name)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (defun filesets-remove-buffer (&optional name buffer)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
1833 "Remove BUFFER (or current buffer) to fileset NAME.
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 User will be queried, if no fileset name is provided."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 (let* ((buffer (or buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (current-buffer)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (name (or name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 (completing-read
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840 (format "Remove '%s' from fileset: " buffer)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 filesets-data nil t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 (entry (assoc name filesets-data)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 (if entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 (let* ((files (filesets-entry-get-files entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845 (this (buffer-file-name buffer))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1846 (inlist (filesets-member this files
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
1847 :test 'filesets-files-equalp)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1848 ;;(message "%s %s %s" files this inlist)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 (if (and files this inlist)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850 (let ((new (list (cons ':files (delete (car inlist) files)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (setcdr entry new)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 (filesets-set-config name 'filesets-data filesets-data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853 (message "Filesets: Can't remove '%s' from fileset '%s'"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 name))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 (defun filesets-convert-patterns (name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 "Change fileset NAME's mode from :pattern to :files."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860 (let ((entry (assoc name filesets-data)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 (if entry
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862 (let ((pattern (filesets-entry-get-pattern entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 (patfiles (filesets-get-filelist entry ':pattern)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864 (if pattern
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 (progn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 (filesets-entry-set-files entry patfiles t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 (filesets-set-config name 'filesets-data filesets-data)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1869 (defun filesets-edit ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 "Customize `filesets-data'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 (customize-variable 'filesets-data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874 (defun filesets-customize ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875 "Customize the filesets group."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 (customize-group 'filesets))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 (defun filesets-info ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 "Display filesets's version information."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 (if (y-or-n-p (format "Filesets v%s: visit homepage? " filesets-version))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 (filesets-goto-homepage)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885 (defun filesets-goto-homepage ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886 "Show filesets's homepage."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888 (browse-url filesets-homepage))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890 (defun filesets-remake-shortcut (count submenu)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1891 "Remake a submenu's shortcut when wrapping long menus."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1892 (let* ((name (concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1893 (substring (elt submenu 0) 2))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1894 (if (listp submenu)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1895 (cons name (cdr submenu))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1896 (apply 'vector (list name (cdr (append submenu nil)))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1897 ; (vconcat `[,name] (subseq submenu 1)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1898
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1899 (defun filesets-wrap-submenu (submenu-body)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1900 "Split long submenus."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1901 (let ((bl (length submenu-body)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1902 (if (or (= filesets-max-submenu-length 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1903 (<= bl filesets-max-submenu-length))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1904 submenu-body
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1905 (let* ((result nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 (factor (ceiling (/ (float bl)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1907 filesets-max-submenu-length))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1908 (do ((data submenu-body (cdr data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1909 (n 1 (+ n 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1910 (count 0 (+ count factor)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1911 ((or (> count bl)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1912 (null data)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913 ; (let ((sl (subseq submenu-body count
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1914 (let ((sl (filesets-sublist submenu-body count
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915 (let ((x (+ count factor)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1916 (if (>= bl x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1917 x
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918 nil)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1919 (when sl
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1920 (setq result
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 (append
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 result
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923 (if (= (length sl) 1)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 (if filesets-menu-shortcuts-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 (list (filesets-remake-shortcut n (car sl)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926 sl)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927 `((,(concat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928 (filesets-get-shortcut n)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 (let ((rv ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 (do ((x sl (cdr x)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1931 ((null x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932 (let ((y (concat (elt (car x) 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1933 (if (null (cdr x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1934 ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1935 ", "))))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
1936 (setq rv
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1937 (concat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1938 rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939 (if filesets-menu-shortcuts-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 (substring y 2)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 y)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1942 (if (> (length rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943 filesets-max-entry-length)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944 (concat
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 (substring rv 0 filesets-max-entry-length)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946 " ...")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 rv)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 ,@sl))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 result))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1951 (defun filesets-get-menu-epilog (something &optional
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952 mode lookup-name rebuild-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1953 "Get submenu epilog for SOMETHING (usually a fileset).
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1954 If mode is :tree or :ingroup, SOMETHING is some weird construct and
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955 LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 (case mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1957 ((:tree)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 `("---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 ["Close all files" (filesets-close ',mode ',something ',lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1960 ["Run Command" (filesets-run-cmd nil ',something ',mode)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1961 [,(format "Browse with `%s'" (filesets-browser-name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962 (filesets-browse-dir ',(car something))]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 ,@(when rebuild-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 `(["Rebuild this submenu"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (filesets-rebuild-this-submenu ',lookup-name)]))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 ((:ingroup)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 `("---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968 ["Close all files" (filesets-close ',mode ',something ',lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 ["Run Command" (filesets-run-cmd nil ',something ',mode)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1970 ,@(when rebuild-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 `(["Rebuild this submenu"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 (filesets-rebuild-this-submenu ',lookup-name)]))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 ((:pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1974 `("---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975 ["Close all files" (filesets-close ',mode ',something)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976 ["Run Command" (filesets-run-cmd nil ',something ',mode)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1977 [,(format "Browse with `%s'" (filesets-browser-name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1978 ,(list 'filesets-browse-dir
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1979 (filesets-entry-get-pattern--dir
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 (filesets-entry-get-pattern
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (filesets-get-fileset-from-name something ':pattern))))]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1982 ; [,(concat (if filesets-menu-shortcuts-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983 ; (concat "Con" filesets-menu-shortcuts-marker "vert")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1984 ; "Convert")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1985 ; " :pattern to :files")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1986 ; ,(list (function filesets-convert-patterns) something)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1987 ,@(when rebuild-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1988 `(["Rebuild this submenu"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 (filesets-rebuild-this-submenu ',lookup-name)]))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1990 ((:files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 `("---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 [,(concat "Close all files") (filesets-close ',mode ',something)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993 ["Run Command" (filesets-run-cmd nil ',something ',mode)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994 ["Add current buffer"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 (filesets-add-buffer ',something (current-buffer))]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 ["Remove current buffer"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997 (filesets-remove-buffer ',something (current-buffer))]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1998 ,@(when rebuild-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 `(["Rebuild this submenu"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000 (filesets-rebuild-this-submenu ',lookup-name)]))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2001 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 (filesets-error 'error "Filesets: malformed definition of " something))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (defun filesets-ingroup-get-data (master pos &optional fun)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 "Access to `filesets-ingroup-patterns'. Extract data section."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006 (let ((masterfile (file-name-nondirectory master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 (fn (or fun (lambda (a b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2008 (and (stringp a)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009 (stringp b)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010 (string-match a b))))))
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2011 (filesets-some (lambda (x)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2012 (if (funcall fn (car x) masterfile)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2013 (nth pos x)
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2014 nil))
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2015 filesets-ingroup-patterns)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 (defun filesets-ingroup-get-pattern (master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018 "Access to `filesets-ingroup-patterns'. Extract patterns."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 (filesets-ingroup-get-data master 2))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 (defun filesets-ingroup-get-remdupl-p (master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 "Access to `filesets-ingroup-patterns'. Extract remove-duplicates-flag."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 (filesets-ingroup-get-data master 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2025 (defun filesets-ingroup-collect-finder (patt case-sensitivep)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2026 "Helper function for `filesets-ingroup-collect'. Find pattern PATT."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2027 (let ((cfs case-fold-search)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2028 (rv (progn
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2029 (setq case-fold-search (not case-sensitivep))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030 (re-search-forward patt nil t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2031 (setq case-fold-search cfs)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2032 rv))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2033
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2034 (defun filesets-ingroup-cache-get (master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035 "Access to `filesets-ingroup-cache'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2036 (lax-plist-get filesets-ingroup-cache master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2037
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2038 (defun filesets-ingroup-cache-put (master file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2039 "Access to `filesets-ingroup-cache'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 (let* ((emaster (expand-file-name master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2041 (this (if file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2042 (cons file (filesets-ingroup-cache-get emaster))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 nil)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2044 (setq filesets-ingroup-cache
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2045 (lax-plist-put filesets-ingroup-cache emaster this))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2047 (defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
2048 "Helper function for `filesets-ingroup-collect'. Collect file names."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 (let* ((master (or master
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 (filesets-entry-get-master fs)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2051 (remdupl-flag (or remdupl-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2052 (filesets-ingroup-get-remdupl-p master))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2053 (filesets-ingroup-cache-put master nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2054 (filesets-message 2 "Filesets: parsing %S" master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2055 (let ((cmdpatts (filesets-ingroup-get-pattern master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2056 (count 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2057 (rv nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2058 (if cmdpatts
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2059 (dolist (this-def cmdpatts rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2060 (let* ((this-patt (filesets-alist-get this-def ':pattern nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061 (this-name (filesets-alist-get this-def ':name "" t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 (this-pp (filesets-alist-get this-def ':preprocess nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063 (this-mn (filesets-alist-get this-def ':match-number 1 t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 (this-sd (or depth
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 (filesets-alist-get this-def ':scan-depth 0 t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 (this-csp (filesets-alist-get this-def ':case-sensitive nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2067 (this-fn (filesets-alist-get
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2068 this-def ':get-file-name 'filesets-which-file t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069 (this-stubp (filesets-alist-get this-def ':stubp nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 (this-stub-flag (filesets-alist-get this-def ':stub-flag nil t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071 (flist nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 (lst nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2073 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2074 ((not this-patt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075 (filesets-error 'error "Filesets: malformed :ingroup definition "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2076 this-def))
45130
cb1d1e1eb678 (filesets-ingroup-collect-files):
Richard M. Stallman <rms@gnu.org>
parents: 45012
diff changeset
2077 ((< this-sd 0)
cb1d1e1eb678 (filesets-ingroup-collect-files):
Richard M. Stallman <rms@gnu.org>
parents: 45012
diff changeset
2078 nil)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2079 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 (with-temp-buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2081 (insert-file-contents master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082 (goto-char (point-min))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2083 (when this-pp
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 (funcall this-pp))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2085 (while (filesets-ingroup-collect-finder this-patt this-csp)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 (let* ((txt (match-string this-mn))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2087 (f (funcall this-fn master txt)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2088 (when (and f
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2089 (not (member f flist))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 (or (not remdupl-flag)
45164
79ab9956f2a0 (filesets-external-viewers): Fix customization problem.
Richard M. Stallman <rms@gnu.org>
parents: 45132
diff changeset
2091 (not (filesets-member
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
2092 f filesets-ingroup-files
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 :test 'filesets-files-equalp))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2094 (let ((no-stub-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2095 (and (not this-stub-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2096 (if this-stubp
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2097 (not (funcall this-stubp master f))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2099 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100 (setq flist (cons f flist))
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
2101 (setq filesets-ingroup-files
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
2102 (cons f filesets-ingroup-files))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2103 (when no-stub-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2104 (filesets-ingroup-cache-put master f))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2105 (setq lst (append lst (list f))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2106 (when lst
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2107 (setq rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2108 (nconc rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (mapcar (lambda (this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 `((,this ,this-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 ,@(filesets-ingroup-collect-files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 fs remdupl-flag this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 (- this-sd 1))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 lst))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2115 (filesets-message 2 "Filesets: no patterns defined for %S" master)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2117 (defun filesets-ingroup-collect-build-menu (fs flist &optional other-count)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2118 "Helper function for `filesets-ingroup-collect'. Build the menu.
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2119 FS is a fileset's name. FLIST is a list returned by
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 `filesets-ingroup-collect-files'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 (if (null flist)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2122 nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2123 (let ((count 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 (fsn fs)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125 (rv nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2126 (dolist (this flist rv)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2127 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2128 (let* ((def (if (listp this) (car this) (list this "")))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2129 (files (if (listp this) (cdr this) nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2130 (master (nth 0 def))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2131 (name (nth 1 def))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2132 (nm (concat (filesets-get-shortcut (if (or (not other-count) files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2133 count other-count))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2134 (if (or (null name) (equal name ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2135 ""
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2136 (format "%s: " name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2137 (file-name-nondirectory master))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2138 (setq rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2139 (append rv
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2140 (if files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2141 `((,nm
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
2142 [,(concat "Inclusion Group: "
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2143 (file-name-nondirectory master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2144 (filesets-open ':ingroup ',master ',fsn)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2145 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2146 [,master (filesets-file-open nil ',master ',fsn)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2147 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2148 ,@(let ((count 0))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2149 (mapcar
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2150 (lambda (this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2151 (setq count (+ count 1))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
2152 (let ((ff (filesets-ingroup-collect-build-menu
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2153 fs (list this) count)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154 (if (= (length ff) 1)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2155 (car ff)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2156 ff)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2157 files))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2158 ,@(filesets-get-menu-epilog master ':ingroup fsn)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2159 `([,nm (filesets-file-open nil ',master ',fsn)])))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2160
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2161 (defun filesets-ingroup-collect (fs remdupl-flag master)
79092
c2f73447531e (filesets-alist-get): Use `let' rather than `let*'.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
2162 "Collect names of included files and build submenu."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2163 (filesets-ingroup-cache-put master nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2164 (filesets-message 2 "Filesets: parsing %S" master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2165 (filesets-ingroup-collect-build-menu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2166 fs
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2167 (filesets-ingroup-collect-files fs remdupl-flag master)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2168
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2169 (defun filesets-build-ingroup-submenu (lookup-name master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2170 "Build a :ingroup submenu for file MASTER."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2171 (if (file-readable-p master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2172 (let ((remdupl-flag (filesets-ingroup-get-remdupl-p master)))
45012
161015ebadc0 (filesets-running-xemacs): Make defvar unconditional.
Richard M. Stallman <rms@gnu.org>
parents: 44973
diff changeset
2173 (setq filesets-ingroup-files (list master))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2174 (filesets-ingroup-collect lookup-name remdupl-flag master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2175 (if filesets-be-docile-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2176 (progn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2177 (message "Filesets: can't parse %s" master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2178 nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 (filesets-error 'error "Filesets: can't parse " master))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2180
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2181 (defun filesets-build-dir-submenu-now (level depth entry lookup-name dir patt fd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2182 &optional rebuild-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2183 "Helper function for `filesets-build-dir-submenu'."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2184 ;;(filesets-message 3 "Filesets: scanning %s" dir)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 (if (or (= depth 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2186 (< level depth))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 (let* ((dir (file-name-as-directory dir))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188 (header `([,(concat "Tree: "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 (if (= level 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2190 dir
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191 (concat ".../"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192 (file-name-as-directory
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 (file-name-nondirectory
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2194 (directory-file-name dir))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2195 ,(list (function filesets-open)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 ':tree
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197 `(quote (,dir ,patt))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2198 lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199 "---"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 (dirlist (filesets-directory-files dir patt nil nil fd))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201 (subdirs (filesets-filter-dir-names dirlist))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2202 (count 0)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2203 (dirsmenu (mapcar
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 (let* ((x (file-name-as-directory x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207 (xx (concat dir x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 (dd (filesets-build-dir-submenu-now
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
2209 (+ level 1) depth entry
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210 lookup-name xx patt fd))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211 (nm (concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 x)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213 (if dd
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214 `(,nm ,@dd)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 `[,nm ,(list 'filesets-browse-dir xx)])))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2216 subdirs))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217 (files (filesets-filter-dir-names dirlist t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218 (filesmenu (mapcar (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2219 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2220 `[,(concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2221 x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2222 (filesets-file-open nil
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2223 (quote ,(concat dir x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2224 (quote ,lookup-name))])
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2225 files)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2226 (append header
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2227 (filesets-wrap-submenu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2228 (append
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2229 dirsmenu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2230 filesmenu))
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
2231 (filesets-get-menu-epilog `(,dir ,patt) ':tree
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2232 lookup-name rebuild-flag)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2233 nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2234
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2235 (defun filesets-build-dir-submenu (entry lookup-name dir patt)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2236 "Build a :tree submenu named LOOKUP-NAME with base directory DIR including
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 all files matching PATT for filesets ENTRY."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2238 (let ((fd (filesets-entry-get-filter-dirs-flag entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2239 (depth (or (filesets-entry-get-tree-max-level entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2240 filesets-tree-max-level)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2241 (filesets-build-dir-submenu-now 0 depth entry lookup-name dir patt fd t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2242
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2243 (defun filesets-build-submenu (count lookup-name entry)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2244 "Build submenu for the fileset ENTRY named LOOKUP-NAME.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2245 Construct a shortcut from COUNT."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2246 (let ((lookup-name (or lookup-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247 (filesets-data-get-name entry))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248 (message "Filesets: %s" lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2249 (let ((mode (filesets-entry-mode entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2250 (filesets-verbosity (filesets-entry-get-verbosity entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2251 (this-lookup-name (concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2252 lookup-name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2253 (case mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2254 ((:file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2255 (let* ((file (filesets-entry-get-file entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2256 `[,this-lookup-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2257 (filesets-file-open nil ',file ',lookup-name)]))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2258 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2259 `(,this-lookup-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2260 ,@(case mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2261 ((:pattern)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 (let* ((files (filesets-get-filelist entry mode 'on-ls))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2263 (dirpatt (filesets-entry-get-pattern entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 (pattname (apply 'concat (cons "Pattern: " dirpatt)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 (count 0))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266 ;;(filesets-message 3 "Filesets: scanning %S" pattname)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2267 `([,pattname
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268 ,(list (function filesets-open) mode lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 ,@(filesets-wrap-submenu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2271 (mapcar
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2272 (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2273 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2274 `[,(concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2275 (file-name-nondirectory x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2276 (filesets-file-open nil ',x ',lookup-name)])
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2277 files))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2278 ,@(filesets-get-menu-epilog lookup-name mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2279 lookup-name t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2280 ((:ingroup)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2281 (let* ((master (filesets-entry-get-master entry)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2282 ;;(filesets-message 3 "Filesets: parsing %S" master)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2283 `([,(concat "Inclusion Group: "
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2284 (file-name-nondirectory master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2285 (filesets-open ',mode ',master ',lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2286 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2287 [,master (filesets-file-open nil ',master ',lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2288 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2289 ,@(filesets-wrap-submenu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2290 (filesets-build-ingroup-submenu lookup-name master))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2291 ,@(filesets-get-menu-epilog master mode lookup-name t))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2292 ((:tree)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2293 (let* ((dirpatt (filesets-entry-get-tree entry))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2294 (dir (car dirpatt))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2295 (patt (cadr dirpatt)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2296 (filesets-build-dir-submenu entry lookup-name dir patt)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2297 ((:files)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2298 (let ((files (filesets-get-filelist entry mode 'on-open-all))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2299 (count 0))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2300 `([,(concat "Files: " lookup-name)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2301 (filesets-open ',mode ',lookup-name)]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2302 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2303 ,@(filesets-wrap-submenu
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2304 (mapcar
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2305 (lambda (x)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2306 (setq count (+ count 1))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2307 `[,(concat (filesets-get-shortcut count)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2308 (file-name-nondirectory x))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2309 (filesets-file-open nil ',x ',lookup-name)])
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2310 (filesets-conditional-sort
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2311 files
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 (function file-name-nondirectory))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2313 ,@(filesets-get-menu-epilog lookup-name mode
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314 lookup-name t)))))))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2315
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316 (defun filesets-remove-from-ubl (&optional buffer)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2317 "BUFFER or current buffer require update of the filesets menu."
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 (let ((b (or buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 (current-buffer))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 (if (member b filesets-updated-buffers)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 (setq filesets-updated-buffers
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2322 (delete b filesets-updated-buffers)))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 (defun filesets-build-menu-now (from-scratch-flag)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325 "Update the filesets menu.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 Build all new if FROM-SCRATCH-FLAG is non-nil. (To really build from the
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 bottom up, set `filesets-submenus' to nil, first.)"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 (when (or from-scratch-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 filesets-has-changed-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 (not filesets-menu-cache))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2331 (setq filesets-menu-cache nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2332 (setq filesets-has-changed-flag nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 (setq filesets-updated-buffers nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2334 (setq filesets-update-cache-file-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2335 (do ((data (filesets-conditional-sort filesets-data (function car))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2336 (cdr data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2337 (count 1 (+ count 1)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2338 ((null data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2339 (let* ((this (car data))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2340 (name (filesets-data-get-name this))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2341 (cached (lax-plist-get filesets-submenus name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2342 (submenu (or cached
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2343 (filesets-build-submenu count name this))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2344 (unless cached
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2345 (setq filesets-submenus
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346 (lax-plist-put filesets-submenus name submenu)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347 (unless (filesets-entry-get-dormant-flag this)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348 (setq filesets-menu-cache
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 (append filesets-menu-cache (list submenu))))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2350 (when filesets-cache-save-often-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2351 (filesets-menu-cache-file-save-maybe)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2352 (let ((cb (current-buffer)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2353 (when (not (member cb filesets-updated-buffers))
61138
37e73f1dcca8 Update copyright.
Glenn Morris <rgm@gnu.org>
parents: 60965
diff changeset
2354 (add-submenu
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2355 filesets-menu-path
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356 `(,filesets-menu-name
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2357 ("# Filesets"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2358 ["Edit Filesets" filesets-edit]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2359 ["Save Filesets" filesets-save-config]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2360 ["Save Menu Cache" filesets-menu-cache-file-save]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 ["Rebuild Menu" filesets-build-menu]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 ["Customize" filesets-customize]
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 ["About" filesets-info])
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2364 ,(filesets-get-cmd-menu)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 "---"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 ,@filesets-menu-cache)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 filesets-menu-before
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 filesets-menu-in-menu)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 (setq filesets-updated-buffers
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370 (cons cb filesets-updated-buffers))
48862
43b27399e724 (filesets-build-menu-now): Don't clear messages.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 45894
diff changeset
2371 ;; This wipes out other messages in the echo area.
43b27399e724 (filesets-build-menu-now): Don't clear messages.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 45894
diff changeset
2372 ;; (message nil)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 ;;(message "Filesets updated: %s" cb)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 )))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2376 (defun filesets-build-menu-maybe ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 "Update the filesets menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 (filesets-build-menu-now nil))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381 (defun filesets-build-menu ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382 "Force rebuild of the filesets menu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2383 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2384 ;(setq filesets-submenus nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2385 (filesets-reset-fileset)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2386 (filesets-build-menu-now t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2387 (filesets-menu-cache-file-save-maybe))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2388
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389 (defun filesets-rebuild-this-submenu (fileset)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 "Force rebuild of FILESET submenu."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2391 (filesets-reset-fileset fileset)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2392 (filesets-build-menu-now t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2393
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2394 (defun filesets-menu-cache-file-save-maybe (&optional simply-do-it)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2395 "Write filesets' cache file.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2396 If SIMPLY-DO-IT is non-nil, the cache file will be written no matter if
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2397 fileset thinks this is necessary or not."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2398 (when (and (not (equal filesets-menu-cache-file ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2399 (or simply-do-it
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2400 filesets-update-cache-file-flag))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2401 (when (file-exists-p filesets-menu-cache-file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2402 (delete-file filesets-menu-cache-file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2403 ;;(message "Filesets: saving menu cache")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2404 (with-temp-buffer
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2405 (dolist (this filesets-menu-cache-contents)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2406 (if (get this 'custom-type)
49475
796b9b8e53c3 (filesets-file-open): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 48862
diff changeset
2407 (progn
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2408 (insert (format "(setq-default %s '%S)" this (eval this)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2409 (when filesets-menu-ensure-use-cached
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2410 (newline)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411 (insert (format "(setq %s (cons '%s %s))"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 'filesets-ignore-next-set-default
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2413 this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2414 'filesets-ignore-next-set-default))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2415 (insert (format "(setq %s '%S)" this (eval this))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2416 (newline 2))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2417 (insert (format "(setq filesets-cache-version %S)" filesets-version))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2418 (newline 2)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2419 (when filesets-cache-hostname-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2420 (insert (format "(setq filesets-cache-hostname %S)" (system-name)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2421 (newline 2))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2422 (run-hooks 'filesets-cache-fill-content-hooks)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2423 (write-file filesets-menu-cache-file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2424 (setq filesets-has-changed-flag nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2425 (setq filesets-update-cache-file-flag nil)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2426
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2427 (defun filesets-menu-cache-file-save ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2428 "Save filesets' menu cache file."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2429 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2430 (filesets-menu-cache-file-save-maybe t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2431
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2432 (defun filesets-update-cleanup ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2433 "Rebuild the menu and save the cache file after updating user data."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2434 (interactive)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2435 (message "Filesets v%s: updating menu & cache from version %s"
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2436 filesets-version (or filesets-cache-version "???"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2437 (filesets-build-menu)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2438 (filesets-menu-cache-file-save-maybe)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2439 (filesets-menu-cache-file-load))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2440
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2441 (defun filesets-update-pre010505 ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2442 (let ((msg
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2443 "Filesets: manual editing of user data required!
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2444
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2445 Filesets has detected that you were using an older version before,
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2446 which requires some manual updating. Type 'y' for editing the startup
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2447 file now.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2448
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2449 The layout of `filesets-data' has changed. Please delete your cache file
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2450 and edit your startup file as shown below:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2451
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2452 1. `filesets-data': Edit all :pattern filesets in your startup file and
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2453 transform all entries as shown in this example:
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2454
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2455 \(\"Test\" (:pattern \"~/dir/^pattern$\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2456 --> \(\"Test\" (:pattern \"~/dir/\" \"^pattern$\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2457
45894
52a4d501ce21 (filesets-update-pre010505): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 45319
diff changeset
2458 2. `filesets-data': Change all occurrences of \":document\" to \":ingroup\":
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2459
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2460 \(\(\"Test\" \(:document \"~/dir/file\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2461 --> \(\(\"Test\" \(:ingroup \"~/dir/file\"))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2462
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2463 3. `filesets-subdocument-patterns': If you already modified the variable
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2464 previously called `filesets-subdocument-patterns', change its name to
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2465 `filesets-ingroup-patterns'.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2466
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2467 4. `filesets-menu-cache-contents': If you already modified this
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2468 variable, change the entry `filesets-subdocument--cache' to
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2469 `filesets-ingroup-cache'.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2470
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2471 5. Type M-x filesets-update-cleanup and restart Emacs.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2472
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2473 We apologize for the inconvenience."))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2474 (let* ((cf (or custom-file user-init-file)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2475 (switch-to-buffer-other-frame "*Filesets update*")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2476 (insert msg)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2477 (when (y-or-n-p (format "Edit startup (%s) file now? " cf))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2478 (find-file-other-window cf))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2479 (filesets-error 'error msg))))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2480
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2481 (defun filesets-update (cached-version)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2482 "Do some cleanup after updating filesets.el."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2483 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2484 ((or (not cached-version)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2485 (string< cached-version "1.5.5")
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2486 (boundp 'filesets-subdocument-patterns))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2487 (filesets-update-pre010505)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2488 (filesets-update-cleanup))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2489
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2490 (defun filesets-menu-cache-file-load ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2491 "Load filesets' menu cache file."
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2492 (cond
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2493 ((and (not (equal filesets-menu-cache-file ""))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2494 (file-readable-p filesets-menu-cache-file))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2495 (load-file filesets-menu-cache-file)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2496 (if (and (equal filesets-cache-version filesets-version)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2497 (if filesets-cache-hostname-flag
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2498 (equal filesets-cache-hostname (system-name))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2499 t))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2500 (progn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2501 (setq filesets-update-cache-file-flag nil)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2502 t)
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2503 (filesets-update filesets-cache-version)))
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2504 (t
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2505 (setq filesets-update-cache-file-flag t)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2506 nil)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2507
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2508 (defun filesets-exit ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2509 (filesets-menu-cache-file-save-maybe))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2510
60965
7b5c3ff57835 (filesets-init): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents: 59996
diff changeset
2511 ;;;###autoload
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2512 (defun filesets-init ()
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513 "Filesets initialization.
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2514 Set up hooks, load the cache file -- if existing -- and build the menu."
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2515 (add-hook (if (featurep 'xemacs) 'activate-menubar-hook 'menu-bar-update-hook)
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2516 (function filesets-build-menu-maybe))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2517 (add-hook 'kill-buffer-hook (function filesets-remove-from-ubl))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2518 (add-hook 'first-change-hook (function filesets-reset-filename-on-change))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2519 (add-hook 'kill-emacs-hook (function filesets-exit))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2520 (if (filesets-menu-cache-file-load)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2521 (progn
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2522 (filesets-build-menu-maybe)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2523 ;;Well, normally when we use XEmacs <= 21.4, custom.el is loaded
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2524 ;;after init.el. This more or less ignores the next
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2525 ;;`filesets-data-set-default'
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2526 (if filesets-menu-ensure-use-cached
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2527 (setq filesets-menu-use-cached-flag t)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2528 (filesets-build-menu)))
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2529
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2530
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2531 (provide 'filesets)
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2532
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2533 ;; Local Variables:
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2534 ;; sentence-end-double-space:t
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2535 ;; End:
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2536
84660
7d71915e566c Remove spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 82140
diff changeset
2537 ;; arch-tag: 2c03f85f-c3df-4cec-b0a3-b46fd5592d70
44934
ae16f63fe28f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2538 ;;; filesets.el ends here