aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-05-07 16:11:30 +0000
committerRichard M. Stallman2002-05-07 16:11:30 +0000
commitf194e54a12e89f978fda6f7b12cd66da23067381 (patch)
tree2e46743bc07140e61be9025209bd2209796840d1
parent657c5358f48e522a7975d4e01bfa05486b53710f (diff)
downloademacs-f194e54a12e89f978fda6f7b12cd66da23067381.tar.gz
emacs-f194e54a12e89f978fda6f7b12cd66da23067381.zip
(filesets-external-viewers): Fix customization problem.
(filesets-some): Replaces cl's `some'. Calls changed. (filesets-member): Replaces cl's `member*'. Calls changed. (filesets-ormap): New function.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/filesets.el92
2 files changed, 72 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 47758b6d376..3e17ef53aa4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12002-05-07 Thomas Link <t.link@gmx.at>
2
3 * filesets.el:
4 (filesets-external-viewers): Fix customization problem.
5 (filesets-some): Replaces cl's `some'. Calls changed.
6 (filesets-member): Replaces cl's `member*'. Calls changed.
7 (filesets-ormap): New function.
8
12002-05-07 John Paul Wallington <jpw@shootybangbang.com> 92002-05-07 John Paul Wallington <jpw@shootybangbang.com>
2 10
3 * ibuffer.el (toplevel): Specialize `ibuffer-mode-groups-popup' 11 * ibuffer.el (toplevel): Specialize `ibuffer-mode-groups-popup'
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 9654512b82c..96bf0b9d27f 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -21,7 +21,7 @@
21;; program's author or from the Free Software Foundation, Inc., 675 Mass 21;; program's author or from the Free Software Foundation, Inc., 675 Mass
22;; Ave, Cambridge, MA 02139, USA. 22;; Ave, Cambridge, MA 02139, USA.
23 23
24(defvar filesets-version "1.8.1") 24(defvar filesets-version "1.8.4")
25(defvar filesets-homepage 25(defvar filesets-homepage
26 "http://members.a1.net/t.link/CompEmacsFilesets.html") 26 "http://members.a1.net/t.link/CompEmacsFilesets.html")
27 27
@@ -151,6 +151,38 @@ COND-FN takes one argument: the current element."
151 (when (funcall cond-fn elt) 151 (when (funcall cond-fn elt)
152 (setq rv (append rv (list elt))))))) 152 (setq rv (append rv (list elt)))))))
153 153
154(defun filesets-ormap (fsom-pred lst)
155 "Return the the tail of FSOM-LST for the head of which FSOM-PRED is non-nil."
156 (let ((fsom-lst lst)
157 (fsom-rv nil))
158 (while (and (not (null fsom-lst))
159 (null fsom-rv))
160 (if (funcall fsom-pred (car fsom-lst))
161 (setq fsom-rv fsom-lst)
162 (setq fsom-lst (cdr fsom-lst))))
163 fsom-rv))
164
165(defun filesets-some (fss-pred fss-lst)
166 "Return non-nil if FSS-PRED is non-nil for any element of FSS-LST.
167Like `some', return the first value of FSS-PRED that is non-nil."
168 (catch 'exit
169 (dolist (fss-this fss-lst nil)
170 (let ((fss-rv (funcall fss-pred fss-this)))
171 (when fss-rv
172 (throw 'exit fss-rv))))))
173;(fset 'filesets-some 'some) ;; or use the cl function
174
175(defun filesets-member (fsm-item fsm-lst &rest fsm-keys)
176 "Find the first occurrence of FSM-ITEM in FSM-LST.
177It is supposed to work like cl's `member*'. At the moment only the :test
178key is supported."
179 (let ((fsm-test (or (plist-get fsm-keys ':test)
180 (function equal))))
181 (filesets-ormap (lambda (fsm-this)
182 (funcall fsm-test fsm-item fsm-this))
183 fsm-lst)))
184;(fset 'filesets-member 'member*) ;; or use the cl function
185
154(defun filesets-sublist (lst beg &optional end) 186(defun filesets-sublist (lst beg &optional end)
155 "Get the sublist of LST from BEG to END - 1." 187 "Get the sublist of LST from BEG to END - 1."
156 (let ((rv nil) 188 (let ((rv nil)
@@ -611,7 +643,7 @@ i.e. on open-all-files-events or when running commands
611 643
612:constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil 644:constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil
613 645
614:constraint-flag SYMBOL ... use this viewer only if SYMBOL is non-nil 646:constraint-flag SEXP ... use this viewer only if SEXP evaluates to non-nil
615 647
616:open-hook HOOK ... run hooks after spawning the viewer -- mainly useful 648:open-hook HOOK ... run hooks after spawning the viewer -- mainly useful
617in conjunction with :capture-output 649in conjunction with :capture-output
@@ -659,7 +691,7 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these:
659 :value (:constraint-flag) 691 :value (:constraint-flag)
660 (const :format "" 692 (const :format ""
661 :value :constraint-flag) 693 :value :constraint-flag)
662 (symbol :tag "Symbol")) 694 (sexp :tag "Symbol"))
663 (list :tag ":ignore-on-open-all" 695 (list :tag ":ignore-on-open-all"
664 :value (:ignore-on-open-all t) 696 :value (:ignore-on-open-all t)
665 (const :format "" 697 (const :format ""
@@ -1171,17 +1203,18 @@ non-nil."
1171 filename))) 1203 filename)))
1172 (if (file-exists-p f) 1204 (if (file-exists-p f)
1173 f 1205 f
1174 (some (lambda (dir) 1206 (filesets-some
1175 (let ((dir (file-name-as-directory dir)) 1207 (lambda (dir)
1176 (files (if (file-exists-p dir) 1208 (let ((dir (file-name-as-directory dir))
1177 (filesets-directory-files dir nil ':files) 1209 (files (if (file-exists-p dir)
1178 nil))) 1210 (filesets-directory-files dir nil ':files)
1179 (some (lambda (file) 1211 nil)))
1180 (if (equal filename (file-name-nondirectory file)) 1212 (filesets-some (lambda (file)
1181 (concat dir file) 1213 (if (equal filename (file-name-nondirectory file))
1182 nil)) 1214 (concat dir file)
1183 files))) 1215 nil))
1184 path-list)))) 1216 files)))
1217 path-list))))
1185 1218
1186 1219
1187(defun filesets-eviewer-get-props (entry) 1220(defun filesets-eviewer-get-props (entry)
@@ -1203,7 +1236,7 @@ non-nil."
1203(defun filesets-get-external-viewer (file) 1236(defun filesets-get-external-viewer (file)
1204 "Find an external viewer for FILE." 1237 "Find an external viewer for FILE."
1205 (let ((filename (file-name-nondirectory file))) 1238 (let ((filename (file-name-nondirectory file)))
1206 (some 1239 (filesets-some
1207 (lambda (entry) 1240 (lambda (entry)
1208 (when (and (string-match (nth 0 entry) filename) 1241 (when (and (string-match (nth 0 entry) filename)
1209 (filesets-eviewer-constraint-p entry)) 1242 (filesets-eviewer-constraint-p entry))
@@ -1213,7 +1246,7 @@ non-nil."
1213(defun filesets-get-external-viewer-by-name (name) 1246(defun filesets-get-external-viewer-by-name (name)
1214 "Get the external viewer definition called NAME." 1247 "Get the external viewer definition called NAME."
1215 (when name 1248 (when name
1216 (some 1249 (filesets-some
1217 (lambda (entry) 1250 (lambda (entry)
1218 (when (and (string-equal (nth 1 entry) name) 1251 (when (and (string-equal (nth 1 entry) name)
1219 (filesets-eviewer-constraint-p entry)) 1252 (filesets-eviewer-constraint-p entry))
@@ -1414,10 +1447,11 @@ Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
1414 "Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup. 1447 "Return fileset ENTRY's mode: :files, :file, :tree, :pattern, or :ingroup.
1415See `filesets-data'." 1448See `filesets-data'."
1416 (let ((data (filesets-data-get-data entry))) 1449 (let ((data (filesets-data-get-data entry)))
1417 (some (lambda (x) 1450 (filesets-some
1418 (if (assoc x data) 1451 (lambda (x)
1419 x)) 1452 (if (assoc x data)
1420 '(:files :tree :pattern :ingroup :file)))) 1453 x))
1454 '(:files :tree :pattern :ingroup :file))))
1421 1455
1422(defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry) 1456(defun filesets-entry-get-open-fn (fileset-name &optional fileset-entry)
1423 "Get the open-function for FILESET-NAME. 1457 "Get the open-function for FILESET-NAME.
@@ -1757,7 +1791,8 @@ User will be queried, if no fileset name is provided."
1757 (if entry 1791 (if entry
1758 (let* ((files (filesets-entry-get-files entry)) 1792 (let* ((files (filesets-entry-get-files entry))
1759 (this (buffer-file-name buffer)) 1793 (this (buffer-file-name buffer))
1760 (inlist (member* this files :test 'filesets-files-equalp))) 1794 (inlist (filesets-member this files
1795 :test 'filesets-files-equalp)))
1761 (cond 1796 (cond
1762 (inlist 1797 (inlist
1763 (message "Filesets: '%s' is already in '%s'" this name)) 1798 (message "Filesets: '%s' is already in '%s'" this name))
@@ -1782,7 +1817,8 @@ User will be queried, if no fileset name is provided."
1782 (if entry 1817 (if entry
1783 (let* ((files (filesets-entry-get-files entry)) 1818 (let* ((files (filesets-entry-get-files entry))
1784 (this (buffer-file-name buffer)) 1819 (this (buffer-file-name buffer))
1785 (inlist (member* this files :test 'filesets-files-equalp))) 1820 (inlist (filesets-member this files
1821 :test 'filesets-files-equalp)))
1786 ;;(message "%s %s %s" files this inlist) 1822 ;;(message "%s %s %s" files this inlist)
1787 (if (and files this inlist) 1823 (if (and files this inlist)
1788 (let ((new (list (cons ':files (delete (car inlist) files))))) 1824 (let ((new (list (cons ':files (delete (car inlist) files)))))
@@ -1946,11 +1982,11 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
1946 (and (stringp a) 1982 (and (stringp a)
1947 (stringp b) 1983 (stringp b)
1948 (string-match a b)))))) 1984 (string-match a b))))))
1949 (some (lambda (x) 1985 (filesets-some (lambda (x)
1950 (if (funcall fn (car x) masterfile) 1986 (if (funcall fn (car x) masterfile)
1951 (nth pos x) 1987 (nth pos x)
1952 nil)) 1988 nil))
1953 filesets-ingroup-patterns))) 1989 filesets-ingroup-patterns)))
1954 1990
1955(defun filesets-ingroup-get-pattern (master) 1991(defun filesets-ingroup-get-pattern (master)
1956 "Access to `filesets-ingroup-patterns'. Extract patterns." 1992 "Access to `filesets-ingroup-patterns'. Extract patterns."
@@ -2026,7 +2062,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
2026 (when (and f 2062 (when (and f
2027 (not (member f flist)) 2063 (not (member f flist))
2028 (or (not remdupl-flag) 2064 (or (not remdupl-flag)
2029 (not (member* 2065 (not (filesets-member
2030 f filesets-ingroup-files 2066 f filesets-ingroup-files
2031 :test 'filesets-files-equalp)))) 2067 :test 'filesets-files-equalp))))
2032 (let ((no-stub-flag 2068 (let ((no-stub-flag