From mboxrd@z Thu Jan 1 00:00:00 1970 From: aman Subject: Re: [PATCH] lisp/ox-publish.el: Handle includes with searches Date: Tue, 29 Dec 2015 01:35:10 +0000 (UTC) Message-ID: References: <1447538173-45139-1-git-send-email-nick@ausimian.net> <87fuzx9di7.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDjGj-0003PC-Q3 for emacs-orgmode@gnu.org; Mon, 28 Dec 2015 20:40:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDjGg-00006G-Il for emacs-orgmode@gnu.org; Mon, 28 Dec 2015 20:40:09 -0500 Received: from plane.gmane.org ([80.91.229.3]:52151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDjGg-000064-BN for emacs-orgmode@gnu.org; Mon, 28 Dec 2015 20:40:06 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aDjGd-0005mE-Fn for emacs-orgmode@gnu.org; Tue, 29 Dec 2015 02:40:05 +0100 Received: from mail.ruijie.cn ([mail.ruijie.cn]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Dec 2015 02:40:03 +0100 Received: from aman_yang by mail.ruijie.cn with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Dec 2015 02:40:03 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nicolas Goaziou nicolasgoaziou.fr> writes: > > Hello, > > Nick Gunn ausimian.net> writes: > > > * lisp/ox-publish.el (org-publish-cache-file-needs-publishing): Ignore > > any link search suffix on an include so that the path represents a > > valid file during the publishing check. > > Applied. Thank you. > > Regards, > Hi, I was using org-publish which was already applied with this patch. but I got following error message when I published an org file including another one. org-publish-cache-ctime-of-src: No such file: "/home/emacs/gtd/inbox.org::writing" here's the including block: * including file #+INCLUDE: "../../inbox.org::writing blog" :only-contents t This patch works fine if there's spaces between "inbox.org" and "::writing blog". And I found that org-export-expand-include-keyword, invoked by`C-c '` at INCLUDE statement, awalys get right file name. I copied some logic from org-export-expand-include-keyword to make it works for me. --- a/lisp/ox-publish.el +++ b/lisp/ox-publish.el @@ -1243,13 +1243,17 @@ the file including them will be republished as well." (and (eq (org-element-type element) 'keyword) (let ((value (org-element-property :value element))) (and value - (string-match "^\\(\".+?\"\\|\\S-+\\)" value) - ;; Ignore search suffix. - (car (split-string - (org-remove-double-quotes - (match-string 1 value))))))))) + (string-match "^\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" value) + (let ((matched (match-string 1 value))) + (when (string-match "\\(::\\(.*?\\)\\)\"?\\'" + matched) + (setq matched + (replace-match "" nil nil matched 1)) + (print matched)) + (org-remove-double-quotes matched)) + ))))) (when included-file - (push (org-publish-cache-ctime-of-src + (push (org-publish-cache-ctime-oef-src (expand-file-name included-file)) included-files-ctime))))) (unless visiting (kill-buffer buf)))