emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
Cc: org-mode <emacs-orgmode@gnu.org>,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Bug on file publish
Date: Mon, 27 Oct 2008 00:55:22 +0100	[thread overview]
Message-ID: <4905036A.4000706@gmx.de> (raw)
In-Reply-To: <4904EAC1.40602@gmx.de>

Hi,


I tried to use (file-locked-p f) in org-publish-base-files-1,
but I couldn't get it to work.

(file-locked-p "~/notes/index.org") ;; => t if "~/notes/.#index.org" exists.

.#index.org is only there, if I change the file without saving it. It's
removed, if I save the buffer.




A working quick fix:

Instead of
      (not (string-match "^\\.+$" fnd))
use
      (not (string-match "^\\.+" fnd))

in org-publish-base-files-1

Drawbacks:
- we can't export hidden files anymore.
   Or is that a feature?



It might be better to look for locked project files, or those still
opened in emacs, and ask the user to save those files before publishing
them. Unsaved changes in a buffer are not published before saving them
anyway. So a warning would be usefull anyway. A user might be surprised
if unsaved changes are not published, as unsaved changes are exported.




Anyway - here's the little patch:


diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index 2af71d3..46fd055 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -430,7 +430,7 @@ matching the regexp SKIP-DIR when recursiing through 
BASE-DIR."
           (let ((fd-p (car (file-attributes f)))
                 (fnd (file-name-nondirectory f)))
             (if (and fd-p recurse
-                    (not (string-match "^\\.+$" fnd))
+                    (not (string-match "^\\.+" fnd))
                      (if skip-dir (not (string-match skip-dir fnd)) t))
                 (org-publish-get-base-files-1 f recurse match skip-file 
skip-dir)
               (unless (or fd-p ;; this is a directory

  reply	other threads:[~2008-10-26 23:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-25  0:09 Bug on file publish Richard Riley
2008-10-26  6:42 ` Carsten Dominik
2008-10-26 21:56   ` Sebastian Rose
2008-10-26 22:10   ` Sebastian Rose
2008-10-26 23:55     ` Sebastian Rose [this message]
2008-10-27  5:24       ` Carsten Dominik
2008-10-27  7:22       ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4905036A.4000706@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).