From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How to obtain the headline level from org-element-at-point Date: Sat, 8 Apr 2017 10:31:57 -0400 Message-ID: References: <87fuhj2dbn.fsf@u-cergy.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f403045cef58c5ad6a054ca89a74 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwrPF-0003AS-AC for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 10:32:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwrPE-0000b1-6N for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 10:32:01 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:36335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwrPD-0000ap-SE for emacs-orgmode@gnu.org; Sat, 08 Apr 2017 10:32:00 -0400 Received: by mail-wr0-x230.google.com with SMTP id c55so50878592wrc.3 for ; Sat, 08 Apr 2017 07:31:59 -0700 (PDT) In-Reply-To: <87fuhj2dbn.fsf@u-cergy.fr> 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: Jeremie Juste Cc: "emacs-orgmode@gnu.org" --f403045cef58c5ad6a054ca89a74 Content-Type: text/plain; charset=UTF-8 what do you mean it only considers level 1 headlines? It seems to work on all headlines for me. The email subject doesn't seem related to the body you can get the level like this. (org-element-property :level (org-element-at-point)) John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sat, Apr 8, 2017 at 10:17 AM, Jeremie Juste wrote: > > Hello, > > Interleave-mode https://github.com/rudolfochrist/interleave, is a very > convenient tool for writing notes in associated > with pdf. It uses org-mode for this purpose. > > I recently noticed that in the case where I want to write notes for > multiple pdf in a singlie org file, I have to use the level 1 headline > > * Notes for CS103 > :PROPERTIES: > :INTERLEAVE_PDF: cs103.pdf > :END: > > > I would like to have the possibility of using any headline level for > this purpose but my org-fu is weak. > > I think it boils down to this function in interleave-mode mode where > (org-element-type headline) checks only for level 1 headline. > > > #+BEGIN_SRC elisp > (defun interleave--headline-pdf-path (buffer) > "Return the INTERLEAVE_PDF property of the current headline in BUFFER." > (with-current-buffer buffer > (save-excursion > (let ((headline (org-element-at-point))) > (when (and (equal (org-element-type headline) 'headline) > (org-entry-get nil interleave--pdf-prop)) > (setq interleave-multi-pdf-notes-file t) > (org-entry-get nil interleave--pdf-prop)))))) > > #+END_SRC > > > Can anyone see a way around it ? > > Best regards, > > Jeremie > > --f403045cef58c5ad6a054ca89a74 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
what do you mean it only considers level 1 headlines? It s= eems to work on all headlines for me.

The email subject = doesn't seem related to the body you can get the level like this.
=

(org-element-property :level (org-element-at-point))

John

-----------------------------------
Prof= essor John Kitchin=C2=A0
Doherty Hall A207F
Department of Chemical En= gineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-= 7803

On Sat, Apr 8, 2017 at 10:17 AM, Jeremie Jus= te <jeremiejuste@gmail.com> wrote:

Hello,

Interleave-mode https://github.com/rudolfochrist/int= erleave, is a very convenient tool for writing notes in associated
with pdf. It uses org-mode for this purpose.

I recently noticed that in the case where I want to write notes for
multiple pdf in a singlie org file, I have to use the level 1 headline

* Notes for CS103
=C2=A0 :PROPERTIES:
=C2=A0 :INTERLEAVE_PDF: cs103.pdf
=C2=A0 :END:


I would like to have the possibility of using any headline level for
this purpose but my org-fu is weak.

I think it boils down to this function in interleave-mode mode where
(org-element-type headline) checks only for level 1 headline.


#+BEGIN_SRC elisp
(defun interleave--headline-pdf-path (buffer)
=C2=A0 "Return the INTERLEAVE_PDF property of the current headline in = BUFFER."
(with-current-buffer buffer
=C2=A0 (save-excursion
=C2=A0 =C2=A0 (let ((headline (org-element-at-point)))
=C2=A0 =C2=A0 =C2=A0 (when (and (equal (org-element-type headline) 'hea= dline)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-entry-ge= t nil interleave--pdf-prop))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq interleave-multi-pdf-notes-file t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-entry-get nil interleave--pdf-prop))))))
#+END_SRC


Can anyone see a way around it ?

Best regards,

Jeremie


--f403045cef58c5ad6a054ca89a74--