From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: org-map-entries with 'region-start-level in a buffer with header text Date: Tue, 10 Jan 2017 09:47:31 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c089ecc5ce49a0545be9049 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQxi2-0005EB-7D for emacs-orgmode@gnu.org; Tue, 10 Jan 2017 09:47:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQxi1-0007DT-17 for emacs-orgmode@gnu.org; Tue, 10 Jan 2017 09:47:34 -0500 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]:36952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cQxi0-0007DN-Rc for emacs-orgmode@gnu.org; Tue, 10 Jan 2017 09:47:32 -0500 Received: by mail-it0-x231.google.com with SMTP id r185so49335725ita.0 for ; Tue, 10 Jan 2017 06:47:32 -0800 (PST) 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" To: Org Mode --94eb2c089ecc5ce49a0545be9049 Content-Type: text/plain; charset=UTF-8 In a buffer with text before the first heading, I get an error using org-map-entries in this function: (defun org-export-all (backend) "Export all subtrees that are *not* tagged with :noexport: to separate files. Note that subtrees must have the :EXPORT_FILE_NAME: property set to a unique value for this to work properly." (interactive "sEnter backend: ") (let ((fn (cond ((equal backend "html") 'org-html-export-to-html) ((equal backend "latex") 'org-latex-export-to-latex) ((equal backend "pdf") 'org-latex-export-to-pdf)))) (save-excursion (set-mark (point-min)) (goto-char (point-max)) (org-map-entries (lambda () (funcall fn nil t)) "-noexport" 'region-start-level)))) The error is : Debugger entered--Lisp error: (error "Before first headline at position 1 in buffer test.org<2>") Is there a better way to map over first-level heading, or alternatively, a better way to set the mark? I tried setting mark to : (goto-char (point-min)) (re-search-forward " \\\*")) but that gave strange results, with the wrong trees being sent to individual files. Thank you! matt --94eb2c089ecc5ce49a0545be9049 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

In a buffer with text before the first heading, I= get an error using org-map-entries in this function:

(defun org-export-all (backend)
  "Export=
 all subtrees that are *not* tagged with :noexport: to
separate files.

Note that subtrees must have the :EXPORT_FILE_NAME: property set
to a unique value for this to work properly."
  (interactive "sEnter backend: "=
;)
  (let ((fn (cond ((equal backend "html") 'or=
g-html-export-to-html)
                  ((equal backend <=
span class=3D"gmail-m_-3208652805390946851gmail-str">"latex") 'org-latex-export-to-latex)
                  ((equal backend <=
span class=3D"gmail-m_-3208652805390946851gmail-str">"pdf"=
) 'org-latex-export-to-pdf))))
    (save-excursion
      (=
set-mark (point-min))
      (=
goto-char (point-max))
      (=
org-map-entries (lambda () (funcall fn nil t)) "-noexport&quo=
t; 'region-start-level))))

The error is :
Debugger entered--Lisp error: (error &quo= t;Before first headline at position 1 in buffer test.org<2>")

Is there a better way to map ov=
er first-level heading, 
or alternatively, a better way to set the mark?= I tried setting mark to :


(goto-char (point-min)) (re-s= earch-forward "
\\\*"))

but that gave strange re=
sults, with the wrong trees 
being sent to individual files.

Thank you!

matt
--94eb2c089ecc5ce49a0545be9049--