1 ;;; org-publish.el --- publish related org-mode files as a website
2 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
4 ;; Author: David O'Toole <dto@gnu.org>
5 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
6 ;; Keywords: hypermedia, outlines, wp
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; Requires at least version 4.27 of org.el
28 ;; This program allow configurable publishing of related sets of
29 ;; Org-mode files as a complete website.
31 ;; org-publish.el can do the following:
33 ;; + Publish all one's org-files to HTML or LaTeX
34 ;; + Upload HTML, images, attachments and other files to a web server
35 ;; + Exclude selected private pages from publishing
36 ;; + Publish a clickable index of pages
37 ;; + Manage local timestamps for publishing only changed files
38 ;; + Accept plugin functions to extend range of publishable content
40 ;; Special thanks to the org-mode maintainer Carsten Dominik for his
41 ;; ideas, enthusiasm, and cooperation.
45 ;; Put org-publish.el in your load path, byte-compile it, and then add
46 ;; the following lines to your emacs initialization file:
48 ;; (autoload 'org-publish "org-publish" nil t)
49 ;; (autoload 'org-publish "org-publish-all" nil t)
50 ;; (autoload 'org-publish "org-publish-current-file" nil t)
51 ;; (autoload 'org-publish "org-publish-current-project" nil t)
53 ;; NOTE: When org-publish.el is included with org.el, those forms are
54 ;; already in the file org-install.el, and hence don't need to be put
55 ;; in your emacs initialization file in this case.
59 ;; The program's main configuration variable is
60 ;; `org-publish-project-alist'. See below for example configurations
63 ;; The main interactive functions are:
66 ;; M-x org-publish-all
67 ;; M-x org-publish-current-file
68 ;; M-x org-publish-current-project
70 ;;;; Simple example configuration:
72 ;; (setq org-publish-project-alist
74 ;; '("org" . (:base-directory "~/org/"
75 ;; :base-extension "org"
76 ;; :publishing-directory "~/public_html"
77 ;; :with-section-numbers nil
78 ;; :table-of-contents nil
80 ;; :style "<link rel=stylesheet href=\"../other/mystyle.css\" type=\"text/css\">")))
82 ;;;; More complex example configuration:
84 ;; Imagine your *.org files are kept in ~/org, your images in
85 ;; ~/images, and stylesheets in ~/other. Now imagine you want to
86 ;; publish the files through an ssh connection to a remote host, via
87 ;; Tramp-mode. To maintain relative links from *.org files to /images
88 ;; and /other, we should replicate the same directory structure in
89 ;; your web server account's designated html root (in this case,
90 ;; assumed to be ~/html)
92 ;; Once you've done created the proper directories, you can adapt the
93 ;; following example configuration to your specific paths, run M-x
94 ;; org-publish-all, and it should publish the files to the correct
95 ;; directories on the web server, transforming the *.org files into
96 ;; HTML, and leaving other files alone.
98 ;; (setq org-publish-project-alist
100 ;; '("orgfiles" :base-directory "~/org/"
101 ;; :base-extension "org"
102 ;; :publishing-directory "/ssh:user@host:~/html/notebook/"
103 ;; :publishing-function org-publish-org-to-html
104 ;; :exclude "PrivatePage.org" ;; regexp
105 ;; :headline-levels 3
106 ;; :with-section-numbers nil
107 ;; :table-of-contents nil
108 ;; :style "<link rel=stylesheet href=\"../other/mystyle.css\" type=\"text/css\">"
110 ;; :auto-postamble nil)
111 ;; ("images" :base-directory "~/images/"
112 ;; :base-extension "jpg\\|gif\\|png"
113 ;; :publishing-directory "/ssh:user@host:~/html/images/"
114 ;; :publishing-function org-publish-attachment)
115 ;; ("other" :base-directory "~/other/"
116 ;; :base-extension "css"
117 ;; :publishing-directory "/ssh:user@host:~/html/other/"
118 ;; :publishing-function org-publish-attachment)
119 ;; ("website" :components ("orgfiles" "images" "other"))))
121 ;; For more information, see the documentation for the variable
122 ;; `org-publish-project-alist'.
124 ;; Of course, you don't have to publish to remote directories from
125 ;; within emacs. You can always just publish to local folders, and
126 ;; then use the synchronization/upload tool of your choice.
128 ;;; List of user-visible changes since version 1.27
130 ;; 1.78: Allow list-valued :publishing-function
131 ;; 1.77: Added :preparation-function, this allows you to use GNU Make etc.
132 ;; 1.65: Remove old "composite projects". They're redundant.
133 ;; 1.64: Allow meta-projects with :components
134 ;; 1.57: Timestamps flag is now called "org-publish-use-timestamps-flag"
135 ;; 1.52: Properly set default for :index-filename
136 ;; 1.48: Composite projects allowed.
137 ;; :include keyword allowed.
138 ;; 1.43: Index no longer includes itself in the index.
139 ;; 1.42: Fix "function definition is void" error
140 ;; when :publishing-function not set in org-publish-current-file.
141 ;; 1.41: Fixed bug where index isn't published on first try.
142 ;; 1.37: Added interactive function "org-publish". Prompts for particular
143 ;; project name to publish.
144 ;; 1.34: Added force-publish option to all interactive functions.
145 ;; 1.32: Fixed "index.org has changed on disk" error during index publishing.
146 ;; 1.30: Fixed startup error caused by (require 'em-unix)
154 (unless (fboundp 'declare-function
)
155 (defmacro declare-function
(fn file
&optional arglist fileonly
))))
157 (defgroup org-publish nil
158 "Options for publishing a set of Org-mode and related files."
159 :tag
"Org Publishing"
162 (defcustom org-publish-project-alist nil
163 "Association list to control publishing behavior.
164 Each element of the alist is a publishing 'project.' The CAR of
165 each element is a string, uniquely identifying the project. The
166 CDR of each element is in one of the following forms:
168 (:property value :property value ... )
172 (:components (\"project-1\" \"project-2\" ...))
174 When the CDR of an element of org-publish-project-alist is in
175 this second form, the elements of the list after :components are
176 taken to be components of the project, which group together files
177 requiring different publishing options. When you publish such a
178 project with \\[org-publish], the components all publish.
180 When a property is given a value in org-publish-project-alist, its
181 setting overrides the value of the corresponding user variable
182 \(if any) during publishing. However, options set within a file
185 Most properties are optional, but some should always be set:
187 :base-directory Directory containing publishing source files
188 :base-extension Extension (without the dot!) of source files.
189 This can be a regular expression.
190 :publishing-directory Directory (possibly remote) where output
191 files will be published
193 The :exclude property may be used to prevent certain files from
194 being published. Its value may be a string or regexp matching
195 file names you don't want to be published.
197 The :include property may be used to include extra files. Its
198 value may be a list of filenames to include. The filenames are
199 considered relative to the publishing directory.
201 When both :include and :exclude properties are given values, the
202 exclusion step happens first.
204 One special property controls which back-end function to use for
205 publishing files in the project. This can be used to extend the
206 set of file types publishable by org-publish, as well as the set
209 :publishing-function Function to publish file. The default is
210 `org-publish-org-to-html', but other
211 values are possible. May also be a
212 list of functions, in which case
213 each function in the list is invoked
216 Another property allows you to insert code that prepares a
217 project for publishing. For example, you could call GNU Make on a
218 certain makefile, to ensure published files are built up to date.
220 :preparation-function Function to be called before publishing
223 Some properties control details of the Org publishing process,
224 and are equivalent to the corresponding user variables listed in
225 the right column. See the documentation for those variables to
226 learn more about their use and default values.
228 :language `org-export-default-language'
229 :headline-levels `org-export-headline-levels'
230 :section-numbers `org-export-with-section-numbers'
231 :table-of-contents `org-export-with-toc'
232 :emphasize `org-export-with-emphasize'
233 :sub-superscript `org-export-with-sub-superscripts'
234 :TeX-macros `org-export-with-TeX-macros'
235 :fixed-width `org-export-with-fixed-width'
236 :tables `org-export-with-tables'
237 :table-auto-headline `org-export-highlight-first-table-line'
238 :style `org-export-html-style'
239 :convert-org-links `org-export-html-link-org-files-as-html'
240 :inline-images `org-export-html-inline-images'
241 :expand-quoted-html `org-export-html-expand'
242 :timestamp `org-export-html-with-timestamp'
243 :publishing-directory `org-export-publishing-directory'
244 :preamble `org-export-html-preamble'
245 :postamble `org-export-html-postamble'
246 :auto-preamble `org-export-html-auto-preamble'
247 :auto-postamble `org-export-html-auto-postamble'
248 :author `user-full-name'
249 :email `user-mail-address'
251 The following properties may be used to control publishing of an
252 index of files or summary page for a given project.
254 :auto-index Whether to publish an index during
255 `org-publish-current-project' or `org-publish-all'.
256 :index-filename Filename for output of index. Defaults
257 to 'index.org' (which becomes 'index.html').
258 :index-title Title of index page. Defaults to name of file.
259 :index-function Plugin function to use for generation of index.
260 Defaults to `org-publish-org-index', which
261 generates a plain list of links to all files
266 (defcustom org-publish-use-timestamps-flag t
267 "When non-nil, use timestamp checking to publish only changed files.
268 When nil, do no timestamp checking and always publish all files."
272 (defcustom org-publish-timestamp-directory
"~/.org-timestamps/"
273 "Name of directory in which to store publishing timestamps."
277 (defcustom org-publish-before-export-hook nil
278 "Hook run before export on the Org file.
279 If the functions in this hook modify the original Org buffer, the
280 modified buffer will be used for export, but the buffer will be
281 restored and saved back to its initial state after export."
285 (defcustom org-publish-after-export-hook nil
286 "Hook run after export on the exported buffer.
287 If functions in this hook modify the buffer, it will be saved."
291 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
292 ;;; Timestamp-related functions
294 (defun org-publish-timestamp-filename (filename)
295 "Return path to timestamp file for filename FILENAME."
297 (if (eq system-type
'windows-nt
) "~\\|/\\|:" "~\\|/") filename
)
298 (setq filename
(replace-match "_" nil t filename
)))
299 (concat org-publish-timestamp-directory filename
".timestamp"))
301 (defun org-publish-needed-p (filename)
302 "Return `t' if FILENAME should be published."
303 (if org-publish-use-timestamps-flag
304 (if (file-exists-p org-publish-timestamp-directory
)
305 ;; first handle possible wrong timestamp directory
306 (if (not (file-directory-p org-publish-timestamp-directory
))
307 (error "Org publish timestamp: %s is not a directory"
308 org-publish-timestamp-directory
)
309 ;; there is a timestamp, check if FILENAME is newer
310 (file-newer-than-file-p
311 filename
(org-publish-timestamp-filename filename
))))
312 ;; don't use timestamps, always return t
315 (defun org-publish-update-timestamp (filename)
316 "Update publishing timestamp for file FILENAME.
317 If there is no timestamp, create one."
318 (let ((timestamp-file (org-publish-timestamp-filename filename
))
319 newly-created-timestamp
)
320 (if (not (file-exists-p timestamp-file
))
321 ;; create timestamp file if needed
323 (make-directory (file-name-directory timestamp-file
) t
)
324 (write-file timestamp-file
)
325 (setq newly-created-timestamp t
)))
326 ;; Emacs 21 doesn't have `set-file-times'
327 (if (and (fboundp 'set-file-times
)
328 (not newly-created-timestamp
))
329 (set-file-times timestamp-file
)
330 (call-process "touch" nil
0 nil timestamp-file
))))
332 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
333 ;;; Mapping files to project names
335 (defvar org-publish-files-alist nil
336 "Alist of files and their parent projects.
337 Each element of this alist is of the form:
339 (file-name . project-name)")
341 (defvar org-publish-initial-buffer nil
342 "The buffer `org-publish' has been called from.")
343 (defvar org-publish-temp-files nil
344 "Temporary list of files to be published.")
346 (defun org-publish-initialize-files-alist (&optional refresh
)
347 "Set `org-publish-files-alist' if it is not set.
348 Also set it if the optional argument REFRESH is non-nil."
350 (when (or refresh
(not org-publish-files-alist
))
351 (setq org-publish-files-alist
352 (org-publish-get-files org-publish-project-alist
))))
354 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
355 ;;; Compatibility aliases
357 ;; Delete-dups is not in Emacs <22
358 (if (fboundp 'delete-dups
)
359 (defalias 'org-publish-delete-dups
'delete-dups
)
360 (defun org-publish-delete-dups (list)
361 "Destructively remove `equal' duplicates from LIST.
362 Store the result in LIST and return it. LIST must be a proper list.
363 Of several `equal' occurrences of an element in LIST, the first
366 This is a compatibility function for Emacsen without `delete-dups'."
367 ;; Code from `subr.el' in Emacs 22:
370 (setcdr tail
(delete (car tail
) (cdr tail
)))
371 (setq tail
(cdr tail
))))
374 (declare-function org-publish-delete-dups
"org-publish" (list))
376 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
377 ;;; Getting project information out of org-publish-project-alist
379 (defun org-publish-get-files (projects-alist &optional no-exclusion
)
380 "Return the list of all publishable files for PROJECTS-ALIST.
381 If NO-EXCLUSION is non-nil, don't exclude files."
386 (let* ((exclude (plist-get (cdr p
) :exclude
))
387 (files (and p
(org-publish-get-base-files p exclude
))))
388 ;; add all files from this project
390 (add-to-list 'all-files
391 (cons (expand-file-name f
) (car p
))))
393 (org-publish-expand-projects projects-alist
))
396 (defun org-publish-expand-projects (projects-alist)
397 "Expand projects contained in PROJECTS-ALIST."
398 (let (without-component with-component
)
401 (if (plist-get (cdr p
) :components
)
402 'with-component
'without-component
) p
))
404 (org-publish-delete-dups
405 (append without-component
406 (car (mapcar (lambda(p) (org-publish-expand-components p
))
409 (defun org-publish-expand-components (project)
410 "Expand PROJECT into an alist of its components."
411 (let* ((components (plist-get (cdr project
) :components
)))
412 (org-publish-delete-dups
413 (delq nil
(mapcar (lambda(c) (assoc c org-publish-project-alist
))
416 (defun org-publish-get-base-files-1 (base-dir &optional recurse match skip-file skip-dir
)
417 "Set `org-publish-temp-files' with files from BASE-DIR directory.
418 If RECURSE is non-nil, check BASE-DIR recursively. If MATCH is
419 non-nil, restrict this list to the files matching the regexp
420 MATCH. If SKIP-FILE is non-nil, skip file matching the regexp
421 SKIP-FILE. If SKIP-DIR is non-nil, don't check directories
422 matching the regexp SKIP-DIR when recursiing through BASE-DIR."
424 (let ((fd-p (car (file-attributes f
)))
425 (fnd (file-name-nondirectory f
)))
426 (if (and fd-p recurse
427 (not (string-match "^\\.+$" fnd
))
428 (if skip-dir
(not (string-match skip-dir fnd
)) t
))
429 (org-publish-get-base-files-1 f recurse match skip-file skip-dir
)
430 (unless (or fd-p
;; this is a directory
431 (and skip-file
(string-match skip-file fnd
))
432 (not (string-match match fnd
)))
433 (pushnew f org-publish-temp-files
)))))
434 (directory-files base-dir t
(unless recurse match
))))
436 (defun org-publish-get-base-files (project &optional exclude-regexp
)
437 "Return a list of all files in PROJECT.
438 If EXCLUDE-REGEXP is set, this will be used to filter out
440 (let* ((project-plist (cdr project
))
441 (base-dir (file-name-as-directory
442 (plist-get project-plist
:base-directory
)))
443 (include-list (plist-get project-plist
:include
))
444 (recurse (plist-get project-plist
:recursive
))
445 (extension (or (plist-get project-plist
:base-extension
) "org"))
446 (match (concat "^[^\\.].*\\.\\(" extension
"\\)$")))
447 (setq org-publish-temp-files nil
)
448 (org-publish-get-base-files-1 base-dir recurse match
449 ;; FIXME distinguish exclude regexp
450 ;; for skip-file and skip-dir?
451 exclude-regexp exclude-regexp
)
452 org-publish-temp-files
))
454 (defun org-publish-get-project-from-filename (filename)
455 "Return the project FILENAME belongs."
456 (let* ((project-name (cdr (assoc (expand-file-name filename
)
457 org-publish-files-alist
))))
458 (assoc project-name org-publish-project-alist
)))
460 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
461 ;;; Pluggable publishing back-end functions
463 (defun org-publish-org-to (format plist filename pub-dir
)
464 "Publish an org file to FORMAT.
465 PLIST is the property list for the given project.
466 FILENAME is the filename of the org file to be published.
467 PUB-DIR is the publishing directory."
469 (unless (file-exists-p pub-dir
)
470 (make-directory pub-dir t
))
472 (let ((init-buf (current-buffer))
474 (init-buf-string (buffer-string)) export-buf
)
475 ;; run hooks before exporting
476 (run-hooks 'org-publish-before-export-hook
)
477 ;; export the possibly modified buffer
479 (funcall (intern (concat "org-export-as-" format
))
480 (plist-get plist
:headline-levels
)
481 nil plist nil nil pub-dir
))
482 (set-buffer export-buf
)
483 ;; run hooks after export and save export
484 (and (run-hooks 'org-publish-after-export-hook
)
485 (if (buffer-modified-p) (save-buffer)))
486 (kill-buffer export-buf
)
487 ;; maybe restore buffer's content
488 (set-buffer init-buf
)
489 (when (buffer-modified-p init-buf
)
491 (insert init-buf-string
)
493 (goto-char init-point
))
494 (unless (eq init-buf org-publish-initial-buffer
)
495 (kill-buffer init-buf
))))
497 (defun org-publish-org-to-latex (plist filename pub-dir
)
498 "Publish an org file to LaTeX.
499 See `org-publish-org-to' to the list of arguments."
500 (org-publish-org-to "latex" plist filename pub-dir
))
502 (defun org-publish-org-to-html (plist filename pub-dir
)
503 "Publish an org file to HTML.
504 See `org-publish-org-to' to the list of arguments."
505 (org-publish-org-to "html" plist filename pub-dir
))
507 (defun org-publish-attachment (plist filename pub-dir
)
508 "Publish a file with no transformation of any kind.
509 See `org-publish-org-to' to the list of arguments."
510 ;; make sure eshell/cp code is loaded
515 (unless (file-directory-p pub-dir
)
516 (make-directory pub-dir t
))
517 (eshell/cp filename pub-dir
))
519 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
520 ;;; Publishing files, sets of files, and indices
522 (defun org-publish-file (filename &optional project
)
523 "Publish file FILENAME from PROJECT."
524 (when (org-publish-needed-p filename
)
527 (or (org-publish-get-project-from-filename filename
)
529 (format "%s is not in a project. Re-read the list of projects files? "
530 (abbreviate-file-name filename
)))
531 ;; If requested, re-initialize the list of projects files
532 (progn (org-publish-initialize-files-alist t
)
533 (or (org-publish-get-project-from-filename filename
)
534 (error "File %s not part of any known project"
535 (abbreviate-file-name filename
))))
536 (error "Can't publish file outside of a project")))))
537 (project-plist (cdr project
))
539 (or (plist-get project-plist
:publishing-function
)
540 'org-publish-org-to-html
))
541 (base-dir (file-name-as-directory
542 (file-truename (plist-get project-plist
:base-directory
))))
543 (pub-dir (file-name-as-directory
544 (file-truename (plist-get project-plist
:publishing-directory
))))
549 (and (string-match (regexp-quote base-dir
) filename
)
550 (substring filename
(match-end 0))))))
551 (if (listp publishing-function
)
552 ;; allow chain of publishing functions
554 (funcall f project-plist filename tmp-pub-dir
))
556 (funcall publishing-function project-plist filename tmp-pub-dir
)))
557 (org-publish-update-timestamp filename
)))
559 (defun org-publish-projects (projects)
560 "Publish all files belonging to the PROJECTS alist.
561 If :auto-index is set, publish the index too."
564 (let* ((project-plist (cdr project
))
565 (exclude-regexp (plist-get project-plist
:exclude
))
566 (index-p (plist-get project-plist
:auto-index
))
567 (index-filename (or (plist-get project-plist
:index-filename
)
569 (index-function (or (plist-get project-plist
:index-function
)
570 'org-publish-org-index
))
571 (preparation-function (plist-get project-plist
:preparation-function
))
572 (files (org-publish-get-base-files project exclude-regexp
)) file
)
573 (when preparation-function
(funcall preparation-function
))
574 (if index-p
(funcall index-function project index-filename
))
575 (while (setq file
(pop files
))
576 (org-publish-file file project
))))
577 (org-publish-expand-projects projects
)))
579 (defun org-publish-org-index (project &optional index-filename
)
580 "Create an index of pages in set defined by PROJECT.
581 Optionally set the filename of the index with INDEX-FILENAME.
582 Default for INDEX-FILENAME is 'index.org'."
583 (let* ((project-plist (cdr project
))
584 (dir (file-name-as-directory
585 (plist-get project-plist
:base-directory
)))
586 (exclude-regexp (plist-get project-plist
:exclude
))
587 (files (org-publish-get-base-files project exclude-regexp
))
588 (index-filename (concat dir
(or index-filename
"index.org")))
589 (index-buffer (find-buffer-visiting index-filename
))
590 (ifn (file-name-nondirectory index-filename
))
592 ;; if buffer is already open, kill it to prevent error message
594 (kill-buffer index-buffer
))
596 (while (setq file
(pop files
))
597 (let ((fn (file-name-nondirectory file
)))
598 ;; index shouldn't index itself
599 (unless (string= fn ifn
)
600 (insert (concat " + [[file:" fn
"]["
601 (file-name-sans-extension fn
)
603 (write-file index-filename
)
604 (kill-buffer (current-buffer)))))
606 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
607 ;;; Interactive publishing functions
609 (defalias 'org-publish-project
'org-publish
)
612 (defun org-publish (project &optional force
)
615 (setq org-publish-initial-buffer
(current-buffer))
616 (save-window-excursion
617 (let* ((force current-prefix-arg
)
618 (org-publish-use-timestamps-flag
619 (if force nil org-publish-use-timestamps-flag
)))
620 (org-publish-projects
622 (assoc (completing-read
624 org-publish-project-alist nil t
)
625 org-publish-project-alist
)))))))
628 (defun org-publish-all (&optional force
)
629 "Publish all projects.
630 With prefix argument, force publish all files."
632 (org-publish-initialize-files-alist)
633 (save-window-excursion
634 (let ((org-publish-use-timestamps-flag
635 (if force nil org-publish-use-timestamps-flag
)))
636 (org-publish-projects org-publish-project-alist
))))
639 (defun org-publish-current-file (&optional force
)
640 "Publish the current file.
641 With prefix argument, force publish the file."
643 (org-publish-initialize-files-alist)
644 (save-window-excursion
645 (let ((org-publish-use-timestamps-flag
646 (if force nil org-publish-use-timestamps-flag
)))
647 (org-publish-file (buffer-file-name)))))
650 (defun org-publish-current-project (&optional force
)
651 "Publish the project associated with the current file.
652 With a prefix argument, force publishing of all files in
655 (org-publish-initialize-files-alist)
656 (save-window-excursion
657 (let ((project (org-publish-get-project-from-filename (buffer-file-name)))
658 (org-publish-use-timestamps-flag
659 (if force nil org-publish-use-timestamps-flag
)))
661 (error "File %s is not part of any known project" (buffer-file-name)))
662 (org-publish project
))))
664 (provide 'org-publish
)
667 ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb
669 ;;; org-publish.el ends here