Merged from mwolson@gnu.org--2005 (patch 333, 337, 345-346, 349)
[muse-el.git] / lisp / muse-project.el
blobb9895d8421743e9627af365dabe9cccd619cd362
1 ;;; muse-project.el --- handle Muse projects
3 ;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 ;; This file is not part of GNU Emacs.
7 ;; This is free software; you can redistribute it and/or modify it under
8 ;; the terms of the GNU General Public License as published by the Free
9 ;; Software Foundation; either version 2, or (at your option) any later
10 ;; version.
12 ;; This is distributed in the hope that it will be useful, but WITHOUT
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 ;; for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
19 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
22 ;;; Commentary:
24 ;;; Contributors:
26 ;;; Code:
28 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 ;; Muse Project Maintainance
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34 (require 'muse)
35 (require 'muse-publish)
37 (defgroup muse-project nil
38 "Options controlling the behavior of Muse project handling."
39 :group 'muse)
41 (defcustom muse-before-project-publish-hook nil
42 "A hook run before a project is published.
43 Each function is passed the project object, a cons with the format
44 (PROJNAME . SETTINGS)"
45 :type 'hook
46 :group 'muse-project)
48 (defcustom muse-after-project-publish-hook nil
49 "A hook run after a project is published.
50 Each function is passed the project object, a cons with the format
51 (PROJNAME . SETTINGS)"
52 :type 'hook
53 :group 'muse-project)
55 (defvar muse-project-alist-using-customize nil
56 "Used internally by Muse to indicate whether `muse-project-alist'
57 has been modified via the customize interface.")
58 (make-variable-buffer-local 'muse-project-alist-using-customize)
60 (defmacro with-muse-project (project &rest body)
61 `(progn
62 (unless (muse-project ,project)
63 (error "Can't find project %s" ,project))
64 (with-temp-buffer
65 (muse-mode)
66 (setq muse-current-project (muse-project ,project))
67 (muse-project-set-variables)
68 ,@body)))
70 (put 'with-muse-project 'lisp-indent-function 0)
71 (put 'with-muse-project 'edebug-form-spec '(sexp body))
73 (defun muse-project-alist-get (sym)
74 "Turn `muse-project-alist' into something we can customize easily."
75 (when (boundp sym)
76 (setq muse-project-alist-using-customize t)
77 (let* ((val (copy-alist (symbol-value sym)))
78 (head val))
79 (while val
80 (let ((head (car (cdar val)))
81 res)
82 ;; Turn settings of first part into cons cells, symbol->string
83 (while head
84 (cond ((stringp (car head))
85 (add-to-list 'res (car head) t)
86 (setq head (cdr head)))
87 ((symbolp (car head))
88 (add-to-list 'res (list (symbol-name (car head))
89 (cadr head)) t)
90 (setq head (cddr head)))
92 (setq head (cdr head)))))
93 (setcdr (car val) (cons res (cdr (cdar val)))))
94 (let ((styles (cdar val)))
95 ;; Symbol->string in every style
96 (while (cdr styles)
97 (let ((head (cadr styles))
98 res)
99 (while (consp head)
100 (setq res (plist-put res (symbol-name (car head))
101 (cadr head)))
102 (setq head (cddr head)))
103 (setcdr styles (cons res (cddr styles))))
104 (setq styles (cdr styles))))
105 (setq val (cdr val)))
106 head)))
108 (defun muse-project-alist-set (sym val)
109 "Turn customized version of `muse-project-alist' into something
110 Muse can make use of."
111 (set sym val)
112 (when muse-project-alist-using-customize
113 ;; Make sure the unescaped version is written to .emacs
114 (put sym 'saved-value (list (custom-quote val)))
115 ;; Perform unescaping
116 (while val
117 (let ((head (car (cdar val)))
118 res)
119 ;; Turn cons cells into flat list, string->symbol
120 (while head
121 (cond ((stringp (car head))
122 (add-to-list 'res (car head) t))
123 ((consp (car head))
124 (add-to-list 'res (intern (caar head)) t)
125 (add-to-list 'res (car (cdar head)) t)))
126 (setq head (cdr head)))
127 (setcdr (car val) (cons res (cdr (cdar val)))))
128 (let ((styles (cdar val)))
129 ;; String->symbol in every style
130 (while (cdr styles)
131 (let ((head (cadr styles))
132 res)
133 (while (consp head)
134 (setq res (plist-put res (intern (car head))
135 (cadr head)))
136 (setq head (cddr head)))
137 (setcdr styles (cons res (cddr styles))))
138 (setq styles (cdr styles))))
139 (setq val (cdr val)))))
141 (define-widget 'muse-project 'default
142 "A widget that defines a Muse project."
143 :format "\n%v"
144 :value-create 'muse-widget-type-value-create
145 :value-get 'muse-widget-child-value-get
146 :value-delete 'ignore
147 :match 'muse-widget-type-match
148 :type '(cons :format " %v"
149 (repeat :tag "Settings" :format "%{%t%}:\n%v%i\n\n"
150 (choice
151 (string :tag "Directory")
152 (list :tag "Book function"
153 (const :tag ":book-funcall" ":book-funcall")
154 (choice (function)
155 (sexp :tag "Unknown")))
156 (list :tag "Book part"
157 (const :tag ":book-part" ":book-part")
158 (string :tag "Name"))
159 (list :tag "Book style"
160 (const :tag ":book-style" ":book-style")
161 (string :tag "Style"))
162 (list :tag "Default file"
163 (const :tag ":default" ":default")
164 (string :tag "File"))
165 (list :tag "End of book"
166 (const :tag ":book-end" ":book-end")
167 (const t))
168 (list :tag "Force publishing"
169 (const :tag ":force-publish" ":force-publish")
170 (repeat (string :tag "File")))
171 (list :tag "Major mode"
172 (const :tag ":major-mode" ":major-mode")
173 (choice (function :tag "Mode")
174 (sexp :tag "Unknown")))
175 (list :tag "New chapter"
176 (const :tag ":book-chapter" ":book-chapter")
177 (string :tag "Name"))
178 (list :tag "No chapters"
179 (const :tag ":nochapters" ":nochapters")
180 (const t))
181 (list :tag "Set variables"
182 (const :tag ":set" ":set")
183 (repeat (list :inline t
184 (symbol :tag "Variable")
185 (sexp :tag "Setting"))))
186 (list :tag "Visit links using"
187 (const :tag ":visit-link" ":visit-link")
188 (choice (function)
189 (sexp :tag "Unknown")))))
190 (repeat :tag "Styles" :format "%{%t%}:\n%v%i\n\n"
191 (set :tag "Style"
192 (list :inline t
193 :tag "Publishing style"
194 (const :tag ":base" ":base")
195 (string :tag "Style"))
196 (list :inline t
197 :tag "Base URL"
198 (const :tag ":base-url" ":base-url")
199 (string :tag "URL"))
200 (list :inline t
201 :tag "Exclude matching"
202 (const :tag ":exclude" ":exclude")
203 (regexp))
204 (list :inline t
205 :tag "Include matching"
206 (const :tag ":include" ":include")
207 (regexp))
208 (list :inline t
209 :tag "Timestamps file"
210 (const :tag ":timestamps" ":timestamps")
211 (file))
212 (list :inline t
213 :tag "Path"
214 (const :tag ":path" ":path")
215 (string :tag "Path"))))))
217 (defcustom muse-project-alist nil
218 "An alist of Muse projects.
219 A project defines a fileset, and a list of custom attributes for use
220 when publishing files in that project."
221 :type '(choice (const :tag "No projects defined." nil)
222 (repeat (cons :format "%{%t%}:\n\n%v"
223 :tag "Project" :indent 4
224 (string :tag "Project name")
225 muse-project))
226 (sexp :tag "Cannot parse expression"))
227 :get 'muse-project-alist-get
228 :set 'muse-project-alist-set
229 :group 'muse-project)
231 ;; Make it easier to specify a muse-project-alist entry
233 (defcustom muse-project-ignore-regexp
234 (concat "\\`\\(.*\\.?#.*\\|.*,v\\|.*~\\|\\.\\.?\\|,.*\\)\\'\\|"
235 "/\\(CVS\\|RCS\\|\\.arch-ids\\|{arch}\\|,.*\\)\\(/\\|\\'\\)")
236 "A regexp matching files to be ignored in Wiki directories.
238 You should set case-fold-search to nil before using this regexp
239 in code."
240 :type 'regexp
241 :group 'muse-regexp)
243 (defun muse-project-recurse-directory (base)
244 "Recusively retrieve all of the directories underneath BASE.
245 A list of these directories is returned.
246 Directories starting with \".\" will be ignored, as well as those
247 which match `muse-project-ignore-regexp'."
248 (let ((case-fold-search nil)
249 list dir)
250 (when (and (file-directory-p base)
251 (not (string-match muse-project-ignore-regexp base)))
252 (dolist (file (directory-files base t "^[^.]"))
253 (when (and (file-directory-p file)
254 (not (string-match muse-project-ignore-regexp file)))
255 (setq dir (file-name-nondirectory file))
256 (push dir list)
257 (nconc list (mapcar #'(lambda (item)
258 (concat dir "/" item))
259 (muse-project-recurse-directory file)))))
260 list)))
262 (defun muse-project-alist-styles (entry-dir output-dir style)
263 "Return a list of styles to use in a `muse-project-alist' entry.
264 ENTRY-DIR is the top-level directory of the project.
265 OUTPUT-DIR is where Muse files are published, keeping directory structure.
266 STYLE is the publishing style to use.
268 For an example of the use of this function, see
269 `examples/mwolson/muse-init.el' from the Muse distribution."
270 (cons `(:base ,style :path ,(expand-file-name output-dir)
271 :include ,(concat "/" (file-name-nondirectory entry-dir)
272 "/[^/]+$"))
273 (mapcar (lambda (dir);
274 `(:base ,style
275 :path ,(expand-file-name dir output-dir)
276 :include ,(concat "/" dir "/[^/]+$")))
277 (muse-project-recurse-directory entry-dir))))
279 (defun muse-project-alist-dirs (entry-dir)
280 "Return a list of directories to use in a `muse-project-alist' entry.
281 ENTRY-DIR is the top-level directory of the project.
283 For an example of the use of this function, see
284 `examples/mwolson/muse-init.el' from the Muse distribution."
285 (cons (expand-file-name entry-dir)
286 (mapcar (lambda (dir) (expand-file-name dir entry-dir))
287 (muse-project-recurse-directory entry-dir))))
289 ;; Constructing the file-alist
291 (defvar muse-project-file-alist nil
292 "This variable is automagically constructed as needed.")
294 (defvar muse-current-project nil
295 "Project we are currently visiting.")
296 (make-variable-buffer-local 'muse-current-project)
298 (defsubst muse-project (&optional project)
299 "Resolve the given PROJECT into a full Muse project, if it is a string."
300 (if (null project)
301 (or muse-current-project
302 (muse-project-of-file))
303 (if (stringp project)
304 (assoc project muse-project-alist)
305 (muse-assert (consp project))
306 project)))
308 (defsubst muse-project-page-file (page project &optional no-check-p)
309 "Return a filename if PAGE exists within the given Muse PROJECT."
310 (setq project (muse-project project))
311 (cdr (assoc page (muse-project-file-alist project no-check-p))))
313 (defun muse-project-private-p (file)
314 "Return non-nil if NAME is a private page with PROJECT."
315 (unless muse-under-windows-p
316 (setq file (file-truename file))
317 (if (file-attributes file) ; don't publish if no attributes exist
318 (or (when (eq ?- (aref (nth 8 (file-attributes
319 (file-name-directory file))) 7))
320 (message (concat
321 "The " (file-name-directory file)
322 " directory must be readable by others"
323 " in order for its contents to be published.")))
324 (eq ?- (aref (nth 8 (file-attributes file)) 7)))
325 t)))
327 (defun muse-project-file-entries (path)
328 (let* ((names (list t))
329 (lnames names)
330 (case-fold-search nil))
331 (cond
332 ((file-directory-p path)
333 (dolist (file (directory-files
334 path t (when (and muse-file-extension
335 (not (string= muse-file-extension "")))
336 (concat "." muse-file-extension "\\'"))))
337 (unless (or (string-match muse-project-ignore-regexp file)
338 (file-directory-p file))
339 (setcdr lnames
340 (cons (cons (muse-page-name file) file) nil))
341 (setq lnames (cdr lnames)))))
342 ((file-readable-p path)
343 (setcdr lnames
344 (cons (cons (muse-page-name path) path) nil))
345 (setq lnames (cdr lnames)))
346 (t ; regexp
347 (muse-assert (file-name-directory path))
348 (dolist (file (directory-files
349 (file-name-directory path) t
350 (file-name-nondirectory path)))
351 (unless (string-match muse-project-ignore-regexp file)
352 (setcdr lnames
353 (cons (cons (muse-page-name file) file) nil))
354 (setq lnames (cdr lnames))))))
355 (cdr names)))
357 (defun muse-project-file-alist (&optional project no-check-p)
358 "Return member filenames for the given Muse PROJECT.
359 On UNIX, this list is only updated if one of the directories'
360 contents have changed. On Windows, it is always reread from
361 disk."
362 (setq project (muse-project project))
363 (let* ((file-alist (assoc (car project) muse-project-file-alist))
364 (last-mod (cdr (cdr file-alist))))
365 ;; Determine the last modified of any directory mentioned in the
366 ;; project's pattern list
367 (unless (or muse-under-windows-p no-check-p)
368 (let ((pats (cadr project)))
369 (while pats
370 (if (symbolp (car pats))
371 (setq pats (cddr pats))
372 (let* ((fnd (file-name-directory (car pats)))
373 (dir (cond ((file-directory-p (car pats))
374 (car pats))
375 ((and (not (file-readable-p (car pats)))
377 (file-directory-p fnd))
378 fnd))))
379 (when dir
380 (let ((mod-time (nth 5 (file-attributes dir))))
381 (when (or (null last-mod)
382 (and mod-time
383 (muse-time-less-p last-mod mod-time)))
384 (setq last-mod mod-time)))))
385 (setq pats (cdr pats))))))
386 ;; Either return the currently known list, or read it again from
387 ;; disk
388 (if (or (and no-check-p (cadr file-alist))
389 (not (or muse-under-windows-p
390 (null (cddr file-alist))
391 (null last-mod)
392 (muse-time-less-p (cddr file-alist) last-mod))))
393 (cadr file-alist)
394 (if file-alist
395 (setcdr (cdr file-alist) last-mod)
396 (setq file-alist (cons (car project) (cons nil last-mod))
397 muse-project-file-alist
398 (cons file-alist muse-project-file-alist)))
399 ;; Read in all of the file entries
400 (save-match-data
401 (setcar
402 (cdr file-alist)
403 (let* ((names (list t))
404 (pats (cadr project)))
405 (while pats
406 (if (symbolp (car pats))
407 (setq pats (cddr pats))
408 (nconc names (muse-project-file-entries (car pats)))
409 (setq pats (cdr pats))))
410 (cdr names)))))))
412 (defun muse-project-of-file (&optional pathname)
413 "Determine which project the given PATHNAME relates to.
414 If PATHNAME is nil, the current buffer's filename is used."
415 (if (and (null pathname) muse-current-project)
416 muse-current-project
417 (unless pathname (setq pathname (muse-current-file)))
418 (save-match-data
419 (when (and pathname
420 (not (let ((case-fold-search nil))
421 (string-match muse-project-ignore-regexp pathname))))
422 (let* ((file (file-truename pathname))
423 (dir (file-name-directory file))
424 (project-entry muse-project-alist)
425 found)
426 (while (and project-entry (not found))
427 (let ((pats (car (cdar project-entry))))
428 (while (and pats (not found))
429 (if (symbolp (car pats))
430 (setq pats (cddr pats))
431 (let ((truename (file-truename (car pats))))
432 (if (or (string= truename file)
433 (string= truename dir)
434 (string-match (regexp-quote truename) file))
435 (setq found (car project-entry))))
436 (setq pats (cdr pats))))
437 (setq project-entry (cdr project-entry))))
438 found)))))
440 (defun muse-read-project (prompt &optional no-check-p no-assume)
441 "Read a project name from the minibuffer, if it can't be figured
442 out."
443 (if (null muse-project-alist)
444 (error "There are no Muse projects defined; see `muse-project-alist'.")
445 (or (unless no-check-p
446 (muse-project-of-file))
447 (if (and (not no-assume)
448 (= 1 (length muse-project-alist)))
449 (car muse-project-alist)
450 (assoc (completing-read prompt muse-project-alist)
451 muse-project-alist)))))
453 (defvar muse-project-page-history nil)
455 (defun muse-read-project-file (project prompt &optional default)
456 (let ((name (completing-read prompt (muse-project-file-alist project)
457 nil nil nil 'muse-project-page-history
458 default)))
459 (cons name (muse-project-page-file name project))))
461 ;;;###autoload
462 (defun muse-project-find-file (name project &optional command directory)
463 "Open the Muse page given by NAME in PROJECT.
464 If COMMAND is non-nil, it is the function used to visit the file.
465 If DIRECTORY is non-nil, it is the directory in which the page
466 will be created if it does not already exist. Otherwise, the
467 first directory within the project's fileset is used."
468 (interactive
469 (let* ((project (muse-read-project "Find in project: "
470 current-prefix-arg))
471 (default (muse-get-keyword :default (cadr project)))
472 (entry (muse-read-project-file
473 project (if default
474 (format "Find page: (default: %s) "
475 default)
476 "Find page: ")
477 default)))
478 (list entry project)))
479 (setq project (muse-project project))
480 (let ((project-name (car project)))
481 (unless (interactive-p)
482 (setq project (muse-project project)
483 name (cons name (muse-project-page-file name project))))
484 ;; If we're given a relative or absolute filename, open it as-is
485 (if (and (car name)
486 (save-match-data (string-match muse-file-regexp (car name))))
487 (setcdr name (car name))
488 ;; At this point, name is (PAGE . FILE).
489 (unless (cdr name)
490 (let ((pats (cadr project)))
491 (while (and pats (null directory))
492 (if (symbolp (car pats))
493 (setq pats (cddr pats))
494 (if (file-directory-p (car pats))
495 (setq directory (car pats) pats nil)
496 (setq pats (cdr pats))))))
497 (when directory
498 (let ((filename (expand-file-name
499 (if (and muse-file-extension
500 (not (string= muse-file-extension "")))
501 (concat (car name) "." muse-file-extension)
502 (car name))
503 directory)))
504 (unless (file-exists-p directory)
505 (make-directory directory t))
506 (setcdr name filename)))))
507 ;; Open the file
508 (if (cdr name)
509 (funcall (or command 'find-file) (cdr name))
510 (error "There is no page %s in project %s."
511 (car name) project-name))))
513 (defun muse-project-applicable-styles (file styles &optional ignore-regexp)
514 "Given STYLES, return a list of the ones that are considered for FILE.
515 The name of a project may be used for STYLES."
516 (when (stringp styles)
517 (setq styles (cddr (muse-project styles))))
518 (when (and file styles)
519 (let (used-styles)
520 (dolist (style styles)
521 (let ((include-regexp (muse-style-element :include style))
522 (exclude-regexp (muse-style-element :exclude style)))
523 (when (and (or ignore-regexp
524 (and (null include-regexp)
525 (null exclude-regexp))
526 (if include-regexp
527 (string-match include-regexp file)
528 (not (string-match exclude-regexp file))))
529 (or (not (file-exists-p file))
530 (not (muse-project-private-p file))))
531 (add-to-list 'used-styles style))))
532 used-styles)))
534 (defun muse-project-publish-file (file styles &optional force ignore-regexp)
535 (setq styles (muse-project-applicable-styles file styles ignore-regexp))
536 (let (published)
537 (dolist (style styles)
538 (let ((output-dir (muse-style-element :path style)))
539 ;; ensure the publishing location is available
540 (unless (file-exists-p output-dir)
541 (message "Creating publishing directory %s" output-dir)
542 (make-directory output-dir))
543 ;; publish the member file!
544 (if (muse-publish-file file style output-dir force)
545 (setq published t))))
546 published))
548 (defun muse-project-save-buffers (&optional project)
549 (setq project (muse-project project))
550 (map-y-or-n-p
551 (function
552 (lambda (buffer)
553 (and (buffer-modified-p buffer)
554 (not (buffer-base-buffer buffer))
555 (or (buffer-file-name buffer)
556 (progn
557 (set-buffer buffer)
558 (and buffer-offer-save
559 (> (buffer-size) 0))))
560 (with-current-buffer buffer
561 (let ((proj (muse-project-of-file)))
562 (and proj (string= (car proj)
563 (car project)))))
564 (if (buffer-file-name buffer)
565 (format "Save file %s? "
566 (buffer-file-name buffer))
567 (format "Save buffer %s? "
568 (buffer-name buffer))))))
569 (function
570 (lambda (buffer)
571 (set-buffer buffer)
572 (save-buffer)))
573 (buffer-list)
574 '("buffer" "buffers" "save")
575 (if (boundp 'save-some-buffers-action-alist)
576 save-some-buffers-action-alist)))
578 ;;;###autoload
579 (defun muse-project-publish (project &optional force)
580 "Publish the pages of PROJECT that need publishing."
581 (interactive (list (muse-read-project "Publish project: " nil t)
582 current-prefix-arg))
583 (setq project (muse-project project))
584 (let ((styles (cddr project))
585 (muse-current-project project)
586 published)
587 ;; determine the style from the project, or else ask
588 (unless styles
589 (setq styles (list (muse-publish-get-style))))
590 ;; prompt to save any buffers related to this project
591 (muse-project-save-buffers project)
592 ;; run hook before publishing begins
593 (run-hook-with-args 'muse-before-project-publish-hook project)
594 ;; publish all files in the project, for each style; the actual
595 ;; publishing will only happen if the files are newer than the
596 ;; last published output, or if the file is listed in
597 ;; :force-publish. Files in :force-publish will not trigger the
598 ;; "All pages need to be published" message.
599 (let ((forced-files (muse-get-keyword :force-publish (cadr project)))
600 (file-alist (muse-project-file-alist project)))
601 (dolist (pair file-alist)
602 (when (muse-project-publish-file (cdr pair) styles force)
603 (setq forced-files (delete (car pair) forced-files))
604 (setq published t)))
605 (dolist (file forced-files)
606 (muse-project-publish-file (cdr (assoc file file-alist)) styles t)))
607 ;; run hook after publishing ends
608 (run-hook-with-args 'muse-after-project-publish-hook project)
609 ;; notify the user that everything is now done
610 (if published
611 (message "All pages in %s have been published." (car project))
612 (message "No pages in %s need publishing at this time."
613 (car project)))))
615 (defun muse-project-batch-publish ()
616 "Publish Muse files in batch mode."
617 (let ((muse-batch-publishing-p t)
618 force)
619 (if (string= "--force" (or (car command-line-args-left) ""))
620 (setq force t
621 command-line-args-left (cdr command-line-args-left)))
622 (if command-line-args-left
623 (dolist (project command-line-args-left)
624 (message "Publishing project %s ..." project)
625 (muse-project-publish project force))
626 (message "No projects specified."))))
628 (eval-when-compile
629 (put 'make-local-hook 'byte-compile nil))
631 (defun muse-project-set-variables ()
632 "Load project-specific variables."
633 (let ((vars (muse-get-keyword :set (cadr muse-current-project)))
634 sym custom-set var)
635 (while vars
636 (setq sym (car vars))
637 (setq custom-set (or (get sym 'custom-set) 'set))
638 (setq var (if (eq (get sym 'custom-type) 'hook)
639 (make-local-hook sym)
640 (make-local-variable sym)))
641 (funcall custom-set var (car (cdr vars)))
642 (setq vars (cdr (cdr vars))))))
644 (defun muse-project-delete-output-files (project)
645 (interactive
646 (list (muse-read-project "Remove all output files for project: " nil t)))
647 (setq project (muse-project project))
648 (let ((file-alist (muse-project-file-alist project))
649 (styles (cddr project))
650 output-file path)
651 (dolist (entry file-alist)
652 (dolist (style styles)
653 (setq output-file
654 (and (setq path (muse-style-element :path style))
655 (expand-file-name
656 (concat (muse-style-element :prefix style)
657 (car entry)
658 (or (muse-style-element :osuffix style)
659 (muse-style-element :suffix style)))
660 path)))
661 (if output-file
662 (muse-delete-file-if-exists output-file))))))
664 (provide 'muse-project)
666 ;;; muse-project.el ends here