163 |
fsom-rv)) |
fsom-rv)) |
164 |
|
|
165 |
(defun filesets-some (fss-pred fss-lst) |
(defun filesets-some (fss-pred fss-lst) |
166 |
"Return non-nil if FSS-PRED is non-nil for any element of FSS-LST. |
"Return non-nil if FSS-PRED is non-nil for any element of FSS-LST. |
167 |
Like `some', return the first value of FSS-PRED that is non-nil." |
Like `some', return the first value of FSS-PRED that is non-nil." |
168 |
(catch 'exit |
(catch 'exit |
169 |
(dolist (fss-this fss-lst nil) |
(dolist (fss-this fss-lst nil) |
179 |
(let ((fsm-test (or (plist-get fsm-keys ':test) |
(let ((fsm-test (or (plist-get fsm-keys ':test) |
180 |
(function equal)))) |
(function equal)))) |
181 |
(filesets-ormap (lambda (fsm-this) |
(filesets-ormap (lambda (fsm-this) |
182 |
(funcall fsm-test fsm-item fsm-this)) |
(funcall fsm-test fsm-item fsm-this)) |
183 |
fsm-lst))) |
fsm-lst))) |
184 |
;(fset 'filesets-member 'member*) ;; or use the cl function |
;(fset 'filesets-member 'member*) ;; or use the cl function |
185 |
|
|
199 |
(let ((this (shell-command-to-string |
(let ((this (shell-command-to-string |
200 |
(format "which --skip-alias %s 2> /dev/null | head -n 1" |
(format "which --skip-alias %s 2> /dev/null | head -n 1" |
201 |
cmd-list)))) |
cmd-list)))) |
202 |
(if (equal this "") |
(if (equal this "") |
203 |
nil |
nil |
204 |
(file-name-nondirectory (substring this 0 (- (length this) 1)))))) |
(file-name-nondirectory (substring this 0 (- (length this) 1)))))) |
205 |
|
|
353 |
(defcustom filesets-menu-cache-contents |
(defcustom filesets-menu-cache-contents |
354 |
'(filesets-be-docile-flag |
'(filesets-be-docile-flag |
355 |
filesets-submenus |
filesets-submenus |
356 |
filesets-menu-cache |
filesets-menu-cache |
357 |
filesets-ingroup-cache) |
filesets-ingroup-cache) |
358 |
"*Stuff we want to save in `filesets-menu-cache-file'. |
"*Stuff we want to save in `filesets-menu-cache-file'. |
359 |
|
|
745 |
(:get-file-name (lambda (master file) |
(:get-file-name (lambda (master file) |
746 |
(filesets-which-file master |
(filesets-which-file master |
747 |
(concat file ".sty") |
(concat file ".sty") |
748 |
(filesets-convert-path-list |
(filesets-convert-path-list |
749 |
(or (getenv "MY_TEXINPUTS") |
(or (getenv "MY_TEXINPUTS") |
750 |
(getenv "TEXINPUTS"))))))) |
(getenv "TEXINPUTS"))))))) |
751 |
((:name "Include") |
((:name "Include") |
753 |
(:get-file-name (lambda (master file) |
(:get-file-name (lambda (master file) |
754 |
(filesets-which-file master |
(filesets-which-file master |
755 |
(concat file ".tex") |
(concat file ".tex") |
756 |
(filesets-convert-path-list |
(filesets-convert-path-list |
757 |
(or (getenv "MY_TEXINPUTS") |
(or (getenv "MY_TEXINPUTS") |
758 |
(getenv "TEXINPUTS")))))) |
(getenv "TEXINPUTS")))))) |
759 |
(:scan-depth 5)) |
(:scan-depth 5)) |
763 |
(:get-file-name (lambda (master file) |
(:get-file-name (lambda (master file) |
764 |
(filesets-which-file master |
(filesets-which-file master |
765 |
(concat file ".tex") |
(concat file ".tex") |
766 |
(filesets-convert-path-list |
(filesets-convert-path-list |
767 |
(or (getenv "MY_TEXINPUTS") |
(or (getenv "MY_TEXINPUTS") |
768 |
(getenv "TEXINPUTS")))))) |
(getenv "TEXINPUTS")))))) |
769 |
(:scan-depth 5)) |
(:scan-depth 5)) |
772 |
(:get-file-name (lambda (master file) |
(:get-file-name (lambda (master file) |
773 |
(filesets-which-file master |
(filesets-which-file master |
774 |
(concat file ".bib") |
(concat file ".bib") |
775 |
(filesets-convert-path-list |
(filesets-convert-path-list |
776 |
(or (getenv "MY_BIBINPUTS") |
(or (getenv "MY_BIBINPUTS") |
777 |
(getenv "BIBINPUTS"))))))))) |
(getenv "BIBINPUTS"))))))))) |
778 |
("^.+\\.el$" t |
("^.+\\.el$" t |
1066 |
(fset 'filesets-add-submenu 'add-submenu)) |
(fset 'filesets-add-submenu 'add-submenu)) |
1067 |
|
|
1068 |
(require 'easymenu) |
(require 'easymenu) |
1069 |
|
|
1070 |
(defun filesets-error (class &rest args) |
(defun filesets-error (class &rest args) |
1071 |
"`error' wrapper." |
"`error' wrapper." |
1072 |
(error (mapconcat 'identity args " "))) |
(error (mapconcat 'identity args " "))) |
1122 |
(let ((files nil) |
(let ((files nil) |
1123 |
(dirs nil)) |
(dirs nil)) |
1124 |
(dolist (this (file-name-all-completions "" dir)) |
(dolist (this (file-name-all-completions "" dir)) |
1125 |
(cond |
(cond |
1126 |
((string-match "^\\.+/$" this) |
((string-match "^\\.+/$" this) |
1127 |
nil) |
nil) |
1128 |
((string-match "[:/\\]$" this) |
((string-match "[:/\\]$" this) |
1129 |
(when (or (not match-dirs-flag) |
(when (or (not match-dirs-flag) |
1130 |
(not pattern) |
(not pattern) |
1131 |
(string-match pattern this)) |
(string-match pattern this)) |
1132 |
(filesets-message 5 "Filesets: matched dir %S with pattern %S" |
(filesets-message 5 "Filesets: matched dir %S with pattern %S" |
1133 |
this pattern) |
this pattern) |
1134 |
(setq dirs (cons this dirs)))) |
(setq dirs (cons this dirs)))) |
1135 |
(t |
(t |
1136 |
(when (or (not pattern) |
(when (or (not pattern) |
1137 |
(string-match pattern this)) |
(string-match pattern this)) |
1138 |
(filesets-message 5 "Filesets: matched file %S with pattern %S" |
(filesets-message 5 "Filesets: matched file %S with pattern %S" |
1139 |
this pattern) |
this pattern) |
1140 |
(setq files (cons (if full-flag |
(setq files (cons (if full-flag |
1141 |
(concat (file-name-as-directory dir) this) |
(concat (file-name-as-directory dir) this) |
1293 |
(filesets-get-external-viewer filename))))) |
(filesets-get-external-viewer filename))))) |
1294 |
(when def |
(when def |
1295 |
(filesets-alist-get def property nil t)))) |
(filesets-alist-get def property nil t)))) |
1296 |
|
|
1297 |
(defun filesets-reset-filename-on-change () |
(defun filesets-reset-filename-on-change () |
1298 |
"Reset a buffer's filename if the buffer is being modified." |
"Reset a buffer's filename if the buffer is being modified." |
1299 |
(when filesets-output-buffer-flag |
(when filesets-output-buffer-flag |
1530 |
(filesets-data-get entry ':ingroup nil t)) |
(filesets-data-get entry ':ingroup nil t)) |
1531 |
|
|
1532 |
(defun filesets-file-open (open-function file-name &optional fileset-name) |
(defun filesets-file-open (open-function file-name &optional fileset-name) |
1533 |
"Open FILE-NAME using OPEN-FUNCTION. If OPEN-FUNCTION is nil, it's |
"Open FILE-NAME using OPEN-FUNCTION. If OPEN-FUNCTION is nil, its |
1534 |
value will be deduced from FILESET-NAME" |
value will be deduced from FILESET-NAME." |
1535 |
(let ((open-function (or open-function |
(let ((open-function (or open-function |
1536 |
(filesets-entry-get-open-fn fileset-name)))) |
(filesets-entry-get-open-fn fileset-name)))) |
1537 |
(if (file-readable-p file-name) |
(if (file-readable-p file-name) |
1573 |
(cond |
(cond |
1574 |
((and (symbolp this) (fboundp this)) |
((and (symbolp this) (fboundp this)) |
1575 |
(let ((x (funcall this))) |
(let ((x (funcall this))) |
1576 |
(setq rv (append rv (if (listp x) x (list x)))))) |
(setq rv (append rv (if (listp x) x (list x)))))) |
1577 |
(t |
(t |
1578 |
(setq rv (append rv (list this)))))))) |
(setq rv (append rv (list this)))))))) |
1579 |
|
|
1618 |
(or (equal mode ':ingroup) |
(or (equal mode ':ingroup) |
1619 |
(equal mode ':tree))) |
(equal mode ':tree))) |
1620 |
(filesets-get-filelist fileset mode event) |
(filesets-get-filelist fileset mode event) |
1621 |
(filesets-get-filelist |
(filesets-get-filelist |
1622 |
(filesets-get-fileset-from-name name) |
(filesets-get-fileset-from-name name) |
1623 |
mode event)))) |
mode event)))) |
1624 |
(when files |
(when files |
1644 |
(if (equal txt "") "" " ") |
(if (equal txt "") "" " ") |
1645 |
(format "%s" this)))))))) |
(format "%s" this)))))))) |
1646 |
(cmd (concat fn " " args))) |
(cmd (concat fn " " args))) |
1647 |
(filesets-cmd-show-result |
(filesets-cmd-show-result |
1648 |
cmd (shell-command-to-string cmd)))) |
cmd (shell-command-to-string cmd)))) |
1649 |
((symbolp fn) |
((symbolp fn) |
1650 |
(let ((args |
(let ((args |
1800 |
(cond |
(cond |
1801 |
(inlist |
(inlist |
1802 |
(message "Filesets: '%s' is already in '%s'" this name)) |
(message "Filesets: '%s' is already in '%s'" this name)) |
1803 |
((and (equal (filesets-entry-mode entry) ':files) |
((and (equal (filesets-entry-mode entry) ':files) |
1804 |
this) |
this) |
1805 |
(filesets-entry-set-files entry (cons this files) t) |
(filesets-entry-set-files entry (cons this files) t) |
1806 |
(filesets-set-config name 'filesets-data filesets-data)) |
(filesets-set-config name 'filesets-data filesets-data)) |
1911 |
(if (null (cdr x)) |
(if (null (cdr x)) |
1912 |
"" |
"" |
1913 |
", ")))) |
", ")))) |
1914 |
(setq rv |
(setq rv |
1915 |
(concat |
(concat |
1916 |
rv |
rv |
1917 |
(if filesets-menu-shortcuts-flag |
(if filesets-menu-shortcuts-flag |
2117 |
(append rv |
(append rv |
2118 |
(if files |
(if files |
2119 |
`((,nm |
`((,nm |
2120 |
[,(concat "Inclusion Group: " |
[,(concat "Inclusion Group: " |
2121 |
(file-name-nondirectory master)) |
(file-name-nondirectory master)) |
2122 |
(filesets-open ':ingroup ',master ',fsn)] |
(filesets-open ':ingroup ',master ',fsn)] |
2123 |
"---" |
"---" |
2127 |
(mapcar |
(mapcar |
2128 |
(lambda (this) |
(lambda (this) |
2129 |
(setq count (+ count 1)) |
(setq count (+ count 1)) |
2130 |
(let ((ff (filesets-ingroup-collect-build-menu |
(let ((ff (filesets-ingroup-collect-build-menu |
2131 |
fs (list this) count))) |
fs (list this) count))) |
2132 |
(if (= (length ff) 1) |
(if (= (length ff) 1) |
2133 |
(car ff) |
(car ff) |
2184 |
(let* ((x (file-name-as-directory x)) |
(let* ((x (file-name-as-directory x)) |
2185 |
(xx (concat dir x)) |
(xx (concat dir x)) |
2186 |
(dd (filesets-build-dir-submenu-now |
(dd (filesets-build-dir-submenu-now |
2187 |
(+ level 1) depth entry |
(+ level 1) depth entry |
2188 |
lookup-name xx patt fd)) |
lookup-name xx patt fd)) |
2189 |
(nm (concat (filesets-get-shortcut count) |
(nm (concat (filesets-get-shortcut count) |
2190 |
x))) |
x))) |
2206 |
(append |
(append |
2207 |
dirsmenu |
dirsmenu |
2208 |
filesmenu)) |
filesmenu)) |
2209 |
(filesets-get-menu-epilog `(,dir ,patt) ':tree |
(filesets-get-menu-epilog `(,dir ,patt) ':tree |
2210 |
lookup-name rebuild-flag))) |
lookup-name rebuild-flag))) |
2211 |
nil)) |
nil)) |
2212 |
|
|
2346 |
filesets-menu-in-menu) |
filesets-menu-in-menu) |
2347 |
(setq filesets-updated-buffers |
(setq filesets-updated-buffers |
2348 |
(cons cb filesets-updated-buffers)) |
(cons cb filesets-updated-buffers)) |
2349 |
(message nil) |
;; This wipes out other messages in the echo area. |
2350 |
|
;; (message nil) |
2351 |
;;(message "Filesets updated: %s" cb) |
;;(message "Filesets updated: %s" cb) |
2352 |
))) |
))) |
2353 |
|
|
2382 |
(with-temp-buffer |
(with-temp-buffer |
2383 |
(dolist (this filesets-menu-cache-contents) |
(dolist (this filesets-menu-cache-contents) |
2384 |
(if (get this 'custom-type) |
(if (get this 'custom-type) |
2385 |
(progn |
(progn |
2386 |
(insert (format "(setq-default %s '%S)" this (eval this))) |
(insert (format "(setq-default %s '%S)" this (eval this))) |
2387 |
(when filesets-menu-ensure-use-cached |
(when filesets-menu-ensure-use-cached |
2388 |
(newline) |
(newline) |
2433 |
\(\"Test\" (:pattern \"~/dir/^pattern$\")) |
\(\"Test\" (:pattern \"~/dir/^pattern$\")) |
2434 |
--> \(\"Test\" (:pattern \"~/dir/\" \"^pattern$\")) |
--> \(\"Test\" (:pattern \"~/dir/\" \"^pattern$\")) |
2435 |
|
|
2436 |
2. `filesets-data': Change all occurances of \":document\" to \":ingroup\": |
2. `filesets-data': Change all occurrences of \":document\" to \":ingroup\": |
2437 |
|
|
2438 |
\(\(\"Test\" \(:document \"~/dir/file\")) |
\(\(\"Test\" \(:document \"~/dir/file\")) |
2439 |
--> \(\(\"Test\" \(:ingroup \"~/dir/file\")) |
--> \(\(\"Test\" \(:ingroup \"~/dir/file\")) |